Project 2 - Rankine cycle Simulator
The Rankine cycle Simulation:
Rankine Cycle is used to predict about performance of both 'Steam Turbine' and 'Reciprocating Steam Engines'.Rankine cycle is an idealised thermodynamic cycle of heat engines which give electrical energy after converting mechanical energy.
1:TURBINE.
2:CONDENSOR.
3:PUMP
4:BOILER.
There are four processes undergoes in Rankine Cycle:
1.) Process 3-4: pumping of working fluid from low pressure to high pressure takes place.this is the initial process also kniwn as Isentropic Compression.
2.) process 4-1: The pressurized working fluid now enters a boiler where it start to boil at constant pressure until it becomes saturated vapour.also known as constant pressure heat addition process.
3.) process 1-2: The saturated vapour then enters the turbine and get expand through it making it to produce mechanical work.the output working fluid comes with decrease in both pressure and temperature.also known as Isntropic expansion.
4.) process 2-3: The last process is of condensation of the output working fluid from the turbine outlet.condensor condenses the working fluid at constant pressure till it becomes saturated liquid.
The calculations for Rankine Cycle are given below:
Qnet = Wnet
Qin - Qout = Wt - Wp
Qin = heat supplied by the boiler(kj/kg)
Qout = heat rejected by condensor(kj/kg)
Wt = Work done on the turbine(kj/kg)
Wp = Work done by the pump(kj/kg)
Wnet = Wt - Wp
Efficiency of the cycle is given by:
efficiency = Wnet/Qin
also after applying SFEE equation we get
Qin = h1 -h4
Qout = h2 - h3
Wt = h1 -h2
Wp = h4 - h3
Steam Rate : it is defined as rate of steam flow to produce unit KW of output power.and the formula for it is given as below: SR = 3600/Wnet.
The program for the Rankine Cycle Simulation is given below:
clear all
close all
clc
% inputs and process lables
fprintf(' RANKINE CYCLE SIMULATOR \n');
fprintf('1-2 Isentropic expansion in turbine\n');
fprintf('2-3 Constant pressure heat rejection in Condensor\n');
fprintf('3-4 Isentropic compression in the pump\n');
fprintf('4-1 Constant pressure heat addition in boiler\n');
t1 = input('Enter the temperature at turbine inlet(degree celcius) : ');
p1 = input('Enter the pressure at turbine inlet(bar) : ');
p2 = input('Enter the Condensor Inlet Pressure(bar) : ');
%also
%state 1-2
h1 = XSteam('h_pT',p1,t1);
s1 = XSteam('s_pT',p1,t1);
%state 2-3
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));
%state 3-4
p3 = p2;
h3 = XSteam('hL_p',p3);
s3 = XSteam('sL_p',p3);
t3 = XSteam('Tsat_p',p3);
t2 = t3;
%state 4-1
p4 = p1;
s4 = s3;
h4 = XSteam('h_ps',p4,s4);
cp4 = XSteam('Cp_ps',p4,s4);
cv4 = XSteam('Cv_ps',p4,s4);
gamma = (cp4/cv4);
t4 = (t3/((p3/p4)^((gamma-1)/(gamma))));
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);
%finding the work
%work done on turbine
Wt = (h1-h2);
%work done by pump
Wp = (h4-h3);
%net work
W = (Wt-Wp);
%calculation for heat supplied and heat rejected
Q_supp = (h1-h4);
Q_rej = (h2-h3);
%Thermal efficiency
N_therm = ((W/Q_supp)*100);
%steam rate
SR = (3600/W);
%back work ratio
BWR = (h1-h4)/(h2-h3);
%plotting saturation curve
T = linspace(1,400,600);
for i = 1:length(T)
h_l(i) = XSteam('hL_T',T(i));
h_v(i) = XSteam('hV_T',T(i));
s_l(i) = XSteam('sL_T',T(i));
s_v(i) = XSteam('sV_T',T(i));
end
%Plooting T-S Diagram
figure(1)
hold on
plot([s1 s2],[t1 t2],'linewidth',2.5,'color','r')
plot([s2 s3],[t2 t3],'linewidth',2.5,'color','r')
plot([s3 s4],[t3 t4],'linewidth',2.5,'color','r')
plot([s4 s5],[t4 t5],'linewidth',2.5,'color','r')
plot([s5 s6],[t5 t6],'linewidth',2.5,'color','r')
xlabel('Entropy[kj/kgk]')
ylabel('Temperature[deg C]')
title('T-S Diagram')
s_0 = linspace(s6,s1,600);
for j = 1:length(s_0)
t_0(j) = XSteam('T_ps',p1,s_0(j));
end
plot(s_0,t_0,'linewidth',2.5,'color','r')
plot(s_l,T,'linewidth',1,'color','b')
plot(s_v,T,'linewidth',1,'color','b')
%Annotations
text(s1,t1,'1');
text(s2,t2,'2');
text(s3,t3,'3');
text(s4,t4,'4');
text(s5,t5,'5');
text(s6,t6,'6');
%plotting H-S Diagram
figure(2)
hold on
plot([s1 s2],[h1 h2],'linewidth',2.5,'color','g')
plot([s2 s3],[h2 h3],'linewidth',2.5,'color','g')
plot([s3 s4],[h3 h4],'linewidth',2.5,'color','g')
h_0 = linspace(h4,h5,600);
for k = 1:length(h_0)
s_4(k) = XSteam('s_ph',p1,h_0(k));
end
h_01 = linspace(h6,h1,600);
for m = 1:length(h_01)
s_6(m) = XSteam('s_ph',p1,h_01(m));
end
plot(s_4,h_0,'linewidth',2.5,'color','g')
plot([s5 s6],[h5 h6],'linewidth',2.5,'color','g')
plot(s_6,h_01,'linewidth',2.5,'color','g')
plot(s_l,h_l,'linewidth',1,'color','b')
plot(s_v,h_v,'linewidth',1,'color','b')
xlabel('Specific Entropy[kj/kgk]')
ylabel('Specific Enthalpy[kj/kg]')
title('H-S Diagram')
%Annotations
text(s1,h1,'1');
text(s2,h2,'2');
text(s3,h3,'3');
text(s4,h4,'4');
text(s5,h5,'5');
text(s6,h6,'6');
%Results
fprintf(' RESULT \n');
fprintf('state 1 :\n')
fprintf('P1 = %f bar\n',p1);
fprintf('T1 = %f deg celcius\n',t1);
fprintf('H1 = %f kj/kg\n',h1);
fprintf('S1 = %f kj/kgk\n',s1);
fprintf('state 2 :\n');
fprintf('P2 = %f bar\n',p2);
fprintf('T2 = %f deg celcius\n',t2);
fprintf('H2 = %f kj/kg\n',h2);
fprintf('S3 = %f kj/kgk\n',s2);
fprintf('state 3 :\n');
fprintf('P3 = %f bar\n',p3);
fprintf('T3 = %f deg celcius\n',t3);
fprintf('H3 = %f kj/kg\n',h3);
fprintf('S3 = %f kj/kgk\n',s3);
fprintf('state 4 :\n');
fprintf('P4 = %f bar\n',p4);
fprintf('T4 = %f deg celcius\n',t4);
fprintf('H4 = %f kj/kg\n',h4);
fprintf('s4 = %f kj/kgk\n',s4);
fprintf('Work done on the turbine : %f kj/kg\n',Wt);
fprintf('Work done by pump : %f kj/kg\n',Wp);
fprintf('Net work done : %f kj/kg\n',W);
fprintf('Steam Rate : %f kg/kwh\n',SR);
fprintf('Thermal efficiency : %f\n',N_therm);
fprintf('The BWR of the cycle : %f\n',BWR);
Explanation for the code is as follows:
1.) to erase the workspace we use clear all,close all and clc command.
2.) The input and process labels are given using fprintf command.
3.) using input command the values of P1,T1 and P2 are to be assigned in command window while exwcuting the program.
4.) The data is restored from the file XSteam.m which is a data table.for state 1 the data for enthalpy and entropy are extracted using variables h_pT and s_pT as assigned.
5.) similarly values of variables for other states are to be calculated using the same way.
6.) for state 2 since the vapour is converted into liquid. the Dryness fraction, enthalpy and entropy for both the liquid and vapour are to be calculated seperately.
7.)at state 3 the temperature at exit of condensor and entry of pump are same.for state 4 since heat addition takes place at constant pressure and volume so entropy will not change and gamma is used to calculate T4 here.
8.) then work done , heat involved and SR are calculated.To plot the saturation curve now temperature is divide into 600 numbers using linspace and for each value the enthalpy and entropy are calculated.
9.) now both the T-S and H-S plots are plotted using plot command successfully and annotations are added using text command and results of every state points are shown in the command window using fprintf command.
PLOTS:
RESULTS:
ERROR FACD DURING PROGRAMMING:
the screenshot shown below shows the error faced during programming. unfortunately by mistake i wrote Xsteam in place of XSteam and this shows this error,so the solution was to change the s word to S.
REFERENCES: