Project 2 - Rankine cycle Simulator
Aim and Objective:-
- To calculate the net work done by rankine cycle using the given inputs.
- To plot t-s and h-s diagram
Theory :-
- Rankine cycle is an idealized thermodynamic cycle of a heat engine that converts heat into mechanical work.
- The heat is supplied externally to a closed loop, which usually water as a working fluid.
Process of rankine Cycle
- (1-2) :- Superheated Steam enters into the turbine and expand isentropically, which results in the work done. The shaft of turbine is connected to generator, which converts the work done into the electricity.
- (2-3) :- Heated vapour is passed through the condenser, where it is condensed and vapour is converted into liquid.
- (3-4) :- The condensed liquid is then compressed isentropically until it reaches the boiler pressure and then, pump transfer the liquid to boiler.
- (4-1) :- The liquid then enters the boiler as a compressed liquid, where it is heated and the liquid is converted to a superheated vapour and it enters the turbine again.
Content Body :-
clear all
close all
clc
%print process description
fprintf('\n\n Rankine Cycle Simulator ')
fprintf('\n1-2 Isentropic expansion in the turbine\n')
fprintf('2-3 Const pressure heat rejection in condenser\n')
fprintf('3-4 isentropic compression in the pump\n')
fprintf('4-1 constant pressure heat addition in the boiler\n')
%Initial conditions
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 condenser inlet (in Bar):');
%calculating the state point
%at state point 1
h1 = XSteam('h_pt',p1,t1);
s1 = XSteam('s_pt',p1,t1);
%at 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);
s2 = sg2;
h2 = hg2;
%hf2 + (x2*(hg2-hf2))
t2 = XSteam('t_hs',h2,s2);
%at state point 3
t3 = t2;
p3 = p2;
s3 = XSteam('sL_t',t3);
h3 = XSteam('hL_t',t3);
v3 = XSteam('vL_p',p3);
%at state point 4
p4 = p1;
s4 = s3;
cp4 = XSteam('cp_ps',p4,s4);
cv4 = XSteam('cv_ps',p4,s4);
gamma = cp4/cv4;
r = (gamma - 1)/gamma;
t4 = t3*(p4/p3)^r;
%calculating the remaining values
Wt = h1 - h2; %Turbine work
Wp = v3*(p4-p3)*100; %pump work
h4 = Wp+h3;
W_net = Wt - Wp; %Net work in KJ/kg
Qs = h1-h4;
N_per = (W_net/Qs);
Steam_rate = 3600/(W_net);
%at state point 5 and 6
t5 = XSteam('tsat_p',p1);
t6 = t5;
s5 = XSteam('sL_p',p1);
s6 = XSteam('sV_p',p1);
h5 = XSteam('hL_p',p1);
h6 = XSteam('hV_p',p1);
%printing all state points
fprintf('\n ----------------Result---------------\n')
fprintf('At State point 1:\nP1 : %f Bar\nT1 : %f Deg. Calcius\nH1 : %f Kj/kg\nS1 : %f Kj/kgk\n\n',p1,t1,h1,s1)
fprintf('At State point 2:\nP2 : %f Bar\nT2 : %f Deg. Calcius\nH2 : %f Kj/kg\nS2 : %f Kj/kgk\n\n',p2,t2,h2,s2)
fprintf('At State point 3:\nP3 : %f Bar\nT3 : %f Deg. Calcius\nH3 : %f Kj/kg\nS3 : %f Kj/kgk\n\n',p3,t3,h3,s3)
fprintf('At State point 4:\nP4 : %f Bar\nT4 : %f Deg. Calcius\nH4 : %f Kj/kg\nS4 : %f Kj/kgk\n\n',p4,t4,h4,s4)
fprintf('Wt : %f Kj/kg\nWp : %f Kj/kg\nWnet : %f Kj/kg\nNper : %f percentage\nS.S.C : %f kg/kWh\n',Wt,Wp,W_net,N_per,Steam_rate)
%plotting T-S Diagram
subplot(1,2,1)
t_rankine = linspace(t5,t1,5000);
for i = 1:length(t_rankine);
s_rankine(i) = XSteam('s_pt',p1,t_rankine(i));
end
plot([s1 s2 s3 s4 s5 s6 s_rankine],[t1 t2 t3 t4 t5 t6 t_rankine],'linewidth',1)
hold on
t_curve = linspace(1,400,500);
for p = 1:length(t_curve)
s_1(p) = XSteam('sL_t',t_curve(p));
s_v(p) = XSteam('sV_t',t_curve(p));
h_1(p) = XSteam('hL_t',t_curve(p));
h_v(p) = XSteam('hV_t',t_curve(p));
end
plot(s_1,t_curve)
plot(s_v,t_curve)
text(s1,t1,'1','fontsize',10)
text(s2,t2,'2','fontsize',10)
text(s3,t3,'3','fontsize',10,'horizontalalignment','right','verticalalignment','top')
text(s4,t4,'4','fontsize',10,'horizontalalignment','right','verticalalignment','bottom')
text(s5,t5,'5','fontsize',10)
text(s6,t6,'6','fontsize',10)
xlabel('Entropy in KJ/Kg')
ylabel('Temperature in Deg. Celcius')
%plot H-S Diagram
subplot(1,2,2)
plot([s1 s2 s3 s4 s1],[h1 h2 h3 h4 h1],'linewidth',1)
hold on
plot(s_v,h_v,'color','r')
plot(s_1,h_1,'color','r')
text(s1,h1,'1','fontsize',10)
text(s2,h2,'2','fontsize',10)
text(s3,h3,'2','fontsize',10,'horizontalalignment','right','verticalalignment','top')
text(s4,h4,'4','fontsize',10,'horizontalalignment','right','verticalalignment','bottom')
xlabel('Entropy in KJ/kg')
ylabel('Enthalpy in Kj/kg')
- Code starts with clear all, close all and clc
- Variable, p1,t1,p2 are given by input command which are then entered in the command window.
- At state 1 values for enthalpy and entropy are extracted as a function of pressure and temperature from the XSteam file.
- At state 2 steam is condensed into thelow pressure liquid by condenser and hence dryness fraction, enthalpy and entropy for saturated vapour and water are considered to calculate specific heat.
- At state 3 the temperature temperature and pressure at condenser exit and entry of pump are same.
- At state 4 pressure is equal to p1, but the temperature increases with constant volume as our entropy remains same.
- Two more points are defined 5 and 6 to plot in detail.
- Work done, heat supplied and SSC are calculated.
Conclusion :-
Hence, Net work done, Heat supplied, Steam rate and t-s, h-s plot are defined