Challenge

Project 2 - Rankine cycle Simulator

clear all
close all
clc
%state1
h1=Xsteam('h_pT',p1,T1);
s1=Xsteam('s_pT',p1,T1);
%state2
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));
%state3
p3=p2;
s3=Xsteam('vL_P',p3);
h3=Xsteam('hL_P',p3);
%state4
s4=s3;
p4=p1;
wt=h1-h2;
v3=Xsteam('vL_p',p3);
wp=v3*(p4-p3)*100;
h4=h3+wp;
wnet=wt-wp;
Qin=h1-h4;
Qout=h2-h3;
thermal_eff=(wnet/Qin)*100;
ssc=(3600/wnet);
BW=wp/wt;
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


figure(1)
hold on
plot(sf,T,'r','linewidth',2)
plot(sg,T,'r','linewidth',2)
plot([s1 s2],[T1 T2],'b','linewidth',2)
plot([s2 s3],[T2 T3],'b','linewidth',2)
plot([s3 s4],[T3 T4],'b','linewidth',2)
plot([s4 s5],[T4 T5],'b','linewidth',2)
plot([s5 s6],[T5 T6],'b','linewidth',2)
sc1=linspace(s6,s1,1000);

for 1=1:length(sc1);
Tc1(1)=Xsteam('T_ps',p1,sc(1));
end

plot(sc1,Tc1,'b','linewidth',2)
text(s1+0.1,T2,'1')
text(s2+0.1,T2,'2')
text(s3+0.1,T2,'3')
text(s4+0.1,T2,'4')
title('temp vs entropy plot')
xlabel('entropy,s')
ylabel('temperature')
legend('saturation curve')


figure(2)
hold on
plot(sf,hf,'k','linewidth',2)
plot(sg,hg,'k','linewidth',2)
plot([s1 s2],[h1 h2],'r','linewidth',2)
plot([s2 s3],[h2 h3],'r','linewidth',2)
plot([s3 s4],[h3 h4],'r','linewidth',2)
hc=linspace(h4,h5,100)
for r=1:length(hc)
sch(r)=Xsteam('h_ps',p1,sc1(m)0;
end
plot(sc1,hc1,'r','linewidth',2)
plot([s5 s6],[h5 h6],'r','linewidth',2)
for m=1:length(sc1)
hc1(m)=Xsteam('h_ps',p1,sc1(m));
end

plot(sc1,Tc1,'r','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 plot')
xlabel('entropy,s')
ylabel('enthalpy')
legend('saturation curve')


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.