Project 2 - Rankine cycle Simulator
clear all
close all
clc
% given
% At state point 1
T1 = 400;
p1 = 30;
p2 = 0.05;
%At state point 1
T1 = 400; %degree celicus
p1 = 30; %Bar
h1 = 3.2316e+03;
sf1 = XSteam('sL_p',p1);
sg1 = XSteam('sV_p',p1);
Ts1 = XSteam('Tsat_p',p1)
%At state point 2
p2 = 0.05; %Bar
% state 1 Turbine INLET or BOILER outlet
h1 = XSteam('h_pT', p1,T1); % extracting enthalpy at state point 1
s1 = XSteam('s_pT', p1,T1); % entropy
sf1 = XSteam('sL_p',p1);
sg1 = XSteam('sV_p',p1);
% state 2 Turbine outlet or condensor inlet
s2 = s1; %Isentropic expansion
sf2 = XSteam('sL_p',p2);
sg2 = XSteam('sV_p',p2);
x2 = (s2-sf2)/(sg2-sf2);
hf2 = XSteam('hL_p',p2);
hg2 = XSteam('hV_p',p2);
h2 = hf2+(x2*(hg2-hf2));
T2 = XSteam('T_hs',h2,s2);
% state 3
T3 = T2;
p3 = p2; % constant pressure at heat rejection
s3 = XSteam('sL_p' ,p3);
h3 = XSteam ('hL_p',p3);
%state 4
s4 = s3;
p4 = p1;
% workdone by turbine
Wt = h1-h2;
% workdone to run pump
% v3 = XSteam('vL_p',p3);
% Wp = v3*(p4-p3)*100;
% h4 = h3+Wp;
h4 = XSteam('h_ps',p4,s4);
Wp = h4-h3;
% net work
Wnet= Wt- Wp;
% Heat into the system
Qin = h2 - h3;
% Heat out of the system
Qout = h2 - h3;
% Thermal efficiency
eff = (Wnet/Qin)*100;
% Calculate temperature at the state points
T3 = XSteam('Tsat_p',p3);
T2 = T3;
Cp4 = XSteam('Cp_ps',p4,s4);
Cv4 = XSteam('Cv_ps',p4,s4);
k = Cp4/Cv4;
T4 = T3/(p3/p4)^((k-1)/k);
% Calculating temperature, entropy and enthalpy at the vapour and liquid
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;
Ntherm = (Wnet/Qin)*100;
s.s.c = 3600/Wt;
% Back-work ratio
BWR = Wp/Wt;
% Plotting the saturation curve
T = linspace(1,375,1000)
for i = 1:length(T)
a(i) = XSteam('hL_T',T(i));
b(i) = XSteam('hV_T',T(i));
c(i) = XSteam('sL_T',T(i));
d(i) = XSteam('sV_T',T(i));
end
% plot1
figure(1)
hold on
plot([s1 s2],[T1 T2], 'color','r','linewidth',2)
text(s1,T1,'1')
text(s2,T2,'2')
plot([s2 s3],[T2 T3], 'color','c','linewidth',2)
text(s3,T3,'3')
plot([s3 s4],[T3 T4], 'color','b','linewidth',2)
text(s4,T4,'4')
plot([s4 sf1],[T4 Ts1], 'color','m','linewidth',2)
text(sf1,Ts1,'5')
plot([sf1 sg1],[Ts1 Ts1], 'color','k','linewidth',2)
text(sg1,Ts1,'6')
plot([sg1 s1],[Ts1 T1], 'color','g','linewidth',2)
plot(c,T,'color','b','linestyle','-.','linewidth',1.5)
plot(d,T,'color','b','linestyle','-.','linewidth',1.5)
title('T-S Diagram')
xlabel('Entropy(KJ/kgk)')
ylabel('Temperature(K)')
legend('1-2 isentropic expansion','2-3 constant pressure','3-4 isentropic compression','4-1 constant pressure ')
% plot(2)
figure(2)
hold on
plot([s1 s2],[h1 h2], 'color','k','linewidth',2)
text(s1,h1,'1')
plot([s2 s3],[h2 h3], 'color','g','linewidth',2)
text(s2,h2,'2')
plot([s3 s4],[h3 h4], 'color','m','linewidth',2)
text(s3,h3,'3')
plot([s4 s1],[h4 h1], 'color','r','linewidth',2)
text(s4,h4,'4')
plot(c,a,'color','b','linestyle','-.','linewidth',1.5)
plot(d,b,'color','b','linestyle','-.','linewidth',1.5)
title('h-s Diagram')
xlabel('Entropy(KJ/kgk)')
ylabel('Enthalpy(KJ/kg)')
legend('1-2 isentropic expansion','2-3 constant pressure','3-4 isentropic compression','4-1 constant pressure ')
%Display
disp('At state point 1:')
fprintf('p1 is: %f Bar\n',p1)
fprintf('T1 is: %f Deg Celcius\n',T1)
fprintf('h1 is: %f KJ/Kg\n',h1)
fprintf('s1 is: %f KJ/KgK\n',s1)
disp('At state point 2:')
fprintf('p2 is: %f Bar\n',p2)
fprintf('T2 is: %f Deg Celcius\n',T2)
fprintf('h2 is: %f KJ/Kg\n',h2)
fprintf('s2 is: %f KJ/KgK\n',s2)
fprintf('x2 is: %f',x2)
disp('At state point 3:')
fprintf('p3 is: %f Bar\n',p3)
fprintf('T3 is: %f Deg Celcius\n',T3)
fprintf('h3 is: %f KJ/Kg\n',h3)
fprintf('s3 is: %f KJ/KgK\n',s3)
disp('At state point 4:')
fprintf('p4 is: %f Bar\n',p4)
fprintf('T4 is: %f Deg Celcius\n',T4)
fprintf('h4 is: %f KJ/Kg\n',h4)
fprintf('s4 is: %f KJ/KgK\n',s4)
fprintf('Wt is: %f KJ/Kg\n',Wt)
fprintf('Wp is: %f KJ/Kg\n',Wp)
fprintf('Wnet is: %f KJ/Kg\n',Wnet)
fprintf('Ntherm is: %f Percent\n',Ntherm)
fprintf('s.s.c is: %f Kg/Kwh\n',s.s.c)
fprintf('BWR is : %f\n', BWR)
The Rankine Cycle is a mechanical cycle commonly used in power plants to convert the pressure energy of steam into mechanical energy through steam turbine. The Rankine Cycle's major components include a rotating steam turbine, a boiler pump, a stationary condensor and a boiler.
A boiler is used to heat the water for steam at a required pressure and temperature as per the turbine's requirements for power generation.
The turbine exhaust is directed to the radial or axial flow condensor for condensing the steam to condensate and recycled back to the boiler through boiler pump for heating again.
ISOBARIC HEAT TRANSFER - High pressure liquid enter the boiler from the feed pump and is heated to the saturation temperature. Further addition of energy causes evaporation of the liquid until it is fully converted to saturated steam.
ISENTRIPIC EXPANSION - The vapour is expended in the turbine , thus producing work which may be converted to electricity.
ISOBARIC HEAT REJECTION - The vapour liquid mixture leaving the turbine is condensed at low pressure , usually in a surface condensor using colling water.
ISENTROPIC COMPRESSION - The pressure of the condensate is raised in the feed pump. Because of the low specific volume of liquid , the pump work is relatively small and neglected in thermodynamic calculations
STEPS -
The program begins with clear all, close all,clc to erase the workspace and plots.
Inputs variables p1,T1,p2 are given by inputs command whose values are entered in command window while executing the program.
@State-1, values for enthalpy & entropy are extracted as a function of pressure & temperature.
h-pT, s_pT, hL_p, sV_p etc are the default variables whose value is stored in XSteam file.
Similarly, all the variable for all states are extracted using a suitable format.
Pressure, temperature, entropy, enthalpy for all the state variable are extracted as a function of the dependent varaible from the XSteam file.
@State-2 is a condensor inlet where the high-pressure steam is converted into low-pressure water and hence dryness fraction , enthalpy & entropy for saturated vapour and saturated water are considered to calculate the specific enthalpy.
@State-3 The water is condensed back to its Saturation Temperature and fed to the pump, the temperature of water at the exit of the condensor and entry of pump is the same.
@State-4 This is Constant pressure heat addition , hence pressure is equal to p1 , but the temperature increases on heating of Constant Pressure & Constant Volume as our entropy remains same and hence cp/cv = gamma is considered to find temperature T4.
define two more points 5 and 6 to plot cycle in detail .
Finally workdone and heat evolved & SSC are calculated by basic formulae.
To plot the saturation curve, a Temperature range is defined using linspace command and for the overall length of the temperature values of enthalpy and entropy are calculated at every temperature point. The break in the saturation curve separates the liquid phase and Vapour phase.
Now all the necessary data is found out, plotting is done for both T-S & H-S curves using the plot commands. Annotations are assigned using text command.
Results of the cycle simulation is displayed over Command window using fprintf command.