Rankine cycle Simulator
Rankine cycle
A rankine cycle is a basic operating cycle for all the power plants which involves condensation and expansion of the working fluid.
A basic rankine cycle is shown below.
It involves the following 4 processes
1. 1-2 is Isentropic Expansion in the turbine:The steam at high pressure enters the turbine where it expands to low pressure by giving turbine work Wt, which can be converted into useful work.
2. 2-3 is const Pressure heat Rejection by the Condenser: The steam at low pressure from the turbine enters condenser and here it is converted into liquid by cooloing water and gives out heat Qout.
3. 3-4 is Isentropic Compression in the pump: The liquid at constant pressure enters the pump where it is compressed to high pressure which requires work input Wp.
4. 4-1 is const Pressure heat Addition by the Boiler: Heat is added to the liquid and converted into steam with the addition of heat Qin in the boiler.
The code written requires following 3 inputs
1. Temp at turbine inlet t1.
2. pressure at the turbine inlet p1.
3. pressure at the condenser inlet p2.
clear all
close all
clc
disp(' RANKINE CYCLE SIMULATOR');
disp('1-2 is Isentropic Expansion in the turbine');
disp('2-3 is const Pressure heat Rejection by the Condenser');
disp('3-4 is Isentropic Compression in the pump');
disp('4-1 is const Pressure heat Addition by the Boiler');
p1=input('\nEnter the Pressure at the Turbine Inlet(in bar):');
t1=input('Enter the temperature at the Turbine Inlet(in degree Celcius):');
p2=input('Enter the Pressure at the Condenser(in bar):');
% conditions at the inlet of the Turbine
tsat=XSteam('Tsat_p',p1);
sf1=XSteam('sL_p',p1);
sg1=XSteam('sV_p',p1);
if t1>tsat
tsup=t1;
h1=XSteam('h_pT',p1,tsup);
s1=XSteam('s_pT',p1,tsup);
elseif t1==tsat
h1=XSteam('hL_p',p1);
s1=XSteam('sL_p',p1);
else
disp('Temperature entered must be greater than or equal to saturation temperature')
end
%conditions at the condenser inlet or the Turbine exhaust
t2=XSteam('Tsat_p',p2);
hf2=XSteam('hL_p',p2);
hg2=XSteam('hV_p',p2);
s2=s1;
sg2=XSteam('sV_p',p2);
sf2=XSteam('sL_p',p2);
x2=(s2-sf2)/(sg2-sf2);
h2=hf2+(x2*(hg2-hf2));
%conditions at the condenser exit
p3=p2;
t3=t2;
h3=hf2;
s3=sf2;
%conditions at the boiler inlet
p4=p1;
s4=s3;
cp4=XSteam('Cp_ps',p4,s4);
cv4=XSteam('Cv_ps',p4,s4);
gamma=cp4/cv4;
t4=t3*(p4/p3)^((gamma-1)/gamma);
vf=XSteam('vL_p',p3);
wp=vf*(p1-p2)*100;%input power to pump
h4=wp+h3;
wt=h1-h2;% work output from turbine
Qin=h1-h4;%heat input
Qout=h2-h3;%heat output
wnet=wt-wp; %net work
Ntherm=(wnet/Qin)*100;% thermalefficiency
ssc=3600/wnet;%specific fuel consumption
%plotting of T-S and H-S diagram
%T-S diagram
figure(1)
hold on
%plotting saturation lines
temp = linspace(1, 373, 500);
for i = 1 : length(temp)
hl(i) = XSteam('hL_T', temp(i));
hv(i) = XSteam('hV_T', temp(i));
sl(i) = XSteam('sL_T', temp(i));
sv(i) = XSteam('sV_T', temp(i));
end
plot(sl, temp, 'r', 'linestyle','-','linewidth', 1.5)
plot(sv, temp, 'r', 'linestyle','-','linewidth', 1.5)
xlabel('Specific Entropy (kJ/kgK)')
ylabel('Temprature (degC)')
title('T-S diagram');
plot([s1 s2 s3 s4 sf1 sg1],[t1 t2 t3 t4 tsat tsat],'color','black','linewidth', 1.5)
text(s1,t1,'1')
text(s2,t2,'2')
text(s3,t3-10,'3')
text(s4,t4+10,'4')
t=linspace(tsat,tsup,1000);
for j =1:length(t)
sinst(j) = XSteam('s_pT',p1,t(j));
end
plot(sinst,t,'color','black','linewidth', 1.5);
%H-S diagram
figure(2)
hold on
title('H-S diagram');
plot(sl, hl, 'r','linestyle','-', 'linewidth', 1.5)
plot(sv, hv, 'r','linestyle','-', 'linewidth', 1.5)
plot([s1 s2 s3 s4 s1], [h1 h2 h3 h4 h1], 'color', 'black','linewidth', 1.5);
text(s1,h1,'1')
text(s2,h2,'2')
text(s3,h3-100,'3')
text(s4,h4+100,'4')
ylabel('Specific Enthalpy (kJ/kg)')
xlabel('Specific Entropy (kJ/kgK)')
%output
%at state 1
disp(' RESULTS');
disp('At State point 1:');
fprintf('P1 is : %.2f Bar',p1);
fprintf('\nT1 is : %.2f Deg Celcius',t1);
fprintf('\nH1 is : %.2f kJ/kg',h1);
fprintf('\nS1 is : %.2f kJ/kgK\r\n',s1);
%at state 2
disp('At State point 2:');
fprintf('P2 is : %.2f Bar',p2);
fprintf('\nT2 is : %.2f Deg Celcius',t2);
fprintf('\nH2 is : %.2f kJ/kg',h2);
fprintf('\nS2 is : %.2f kJ/kgK\r\n',s2);
%at state 3
disp('At State point 3:');
fprintf('P3 is : %.2f Bar',p3);
fprintf('\nT3 is : %.2f Deg Celcius',t3);
fprintf('\nH3 is : %.2f kJ/kg',h3);
fprintf('\nS3 is : %.2f kJ/kgK\r\n',s3);
%at state 4
disp('At State point 4:');
fprintf('P4 is : %.2f Bar',p4);
fprintf('\nT4 is : %.2f Deg Celcius',t4);
fprintf('\nH4 is : %.2f kJ/kg',h4);
fprintf('\nS4 is : %.2f kJ/kgK\r\n',s4);
fprintf('Wt is : %.2f kJ/kg',wt);
fprintf('\nWp is : %.2f kJ/kg',wp);
fprintf('\nWnet is : %.2f kJ/kg',wnet);
fprintf('\nNtherm is : %.2f Percent',Ntherm);
fprintf('\nS.S.C is : %.2f kg/kWh',ssc);
Explaination
If the temp of steam at the entry of turbine is greater than saturated temp, then the steam is said to be superheated and t1=tsup. If it is equal to saturated temp then t1=tsat. If entered temp is less than the saturated temp then it will display "Temperature entered must be greater than or equal to saturation temperature".Then the enthalpy and entropy are derived from the XSteam library for state 1. for state 2, 3 and 4 following formulae is used.
s2=s1
x2=(s2-sf2)/(sg2-sf2)
h2=hf2+(x2*(hg2-hf2))
conditions at the condenser exit
p3=p2
t3=t2
h3=hf2
s3=sf2
conditions at the boiler inlet
p4=p1
s4=s3
gamma=cp4/cv4
t4=t3*(p4/p3)^((gamma-1)/gamma)
wp=vf*(p1-p2)*100 input power to pump
h4=wp+h3
wt=h1-h2 work output from turbine
Qin=h1-h4 heat input
Qout=h2-h3 heat output
wnet=wt-wp net work
Ntherm=(wnet/Qin)*100 thermalefficiency
ssc=3600/wnet specific fuel consumption
1.T-S diagram
2.H-S diagram
3. Output
If the steam is saturated at the inlet of the turbine
1.T-S diagram
2.H-S diagram
3. Output