Project 2 - Rankine cycle Simulator
Program
clear all
close all
clc
disc(' RANKINE CYCLE ');
disp('1-2 is Iscentropic Expansion in the turbine');
disp('3-4 is Constant Pressure Heat rejection by the Condensor')
disp('3-4 Iscentropic Expansion in the pump');
disp('4-1 is Constant Pressure Heat addition to the Boiler');
%inputs
disc(' INPUTS ');
P1=input('Enter the Pressure at turbine inlet (bar):');
T1=input('Enter the temerature at the Turbine inlet(degree C):');
P2=input('Enter the Pressureat the Condensor(bar):');
%using the XStream functions, the enthalpy and entropy at various
%points can be calculated
%Calculating entholpy(h) and entropy (s) at point 1
h1=XStream('h_pT',P1,T1);
s1=XStream('s_pT',P1,T1);
%caculating presuure(P),entholpy (h) and entropy(s) at point 2;
%since iscentropic expansion
s2=s1;
%For Iscentropic expansion
%wkt (T2/T1)=(P2/P1)^(1-(1/g))
g=1.4;
power=1-(1/g);
%hence (T2/T1)=(P2/P)^power:
T2=T1*((P2/P1)^power);
h2=XStream('h_pT',P2,T2);
%caculating presuure(P),entholpy (h) and entropy(s) at point 3;
%since constant pressure heat removel
P3=P2;
T3=T2;
h3=XStream('h_pT',T3);
s3=XStream('sL_T',T3);
%alculating (P),entholpy (h) and entropy(s) at point 4;
%since iscentropic Compression
s4=s3;
%Since constant Pressure Process;
P4=P1;
T4=XStream('T_ps',P4,s4);
h41=XStream('h_pT',P4,T4);
s41=XStream('sL_p',P4);
h42=XStream('hV_p',P4);
s42=XStream('sV_p',P4);
T41=XStream('T_hs',h4,s41);
T42=XStream('T_hs',h42,s42);
% calculating the entropy and entholpyat the saturation curve
Temp=linspace(0,500,600);
for i-1:length(Temp)
sv(i)=XStream('sV_T',Temp(i));
s(i)=XStream('sL_T',Temp(i));
hv(i)=XStream('hV_T',Temp(i));
h1(i)=XStream('hL_T',Temp(i));
endfor
%calculating net work output(W_net)
W_t=h1-h2;
W_p=h4-h3;
W_net=W_t-W_p;
%calculating the thermal efficiency
%wkt 1j=360kg/s
SSC=3600/W_net;
%Displaying results in the command window
disp(' Results ');
P1=P1;
T1=T1;
P2=P2;
disp('At stage point 1');
n1=sprintf('P1 is %.3f bar',P1);
disp(n1);
n2=sprintf('T1 is %.3f C',T1);
disp(n2);
n3=sprintf('h1 is %.3f kJ/kg',h1);
disp(n3);
n4=sprintf('s1 is %.3f kJ/kg',s1);
disp(n4);
disp('At stage point 2');
n11=sprintf('P2 is %.3f bar',P2);
disp(n11);
n21=sprintf('T2 is %.3f C',T2);
disp(n21);
n31=sprintf('h2 is %.3f kJ/kg',h2);
disp(n31);
n41=sprintf('s2 is %.3f kJ/kg',s2);
disp(n41);
disp('At stage point 3');
n12=sprintf('P3 is %.3f bar',P3);
disp(n12);
n22=sprintf('T3 is %.3f C',T3);
disp(n22);
n32=sprintf('h3 is %.3f kJ/kg',h3);
disp(n32);
n42=sprintf('s3 is %.3f kJ/kg',s3);
disp(n42);
disp('At stage point 4');
n13=sprintf('P4 is %.3f bar',P4);
disp(n13);
n23=sprintf('T4 is %.3f C',T4);
disp(n23);
n33=sprintf('h4 is %.3f kJ/kg',h4);
disp(n33);
n43=sprintf('s4 is %.3f kJ/kg',s4);
disp(n43);
n14=sprintf('W_t is %.3f kJ/kg',W_t);
disp(n14);
n15=sprintf('W_p is %.3f kJ/kg',W_p);
disp(n15);
n16=sprintf('W_net is %.3f kJ/kg',W_net);
disp(n16);
n17=sprintf('Eff_Thermal is %.2f kJ/kg',Eff_Thermal);
disp(n17);
n18=sprintf('SSC is %.3f kJ/kg',SSC);
disp(n18);
figure(2)
plot([s1 s2],[h1 h2],[h3 h4],[s4 s1],[h4 h1],'marker','8','color','g')
hold on
plot(sv,hv)
plot(s1,h1)
xlabel('Entropy-s(kJ/kgK');
ylabel('Enthalpy-h(kJ/k)';
Graph
H-S Graph
T-S Graph