Project

Rankine Cycle Simulator

Problem Statement:

Create a Rankine Cycle Simulator using MATLAB that is capable of calculating the state points of the ideal Rankine cycle and plotting the Temperature-Entropy and Enthalpy-Entropy graphs for the same.

Theory:

Rankine Cycle -

The ideal Rankine cycle consists of the following four processes:

1-2 Isentropic compression in a pump - 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.


2-3 Constant pressure heat addition in a boiler - Water enters the boiler as a compressed liquid at state 2 and leaves as 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.


3-4 Isentropic expansion in a turbine - 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.


4-1 Constant pressure heat rejection in a condenser - The pressure and the temperature of the steam drop during this process to the values at state 4, where steam enters the condenser. At this stage, steam is usually a saturated liquid-vapor mixture with high quality. 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.

Performance parameters of the Rankine cycle -

XSteam.m -

The 'Xsteam.m' file is a part of the MATLAB file exchange program. The file was published by Mr. Marcus Holmgren. Steam and water properties based on the "International Association for Properties of Water and Steam Industrial Formulation 1997 (IAPWS IF-97). It is a full implementation of the IF-97 standard that provides very accurate steam and water properties in ranges from 0-1000 bar and 0-2000°C. Provided thermodynamic properties are:

1. Temperature
2. Pressure
3. Enthalpy
4. Specific volume
5. Density
6. Specific entropy
7. Specific internal energy
8. Specific isobaric heat capacity
9. Specific isochoric heat capacity
10. Speed of sound
11. Viscosity
12. Vapour fraction

Thermodynamic properties can be calculated with the inputs, p and T known, p and h known, h and s known and some with pressure and density known. X Steam is a full implementation of the IF-97 formulation. Examples:
XSteam('h_pt',1,20) return the enthalpy of water at 1 bar and 20 degC. 84.0118 kJ/kg

XSteam('rho_ph',1,3000) return the density of steam at 1 bar and 3000 kJ/kg. 0.4056 kg/m3

XSteam('w_pt',1,20) returns the speed of sound at 1 bar and 20 deg C. 1483.4 m/s

XSteam('tSat_p',1) returns the saturation temperature at 1 bar. 99.6059 deg C

The X Steam Tables are the perfect tool both for replacing paper tables and for advanced calculations. The X Steam tables are open source and free of charge. Using this code we obtain values at state points of the Rankine cycle and compute the values of the performance parameters for the cycle.

About the program:

-> The program uses the Xsteam function file to compute various state points of the Rankine cycle just by taking an input from the user of the inlet-outlet turbine pressures and inlet turbine temperature.

-> The first section of the program consists of the display lines about the Rankine cycle before the simulator asks for user inputs.

disp('                    Rankine Cycle Simulator                      ')

%display the various processes involved
disp(' 1-2 is Isentropic Compression in pump.')
disp(' 2->3 Constant Pressure heat addition in boiler')
disp(' 3->4 Isentropic expansion in the turbine')
disp(' 4->1 Constant pressure heat rejection by condenser')

-> In the next section temperature arrays are created and corresponding entropy and enthalpy values are computed to plot the saturation curves for both, the TS and HS diagram.

%values to obtain the saturation curves for TS and HS diagram
T_ts_sat = linspace(0,373,100);
for i = 1:length(T_ts_sat)
    S_ts_l(i) = XSteam('sl_t',T_ts_sat(i));
    S_ts_v(i) = XSteam('sv_t',T_ts_sat(i));  
end
for i = 1:length(T_ts_sat)
    H_hs_l(i) = XSteam('hl_t',T_ts_sat(i));
    H_hs_v(i) = XSteam('hv_t',T_ts_sat(i));  
end
%values near the critical point of water
T_ts_cri = 373.706;
P_ts_cri = 220;
S_cri = XSteam('s_pt',P_ts_cri,T_ts_cri);
H_cri = XSteam('h_ps',P_ts_cri,S_cri);

-> The following section consists of the code for the computation of the Enthalpy, Entropy, Temperature, and Pressure for each state point of the ideal Rankine cycle (including points in the superheated vapor and subcooled liquid zone.

%H,S,P & T for saturated vapor at outlet of boiler & inlet to turbine
T_3 = input('Enter the temperature at turbine inlet (in deg celsius):');
P_3 = input('Enter the pressure at the turbine inlet (in bar):');
H_3 = XSteam('hV_p',P_3);
S_3 = XSteam('s_pT',P_3,T_3);

%H,S,P & T for saturated vapor at outlet of turbine & inlet to condenser
P_4 = input('Enter the pressure at condenser (in bar):');
S_4 = S_3;
H_4 = XSteam('h_ps',P_4,S_4);
gamma = 1.4;
T_4 = T_3*((P_4/P_3)^(1-(1/gamma)));

%H,S,P & T for saturated liquid at outlet of condenser & inlet to pump
T_1 = T_4;
P_1 = P_4;
H_1 = XSteam('hL_T',T_1);
S_1 = XSteam('sL_T',T_1);

%H,S,P & T for saturated liquid at outlet of condenser & inlet to pump
S_2 = S_1;
P_2 = P_3;
H_2 = XSteam('h_ps',P_2,S_2);
T_2 = XSteam('t_ps',P_2,S_2); %(T_1*((P_2/P_1)^(1-(1/gamma))));

%H,S,P & T for the subcooled liquid region
P_2_2 = P_3;
S_2_2 = XSteam('sL_p',P_2_2);
H_2_2 = XSteam('h_ps',P_2_2,S_2_2);
T_2_2 = XSteam('T_hs',H_2_2,S_2_2);
T_sub = linspace(T_2,T_2_2,100);
 
 for i = 1:length(T_sub)
   S_sub(i) = XSteam('s_pT',P_2_2,T_sub(i));     
 end

%H,S,P & T for the superheated vapor region
S_3_3 = XSteam('sV_t',T_2_2);
T_3_3=T_2_2;

T_super = linspace(T_3_3,T_3,100);
for i = 1:length(T_super)
   S_super(i) = XSteam('s_pT',P_3,T_super(i));     
end

-> The values from the latter part of the code are used to find the work done by turbine, work done by the pump, resulting net work done, the thermal efficiency of the system, the specific steam consumption and the back work ratio.

%computing values of thermal effciciencies, specific steam consumption and
%back work ratio
W_Turbine = (H_3 - H_4);
W_Pump = (H_2 - H_1);
W_net = W_Turbine - W_Pump;
Q_input = (H_3 - H_2);
Eff_therm = (W_net/Q_input)*100;
SSC = (3600/W_net);%1kWh = 3600KJ
BWR = W_Pump/W_Turbine;

-> After deriving values of all state points and saturation curves, they are plotted to create the Temperature vs Entropy and Enthalpy vs Entropy diagrams. The state points are assigned a red '*' marker and the cycle is shown by a black line while the saturation curve is assigned a red line.

%plotting the HS & TS  diagrams
figure(1);
hold on;
plot(S_1,T_1,'*','color','r');
plot(S_2,T_2,'*','color','r');
plot(S_2_2,T_2_2,'*','color','r');
plot(S_3_3,T_3_3,'*','color','r');
plot(S_3,T_3,'*','color','r');
plot(S_4,T_4,'*','color','r');

plot(S_ts_l,T_ts_sat,'color','r');
plot(S_ts_v,T_ts_sat,'color','r');
plot([S_cri S_ts_v(1,100)],[T_ts_cri T_ts_sat(1,100)],'color','r');
plot([S_cri S_ts_l(1,100)],[T_ts_cri T_ts_sat(1,100)],'color','r');

plot([S_3 S_4],[T_3 T_4],'color','k');
plot([S_1 S_4],[T_1 T_4],'color','k');
plot([S_1 S_2],[T_1 T_2],'color','k');
plot([S_2_2 S_3_3],[T_2_2 T_3_3],'color','k');
plot(S_sub,T_sub,'color','k');
plot(S_super,T_super,'color','k');

figure(2);

hold on;

plot(S_1,H_1,'*','color','b');
plot(S_2,H_2,'*','color','b');
plot(S_3,H_3,'*','color','b');
plot(S_4,H_4,'*','color','b');
plot([S_3 S_4],[H_3 H_4],'color','k');
plot([S_1 S_2],[H_1 H_2],'color','k');
plot([S_2 S_3],[H_2 H_3],'color','k');
plot([S_1 S_4],[H_1 H_4],'color','k');
plot(S_ts_l,H_hs_l,'color','r');
plot(S_ts_v,H_hs_v,'color','r');

plot([S_cri S_ts_v(1,100)],[H_cri H_hs_v(1,100)],'color','r');
plot([S_cri S_ts_l(1,100)],[H_cri H_hs_l(1,100)],'color','r');

-> Once the plotting is complete the next part of code prints the values of enthalpy, entropy, temperature, and pressure at each state point and the overall performance parameters of the cycle in the command window.

%printing the values of state points and performance parameters
fprintf('\n At State point 1:')         
fprintf('\n P1 is :%d bar',P_1)             
fprintf('\n T1 is :%d degC',T_1)
fprintf('\n H1 is :%d KJ/Kg',H_1)
fprintf('\n S1 is :%d ',S_1)

fprintf('\n')
fprintf('\n At State point 2:')
fprintf('\n P2 is :%d',P_2)
fprintf('\n T2 is :%d',T_2)
fprintf('\n H2 is :%d',H_2)
fprintf('\n S2 is :%d',S_2)

fprintf('\n')
fprintf('\n At State point 3:')
fprintf('\n P3 is :%d',P_3)
fprintf('\n T3 is :%d',T_3)
fprintf('\n H3 is :%d',H_3)
fprintf('\n S3 is :%d',S_3)

fprintf('\n')
fprintf('\n At State point 4:')
fprintf('\n P4 is :%d',P_4)
fprintf('\n T4 is :%d',T_4)
fprintf('\n H4 is :%d',H_4)
fprintf('\n S4 is :%d',S_4)

fprintf('\n')
fprintf('\n W_Turbine is:%d',W_Turbine)
fprintf('\n W_Pump is:%d',W_Pump)
fprintf('\n W_net is:%d',W_net)
fprintf('\n Thermal efficiency is:%d',Eff_therm)
fprintf('\n Specific steam consumpiton is:%d',SSC)
fprintf('\n Back work ratio is:%d',BWR)

Outputs:

Command Window -

 Rankine Cycle Simulator                      
 1-2 is Isentropic Compression in pump.
 2->3 Constant Pressure heat addition in boiler
 3->4 Isentropic expansion in the turbine
 4->1 Constant pressure heat rejection by condenser
Enter the temperature at turbine inlet (in deg celsius):400
Enter the pressure at the turbine inlet (in bar):30
Enter the pressure at condenser (in bar):0.05

 At State point 1:
 P1 is :5.000000e-02 bar
 T1 is :6.431355e+01 degC
 H1 is :2.692056e+02 KJ/Kg
 S1 is :8.850387e-01 

 At State point 2:
 P2 is :30
 T2 is :6.444600e+01
 H2 is :2.722290e+02
 S2 is :8.850387e-01

 At State point 3:
 P3 is :30
 T3 is :400
 H3 is :2.803265e+03
 S3 is :6.923259e+00

 At State point 4:
 P4 is :5.000000e-02
 T4 is :6.431355e+01
 H4 is :2.110708e+03
 S4 is :6.923259e+00

 W_Turbine is:6.925565e+02
 W_Pump is:3.023406e+00
 W_net is:6.895331e+02
 Thermal efficiency is:2.724312e+01
 Specific steam consumpiton is:5.220924e+00
 Back work ratio is:4.365572e-03>>  

TS Diagram -

HS Diagram -

Conclusion:

The ideal Rankine cycle eliminates many of the impracticalities of the Carnot vapor cycle by superheating the steam in the boiler and condensing it completely in the condenser. The actual vapor power cycle differs from the ideal Rankine cycle, as a result of irreversibilities in various components. Fluid friction and heat loss to the surroundings are the two common sources of irreversibilities. Fluid friction causes pressure drops in the boiler, the condenser, and the piping between various components. The other major source of irreversibility is the heat loss from the steam to the surroundings as the steam flows through various components. Loss of efficiency in such forms is recovered by using various techniques such as reheating, cogeneration and combined gas-vapor cycles.

Also, The X Steam Tables are the perfect tool both for replacing paper tables and for advanced calculations. The X Steam tables are open source and free of charge.

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.