Project 2 - Rankine cycle Simulator
Aim :Understand the concept of Rankine cycle by referring to standard thermal engineering text book.
clear all
close all
clc
fprintf('1-2 Isobaric heat transfer\n')
fprintf('2-3 isentropic expansion\n')
fprintf('3-4 Isobaric heat rejection\n')
fprintf('2-3 isentropic comppression\n')
%input
p1 = input('Enter the pressure at the turbine inlet(in bar):');
t1 = input('Enter the temperature at inlet(in degree celcius):');
p2 = input('Enter the pressure at condenser(in bar):');
%input condition
h1= Xsteam('h_pT',p1,t1);
s1 = Xsteam('s_pT',p1,t1);
%state points evaluation
p4=p1;
p3=p2;
h3 = Xsteam('hL_p',p3)
s3 = Xsteam('sL_p',p3)
t3 = Xsteam('Tsat_p',p3);
s2 = s1;
t2 = t3;
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);
s4=s3;
h4 = Xsteam('h_ps',p4,s4);
cp4 = Xsteam('Cp_ps',p4,s4);
cv4 = Xsteam('Cv_ps',p4,s4);
g4 = cp4/cv4;
o = (g4-1)/g4;
t4 = t3*((p4/p3)^o);
%turbine work
wt = h1 - h2;
wp = h4 - h3;
%net work
wnet = wt - wp;
%heat supplied
qs = h1 - h4;
%efficiency
n_per = (wnet/qs)*100;
%steam rate per second
stm_rate = 3600/(wt - wp);
%for process 1 - 4
t5 = Xsteam('Tsat_p',p1);
s5 = Xsteam('sL_p',p1);
s6 = Xsteam('sV_p',p1);
%output
fprintf('\n\tRESULT\n')
fprintf('At state point 1:\np1 is :%4.2f bar\nT1 is :%4.2f Degree celcius\nH1 is :%4.2f KJ/KgK\nS1 is :%4.2f KJ/KgK\n\n',p1,t1,h1,s1)
fprintf('At state point 2:\np2 is :%4.2f bar\nT2 is :%4.2f Degree celcius\nH2 is :%4.2f KJ/KgK\nS2 is :%4.2f KJ/KgK\n\n',p2,t2,h2,s2)
fprintf('At state point 3:\np3 is :%4.2f bar\nT3 is :%4.2f Degree celcius\nH3 is :%4.2f KJ/KgK\nS3 is :%4.2f KJ/KgK\n\n',p3,t3,h3,s3)
fprintf('At state point 4:\np4 is :%4.2f bar\nT4 is :%4.2f Degree celcius\nH4 is :%4.2f KJ/KgK\nS4 is :%4.2f KJ/KgK\n\n',p4,t4,h4,s4)
fprintf('Wt is :%4.2f KJ/kg\nWp is :%4.2f KJ/Kg\nWnet is :%4.2f KJ/Kg\nNtherm is :%4.2f percent\nS.SC is :%4.2f Kg/KWh',wt,wp,wnet,n_per,stm_rate)
%vapour line
temp = linspace(1,400,100);
for i = 1:length(temp)
ent_l(i) = Xsteam('sL_T',temp(i));
ent_v(i) = Xsteam('sV_T',temp(i));
enth_l(i) = Xsteam('hL_T',temp(i));
enth_v(i) = Xsteam('hV_T',temp(i));
end
%plotting
subplot(1,2,1)
plot([s1 s2 s3 s4 s5 s6 s1],[t1 t2 t3 t4 t5 t1],'color','b','linwidth',2,'marker','o','markersize',2,'markerfacecolor','b','markeredgecolor','b')
axis([0 10 300 5000])
hold on
plot(ent_v,enth_v,'color','r')
plot(ent_l,enth_l,'color','r')
text(s1,h1,'1','FontSize',15)
text(s2,h2,'2','FontSize',15)
text(s3,h3,'3','FontSize',15,'HorizontalAlignment','right','VerticalAlignment','top')
text(s4,h4,'4','FontSize',15,'HorizontalAlignment','right','VerticalAlignment','bottom')
xlabel('Entropy')
ylabel('Enthalpy')
result:

