Challenge

Project 2 - Rankine cycle Simulator

Create a Rankine Cycle Simulator and plot the corresponding T-s and h-s plots.

Rankine cycle

The Rankine Cycle is a mechanical cycle commonly used in power plants to convert the pressure energy of steam into mechanical energy through steam turbines.
The Rankine Cycle’s major components include a rotating steam turbine, a boiler pump, a stationary condenser, and a boiler.

A boiler is used to heat the water for steam at the required pressure and temperature as per the turbine’s requirement for power generation.

The turbine exhaust is directed to the radial or axial flow condenser for condensing the steam to condensate and recycled back to the boiler
through boiler pumps for heating again.

The four processes in the Rankine cycle
Process 1–2: Process 1-2 is isentropic expansion.
Process 2–3: Process 2-3 is constant pressure heat rejection in condenser.
Process 3–4: Process 3-4 is isentropic compression.
Process 4–1: Process 4-1 constant pressure heat addition in boiler.

formulae used

w_turbine=h1-h2; work done by turbine

w_pump=h4-h3; work done by pump

net_work=w_turbine-w_pump; net work done

q_in=h1-h4; heat addition

q_out=h2-h3; heat rejection

n=net_work/q_in; thermal efficiency

BWR=w_pump/w_turbine; back work ratio

SSC=3600/net_work; specific heat consumption


code explaination
fopen used for opening the xsteam file and used r for reading it.
fprintf to print the data.
\n used for next line
used input to take input from user

used xsteam file to take values from it for example
to find the value of enthalphy i.e. h1
h1=XSteam('h_pT',p1,t1); by using this statement it will read the file and take the desired value.


used linspace to find 1000 values with equal intervals.

used for loop to run the program many times

calculated values using formulae given above in formulae used.

%Create a Rankine Cycle Simulator and plot the corresponding T-s and h-s plots.

f1=fopen('XSteam.m','r');

fprintf(" \n RANKINE CYCLE SIMULATOR");%fprintf used to write data as it is
fprintf(" \n \n 1-2  is isentropic expansion.");
fprintf("\n 2-3 is constant pressure heat rejection in condenser.");
fprintf("\n 3-4 is isentropic compression in the pump.");
fprintf("\n 4-1 is constant pressure heat addition in boiler.");

p1=input("Enter the pressure at the turbine inlet(in bar): ");  %input by user
t1=input("Enter the Temperature at the turbine inlet(in degree celcius): ");  %input by user
p2=input("Enter the Pressure at the condenser(in bar): "); %input by user

p3=p1;
p4=p2;



h1=XSteam('h_pT',p1,t1);%to get the value from Xsteam file  
s1=XSteam('s_ph',p1,h1);

fprintf('\n')%\n used for next line
fprintf('\n state point 1')
fprintf('\n P1 is:%f bar',p1)
fprintf('\n T1 is:%f deg celsius',t1)
fprintf('\n H1 is:%f KJ/Kg',h1)
fprintf('\n S1 is:%f KJ/KgK',s1)

%for 2 state
p2=0.05;
s2=s1;

t2=XSteam('T_ps',p2,s2);
sf2=XSteam('sL_p',p2);
sg2=XSteam('sV_T',p2);
hf2=XSteam('hL_p',p2);
hg2=XSteam('hV_T',t2);
x=((s2-sf2)/(sg2-sf2));
h2=hf2+(x*(hg2-hf2));

fprintf('\n')
fprintf('\n state point 2')
fprintf('\n P2 is:%f bar',p2)
fprintf('\n T2 is:%f deg celsius',t2)
fprintf('\n H2 is:%f KJ/Kg',h2)
fprintf('\n S2 is:%f KJ/KgK',s2)

%for state point 3
t3=t2;
p3=p2;

h3=XSteam('hL_T',t3);
s3=XSteam('sL_p',p3);

fprintf('\n')
fprintf('\n state point 3')
fprintf('\n P3 is:%f bar',p3)
fprintf('\n T3 is:%f deg celsius',t3)
fprintf('\n H3 is:%f KJ/Kg',h3)
fprintf('\n S3 is:%f KJ/KgK',s3)


%for state point 4

p4=p1;
s4=s3;

h4=XSteam('h_ps',p4,s4);
t4=XSteam('T_hs',h4,s4);

fprintf('\n')
fprintf('\n state point 4')
fprintf('\n P4 is:%f bar',p4)
fprintf('\n T4 is:%f deg celsius',t4)
fprintf('\n H4 is:%f KJ/Kg',h4)
fprintf('\n S4 is:%f KJ/KgK',s4)

%for state point 5
p5=p4;
t5=XSteam('Tsat_p',p5);
h5=XSteam('hL_T',t5);
s5=XSteam('sL_p',p5);

fprintf('\n')
fprintf('\n state point 5')
fprintf('\n P5 is:%f bar',p5)
fprintf('\n T5 is:%f deg celsius',t5)
fprintf('\n H5 is:%f KJ/Kg',h5)
fprintf('\n S5 is:%f KJ/KgK',s5)

%for state point 6
t6=t5;

p6=XSteam('psat_T',t6);
h6=XSteam('hV_T',t6);
s6=XSteam('sV_T',t6);

fprintf('\n')
fprintf('\n state point 6')
fprintf('\n P6 is:%f bar',p6)
fprintf('\n T6 is:%f deg celsius',t6)
fprintf('\n H6 is:%f KJ/Kg',h6)
fprintf('\n S6 is:%f KJ/KgK',s6)


%loop to find variables on saturation lines
t=linspace(0,400,1000);%used linspace to find  values with equal intervals
for i=1:length(t)
    s_1(i)=XSteam('sL_T',t(i));

for j=1:length(t)
    s_2(j)=XSteam('sV_T',t(j));
end
end

for i=1:length(t)
    h_1(i)=XSteam('hL_T',t(i));
    
    for j=1:length(t)
    h_2(j)=XSteam('hV_T',t(j));
    end
end


%net work done
w_turbine=h1-h2;                    %work done by turbine
fprintf('\n wt is:%f ',w_turbine)
w_pump=h4-h3;                      %work done by pump
fprintf('\n wp is:%f ',w_pump)

net_work=w_turbine-w_pump;          %net work done
fprintf('\n net work done is:%f ',net_work)

q_in=h1-h4;                       %heat addition
fprintf('\n q_in is:%f ',q_in)

q_out=h2-h3;                  %heat rejection
fprintf('\n q_out:%f ',q_out)


%thermal effiency
n=net_work/q_in;
fprintf('\n thermal effiency:%f ',n)

%back work ratio
BWR=w_pump/w_turbine;
fprintf('\n back work ratio:%f ',BWR)

%specific heat consumption
SSC=3600/net_work;
fprintf('\n specific heat consumption:%f ',SSC)


%plotting t-s graph
figure(1)
hold on%retains plots in the current axes
plot([s_1 s_2],[t t])%to plot the graph
plot([s1 s2 s3 s4 s5 s6 s1],[t1 t2 t3 t4 t5 t6 t1])%to plot the graph
text(s1,t1,'1')%to write the text at the particular co-orditanes
text(s2,t2,'2')%to write the text at the particular co-orditanes
text(s3,t3,'3')%to write the text at the particular co-orditanes
text(s4,t4,'4')%to write the text at the particular co-orditanes
text(s5,t6,'5')%to write the text at the particular co-orditanes
text(s6,t6,'6')%to write the text at the particular co-orditanes
title("T-s graph")%to display the title
xlabel('Entropy(KJ/kgK)')%for labelling the x axis
ylabel('Temperature(K)')%for labelling the y axis
axis([0,8,0,450])%Set axis limits and aspect ratios


%plotting h-s graph
figure(2)
hold on %retains plots in the current axes
plot([s_1 s_2],[h_1 h_2])%to plot the graph
plot([s1 s2 s3 s4 s5 s6 s1],[h1 h2 h3 h4 h5 h6 h1])%to plot the graph
text(s1,h1,'1')%to write the text at the particular co-orditanes
text(s2,h2,'2')%to write the text at the particular co-orditanes
text(s3,h3,'3')%to write the text at the particular co-orditanes
text(s4,h4,'4')%to write the text at the particular co-orditanes
text(s5,h6,'5')%to write the text at the particular co-orditanes
text(s6,h6,'6')%to write the text at the particular co-orditanes
title("h-s graph")%to display the title
xlabel('Entropy(KJ/kgK)')%for labelling the x axis
ylabel('enthalphy(KJ/Kg)')%for labelling the y axis
axis([0,8,0,3500])%Set axis limits and aspect ratios













references

https://www.youtube.com/watch?v=MQ13EepiG9Q

https://www.youtube.com/watch?v=mf6yOxs5nNI&t=753s

https://en.wikipedia.org/wiki/Rankine_cycle

https://www.thermopedia.com/content/1072/

https://in.mathworks.com/help/

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.