Project 2 - Rankine cycle Simulator
Aim:
1) Creating a Rankine Cycle Simulator & Calculating the state points of the Rankine Cycle based on user inputs.
2) Plotting the corresponding T-S and H-S plots for the given set of inputs
Theory:
Rankine cycle is the theoretical cycle on which the steam turbine (or engine) works.
Process 1-2 : Reversible adiabatic expansion in the turbine (or steam engine).
Process 2-3 : Constant-pressure transfer of heat in the condenser.
Process 3-4 : Reversible adiabatic pumping process in the feed pump.
Process 4-1 : Constant-pressure transfer of heat in the boiler.
Applying steady flow energy equation (S.F.E.E.) to boiler, turbine, condenser and pump :
(i) For boiler (as control volume), we geth
f4 + Q1 = h1
∴ Q1 = h1 – hf4
(ii) For turbine (as control volume), we get
h1 = WT + h2, where WT = turbine work
WT = h1 – h2
(iii) For condenser, we get
h2 = Q2 + hf3
∴ Q2 = h2 – hf3
(iv) For the feed pump, we get
hf3 + WP = hf4 , where, WP = Pump work
∴ WP = hf4– hf3 = v3 (p1 – p2)
Efficiency of Rankine cycle is given by
η =W/Qnet1=WT-WP/Q1
Program:
%% General Calculation
% Step 1
% Clearing workspace, command window & closing all plots
clear all
close all
clc
% Step 2
% Print discription of all process
fprintf(' RANKINE CYCLE SIMULATORnn');
fprintf('1-2 Isentropic Expansion in the Turbinen');
fprintf('2-3 Constant Pressure Heat Rejection by the Condensern')
fprintf('3-2 Isentropic Compression in the Pumpn')
fprintf('4-1 Constant Pressure Heat Addition by the Boilernn')
% Step 3
% Taking all inputs arguments
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 Condenser (in bar): ');
fprintf(' RESULTn');
%% Calculation for General properties
% Step 4
% Calculation of Cp value at P1 & P2 for saturated liquid & vapour
CP1_L=XSteam('CpL_p',P1);
CP1_V=XSteam('CpV_p',P1);
CP2_L=XSteam('CpL_p',P2);
CP2_V=XSteam('CpV_p',P2);
% Step 5
% Calculation of Saturation Temperature at P1 & P2
Tsat_P1=XSteam('Tsat_p',P1);
Tsat_P2=XSteam('Tsat_p',P2);
%% Calculation of Enthalpy & Entropy at saturation points
% Step 6
% Calculation of saturation properties at state 1
Hg_1=XSteam('hV_p',P1);
Sg_1=XSteam('sV_p',P1);
% Step 7
% Calculation of saturation properties at state 2
Hg_2=XSteam('hV_p',P2);
Sg_2=XSteam('sV_p',P2);
% Step 8
% Calculation of saturation properties at state 3
Hf_3=XSteam('hL_p',P2);
Sf_3=XSteam('sL_p',P2);
% Step 9
% Calculation of saturation properties at state 4
Hf_4=XSteam('hL_p',P1);
Sf_4=XSteam('sL_p',P1);
%% Calculation of Process properties at state 1
% Step 10
% Calculation of Process properties at state 1
fprintf('At State point 1n');
fprintf('P1 is :%f Barn',P1);
fprintf('T1 is :%f degCn',T1);
H1=XSteam('h_pT',P1,T1);
fprintf('H1 is :%f kJ/kgn',H1);
S1=XSteam('s_pT',P1,T1);
fprintf('S1 is :%f kJ/kgnn',S1);
%% Calculation of Process properties at state 2
% Step 11
% Calculation of Process properties at state 2
fprintf('At state point 2n');
fprintf('P2 is : %f Barn', P2);
S2 = S1;
fprintf('S2 is : %f kJ/kgKn', S2);
%Calculating value of X
if(S2<=Sg_2)
X2 = (S2 - Sf_3) / (Sg_2-Sf_3); % Dryness Fraction at state point 2
else
X2=1;
end
fprintf('X2 is :%f n', X2);
%calculating value of T2
if(X2<1)
T2=Tsat_P2;
else
%S2=Sg_2+CP2_V*(log(T2/Tsat_P2))
T2=(Tsat_P2+273.15)*exp((S2-Sg_2)/CP2_V) ;
T2=T2-273.15;
end
fprintf('T2 is : %f degC n', T2)
if(X2<1)
H2 = Hf_3 + X2 * (Hf_3-Hg_2);
else
H2=XSteam('h_pT',P2,T2);
end
fprintf('H2 is : %f kJ/kgnn', H2)
%% Calculation of Process properties at state 3
% Step 12
% Calculation of Process properties at state 3
fprintf('At state point 3n')
P3 = P2;
fprintf('P3 is : %f Barn', P3)
V3 = XSteam('vL_p', P3);
T3 = Tsat_P2; % No subcooling assumed
fprintf('T3 is : %f degCn', T3)
H3 =Hf_3;
fprintf('H3 is : %f kJ/kgn', H3)
S3 =Sf_3;
fprintf('S3 is : %f kJ/kgKnn', S3)
%% Calculation of Process properties at state 4
% Step 13
% Calculation of Process properties at state 4
fprintf('At state point 4n')
P4 = P1;
fprintf('P4 is : %f Barn', P4)
S4 = S3;
fprintf('S4 is : %f kJ/kgKn', S4)
Wp = V3 * (P4 - P3) * 100;
H4 = Wp + H3;
fprintf('H4 is : %f kJ/kgn', H4)
T4= (Tsat_P1+273.15)/(exp((Sf_4-S4)/CP1_L));
T4=T4-273.15;
fprintf('T4 is : %f Deg celsius nn', T4)
%% Calculation for plotting saturation Liquid and Vapour lines
% Step 14
% Calculation & plotting saturation Liquid and Vapour lines
temp = linspace(1, T1, 1000);
for i = 1 : length(temp)
H_L(i) = XSteam('hL_T', temp(i));
H_V(i) = XSteam('hV_T', temp(i));
S_L(i) = XSteam('sL_T', temp(i));
S_V(i) = XSteam('sV_T', temp(i));
end
%% Ploting T - S and H - S Diagrams .
% Step 15
% Plotting T-s Plot
figure(1)
hold on
plot([S1 S2], [T1 T2], 'r', 'linewidth', 2)
text(S1,T1,' 1')
text(S2,T2,' 2')
plot([S2 Sg_2], [T2 Tsat_P2], 'r', 'linewidth', 2)
text(Sg_2,Tsat_P2,' 2s')
plot([Sg_2 S3], [Tsat_P2 T3], 'r', 'linewidth', 2)
text(S3,T3,' 3')
plot([S3 S4], [T3 T4], 'r', 'linewidth', 2)
text(S4,T4,' 4')
plot([S4 Sf_4], [T4 Tsat_P1], 'r', 'linewidth', 2)
text(Sf_4,Tsat_P1,' 4s')
plot([Sf_4 Sg_1], [Tsat_P1 Tsat_P1], 'r', 'linewidth', 2)
text(Sg_1,Tsat_P1,' 1s')
plot([Sg_1 S1], [Tsat_P1 T1], 'r', 'linewidth', 2)
plot(S_L, temp, 'b', 'linestyle','--','linewidth', 1)
plot(S_V, temp, 'b', 'linestyle','--','linewidth', 1)
title('T-S Diagram of Ideal Rankine Cycle')
ylabel('Temprature (degC)')
xlabel('Specific Entropy (kJ/kgK)')
% Step 15
% Plotting H-S Plot
figure(2)
hold on
plot([S1 S2], [H1 H2], 'r', 'linewidth', 2)
text(S1,H1,' 1')
text(S2,H2,' 2')
plot([S2 Sg_2], [H2 Hg_2], 'r', 'linewidth', 2)
text(Sg_2,Hg_2,' 2s')
plot([Sg_2 S3], [Hg_2 H3], 'r', 'linewidth', 2)
text(S3,H3,' 3')
plot([S3 S4], [H3 H4], 'r', 'linewidth', 2)
text(S4,H4,' 4')
plot([S4 Sf_4], [H4 Hf_4], 'r', 'linewidth', 2)
text(Sf_4,Hf_4,' 4s')
plot([Sf_4 Sg_1], [Hf_4 Hg_1], 'r', 'linewidth', 2)
text(Sg_1,Hg_1,' 1s')
plot([Sg_1 S1], [Hg_1 H1], 'r', 'linewidth', 2)
plot(S_L, H_L, 'b','linestyle','--', 'linewidth', 1.5)
plot(S_V, H_V, 'b','linestyle','--', 'linewidth', 1.5)
title('H-S Diagram of Ideal Rankine Cycle')
ylabel('Specific Enthalpy (kJ/kg)')
xlabel('Specific Entropy (kJ/kgK)')
%% Work done, heat, SSC and efficiency calculations
% Step 16
% Calculation of Work done, heat, SSC and efficiency
Wt = H1 - H2;
fprintf('Work by turbine is : %f kJ/kgn', Wt)
fprintf('Work by compressor is : %f kJ/kgn', Wp)
Wnet = Wt - Wp;
fprintf('Net Wok done is : %f kJ/kgn', Wnet)
Qin = H1 - H4;
eff_thermal = Wnet*100 / Qin ; % Effieciency
fprintf('Thermal efficiency is : %f', eff_thermal); disp('%')
SSC = 3600 / Wt; % Specific steam consuption
fprintf('S.S.C is : %f kg/kWh ', SSC)
Stepwise Explanation:
For writing this program, we are using XSteam.m which is basically steam table.
Step 1: Clearing workspace, command window & closing all plots
Step 2: Print discription of all process in command window.
Step 3: Taking all inputs arguments.
Step 4: Calculation of Cp value at P1 & P2 for saturated liquid & vapour
Step 5: Calculation of Saturation Temperature at P1 & P2
Step 6: Calculation of saturation properties at state 1
Step 7: Calculation of saturation properties at state 2
Step 8: Calculation of saturation properties at state 3
Step 9: Calculation of saturation properties at state 4
Step 10: Calculation of Process properties at state 1
Step 11: Calculation of Process properties at state 2
Step 12: Calculation of Process properties at state 3
Step 13: Calculation of Process properties at state 4
Step 14: Calculation & Plotting saturation Liquid and Vapour lines.
Step 15: Plotting T-s Plot
Step 16: Plotting h-s Plot
Step 17: Calculation of Work done, heat, SSC and efficiency
Result
Plot
Command Window
RANKINE CYCLE SIMULATOR
1-2 Isentropic Expansion in the Turbine
2-3 Constant Pressure Heat Rejection by the Condenser
3-2 Isentropic Compression in the Pump
4-1 Constant Pressure Heat Addition by the Boiler
Enter the Pressure at the Turbine Inlet (in bar): 44
Enter the Temperature at the Turbine inlet (in Degree celsius): 538
Enter the Pressure at the Condenser (in bar): 5.83
RESULT
At State point 1
P1 is :44.000000 Bar
T1 is :538.000000 degC
H1 is :3528.828574 kJ/kg
S1 is :7.153990 kJ/kg
At state point 2
P2 is : 5.830000 Bar
S2 is : 7.153990 kJ/kgK
X2 is :1.000000
T2 is : 230.448598 degC
H2 is : 2917.013655 kJ/kg
At state point 3
P3 is : 5.830000 Bar
T3 is : 157.712349 degC
H3 is : 665.638034 kJ/kg
S3 is : 1.919867 kJ/kgK
At state point 4
P4 is : 44.000000 Bar
S4 is : 1.919867 kJ/kgK
H4 is : 669.834038 kJ/kg
T4 is : 165.230094 Deg celsius
Work by turbine is : 611.814919 kJ/kg
Work by compressor is : 4.196004 kJ/kg
Net Wok done is : 607.618915 kJ/kg
Thermal efficiency is : 21.252888%
S.S.C is : 5.884132 kg/kWh >>
Error & Solution:
I was unable to plot saturation lines for vapour & liquid for both plots , I tried many combinations for this. Finally after little research & expert advice from skill-lync, I used linspace & for loop command to plot saturation lines for vapour & liquid.