Project 2 - Rankine cycle Simulator
Aim : To create ideal rankine cycle simulator using MATLAB
Rankine cycle-
There are four processes in the Rankine cycle.
- Process 1–2: The working fluid is pumped from low to high pressure. As the fluid is a liquid at this stage, the pump requires little input energy.it is isentropic compression process
- Process 2–3: The high-pressure liquid enters a boiler, where it is heated at constant pressure by an external heat source to become a dry saturated vapour.it is constant pressure heat addition process
- Process 3–4: The dry saturated vapour expands through a turbine. This decreases the temperature and pressure of the vapour, and some condensation may occur. .it is isentropic expansion.
- Process 4–1: The wet vapour then enters a condenser, where it is condensed at a constant pressure to become a saturated liquid.it is constant pressure heat rejection process.
In an ideal Rankine cycle the pump and turbine would be isentropic, i.e., the pump and turbine would generate no entropy and hence maximize the net work output. Processes 1–2 and 3–4 would be represented by vertical lines on the T-s diagram and more closely resemble that of the Carnot cycle. The Rankine cycle shown here prevents the state of the working fluid from ending up in the superheated vapor region after the expansion in the turbine, which reduces the energy removed by the condensers.
The actual vapor power cycle differs from the ideal Rankine cycle because of irreversibilities in the inherent components caused by fluid friction and heat loss to the surroundings; fluid friction causes pressure drops in the boiler, the condenser, and the piping between the components, and as a result the steam leaves the boiler at a lower pressure; heat loss reduces the net work output, thus heat addition to the steam in the boiler is required to maintain the same level of net work output.
T-S diagram of Rankine cycle-
Efficiency can be calculated as follows-
`η=(Wt-Wp)/Q`
`Q/m=h3-h2`
`(Qout)/m=h4-h1`
`(Wp)/m=h2-h1`
`(Wt)/m=h3-h4`
where,
Wt - turbine work,
Wp - pump work,
Q - heat input,
Qout -heat rejected,
m = mass of steam,
h- specific enthalpy.
MATLAB CODE -
clear all
close all
clc
%give discription of all process to user
fprintf('Rankine cycle simulator \n\n');
fprintf('1-2 Isentropic Expansion in Turbine \n');
fprintf('2-3 Constant Pressure Heat Rejection by Condenser \n');
fprintf('3-4 Isentropic compression in pump \n');
fprintf('4-1 Constant Pressure Heat Addition by Boiler \n');
%getting inputs from user
p1 =input('Enter the value of pressure(bar) at turbine inlet: ');
t1 =input('Enter the value of temperature(celcius) at turbine inlet: ');
p2 =input('Enter the value of pressure(bar) at condenser : ');
%preparing results
fprintf('results /n/n');
%calculation for general properties
%calculation for cp value at p1 and p2 for saturated liquid and vapour
cp1_l =XSteam('CpL_p',p1);
cp1_v =XSteam('CpV_p',p1);
cp2_l =XSteam('CpL_p',p2);
cp2_v =XSteam('CpV_p',p2);
%calculation for saturation temperature at p1 and p2
Tsat_p1 =XSteam('Tsat_p',p1);
Tsat_p2 =XSteam('Tsat_p',p2);
%calculation of enthalphy and entropy at saturation point
%saturation properties at state1
Hg_1=XSteam('hV_p',p1);
Sg_1=XSteam('sV_p',p1);
%saturation properties at state2
Hg_2=XSteam('hV_p',p2);
Sg_2=XSteam('sV_p',p2);
%saturation properties at state3
Hf_3=XSteam('hL_p',p2);
Sf_3=XSteam('sL_p',p2);
%saturstion properties at state4
Hf_4=XSteam('hL_p',p1);
Sf_4=XSteam('sL_p',p1);
%calculation of process properties at state1
fprintf('At State point 1 \n');
fprintf('p1 is %f Bar \n',p1);
fprintf('t1 is %f celcius \n',t1);
h1 =XSteam('h_pT',p1,t1);
fprintf('h1 is %f KJ/kg \n',h1);
s1 =XSteam('s_pT',p1,t1);
fprintf('s1 is %f KJ/kg \n',s1);
%calculation of process properties at state2
fprintf('At State point 2 \n');
fprintf('p2 is %f Bar \n',p2);
s2=s1;
fprintf('s2 is %f KJ/kg \n',s2);
%calculating dryness fraction
if(s2<=Sg_2)
x2 =(s2-Sf_3)/(Sg_2-Sf_3);
else
x2 =1;
end
fprintf('x2 is %f \n',x2);
%calculating t2
if(x2<1)
t2 = Tsat_p2;
else
t2 = (Tsat_p2+273.15)*exp((s2-Sg_2)/cp2_v);
t2 = t2-273.15;
end
fprintf('t2 is %f celcius \n',t2);
if(x2<1)
h2=Hf_3+x2*(Hf_3-Hg_2);
else
h2 =XSteam('h_pT',p2,t2);
end
fprintf('h2 is %f KJ/kg \n',h2);
%calculation of process properties at state 3
fprintf('At State point 3 \n')
p3=p2;
fprintf('p3 is %f Bar \n',p3);
v3 = XSteam('vL_p',p3)
t3 = Tsat_p2; %no subcooling
fprintf('t3 is %f celcius\n',t3);
h3 =Hf_3;
fprintf('h3 is %f KJ/kg \n',h3);
s3 =Sf_3;
fprintf('s3 is %f KJ/kg \n',s3);
%calculation of properties at state 4
fprintf('At state point 4 \n');
p4 =p1;
fprintf('p4 is %f Bar \n',p4);
s4=s3;
fprintf('s4 is %f Bar \n ',s4);
Wp =v3*(p4-p3)*100;
h4=Wp+h3;
fprintf('h4 is %f KJ/kg \n',h4);
t4 =(Tsat_p1+273.15)/(exp((Sf_4-s4)/cp1_l));
t4 =t4-273.15;
fprintf('t4 is %f celcius \n',t4);
%plotting saturation liquid and vapour line
temp =linspace(1,t1,1000);
for i=1:length(temp)
H_L(i) = XSteam('hL_T',temp(i));
H_V(i) = XSteam('hV_T',temp(i));
S_L(i) =XSteam('sL_T',temp(i));
S_V(i) =XSteam('sV_T',temp(i));
end
%plotting T-s and H-s diagram
%plotting T-s Plot
figure(1)
hold on
plot([s1 s2],[t1 t2],'r','linewidth',2)
text(s1,t1,'1')
text(s2,t2,'2')
plot([s2 Sg_2],[t2 Tsat_p2],'r','linewidth',2)
text(Sg_2,Tsat_p2,'2s')
plot([Sg_2 s3],[Tsat_p2 t3],'r','linewidth',2)
text(s3,t3,'3')
plot([s3 s4],[t3 t4],'r','linewidth',2)
text(s4,t4,'4')
plot([s4 Sf_4],[t4 Tsat_p1],'r','linewidth',2)
text(Sf_4,Tsat_p1,'4s')
plot([Sf_4 Sg_1],[Tsat_p1 Tsat_p1],'r','linewidth',2);
text(Sg_1,Tsat_p1,'1s')
plot([Sg_1 s1],[Tsat_p1 t1],'r','linewidth',2)
plot(S_L,temp,'b','linestyle','--','linewidth',1)
plot(S_V,temp,'b','linestyle','--','linewidth',1)
title('T-S diagram of ideal rankine cycle')
xlabel('Specific Entropy(KJ/kg)')
ylabel('Temperature(celcius)')
%plotting h-s plot
figure(2)
hold on
plot([s1 s2],[h1 h2],'r','linewidth',2)
text(s1,h1,'1')
text(s2,h2,'2')
plot([s2 Sg_2],[h2 Hg_2],'r','linewidth',2)
text(Sg_2,Hg_2,'2s')
plot([Sg_2 s3],[Hg_2 h3],'r','linewidth',2)
text(s3,h3,'3')
plot([s3 s4],[h3 h4],'r','linewidth',2)
text(s4,h4,'4')
plot([s4 Sf_4],[h4 Hf_4],'r','linewidth',2)
text(Sf_4,Hf_4,'4s')
plot([Sf_4 Sg_1],[Hf_4 Hg_1],'r','linewidth',2)
text(Sg_1,Hg_1,'1s')
plot([Sg_1 s1],[Hg_1 h1],'r','linewidth',2)
plot(S_L,H_L,'b','linestyle','--','linewidth',1.5)
plot(S_V,H_V,'b','linestyle','--','linewidth',1.5)
title('H-S diagram of ideal rankine cycle')
xlabel('Specific Enthalpy(KJ/kg)')
ylabel('Specific Entropy(KJ/kgK)')
%Work done ,heat,SSC and efficiency calculations
Wt = h1-h2;
fprintf('Work done by turbine is %f KJ/kg \n',Wt);
fprintf('Work done by compressor is %f KJ/kg \n',Wp);
Wnet =Wt-Wp;
fprintf('net work done is %f KJ/kg \n',Wnet);
Qin =h1-h4;
eff_thermal =Wnet*100/Qin ;
fprintf('thermal effiency is %f ',eff_thermal)
disp('%')
SSC =3600/Wt;
fprintf('Specific steam consumption(SSC) is %f kg/kwh',SSC)
Explaination of code -
clc, clear all, close all - to clear command window and remove previous variables.
fprintf - to print required lines in command window.
input - to get values of input conditions from user.
XSteam - custom function to get values from steam table.
if-else - to calculate dryness fraction s2.
for - to create points to plot dry saturated liquid and vapour line.
plot - to plot graph based on input
text - give name to points in plot.
output -
command window will show following output-
Rankine cycle simulator
1-2 Isentropic Expansion in Turbine
2-3 Constant Pressure Heat Rejection by Condenser
3-4 Isentropic compression in pump
4-1 Constant Pressure Heat Addition by Boiler
Enter the value of pressure(bar) at turbine inlet: 30
Enter the value of temperature(celcius) at turbine inlet: 400
Enter the value of pressure(bar) at condenser : 0.05
results /n/nAt State point 1
p1 is 30.000000 Bar
t1 is 400.000000 celcius
h1 is 3231.571027 KJ/kg
s1 is 6.923259 KJ/kg
At State point 2
p2 is 0.050000 Bar
s2 is 6.923259 KJ/kg
x2 is 0.814256
t2 is 32.875490 celcius
h2 is -1835.177974 KJ/kg
At State point 3
p3 is 0.050000 Bar
v3 =
0.0010
t3 is 32.875490 celcius
h3 is 137.765119 KJ/kg
s3 is 0.476254 KJ/kg
At state point 4
p4 is 30.000000 Bar
s4 is 0.476254 Bar
h4 is 140.776056 KJ/kg
t4 is 46.846863 celcius
Work done by turbine is 5066.749001 KJ/kg
Work done by compressor is 3.010937 KJ/kg
net work done is 5063.738064 KJ/kg
thermal effiency is 163.832869 %
Specific steam consumption(SSC) is 0.710515 kg/kwh
T-S plot -
H-S plot -
references-