%simple rankine cycle
%The pressure in the condenser
p1 = 0.05;
p4 = p1;
%The maximal temperaturee
T3 = 400;
%The pressure in the boiler
p3 = 30;
p2 = p3;
%computation of the work of the pump
v1 = XSteam('vL_p',p1);
wp = -100*v1*(p2-p1);
%computation of Qin
h1 = XSteam('hL_p',p1);
h2 = h1-wp;
h3 = XSteam('h_pT',p3,T3);
qin = h3-h2;
% computation of work in the turbine
s3 = XSteam('s_pT',30,400);
s4= s3;
h4 = XSteam('h_ps',p4,s4);
wt = h3-h4;
%computation thermal efficency
Eff = 100*(wt-abs(wp))/qin;