Project 2 - Rankine cycle Simulator
Clear all
Close all
Clc
% initial inputs
p1 = input ('state point 1 pressure at the turbine inlet (in bar):');
t1 = input ('state point 1 temperature at the turbine inlet (in degree celsius):');
p2 = input ('state point 2 pressure at the condenser (in bar):');
% calculating a each state point values
% remaining points for state point 1
s1 = Xsteam ('s_pT',p1,t1);
h1 = Xsteam ('h_pT',p1,t1);
%calculating a state point 2
% s2 = sf2 + (x*(Sv2-sf2))
% h2 = hf2 + (x*(hv2 - hf2))
s2 = s1
sf2 = Xsteam ('sL_p',p2);
sv2 = Xsteam ('sv_p',p2);
hf2 = Xsteam ('hL_p',p2);
hv2 = Xsteam ('hv_p',p2);
x2 = (s2 - sf2)/(Sv2 - sf2);
h = hf2 + (x2*(hv2 - hf2));
t2 = Xsteam ('T_hs',h2,s2);
% calculating a state point 3
p3 = p2;
t3 = t2;
s3 = Xsteam('sL_p',p3);
h3 = Xsteam('hL_p'],p3);
% calculating the state point 4
% calculating a gamma value
Cp = Xsteam('cpL_p',p3);
Cv = Xsteam('cvL_p',p3);
gamma = (Cp/Cv);
p4 = p1;
s4 = s3;
h4 = Xsteam ('h_ps',p4,s4);
t4 = t3*(p4/p3)^((gamma-1)/(gamma));
% calculating & cheaking the cycle performance
% finding the workdone
Turbine_work = h1 - h2;
Pump_work = h4 - h3;
Net_work = Turbine_work - Pump_work;
% calculating the heat input and output
Heat_in = h1-h4;
Heat_out = h2-h3;
% calculating the ratios
work_ratio = Net_work/Turbine_work;
back_work_ratio = Turbine_work/Heat_in;
% Calculating the specific steam consumption
SSC = 3600/Net_work;
% calculating the thermal efficiency of rankine cycle
Eff_rankine = (( Net_work)/ ( Heat_in))*100;
% calculating the state point 5
t5 = Xsteam ('Tsat_p',p1);
s5 = Xsteam (' sL_p', P1);
h5 = Xsteam ('hL_p',p1);
% calculating the state point 6
t6 = t5;
s6 = Xsteam (' sv_p',p1);
h6 + Xsteam ('hv_p',p1);