Challenge

Project 2 - Rankine cycle Simulator

DETERMINATION OF THE STATE POINTS OF EACH PROCESS OF THE RANKINE CYCLE

AIM :

  1. To determine the Pressure (p), Temperature (T), Enthalpy (h) and Entropy (s) at each state points of the rankine cycle.
  2. To determine the Work done by Turbine, Pump, Net work done, Efficiency and Specific Steam Utilization.
  3. To plot the P-V and T-S diagram of the rankine cycle with the given inputs.

THEORY :

Rankine cycle is an idealized thermodynamics cycle, which is the fundamental operating cycle of all power plants where an operating fluid is continuously evaporated and condensed to extract work from the system.

Ideal rankine cycle is shown in the diagram below:

The rankine cycle consists of 4 process in the system as given below.

  • 4-1 Isobaric Heat Transfer. High pressure liquid enters the boiler from the feed pump (1) and is heated to the saturation temperature (2). Further addition of energy causes evaporation of the liquid until it is fully converted to saturated steam (3).

  • 1-2 Isentropic Expansion. The vapor is expanded in the turbine, thus producing work which may be converted to electricity. In practice, the expansion is limited by the temperature of the cooling medium and by the erosion of the turbine blades by liquid entrainment in the vapor stream as the process moves further into the two-phase region. Exit vapor qualities should be greater than 90%.

  • 2-3 Isobaric Heat Rejection. The vapor-liquid mixture leaving the turbine (4) is condensed at low pressure, usually in a surface condenser using cooling water. In well designed and maintained condensers, the pressure of the vapor is well below atmospheric pressure, approaching the saturation pressure of the operating fluid at the cooling water temperature.

  • 3-4 Isentropic Compression. The pressure of the condensate is raised in the feed pump. Because of the low specific volume of liquids, the pump work is relatively small and often neglected in thermodynamic calculations.

MAIN PROGRAM :

% Rankine cycle state points determination program

clear all
close all
clc

% Inputs 
p1 = input('Value of pressure at turbine inlet, p1(in bar) =  ');
T1 = input('Value of temperature at turbine inlet, T1(in celsius) =  ');
p2 = input('Value of temperature at condenser inlet, p2(in bar) =  ');

% Extraction of the data
% State 1
h1 = XSteam('h_pT',p1,T1);
s1 = XSteam('s_pT',p1,T1);

% Isentropic Expansion - State 2
s2 = s1;
sl2 = XSteam('sL_p',p2);
sg2 = XSteam('sV_p',p2);
x2 = (s2-sl2)/(sg2-sl2);
hl2 = XSteam('hL_p',p2);
hg2 = XSteam('hV_p',p2);
h2 = hl2 + (x2*(hg2-hl2));

% Constant pressure process - State 3
p3 = p2;
s3 = XSteam('sL_p',p3);
h3 = XSteam('hL_p',p3);

% State 4
p4 = p1;
s4 = s3;

% Work done - Turbine
Wt = h1 - h2;
v3 = XSteam('vL_p',p3);

% Work done - Pump
Wp = v3*(p4 - p3)*100;
h4 = h3 + Wp;

% Net work output 
W_net = Wt - Wp;

% Quantity of heat input
Q_in = h1 - h4;

% Quantity of heat output
Q_out = h2 - h3;

% Thermal efficiency
T_eff = (W_net / Q_in)*100;

% Specific Steam utilization
Sp_ut = (3600/W_net);

% State points temperatures
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));

% Temperature, entropy and enthalpy at the liquid and vapour line
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;

% Plotting the saturation Curve for water
T = linspace(1,375,1000);

for i = 1:length(T)
    sf(i) = XSteam('sL_t',T(i));
    sg(i) = XSteam('sV_t',T(i));
    hf(i) = XSteam('hL_t',T(i));
    hg(i) = XSteam('hV_T',T(i));
    
end

% Plotting 
figure(1)
hold on
plot(sf,T,'r','linewidth',2)
plot(sg,T,'r','linewidth',2)
plot([s1 s2],[T1 T2],'k','linewidth',2.5)
plot([s2 s3],[T2 T3],'k','linewidth',2.5)
plot([s3 s4],[T3 T4],'k','linewidth',2.5)
plot([s4 s5],[T4 T5],'k','linewidth',2.5)
plot([s5 s6],[T5 T6],'k','linewidth',2.5)
hold on
sc1 = linspace(s6, s1,1000);
for l = 1:length(sc1)
    Tc1(l) = XSteam('T_ps',p1,sc1(l));
end
plot(sc1, Tc1,'k', 'linewidth',3)

text(s1+0.1,T1,'1')
text(s2,T2-10,'2')
text(s3, T3-10,'3')
text(s4,T4+20,'4')
title('Temperature vs Entropy plot')
xlabel('Entropy (S) (Kj/kgK)')
ylabel('Temperature (degree C)')
legend('Saturation Curve')

% Plotting h-s diagram 
figure(2)
hold on 
plot(sf,hf,'r','linewidth',2)
plot(sg,hg,'r','linewidth',2)
plot([s1 s2],[h1 h2],'k','linewidth',2.5)
plot([s2 s3],[h2 h3],'k','linewidth',2.5)
plot([s3 s4],[h3 h4],'k','linewidth',2.5)
plot([s5 s6],[h5 h6],'k','linewidth',2.5)

hc = linspace(h4,h5,100);
for k = 1:length(hc)
    sch(k) = XSteam('s_ph',p1,hc(k));
end
plot(sch,hc,'k','linewidth',3)


for m = 1:length(sc1)
    hc1(m) = XSteam('h_ps',p1,sc1(m));
end

plot(sc1,hc1,'k','linewidth',3)
text(s1+0.1,h1,'1')
text(s2+0.1,h2,'2')
text(s3,h3-100,'3')
text(s4,h4+200,'4')
title('Enthalpy vs Entropy plot')
xlabel('Entropy, S (Kj/kgK)')
ylabel('Enthalpy, H (Kj/kg)')
legend('Saturation curve','location','northwest')

% Output
 fprintf('\nRANKINE CYCLE RESULTS\n')
 fprintf('At State Point 1\n');
 fprintf('p1: %8.3f bar\n',p1);
 fprintf('T1: %8.3f C\n',T1);
 fprintf('h1: %8.3f KJ/Kg\n',h1);
 fprintf('s1: %8.3f KJ/Kg.K\n\n',s1);
 fprintf('At State Point 2\n');
 fprintf('p2: %8.3f bar\n',p2);
 fprintf('T2: %8.3f C\n',T2);
 fprintf('h2: %8.3f KJ/Kg\n',h2);
 fprintf('s2: %8.3f KJ/Kg.K\n\n',s2);
 fprintf('At State Point 3\n');
 fprintf('p3: %8.3f bar\n',p3);
 fprintf('T3: %8.3f C\n',T3);
 fprintf('h3: %8.3f KJ/Kg\n',h3);
 fprintf('s3: %8.3f KJ/Kg.K\n\n',s3);
 fprintf('At State Point 4\n');
 fprintf('p4: %8.3f bar\n',p4);
 fprintf('T4: %8.3f C\n',T4);
 fprintf('h4: %8.3f KJ/Kg\n',h4);
 fprintf('s4: %8.3f KJ/Kg.K\n\n',s4);
 fprintf('Turbine Work: %8.3f KJ/Kg\n',Wt);
 fprintf('Pump Work: %8.3f KJ/Kg\n',Wp);
 fprintf('W_net: %8.3f KJ/Kg\n',W_net);
 fprintf('Efficiency (in percentage) : %8.3f\n', T_eff);
 fprintf('Specific Steam Utilization: %8.3f Kg/KWh\n', Sp_ut);

PROCEDURE :

1) The initial inputs of the rankine cycle are used for the calculating the other parameters of the Rankine cycle, this is shown in the commands mentioned below.

p1 = input('Value of pressure at turbine inlet, p1(in bar) = ');
T1 = input('Value of temperature at turbine inlet, T1(in celsius) = ');
p2 = input('Value of temperature at condenser inlet, p2(in bar) = ');

2) Based on the given inputs the respective Enthalpy (h) and Entropy (s) of the water is extracted from the 'XSteam' file as shown below.

% Extraction of the data
% State 1
h1 = XSteam('h_pT',p1,T1);
s1 = XSteam('s_pT',p1,T1);

% Isentropic Expansion - State 2
s2 = s1;
sl2 = XSteam('sL_p',p2);
sg2 = XSteam('sV_p',p2);

3) The Enthalpy and Entropy of the system at different state points are calculated using the below mentioned commands. The Pressure, Enthalpy, Entropy, Heat absorbed and Heat rejected values are used to calculate the Net Work done, Thermal efficiency and Specific Steam Utilization by using the formulas shown below.

x2 = (s2-sl2)/(sg2-sl2);
hl2 = XSteam('hL_p',p2);
hg2 = XSteam('hV_p',p2);
h2 = hl2 + (x2*(hg2-hl2));

% Constant pressure process - State 3
p3 = p2;
s3 = XSteam('sL_p',p3);
h3 = XSteam('hL_p',p3);

% State 4
p4 = p1;
s4 = s3;

% Work done - Turbine
Wt = h1 - h2;
v3 = XSteam('vL_p',p3);

% Work done - Pump
Wp = v3*(p4 - p3)*100;
h4 = h3 + Wp;

% Net work output
W_net = Wt - Wp;

% Quantity of heat input
Q_in = h1 - h4;

% Quantity of heat output
Q_out = h2 - h3;

% Thermal efficiency
T_eff = (W_net / Q_in)*100;

% Specific Steam utilization
Sp_ut = (3600/W_net);

% State points temperatures
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));

% Temperature, entropy and enthalpy at the liquid and vapour line
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;

% Plotting the saturation Curve for water
T = linspace(1,375,1000);

for i = 1:length(T)
sf(i) = XSteam('sL_t',T(i));
sg(i) = XSteam('sV_t',T(i));
hf(i) = XSteam('hL_t',T(i));
hg(i) = XSteam('hV_T',T(i));

end

4) The outputs obtained from the calculation are used to plot the required graphs including the values at different state points and the desired output data is printed in the command window.

% Plotting
figure(1)
hold on
plot(sf,T,'r','linewidth',2)
plot(sg,T,'r','linewidth',2)
plot([s1 s2],[T1 T2],'k','linewidth',2.5)
plot([s2 s3],[T2 T3],'k','linewidth',2.5)
plot([s3 s4],[T3 T4],'k','linewidth',2.5)
plot([s4 s5],[T4 T5],'k','linewidth',2.5)
plot([s5 s6],[T5 T6],'k','linewidth',2.5)
hold on
sc1 = linspace(s6, s1,1000);
for l = 1:length(sc1)
Tc1(l) = XSteam('T_ps',p1,sc1(l));
end
plot(sc1, Tc1,'k', 'linewidth',3)

text(s1+0.1,T1,'1')
text(s2,T2-10,'2')
text(s3, T3-10,'3')
text(s4,T4+20,'4')
title('Temperature vs Entropy plot')
xlabel('Entropy (S) (Kj/kgK)')
ylabel('Temperature (degree C)')
legend('Saturation Curve')

% Plotting h-s diagram
figure(2)
hold on
plot(sf,hf,'r','linewidth',2)
plot(sg,hg,'r','linewidth',2)
plot([s1 s2],[h1 h2],'k','linewidth',2.5)
plot([s2 s3],[h2 h3],'k','linewidth',2.5)
plot([s3 s4],[h3 h4],'k','linewidth',2.5)
plot([s5 s6],[h5 h6],'k','linewidth',2.5)

hc = linspace(h4,h5,100);
for k = 1:length(hc)
sch(k) = XSteam('s_ph',p1,hc(k));
end
plot(sch,hc,'k','linewidth',3)


for m = 1:length(sc1)
hc1(m) = XSteam('h_ps',p1,sc1(m));
end

plot(sc1,hc1,'k','linewidth',3)
text(s1+0.1,h1,'1')
text(s2+0.1,h2,'2')
text(s3,h3-100,'3')
text(s4,h4+200,'4')
title('Enthalpy vs Entropy plot')
xlabel('Entropy, S (Kj/kgK)')
ylabel('Enthalpy, H (Kj/kg)')
legend('Saturation curve','location','northwest')

% Output
fprintf('\nRANKINE CYCLE RESULTS\n')
fprintf('At State Point 1\n');
fprintf('p1: %8.3f bar\n',p1);
fprintf('T1: %8.3f C\n',T1);
fprintf('h1: %8.3f KJ/Kg\n',h1);
fprintf('s1: %8.3f KJ/Kg.K\n\n',s1);
fprintf('At State Point 2\n');
fprintf('p2: %8.3f bar\n',p2);
fprintf('T2: %8.3f C\n',T2);
fprintf('h2: %8.3f KJ/Kg\n',h2);
fprintf('s2: %8.3f KJ/Kg.K\n\n',s2);
fprintf('At State Point 3\n');
fprintf('p3: %8.3f bar\n',p3);
fprintf('T3: %8.3f C\n',T3);
fprintf('h3: %8.3f KJ/Kg\n',h3);
fprintf('s3: %8.3f KJ/Kg.K\n\n',s3);
fprintf('At State Point 4\n');
fprintf('p4: %8.3f bar\n',p4);
fprintf('T4: %8.3f C\n',T4);
fprintf('h4: %8.3f KJ/Kg\n',h4);
fprintf('s4: %8.3f KJ/Kg.K\n\n',s4);
fprintf('Turbine Work: %8.3f KJ/Kg\n',Wt);
fprintf('Pump Work: %8.3f KJ/Kg\n',Wp);
fprintf('W_net: %8.3f KJ/Kg\n',W_net);
fprintf('Efficiency (in percentage) : %8.3f\n', T_eff);
fprintf('Specific Steam Utilization: %8.3f Kg/KWh\n', Sp_ut);

OUTPUT :

1) The desired output is obtained from the program as shown below.

ERRORS ENCOUNTERED :

1) Error was observed in the command window due to use of incorrect command as shown below.

CORRECTIVE ACTION :

1) The error was corrected by linking the individual values of 'sc1' as shown below.

REFERENCES :

  1. https://www.youtube.com/watch?v=SwCdae4Q_QE&ab_channel=BESTMECHANICALENGINEERING
  2. https://www.thermopedia.com/content/1072/
  3. https://in.mathworks.com/help/physmod/simscape/ug/rankine-cycle-steam-turbine.html
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.