Project

Rankine cycle

clear all
close all
clc

%inputs
p1 = 40;
t1 = 400;
p2 = 4;

%state:1

tsat = steam('Tsat_p',p1);
if t1>tsat
h1=steam('h_pt',p1,t1);
s1=steam('s_pt',p1,t1);
else if t1==tsat
h1=steam('hV_p',p1);
s1=steam('sV_p',p1);
else
disp('t1<tsat')
end
end
sf1 = steam('sL_p',p1);
sg1 = steam('sV_p',p1);
hf1 = steam('hL_p',p1);
hg1 = steam('hV_p',p1);

%state:2

%here we are in no need of checking, as it is always in tsat resp of p2

t2 = steam('Tsat_p',p2);
s2 = s1;
sf2 = steam('sL_p',p2);
sg2 = steam('sV_p',p2);
x2 = (s2-sf2)/(sg2-sf2);
h2 = steam('h_px',p2,x2);

%state:3

t3 = t2;
p3 = p2;

%h3 = hf2;
h3 = steam('hL_p',p2);
s3 = steam('sL_p',p2);

%state:4

s4 = s3;
p4 = p1;
cp4 = steam('Cp_ps',p4,s4);
cv4 = steam('Cv_ps',p4,s4);
gamma = cp4/cv4;
t4 = t3* ((p4/p3)^((gamma-1)/gamma));
h4 = steam('h_pt',p4,t4);

%work,efficiency

wt = h1-h2;
wp = h4-h3;
wnet = wt-wp;
qin = h1-h4;
qout = h2-h3;
ntherm = (wnet/qin)*100

%plotting saturation lines

temp = linspace(0,400,500);
for i = 1:length(temp)
hl(i) = steam('hL_T',temp(i));
hv(i) = steam('hV_T',temp(i));
sl(i) = steam('sL_T',temp(i));
sv(i) = steam('sV_T',temp(i));
end

figure(1)

%T_S diagram

plot([sl,sv],[temp,temp],'color','b')
hold on

xlabel('Specific Entropy (KJ/Kg.degC)')
ylabel('Temperature (degC)')

plot([s1,s2,s3,s4,sf1,sg1,s1],[t1,t2,t3,t4,tsat,tsat,t1],'color','r','linewidth',1.5)
axis([0,10,0,450])

%marking T_S diagram
text(s1,t1+10,'1','color','b','FontWeight','bold')
text(s2+0.15,t2+3,'2','color','b','FontWeight','bold')
text(s3,t3-10,'3','color','b','FontWeight','bold')
text(s4,t4+15,'4','color','b','FontWeight','bold')

title('T-S diagram')

%h_s diagram

figure(2)
plot([sl,sv],[hl,hv],'color','b','DisplayName','stauration line')
hold on
plot([s1,s2,s3,s4,sf1,sg1,s1],[h1,h2,h3,h4,hf1,hg1,h1],'linewidth',1.5,'color','r')
xlabel('Specific Entropy (KJ/Kg.degC)')
ylabel('Specific Enthalpy (KJ/Kg)')

text(s1+0.1,h1,'1','color','b','FontWeight','bold')
text(s2+0.1,h2,'2','color','b','FontWeight','bold')
text(s3,h3-100,'3','color','b','FontWeight','bold')
text(s4,h4+150,'4','color','b','FontWeight','bold')

title('H-S diagram')
lgd=legend

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.