Project 2 - Rankine cycle Simulator
Aim:
To Create a Rankine Cycle Simulator using MATLAB.
Program:
clear all
close all
clc
% Rankine cycle
disp('Rankine Cycle');
disp('1-2 isentropic expansio in the turbine');
disp('2-3 constant pressure heat rejection in the condenser');
disp('3-4 Isentropic compression in the pump');
disp('4-1 constant pressure heat addition in the boiler');
% Input data
T1=input('Enter temperature at turbine inlet, T1(in Deg.C)=');
p1=input('Enter pressure at turbine inlet,p1( in bar)=');
p2=input('Enter pressure at condenser inlet,p2(in bar)=');
% State 1
h1=XSteam('h_pT',p1,T1);
s1=XSteam('s_pT',p1,T1);
% State 2
s2=s1;
sf2=XSteam('sL_p',p2);
sg2=XSteam('sV_p',p2);
x2=(s2-sf2)/(sg2-sf2);
hf2=XSteam('hl_p',p2);
hg2=XSteam('hV_p',p2);
h2=hf2+(x2*(hg2-hf2));
% State 3
p3=p2;
s3=XSteam('sL_p',p3);
h3=XSteam('hL_p',p3);
% State 4
s4=s3;
p4=p1;
% Workdone by turbine
Wt=h1-h2;
% work done to run pump
v3=XSteam('vL_p',p3);
Wp=v3*(p4-p3)*100;
h4=h3+Wp;
% net work
Wnet=Wt-Wp;
% Heat addition
Qin = h1-h4;
% heat rejection
Qout=h2-h3;
% Thermal Efficiency
eff=(Wnet/Qin)*100;
% Specific Steam Consumption
SSC=(3600/Wnet);
% Calculating temperature
T3=XSteam('Tsat_p',p3);
T2=T3;
Cp4=XSteam('Cp_ps',p4,s4);
Cv4=XSteam('Cv_ps',p4,s4);
k=Cp4/Cv4;
T4=T3/((p3/p4)^((k-1)/k));
T6=XSteam('Tsat_p',p1);
s5=XSteam('sL_p',p1);
s6=XSteam('sV_p',p1);
h5=XSteam('hL_p',p1);
h6=XSteam('hV_p',p1);
T5=T6;
T=linspace(1,375,1000);
for i=1:length(T)
sf(i)=XSteam('sL_T',T(i));
sg(i)=XSteam('sV_T',T(i));
hf(i)=XSteam('hL_T',T(i));
hg(i)=XSteam('hV_T',T(i));
end
% Plotting
figure(1)
hold on
plot(sf,T,'linewidth',1)
plot(sg,T,'linewidth',1)
plot([s1 s2],[T1 T2],'linewidth',2)
plot([s2 s3],[T2 T3],'linewidth',2)
plot([s3 s4],[T3 T4],'linewidth',2)
plot([s4 s5],[T4 T5],'linewidth',2)
plot([s5 s6],[T5 T6],'linewidth',2)
sc1=linspace(s6,s1,1000);
for j=1:length( sc1)
Tcl(j)=XSteam('T_ps',p1,sc1(j));
end
plot(sc1,Tcl,'linewidth',2)
text(s1+0.1,T1,'1')
text(s2+0.1,T2,'2')
text(s3,T3-20,'3')
text(s4,T4+20,'4')
title('Temperature vs Entropy')
xlabel('Entropy,S (Kj/kgk)')
ylabel('Temperature (degree C)')
figure(2)
hold on
plot(sf,hf,'linewidth',1)
plot(sg,hg,'linewidth',1)
plot([s1 s2],[h1 h2],'linewidth',2)
plot([s2 s3],[h2 h3],'linewidth',2)
plot([s3 s4],[h3 h4],'linewidth',2)
hc=linspace(h4,h5,100);
for k=1:length(hc)
sch(k)=XSteam('s_ph',p1,hc(k));
end
plot(sch,hc,'linewidth',2)
plot([s5 s6],[h5 h6],'linewidth',2)
for m=1:length(sc1)
hc1(m)=XSteam('h_ps',p1,sc1(m));
end
plot(sc1,hc1,'linewidth',2)
text(s1+0.1,h1,'1')
text(s2+0.1,h2,'2')
text(s3,h3-100,'3')
text(s4,h4+200,'4')
title('Enthalpy vs Entropy')
xlabel('Entropy,S (kj/kgk)')
ylabel('Enthalpy,H (kj/kg)')
% Displaying results
disp('RESULTS');
fprintf('At state point1:\n');
fprintf('p1:%8.3f bar\t',p1);
fprintf('T1:%8.3f C\t',T1);
fprintf('h1:%8.3f kJ/kg\t',h1);
fprintf('s1:%8.3f kJ/kgK\n',s1);
fprintf('At state point2:\n');
fprintf('p2:%8.3f bar\t',p2);
fprintf('T2:%8.3f C\t',T2);
fprintf('h2:%8.3f kJ/kg\t',h2);
fprintf('s2:%8.3f kJ/kgK\t',s2);
fprintf('x2:%8.3f\n',x2);
fprintf('At state point3:\n');
fprintf('p3:%8.3f bar\t',p3);
fprintf('T3:%8.3f C\t',T3);
fprintf('h3:%8.3f kJ/kg\t',h3);
fprintf('s3:%8.3f kJ/kgK\n',s3);
fprintf('At state point4:\n');
fprintf('p4:%8.3f bar\t',p4);
fprintf('T4:%8.3f C\t',T4);
fprintf('h4:%8.3f kJ/kg\t',h4);
fprintf('s4:%8.3f kJ/kgK\n',s4);
fprintf('Turbine work:%8.3f kJ/kg\n',Wt);
fprintf('Pump work:%8.3f kJ/kg\n',Wp);
fprintf('Wnet:%8.3f kJ/kg\n',Wnet);
fprintf('Efficiency:%8.3f percent\n',eff);
fprintf('SSc:%8.3f kJ/kWh\n',SSC);
Explaination:
- XSteam data is used to extract the steam and water properties of enthalpy, entroy at specific pressure and temperatures for saturated liquid, saturated vapour conditions etc.
-
Defining the input of Pressure( in bar) at state point 1 (turbine inlet). Temperature at state point 1 (deg celcius) and Temperature at condenser inlet(in bar)
-
The program calculates all the 4 state points of the rankine cycle form the XSteam data.
-
As we extract the data, we use thermodynamic relation to further find state points and extract thier data from XSteam and also to determine the net work, workdone by turbine, work done to run the pump, Head addition and Heat Rejection, Specific steam Consumption are calculated.
-
The plotting of T,s,h, Saturation curve for Saturated liquid and saturated gas, Establishes 2 Graphs one will be Temperature vs Entropy and another will be Enthalpy vs Entropy.
-
Once the Required inputs are given in the command window, the result will be printed in the command window
Errors:
- The errors occured while coding this program has been attached, please find the attachment.
Result:
- The objective to Create a Rankine Cycle Simulator using MATLAB, has been completed and output is verfied.
1-2 isentropic expansio in the turbine
2-3 constant pressure heat rejection in the condenser
3-4 Isentropic compression in the pump
4-1 constant pressure heat addition in the boiler
Enter temperature at turbine inlet, T1(in Deg.C)=
At state point1:
p1: 30.000 bar T1: 400.000 C h1:3231.571 kJ/kg s1: 6.923 kJ/kgK
At state point2:
p2: 0.050 bar T2: 32.875 C h2:2110.708 kJ/kg s2: 6.923 kJ/kgK x2: 0.814
At state point3:
p3: 0.050 bar T3: 32.875 C h3: 137.765 kJ/kg s3: 0.476 kJ/kgK
At state point4:
p4: 30.000 bar T4: 36.935 C h4: 140.776 kJ/kg s4: 0.476 kJ/kgK
Turbine work:1120.863 kJ/kg
Pump work: 3.011 kJ/kg
Wnet:1117.852 kJ/kg
Efficiency: 36.167 percent
SSc: 3.220 kJ/kWh