Challenge

Project 2 - Rankine cycle Simulator

clear all
close all
clc

%process decription
fprintf('1-2 Isobaric Heat Additionn')
fprintf('2-3 Isentropic Expansionn')
fprintf('3-4 Isobaric Heat Rejection')
fprintf('4-1 Isentropic Compressionn')

%initial Input to entered in command window
p1 = input('Enter the pressure at turbine Inlet(in bar):');
T1 = input('Enter the Temperature at turbine Inlet (in Degree Celcius):');
p2 = input('Enter the pressure at condensor (in bar):');

%state points calculation 
%state point  1
h1 =XSteam('h_pt',p1,T1);
s1 =XSteam('s_pt',p1,T1);

%State Point 2
s2=s1;
sf2 = XSteam('sL_p',p2);
sg2 = XSteam('sV_p',p2);
hf2 = XSteam('hL_p',p2);
hg2 = XSteam('hV_p',p2);
x2 = ((s2-sf2)/(sg2-sf2));
h2 = hf2+ x2*(hg2-hf2);
T2 = XSteam('T_hs',h2,s2);

%state point  3
p3 = p2;
s3 = XSteam('sL_p',p3);
h3 = XSteam('hV_p',p3);
T3 = T2;

%state point 4
s4 = s3;
p4 = p1;
Cp4 = XSteam('Cp_ps',p4,s4);
Cv4 = XSteam('Cv_ps',p4,s4);
Y = Cp4/Cv4;
n = (Y-1)/Y;
T4 = T3*(p4/p3)^n;


%Work done by turbine
Wt = h1-h2;

%work done to operate pump
v3 = XSteam('vL_p',p3);
Wp = v3*(p4-p3)*100;
h4 = h3 + Wp;

%Net Work
Wnet = Wt- Wp;

%Heat Supplied into the System 
Qin = h1 - h4;

%Heat Rejected from the system
Qout = h2 - h3;

%Thermal Efficiency
T_eff = (Wnet/Qin)*100;

%Specfic Steam Consumption  | SSC = mass Flow rate/power
SSC = (3600/Wnet);

%Back Work ratio
BW = (Wp/Wt);

%Saurated Liquid and Vapor Point Calculation 
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;

%Printing results
fprintf('nRsultsn');
fprintf('nAt State Point 1:np1 is: %4.2f BarnT1 is:%4.2f Degree Celciusnhi is:%4.2f kj/kgns1 is :%4.2f Kj/kgnn',p1,T1,h1,s1);
fprintf('At State Point 2:np2 is: %4.2f BarnT2 is : %4.2f Degree Celciusnh 2 is: %4.2f kj/Kgns2 is: %4.2f kj/kgnn',p2,T2,h2,s2);
fprintf('At State Point 3:np3 is: %4.2f BarnT3 is: %4.2f Degree Celciusnh3 is : %4.2f kj/kgns3 is: %4.2f kj/kgnn',p3,T3,h3,s3);
fprintf('At State Point 4:np3 is: %4.2f BarnT4 is: %4.2f Degree Celciusnh3 is : %4.2f kj/kgns4 is: %4.2f kj/kgnn',p4,T4,h4,s4);
fprintf('Wt is: %4.2f kj/kgnwp is: %4.2f kj/kgnWnet is: %4.2f kj/kgnThermal Efficieny is: %4.2f percentnssc is: %4.2fkg/kWh',Wt,Wp,Wnet,T_eff,SSC);


%plotting Saturation curve and T-S diagram
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,'color','r','linewidth',1.5)
plot(sg,T,'color','r','linewidth',1.5)

plot([s1 s2],[T1 T2],[s2 s3],[T2 T3],[s3 s4],[T3 T4],[s4 s5],[T4 T5],[s5 s6],[T5 T6],[s6 s1],[T6 T1],'marker','o','markersize',5,'color','k','linewidth',2)
text(s1+0.2,T1,'1')
text(s2+0.2,T2,'2')
text(s3+0.2,T3-4,'3')
text(s4-0.3,T4+4,'4')
text(s5-0.4,T5+5,'5')
text(s6+0.2,T6,'6')
xlabel('Entropy (kj/kgk)')
ylabel('Temperatur (k)')
legend('saturation curve')


figure(2)
hold on
plot(sg,hg,'Color','r','linewidth',1.5)
plot(sf,hf,'Color','r','linewidth',1.5)

plot([s1 s2],[h1 h2],[s2 s3],[h2 h3],[s3 s4],[h3 h4],[s4 s1],[h4 h1],'marker','o','markersize',3,'Color','k','LineWidth',2);
text(s1+0.1,h1,'1')
text(s2+0.1,h2,'2')
text(s3+0.2,h3-4,'3')
text(s4-0.3,h4+4,'4')
xlabel('Entropy (KJ/Kgk)')
ylabel('Enthalpy (KJ/K)')
legend('saturation curve')

result :

1-2 Isobaric Heat Additionn2-3 Isentropic Expansionn3-4 Isobaric Heat Rejection4-1 Isentropic CompressionnEnter the pressure at turbine Inlet(in bar):30
Enter the Temperature at turbine Inlet (in Degree Celcius):400
Enter the pressure at condensor (in bar):0.05
nRsultsnnAt State Point 1:np1 is: 30.00 BarnT1 is:400.00 Degree Celciusnhi is:3231.57 kj/kgns1 is :6.92 Kj/kgnnAt State Point 2:np2 is: 0.05 BarnT2 is : 32.88 Degree Celciusnh 2 is: 2110.71 kj/Kgns2 is: 6.92 kj/kgnnAt State Point 3:np3 is: 0.05 BarnT3 is: 32.88 Degree Celciusnh3 is : 2560.77 kj/kgns3 is: 0.48 kj/kgnnAt State Point 4:np3 is: 30.00 BarnT4 is: 36.94 Degree Celciusnh3 is : 2563.78 kj/kgns4 is: 0.48 kj/kgnnWt is: 1120.86 kj/kgnwp is: 3.01 kj/kgnWnet is: 1117.85 kj/kgnThermal Efficieny is: 167.39 percentnssc is: 3.22kg/kWh>>

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.