Rankine Cycle Simulator
Objective:
Write a programe to simulate Rankine cycle.
Introduction:
Rankine cycle is an ideal vapour cycle. It plays a major role in steam power plants. This cycle is mainly based on the conversion of input heat energy into output power, using turbine. The working fluid at the inlet repeatedly undergoes change of phase and in successive operations, energy is transmitted and output power is produced.Rankine cycle consists of the following procesess:
Process 1-2:Reversible adiabatic expansion of steam in Turbine
Process 2-3:Isobaric heat rejection of steam in condenser.
Process 3-4:Reversible Adiabatic compression of fluid in pump.
Process 4-1:Isobaric Heat addition in Boiler.
Rankine cycle can be understand better through block diagram:
Fig: Block Diagram of Rankine cycle
Process 1-2:Reversible adiabatic expansion of steam in Turbine
Here, dry saturated steam from the boiler is allowed to expand in a turbine isentropically (i.e., entropy remains constant).
Let h1 be the enthalpy of steam entering the turbine
Let h2 be the enthalpy of steam leaving the turbine
Work done by the turbine is given by
WT = h1 − h2
Process 2-3:Isobaric heat rejection of steam in condenser.
Wet steam from the turbine is fed into a condenser, to perform condensation (wet steam is converted to water). As it is a heat rejection process , heat from the steam is rejected into atmosphere.
Let h2 be the enthalpy of steam entering the condenser.
Let h3 be the enthalpy of water leaving the condenser.
Heat rejected from condenser
Q2 = h2 − h3
Process 3-4:ReversibleAdiabatic compression of fluid in pump.
Water from the condenser is pumped into the boiler using an external pump. During this process, pressure increases P3 to P4 isentropically.
The enthalpy and temperature of water also increase due to pump work.
Let P,,h3 be the preasure and enthalpy at stage 3 respectively.
Let P4 and h4 be the corresponding values at stage 4.
Work done by the pump is given by
Wp = h4 − h3 = vf (p1 – p2)
where,
vf: specific volume of saturated water at pressure P3 (condenser pressure)
Process 4-1:Isobaric Heat addition in Boiler
Here the saturated water from the pump is heated using a constant heat source (like furnace). The input saturated water is heated till it reaches super-heated condition. The temperature and enthalpy raises to a great extent, but the pressure is kept constant. The change of phase from liquid to vapour occurs in boiler.
Let h4 be the enthalpy of saturated water entering the boiler.
Let h1 be the enthalpy of super-heated steam coming out of the boiler.
The heat supplied is given by
Q1 = h1 − h4
Code:
% Rankine cycle simulator
clear all
close all
clc
fprintf(\" Rankine cycle \\n\")
fprintf(\"1-2:Reversible adiabatic expansion in turbine \\n\")
fprintf(\"2-3:Isobaric Heat rejection in condenser \\n\")
fprintf(\"3-4:Reversible adiabatic pumping process \\n\")
fprintf(\"4-1:Isobaric heat addition in boiler \\n\")
p1=input(\'Enter turbine inlet preasure=\');
T1=input(\'Enter turbine inlet Temperature=\');
p2=input(\'Enter turbine outlet preasure=\');
% At preasure p1
h1=XSteam(\'h_pT\',p1,T1);
s1=XSteam(\'s_pT\',p1,T1);
Tsat_1=XSteam(\'Tsat_p\',p1);
sf1=XSteam(\'sL_p\',p1);
hf1=XSteam(\'hL_p\',p1);
hg1=XSteam(\'hV_p\',p1);
h4a=hf1;
h1a=hg1;
High_CpV=XSteam(\'CpV_p\',p1);
High_CpL=XSteam(\'CpL_P\',p1);
% At preasure p2
s2=s1;
Tsat_2=XSteam(\'Tsat_p\',p2);
T2=Tsat_2;
T3=T2;
h3=XSteam(\'hL_p\',p2);
hf2=h3;
s3=XSteam(\'sL_p\',p2);
sf2=s3;
s4=s3;
sg2=XSteam(\'sV_p\',p2);
vf=XSteam(\'VL_p\',p2);
hg2=XSteam(\'hV_p\',p2);
p3=p2;
p4=p1;
s4a=XSteam(\'sL_p\',p1);
T4a=Tsat_1;
s1a=XSteam(\'sV_p\',p1);
T1a=Tsat_1;
% s2=sf2+(X_2*(sg2-sf2))
X2=(s2-sf2)/(sg2-sf2); % dryness fraction at state 2
h2=hf2+(X2*(hg2-hf2));
Low_CpV=XSteam(\'CpV_p\',p2);
Low_CpL=XSteam(\'CpL_P\',p2);
% Calculations
wp=vf*(p1-p2)*10^2;
hf4=h3+wp;
h4=hf4;
%h4=hf1-(High_CpL*(Tsat_1-T4))
T4=((h4-hf1)/High_CpL)+Tsat_1;
wt=h1-h2;
w_net=wt-wp;
Q1=h1-hf4;
cycle_Efficiency=(w_net/Q1)*100;
work_ratio=(w_net/wt);
Back_Work_Ratio=(h1-h4)/(h2-h3);
fprintf(\'\\n at state point 1 \\n\')
fprintf(\'p1=%f bar \\n\',p1)
fprintf(\'T1=%f Deg Celsius \\n\',T1)
fprintf(\'h1=%f kJ/kg \\n\',h1)
fprintf(\'s1=%f kJ/kgK \\n\',s1)
fprintf(\'\\n at state point 2 \\n\')
fprintf(\'p2=%f bar \\n\',p2)
fprintf(\'T2=%f Deg Celsius \\n\',T2)
fprintf(\'h2=%f kJ/kg \\n\',h2)
fprintf(\'s2=%f kJ/kgK \\n\',s2)
fprintf(\'\\n at state point 3 \\n\')
fprintf(\'p3=%f bar \\n\',p3)
fprintf(\'T3=%f Deg Celsius \\n\',T3)
fprintf(\'h3=%f kJ/kg \\n\',h3)
fprintf(\'s3=%f kJ/kgK \\n\',s3)
fprintf(\'\\n at state point 4 \\n\')
fprintf(\'p4=%f bar \\n\',p4)
fprintf(\'T4=%f Deg Celsius \\n\',T4)
fprintf(\'h4=%f kJ/kg \\n\',h4)
fprintf(\'s4=%f kJ/kgK \\n\',s4)
fprintf(\'\\n Work done by Turbine= %f kJ/kg \\n\',wt)
fprintf(\'Work done on pump=%f kJ/kg \\n\',wp)
fprintf(\'Net work done= %f kJ/kg \\n\',w_net)
fprintf(\'work Ratio = %f \\n\',work_ratio)
fprintf(\'Back work Ratio = %f \\n\',Back_Work_Ratio)
fprintf(\'Thermal Efficiency=%f percent \\n\',cycle_Efficiency)
T=linspace(0,374,400); % ctiticaal point temperature of water=374 Deg celsius
for i=1:length(T)
h_L(i)=XSteam(\'hL_T\',T(i));
h_V(i)=XSteam(\'hV_T\',T(i));
s_L(i)=XSteam(\'sL_T\',T(i));
s_V(i)=XSteam(\'sV_T\',T(i));
end
% T-S plot
figure(1)
hold on
plot([s1 s2],[T1 T2],\'linewidth\',1.25,\'color\',\'b\')
plot([s2 s3],[T2 T3],\'linewidth\',1.25,\'color\',\'b\')
plot([s3 s4],[T3 T4],\'linewidth\',1.25,\'color\',\'b\')
plot([s4 s4a],[T4 T4a],\'linewidth\',1.25,\'color\',\'b\')
plot([s4a s1a],[T4a T1a],\'linewidth\',1.25,\'color\',\'b\')
plot([s1a s1],[T1a T1],\'linewidth\',1.25,\'color\',\'b\')
plot(s_L,T,\'color\',\'g\')
plot(s_V,T,\'color\',\'g\')
axis([0 8 0 450])
%Annotation
text(s1,T1,\'1\')
text(s2,T2,\'2\')
text(s3,T3,\'3\')
text(s4,T4,\'4\')
text(s4a,T4a,\'4a\')
text(s1a,T1a,\'1a\')
title(\'T-s diagram for Ideal Rankine Cycle\')
xlabel(\'Entropy [kJ/kgK]\')
ylabel(\'Temperature [Deg Celsius]\')
figure(2)
hold on
plot([s1 s2],[h1 h2],\'linewidth\',1.25,\'color\',\'b\')
plot([s2 s3],[h2 h3],\'linewidth\',1.25,\'color\',\'b\')
plot([s3 s4],[h3 h4],\'linewidth\',1.25,\'color\',\'b\')
plot([s4 s4a],[h4 h4a],\'linewidth\',1.25,\'color\',\'b\')
plot([s4a s1a],[h4a h1a],\'linewidth\',1.25,\'color\',\'b\')
plot([s1a s1],[h1a h1],\'linewidth\',1.25,\'color\',\'b\')
plot(s_L,h_L,\'color\',\'g\')
plot(s_V,h_V,\'color\',\'g\')
%Annotation
text(s1,h1,\'1\')
text(s2,h2,\'2\')
text(s3,h3,\'3\')
text(s4,h4,\'4\')
text(s4a,h4a,\'4a\')
text(s1a,h1a,\'1a\')
title(\'h-s diagram for Ideal Rankine Cycle\')
xlabel(\'Entropy [kJ/kgK]\')
ylabel(\'Enthalpy [kJ/kg]\')
Output:
1.T-s plot for Rankine cycle
Fig:T-s plot for Rankine cycle
2.h-s plot for Rankine cycle
Fig:h-s plot for Rankine cycle
3.Command Window
Fig: Command Window
Explanation of code:
1.Display name of cycle and various procesess involved in rankine cycle through command \'fprintf\'.
2.At state1,
Initial conditions are,
T1=Turbine Inlet temperature = 400° C
p1=Turbine Inlet Pressure = 30 bars
p2=Turbine Outlet Pressure = 0.05 bars = Condenser Inlet Pressure
point 1 is in superheated region hence find enthalpy h1 and entropy s1 through command
h1=XSteam(\'h_pT\',p1,T1);
s1=XSteam(\'s_pT\',p1,T1);
3.At state 2, condition of steam at point 2 is saturated liquid vapour hence to find enthalpy we need to calculate dryness fraction X2. at point 2,s1=s2
s2=sf2+(X_2*(sg2-sf2))
X2=(s2-sf2)/(sg2-sf2)
once dryness fraction is known enthalpy h2 can find out by
h2=hf2+(X2*(hg2-hf2)
& hg2=XSteam(\'hV_p\',p2)
& hf2=XSteam(\'hL_p\',p2)
4. At state 3,p2=p3
point 3 is on liquid line hence h3 is find out by
h3=XSteam(\'hL_p\',p2)
&s3=XSteam(\'sL_p\',p2)
&Tsat_2=XSteam(\'Tsat_p\',p2)
T2=Tsat_2
5.At point 4,point 4 is in subcooled region hence enthalpy at 4(i.e. h4) is
hf4=h3+wp;
h4=hf4;
temperature at point 4 is calculated by
h4=hf1-(High_CpL*(Tsat_1-T4))
T4=((h4-hf1)/High_CpL)+Tsat_1
6. We know that, At critical point teperarature of water is 374 deg celsius
therefore to plot dome shape in h-s and T-s diagram,divide temp(T) from 0 to 374 into 400 values and find out enthalpy and entropy of liquid and vapour using command
T=linspace(0,374,400);
for i=1:length(T)
h_L(i)=XSteam(\'hL_T\',T(i));
h_V(i)=XSteam(\'hV_T\',T(i));
s_L(i)=XSteam(\'sL_T\',T(i));
s_V(i)=XSteam(\'sV_T\',T(i));
end
7.to annotate the points in h-s and T-s diagram use text command.
eg:text(s1,T1,\'1\')
Error Occured while coding:
1.All curves in plot are not shown by code.
Fig: Error faced while programing
Steps taken to overcome Errors:
Use \'hold on\' command.
Calculations:
1.Net Work Output(w_net):
w_net=wt-wp
wt=h1-h2=3231.5710-2110.7082=1120.8628 kJ/kg
wp=h4-h3=vf(p1-p2)*100
=0.001053*(30-0.05)*100
wp =3.1537 kJ/kg
w_net=1120.8628-3.1537=1117.8518 kJ/kg
2.Back Work Ratio
Back_Work_Ratio=(h1-h4)/(h2-h3)
=(3231.571-140.8039)/(2110.7082-137.7651)
=1.5666
3.Thermal efficiency
Heat added in boiler(Q1)=h1-h4
=3231.571-140.8039
=3090.7671 kJ/kg
Thermal efficiency=w_net/Q1
=1117.8518/3090.7671
=0.3616
Thermal efficiency =0.3616*100=36.16 %
Conclusion:
1.Net work output is 1117.8518 kJ/kg
2.Back Work Ratio is 1.5666
3.Thermal efficiency is 36.16 %
References:
1.Thermal Engineering by R.K.Rajput
2.Input command in matlab [https://www.mathworks.com/help/matlab/ref/input.html]