Project 2 - Rankine cycle Simulator
AIM : To create a Rankine Cycle Simulator using MATLAB.
OBJECTIVE :
- To calculate the state points of the Rankine Cycle based on user inputs.
- To plot the corresponding T-s and h-s plots for the given set of inputs.
THEORY :
The Rankine cycle is the fundamental operating cycle of all power plants where an operating fluid is continuously evaporated and condensed. The selection of operating fluid depends mainly on the available temperature range. Figure 1 shows the idealized Rankine cycle.
The ideal Rankine cycle does not involve any internal irreversibilities
and consists of the following four processes:
1-2 Isentropic compression in a pump
2-3 Constant pressure heat addition in a boiler
3-4 Isentropic expansion in a turbine
4-1 Constant pressure heat rejection in a condenser
Water enters the pump at state 1 as saturated liquid and is compressed isentropically to the operating pressure of the boiler. The water temperature increases somewhat during this isentropic compression process due to a slight decrease in the specific volume of water.
`implies` WPumps = H2 – H1 ,
Water enters the boiler as a compressed liquid at state 2 and leaves as a superheated vapor at state 3. The boiler is basically a large heat exchanger where the heat originating from combustion gases, nuclear reactors, or other sources is transferred to the water essentially at constant pressure. The boiler, together with the section where the steam is superheated (the superheater), is often called the steam generator.
`implies` Qadd = H3 – H2 ,
The superheated vapor at state 3 enters the turbine, where it expands isentropically and produces work by rotating the shaft connected to an electric generator. The pressure and the temperature of steam drop during this process to the values at state 4, where steam enters the condenser. At this state, steam is usually a saturated liquid–vapor mixture with a high quality.
`implies` WT = H4 – H3 ,
Steam is condensed at constant pressure in the condenser, which is basically a large heat exchanger, by rejecting heat to a cooling medium such as a lake, a river, or the atmosphere. Steam leaves the condenser as saturated liquid and enters the pump, completing the cycle. In areas where water is precious, the power plants are cooled by air instead of water. This method of cooling, which is also used in car engines, is called dry cooling.
`implies` Qre = H4 – H1
During a Rankine cycle, work is done on the fluid by the pumps between states 1 and 2 (isentropic compression). Work is done by the fluid in the turbine between stages 3 and 4 (isentropic expansion). The difference between the work done by the fluid and the work done on the fluid is the net work produced by the cycle and it corresponds to the area enclosed by the cycle curve (in pV diagram). The working fluid in a Rankine cycle follows a closed loop and is reused constantly.
As can be seen, it is convenient to use enthalpy and the first law in terms of enthalpy in analysis of this thermodynamic cycle. This form of the law simplifies the description of energy transfer. At constant pressure, the enthalpy change equals the energy transferred from the environment through heating:
Isobaric process (Vdp = 0):
dH = dQ → Q = H2 – H1
At constant entropy, i.e. in isentropic process, the enthalpy change equals the flow process work done on or by the system:
Isentropic process (dQ = 0):
dH = Vdp → W = H2 – H1
GOVERNING EQUATIONS :
- Net Work done ( `W_(NET)` ) = `W_(TURBINE) - W_(PUMP)` ,
- Thermal efficiency ( `eta` ) = `W_(NET)/Q_(IN)` ,
- Work ratio (WR) = `W_(NET)/W_(TURBINE)` ,
- Back work ratio (BWR) = `W_(PUMP)/W_(TURBINE)` '
- WR + BWR = 1,
- Heat rate (HR) = `1/eta` ,
- Steam rate (SSC) = `1/(W_(NET))`
BODY OF THE CONTENT :
Solution Steps :
- To simulate and find out different state variables, all the processes parameters are to be described such as all four processes occuring and input parameters.
- From the standard Xsteam library to get the steam table data for water, all points in between state variables are calculated. such as enthalpy, entropy, specific heat, saturation temperature, etc.
- The calculated points are used to find out net work done, work done by turbine, thermal efficiency, back work ratio, etc according to their thermodynamic relations and necessary formulas.
- To plot the property diagram of water, i.e., saturation liquid and vapour line , an array is created using linspace command from 0 to value of T1 with 5000 evenly spaced points in between them and suitable state variables are iterated using for loop.
- To plot T-s and h-s diagram, all the required points are plotted and marked using text command.
MATLAB CODE :
% A program for simulating Rankine cycle and plot required graphs.
close all
clear all
clc
% Subscript for different state points
% 1 = Turbine inlet or Boiler outlet, 2 = Condenser inlet or Turbine outlet,
% 3 = Pump inlet or Condenser outlet, 4 = Boiler inlet or Pump outlet
% Input parameters -
% p1 = Turbine inlet pressure (bar),
% T1 = Temperature at turbine inlet(deg C),
% p2 = Turbine outlet pressure (bar),
% Description about four process,
fprintf('Process (1-2) - Isentropic Expansion in the Turbine\n');
fprintf('Process (2-3) - Isobaric Heat Rejection by the Condenser\n')
fprintf('Process (3-2) - Isentropic Compression in the Pump\n')
fprintf('Process (4-1) - Isobaric Heat Addition by the Boiler\n')
% For Inputting state variables at point 1,
p1 = input('Enter the Pressure at the Turbine Inlet (in bar): ');
T1 = input('Enter the Temperature at the Turbine inlet (in Degree celsius): ');
p2 = input('Enter the Pressure at the Turbine Outlet (in bar): ');
% Calculating state variables at all points from given datafile,
% At point 1
hg_1=XSteam('hV_p',p1);
sg_1=XSteam('sV_p',p1);
Tsat_P1=XSteam('Tsat_p',p1);
Cp1_L=XSteam('CpL_p',p1);
% At point 2
hg_2=XSteam('hV_p',p2);
sg_2=XSteam('sV_p',p2);
Tsat_P2=XSteam('Tsat_p',p2);
Cp2_V=XSteam('CpV_p',p2);
% At point 3
hf_3=XSteam('hL_p',p2);
sf_3=XSteam('sL_p',p2);
% At point 4
hf_4=XSteam('hL_p',p1);
sf_4=XSteam('sL_p',p1);
% state variables at point 1,
fprintf('At State 1\n');
fprintf('p1 is :%f bar\n',p1);
fprintf('T1 is :%f degrees C\n',T1);
h1=XSteam('h_pT',p1,T1);
fprintf('h1 is :%f kJ/kg\n',h1);
s1=XSteam('s_pT',p1,T1);
fprintf('s1 is :%f kJ/kgK\n',s1);
% state variables at point 2,
fprintf('At State 2\n');
fprintf('p2 is : %f bar\n', p2);
% entropy remains the same through turbine ( ideal )
s2 = s1;
fprintf('s2 is : %f kJ/kgK\n', s2);
% Calculating value of x(dryness fraction)
if(s2 <= sg_2)
x2 = (s2 - sf_3) / (sg_2-sf_3);
else
x2=1;
end
fprintf('x2 is :%f \n', x2);
% For calculating value of T2,
if(x2<1)
T2 = Tsat_P2;
else
% s2 = sg_2 + Cp2_V*(log(T2/Tsat_P2))-formula for calculating entropy in
% superheated region
T2 = (Tsat_P2+273.15)*exp((s2-sg_2)/Cp2_V);
T2 = T2 - 273.15;
end
fprintf('T2 is : %f degrees C\n', T2)
% For calculating value of h2,
if(x2<1)
h2 = hf_3 + x2 * (hg_2-hf_3);
else
h2 = XSteam('h_pT',p2,T2);
end
fprintf('h2 is : %f kJ/kg\n', h2)
% state variables at point 3,
fprintf('At state 3\n')
p3 = p2;
fprintf('p3 is : %f bar\n', p3)
V3 = XSteam('vL_p', p3);
T3 = Tsat_P2;
fprintf('T3 is : %f degrees C\n', T3)
h3 = hf_3;
fprintf('h3 is : %f kJ/kg\n', h3)
s3 = sf_3;
fprintf('s3 is : %f kJ/kgK\n', s3)
% Calculating state variables at point 4,
fprintf('At state 4\n')
p4 = p1;
fprintf('p4 is : %f bar\n', p4)
% Isentropic pumping process
s4 = s3;
fprintf('s4 is : %f kJ/kgK\n', s4)
T4 = XSteam('T_ps' ,p4,s4);
fprintf('T4 is : %f degrees C\n', T4)
W_p = V3 * (p4 - p3) * 100; % work done by pump(W_p = h4-h3)
h4 = W_p + h3;
fprintf('h4 is : %f kJ/kg\n', h4)
% Calculation of net work output,net heat,back work ratio and thermal
% efficiency and other parameters
% Work done by turbine
W_T = h1 - h2;
fprintf('Work by turbine is : %f kJ/kg\n', W_T)
fprintf('Work by pump is : %f kJ/kg\n', W_p)
% Net work done
Wnet = W_T - W_p;
fprintf('Net Wok done is : %f kJ/kg\n', Wnet)
% Net heat supplied
Qin = h1 - h4;
% Thermal Effieciency
eff_thermal = Wnet/Qin ;
fprintf('Thermal efficiency is : %f\n', eff_thermal);
% Back work ratio
b_w_r = (W_p/W_T);
fprintf('Back work ratio is : %f \n ', b_w_r)
% Work ratio
w_r = (Wnet/W_T);
fprintf('Work ratio is : %f \n ', w_r)
% summation of b_w_r and w_r should be 1
fprintf('Back work ratio + Work ratio is : %f \n ', (b_w_r+w_r))
% Heat rate and specific steam consumption
H_R = (1/eff_thermal);
fprintf('Heat Rate is : %f kJ/kWs\n ', H_R)
ssc = (1/Wnet);
fprintf('Specific steam consumption is : %f kg/kWs\n ', ssc)
% Iterating saturation Liquid and Vapour lines from 0 to value of T1 for plotting
% property diagram of water
temperature = linspace(0, T1, 5000);
for i = 1 : length(temperature)
H_l(i) = XSteam('hL_T', temperature(i));
H_v(i) = XSteam('hV_T', temperature(i));
S_l(i) = XSteam('sL_T', temperature(i));
S_v(i) = XSteam('sV_T', temperature(i));
end
% Plotting T-s Diagram
figure(1)
hold on
plot([s1 s2], [T1 T2],'color','blue', 'linewidth', 3)
plot([s2 sg_2], [T2 Tsat_P2],'color','green', 'linewidth', 3)
plot([sg_2 s3], [Tsat_P2 T3],'color','green', 'linewidth', 3)
plot([s3 s4], [T3 T4],'color','blue', 'linewidth', 3)
plot([s4 sf_4], [T4 Tsat_P1],'color','blue', 'linewidth', 3)
plot([sf_4 sg_1], [Tsat_P1 Tsat_P1],'color','green', 'linewidth', 3)
plot([sg_1 s1], [Tsat_P1 T1],'color','green', 'linewidth', 3)
text(s1,T1,' 1','FontSize',15)
text(s2,T2,' 2','FontSize',15)
text(s3,T3,' 3','FontSize',15)
text(sf_4,Tsat_P1,' 4','FontSize',15)
plot(S_l, temperature, 'black', 'linestyle','--','linewidth', 1)
plot(S_v, temperature, 'black', 'linestyle','--','linewidth', 1)
axis([0 10 0 500])
title('T-s Diagram of Ideal Rankine Cycle')
ylabel('Temprature (degrees C)')
xlabel('Specific Entropy (kJ/kgK)')
grid on
% Plotting h-s Diagram
figure(2)
hold on
plot([s1 s2], [h1 h2],'color','green', 'linewidth', 3)
plot([s2 sg_2], [h2 hg_2],'color', 'red', 'linewidth', 3)
plot([sg_2 s3], [hg_2 h3],'color', 'red', 'linewidth', 3)
plot([s3 s4], [h3 h4],'color', 'green', 'linewidth', 3)
plot([s4 sf_4], [h4 hf_4],'color', 'green', 'linewidth', 3)
plot([sf_4 sg_1], [hf_4 hg_1],'color', 'red', 'linewidth', 3)
plot([sg_1 s1], [hg_1 h1],'color', 'red', 'linewidth', 3)
text(s1,h1,' 1','FontSize',15)
text(s2,h2,' 2','FontSize',15)
text(s3,h3,' 3','FontSize',15)
text(sf_4,hf_4,' 4','FontSize',15)
plot(S_l, H_l,'color','black','linestyle','--', 'linewidth', 1)
plot(S_v, H_v,'color', 'black','linestyle','--', 'linewidth', 1)
title('h-s Diagram of Ideal Rankine Cycle')
ylabel('Specific Enthalpy (kJ/kg)')
xlabel('Specific Entropy (kJ/kgK)')
grid on
ERRORS AND REMEDIES : There were no major errors encountered except one formula mistake which was rectified.
RESULTS : The following are the output of the above code -
- First user will input inlet pressure(p1), turbine inlet temperature(T1), outlet pressure(p2), and accordingly all the results will be calculated.
- For this case, the values of p1,p2,T1 are 30 bar,0.05 bar and 400 degrees C respectively.
- The output obtained in command window is -
- The plots for T-s and h-s diagrams are as follows -
CONCLUSION :
- Thermodynamics an engineering approach - Cengel - Boles