Project 2 - Rankine cycle Simulator
The Rankine cycle is an idealized thermodynamic cycle describing the process by which certain heat engines, such as steam turbines or reciprocating steam engines, allow mechanical work to be extracted from a fluid as it moves between a heat source and heat sink.
Heat energy is supplied to the system via a boiler where the working fluid is converted to a high pressure gaseous stste in order to turn a turbine. After passing over the turbine the fluid is allowed to condense back into a liquid state as waste heat energy is rejected before being returned to boiler, completing the cycle. Friction losses throughout the system are often neglected for the purpose of simplifying calculations as such losses are usually much less significant than thermodynamic losses,especially in large systems.
MAIN CODE: -
clear all
close all
clc
% User Inputs for the Rankine cycle
disp(' RANKINE CYCLE SIMULATOR');
disp('1-2 is Isentropic Expansion in the turbine');
disp('2-3 is const Pressure heat Rejection by the condenser');
disp('3-4 is Isentropic compression in the pump');
disp('4-1 is const Pressure heat Addition by the Boiler');
p1=input('nEnter the Pressure at the Turbine Inlet(in bar):');
t1=input('Enter the temperature at the Turbine Inlet(in degree Celcius):');
p2=input('Enter the Pressure at the Condenser(on bar):');
%Inlet of the Turbine
tsat=XSteam('Tsat_p',p1);
sf1=XSteam('sL_p',p1);
sg1=XSteam('sV_p',p1);
if t1>tsat
tsup=t1;
h1=XSteam('h_pT',p1,tsup);
s1=XSteam('s_pT',p1,tsup);
elseif t1==tsat
h1=XSteam('hL_p',p1);
s1=XSteam('sL_p',p1);
else
disp('Temperature entered must be greater than or equal to saturation temperature')
end
%condenser inlet
t2=XSteam('Tsat_p',p2);
hf2=XSteam('hL_p',p2);
hg2=XSteam('hV_p',p2);
s2=s1;
sg2=XSteam('sV_p',p2);
sf2=XSteam('sL_p',p2);
x2=(s2-sf2)/(sg2-sf2);
h2=hf2+(x2*(hg2-hf2));
%condenser exit
p3=p2;
t3=t2;
h3=hf2;
s3=sf2;
%boiler inlet
p4=p1;
s4=s3;
cp4=XSteam('Cp_ps',p4,s4);
cv4=XSteam('Cv_ps',p4,s4);
gamma=cp4/cv4;
t4=t3*(p4/p3)^((gamma-1)/gamma);
v3=XSteam('vL_p',p3);
h4=XSteam('h_ps',p4,s4)
wp=h4-h3
% work output from turbine
wt=h1-h2;
%heat input
Qin=h1-h4;
%heat output
Qout=h2-h3;
%net work
wnet=wt-wp;
% thermalefficiency
therm_efficiency=(wnet/Qin)*100;
% heat added in the boiler
q_in=h1-h4;
%heat rejected in the condensor
q_out=h2-h3;
%specific fuel consumption
sfc=3600/wnet;
%plotting of T-S and H-S diagram
%T-S diagram
figure(1)
hold on
%plotting saturation lines
temp = linspace(1, 373, 500);
hl=zeros(1,100);
hv=zeros(1,100);
sl=zeros(1,100);
sv=zeros(1,100);
for i = 1 : length(temp)
hl(i) = XSteam('hL_T',temp(i));
hv(i) = XSteam('hV_T',temp(i));
sl(i) = XSteam('sL_T',temp(i));
sv(i) = XSteam('sV_T',temp(i));
end
plot(sl, temp, 'k', 'linewidth', 1.5)
plot(sv, temp, 'k', 'linewidth', 1.5)
xlabel('specific Entropy (kj/kgk)')
ylabel('Temperature (degC)')
title('T-S diagram');
% plot Saturation Curve
t = linspace(tsat,tsup,1000);
for i = 1 : length(t)
plot(XSteam('sL_T',t(i)),t(i),'.','color','b')
plot(XSteam('sV_T',t(i)),t(i),'.','color','b')
end
% plot Cycle
for j = 1:length(t)
sp(j) = XSteam('s_pT',p1,t(j));
end
plot(sp,t,'color','g','linewidth', 1.5);
plot([s1 s2],[t1 t2],'linewidth',2,'color','r')
if x2>1
T3 = Ts2;
plot([s2 Sg2 s3 s4],[t2 ts2 t3 t4],'linewidth',2,'color','r')
t2 = ts2;
else
plot([s2 s3 s4],[t2 t3 t4],'linewidth',2,'color','r')
xlabel('Entropy[kj/kg-k]')
ylabel('Temperature[k]')
title('T-S Diagram')
end
text(s1,t1,'1')
text(s2,t2,'2')
text(s3,t3-10,'3')
text(s4,t4+10,'4')
plot([s4,sf1],[t4,tsat])
plot([sf1,sg1],[tsat,tsat])
%H-S diagram
figure(2)
hold on
title('H-S diagram');
plot(sl, hl, 'r','linestyle','-', 'linewidth', 1.5)
plot(sv, hv, 'r','linestyle','-', 'linewidth', 1.5)
plot([s1 s2 s3 s4 s1], [h1 h2 h3 h4 h1], 'color', 'black','linewidth', 1.5);
text(s1,h1,'1')
text(s2,h2,'2')
text(s3,h3-100,'3')
text(s4,h4+100,'4')
ylabel('specific Enthalpy (kj/kg)')
xlabel('specific Entropy (kj/kgk)')
%output
%at stste 1
disp('RESULTS');
disp('At State point 1:');
fprintf('P1 is : %.2f Bar',p1);
fprintf('\n T1 is : %.2f Deg Celcius',t1);
fprintf('\n H1 is : %.2f kj/kg',h1);
fprintf('\n S1 is : %.2f kj/kgk\r\n',s1);
%at state 2
disp('At State point 2:');
fprintf('P2 is : %.2f Bar',p2);
fprintf('\n T2 is : %.2f Deg Celcius',t2);
fprintf('\n H2 is : %.2f kj/kg',h2);
fprintf('\n S2 is : %.2f kj/kgk\r\n',s2);
%at state 3
disp('At State point 3:');
fprintf('P3 is : %.2f Bar',p3);
fprintf('\n T3 is : %.2f Deg Celcius',t3);
fprintf('\n H3 is : %.2f kj/kg',h3);
fprintf('\n S3 is : %.2f kj/kgk\r\n',s3);
%at state 4
disp('At State point 4:');
fprintf('P4 is : %.2f Bar',p4);
fprintf('\n T4 is : %.2f Deg Celcius',t4);
fprintf('\n H4 is : %.2f kj/kg',h4);
fprintf('\n S4 is : %.2f kj/kgk\r\n',s4);
fprintf('Work output by the Turbine (Wt) is : %.2f kj/kg',wt);
fprintf('\n Work input by the pump (wp) is : %.2f kj/kg',wp);
fprintf('\n Net Work is : %.2f kj/kg',wnet);
fprintf('\n Thermodynamic efficiency is : %.2f percent',therm_efficiency);
fprintf('\n %s Heat input in Boiler:%.2f ',q_in,'kj/kg');
fprintf('\n %s Heat rejected in condenser:%.2f ',q_out,'kj/kg');
fprintf('\n Specific Fuel Consumption is : %.2f kg/kwh',sfc);
COMMAND WINDOW: -
RANKINE CYCLE SIMULATOR
1-2 is Isentropic Expansion in the turbine
2-3 is const Pressure heat Rejection by the condenser
3-4 is Isentropic compression in the pump
4-1 is const Pressure heat Addition by the Boiler
nEnter the Pressure at the Turbine Inlet(in bar):30
Enter the temperature at the Turbine Inlet(in degree Celcius):373
Enter the Pressure at the Condenser(on bar):0.050
h4 =
140.7622
wp =
2.9971
RESULTS
At State point 1:
P1 is : 30.00 Bar
T1 is : 373.00 Deg Celcius
H1 is : 3169.67 kj/kg
S1 is : 6.83 kj/kgk
At State point 2:
P2 is : 0.05 Bar
T2 is : 32.88 Deg Celcius
H2 is : 2081.98 kj/kg
S2 is : 6.83 kj/kgk
At State point 3:
P3 is : 0.05 Bar
T3 is : 32.88 Deg Celcius
H3 is : 137.77 kj/kg
S3 is : 0.48 kj/kgk
At State point 4:
P4 is : 30.00 Bar
T4 is : 36.94 Deg Celcius
H4 is : 140.76 kj/kg
S4 is : 0.48 kj/kgk
Work output by the Turbine (Wt) is : 1087.68 kj/kg
Work input by the pump (wp) is : 3.00 kj/kg
Net Work is : 1084.68 kj/kg
Thermodynamic efficiency is : 35.81 percent
3.028904e+03 Heat input in Boiler:107.00
j/kg Heat input in Boiler:
1.944219e+03 Heat rejected in condenser:107.00
j/kg Heat rejected in condenser:
Specific Fuel Consumption is : 3.32 kg/kwh>>
GRAPHS: -

