Project

Rankine cycle simulator using Octave

Introduction:

1) Vapor cycle and Rankine Cycle Basics

Rankine cycle is one of the most basic vapour power cycles. In general, power cycle converts heat to work continuously and in this process, working fluid is recycled throughout the process. Thermal power plants, Nuclear power plants are few examples where the Rankine cycle finds practical application. The cycle is named after Scottish Mechanical engineer Wiliam john macquorn Rankine. This particular cycle could be used where water is used as the working fluid in the cycle. Water undergoes change of phase during the cycle.

By first law of thermodynamics, dQ = dU + dW; However, since the fluid is undergoing cyclic process, there will be no net change in internal energy, hence dU = 0.

Hence Net Heat in a cycle = Net Work in a cycle.

In Rankine cycle, it generally consists of 4 components. Boiler, where the heat is added. Condenser where the heat is taken out, Turbine is where the work is extracted from thermal expansion of fluid. Pump is used to compress the fluid to initial state (State of fluid when entering the boiler) to complete the cycle. In nuclear power plants, Boiler is replaced by the Nuclear reactor. Hence, Boiler-Turine-Condenser-Pump form the core elements of Vapour power plants. If Q1 is the heat input in the boiler, Q2 heat rejected in the condenser, Wt is the work done by turbine, Wp is the work done on the pump.

From sign convention perspective, Heat added to the system is positive and heat rejected is negative, similarly work done by the system is positive and work done on the system is negative, hence adding all the heat and work, Q1 - Q2 = Wt - Wp.

2) Sensible heat and Latent heat

As we deal with the vapour power cycles, its essential to understand and appreciate the difference between Sensible heat and Latent heat. This could be illustrated with an example. Assume a water of 1kg mass equivalent is being heated in the bowl, let the thermocouple be dipped to note down the temperature changes of the water without touching the walls of the bowl. As we start heating, we notice the temperature of the water to raise, but as the temperature approaches boiling point of water which is a function of Atmospheric pressure, temperature of water hardly changes. The former is known as the sensible heat where the heat is added and the temperature rises, Qs = m*cp*(Th-Tl). But, during the phase transition, temperature doesnt change, heat supplied is utilised in change of Phase Ql = m*L where L could be latent heat of vaporisation or latent heat of condensation.

During the transition, however, we could have a two phase system where the water and steam coexist.

(Source: http://hyperphysics.phy-astr.gsu.edu/hbase/thermo/pvtsur.html)

3) Gibbs Phase rule:

Gibbs phase rule is used to determine the degree of freedom for the system for given phase and composition, P+F = C+2, under the dome, phase is two, composition is one and hence degree of freedom is one. So, Temperature doesnt change within the dome for the given Pressure. Volume changes within the dome. In triple state, all three phases exist together, Temperature at this point is 273.15K which is used as the basis for formin Kelvin temperature scale. Similarly, at critical point, saturated vapour line and saturated liquid line intersect. Critical point of water is 373K, 22MPa.

4) Rankine Cycle: Thermodynamics perspective

Rankine cycle operates between two pressures. P1 which stands for the Boiler pressure, P2 which stands for the condenser pressure. Boiler and Condenser both operate on constant pressure. Heat is added and rejected at the constant pressure. The enthalpy, entropy and volumes could be found from the steam tables. Similarly, heat added in the boiler is equal to latent heat at the pressure, heat required to superheat, from the superheated state point, the fluid which is in form of steam is allowed to expand in the turbine to condenser pressure. The change in the enthalpy during the expansion marks the work done by the turbine. Ideally, the exapnsion in turbine should occur isentropically, however, this doesnt happen in the practical scenario, hence ientropic effciciency is calculated for turbine and pump. The work done in practical scenario is less than Isentropic work done by the turbine.

Both the expansion and compression in turbine and pump is assumed to have taken place in Reversible adiabatic process which is equivalent to isentropic process and maximum work is extracted.

5) Improving Rankine Cycle

Reheat and Regeneration are the two means by which either the Heat input can be decreased or Work output can be increased and subsequently efficiency can be increased. Successive regeneration approximates Rankine cycle to carnot cycle. Regeneration reduces heat required and hence Heat rate reduces, efficiecy improves. In Reheating, qualitty of steam exiting the turbine could be controlled and results in increase in increased net work and reduced steam rate.

6) Carnot cycle and Rankine Cycle

Although carnot efficiency is greater than Rankine efficiency, Carnot efficiency can be realised in practise. It demands heat to be added at constant temperature in Boiler. This is difficult to realise and Rankine cycle is a better approximation to practical scenario. Also, Pump work is extremely high in Carnot cycle.

Octave Code:

The code is very simple after incorporating XSteam. XSteam provides the virtual steam table for the property lookup. Boiler pressure, Condenser pressure and Turbine inlet temperature is taken as the input from the user. From the inputs state properties are calculated with logic mentioned in theory on rankine cycle.

Considerable portion of code is dedicated to plotting the Output for better visualisation of the state of operation. The state points calculated cannot be just joined together as it is erraneous.

1) Temperature doesnt change under dome

2) Pressure curve is not linear in the Vapor zone although it close to approximating it as linear.

Both these aspects are considered and considerable effort is made by utilising XSteam and thermodynamic relations to best plot the scenario.

Though a single plot command could be used for plotting, multiple hold on and plot commands are used for better readability

%This is coded by Sweekar, please contact at [email protected] for queries
%This is the intellectual property of sweekar and please contact sweekar before reproduction
%rankine power cycle is applied for steam power plants, water is considered as the working fluid
%A power cycle is one which continuously convert heat to work and fluid is continuously recycled in the cycle
%Water undergoes change of phase in the cycle
%Concepts of sensible heat and latent heat is effectively utilised
%Net change in the internal energy is zero and hence, change in heat input  is equivalent to useful work obtained
%1-2 Reversible isobaric Heat addition in Boiler
%2-3 Isentropic (Reversible adiabatic) Expansion in turbine
%3-4 Reversible isobaric Heat rejection in condenser
%4-1 Isentropic compression in pump 
%In the code following convention is followed
%ts refers to saturated temperature at the constant pressure
%ps refers to saturated pressure at constant temperature
%By Gibbs phase rule, in two phase system P+F = C+2, degrees of freedom is one
%hsg refers to saturated enthalpy gas phase, hsl saturated enthalpy liquid phase
%ssg refers to saturated entropy gas phase, ssl saturated entropy liquid phase
%vsg refers to saturated volume gas phase, vsl saturated volume liquid phase
%x refers to dryness fraction, p = psl + x*(psg-psl) where p could be h,s,v


%Cleanup
close all
clear all
clc

%Inputs from the user
fprintf("............ RANKINE CYCLE SIMULATOR...............\n")
p2 = input("Enter Boiler presure in bars: ");
p3 = input("Enter Condenser pressure in bars: ");
t2 = input("Enter Turbine inlet temp in degC:");

%Pressure calculations at the state points
p1 = p2;                                             %Constant Boiler pressure
p4 = p3;                                             %Constant Condenser pressure

%Saturation Temperatures calculation
ts1 = XSteam('Tsat_p',p2);                           %Saturated temperature at Boiler pressure
ts2 = XSteam('Tsat_p',p3);                           %Saturated temperature at Condenser pressure

%Properties at state point 2
h2 = XSteam('h_pT',p2,t2); 
s2 = XSteam('s_pT',p2,t2);
ssg1 = XSteam('sV_p',p1);                             %Saturated gas entropy at Boiler pressure
ssl1 = XSteam('sL_p',p1);                             %Saturated liquid entropy at Boiler pressure
hsg1 = XSteam('hV_p',p1);                             %Saturated gas enthalpy at Boiler pressure
hsl1 = XSteam('hL_p',p1);                             %Saturated liquid enthalpy at Boiler pressure

%Properties at state point 3
s3 = s2;                                              %Isentropic expansion
ssg2 = XSteam('sV_p',p3);                             %Saturated gas entropy at Condenser pressure
ssl2 = XSteam('sL_p',p3);                             %Saturated gas entropy at Condenser pressure
x = (s3-ssl2)/(ssg2-ssl2);                            %Quality of steam
hsg2 = XSteam('hV_p',p3);                             %Saturated gas enthalpy at Condender pressure
hsl2 = XSteam('hL_p',p3);                             %Saturated liquid enthalpy at condenser pressure
h3 = hsl2 + x*(hsg2-hsl2);
Wt = h2 - h3;                                         %Turbine work
%Temperature at turbine exit depends on quality of steam
if x<=1
  t3 = ts2;
else
 t3 = XSteam('T_ps',p3,s3);
endif

%Properties at state point 4
%Assumption: State point lies completely on the saturated liquid line
h4 = XSteam('hL_p',p4);
s4 = XSteam('sL_p',p4);
v4 = XSteam('vL_p',p4);
t4 = ts2;

%Properties at state point 1
s1 = s4;                                              %Isentropic pump compression
Wp = -v4*(p1-p4)*100;                                 %Pump work
h1 = h4 - Wp;
cp1 = XSteam('Cp_ps',p1,s1);
cv1 = XSteam('Cv_ps',p1,s1);
g1 = cp1/cv1;
k1 = (g1-1)/g1;
t1 = t4*((p1/p4)^k1);


%Calculation of Performance of Rankine cycle
Wnet = Wt+Wp;                                         %Net work output
Qin = h2 - h1;                                        %Heat added
Qout = h3 - h4;                                       %Heat Rejected
Eff = (Wnet/Qin)*100;                                 %Rankine efficiency
Steam_rate = 1/Wnet;                                  %Steam consumption
Heat_rate = 36/Eff;                                   %Heat rate
BWR = Wp/Wt;                                          %back work ratio

fprintf("Totat work done by Turbine in kJ is %f\n", Wt);
fprintf("Total Pump power required in kJ is %f\n",Wp);
fprintf("Total Work obtained from cycle in kJ is %f\n",Wnet)
fprintf("Total heat input to decide boiler size in kJ is %f\n",Qin);
fprintf("Total Heat rejection to decide condenser sizing in kJ is %f\n",Qout);
fprintf("Efficiency of the vapour power cycle is %f\n",Eff);
fprintf("Steam rate of the cycle in kg/kJ is %f\n",Steam_rate);
fprintf("Heat rate of the cycle in kJ/kWh is %f\n",Heat_rate);
fprintf("Dryness fraction is %f\n",x);
fprintf("Back work ratio for this system is %f\n",BWR);


%Generating data points for plotting in Superheated region
T = linspace(3,373,42);
T1 = linspace(ts1,t2,50);
%T2 = linspace(5,ts1,50);
T3 = linspace(ts2,t3,50);
for i = 1:length(T)
  S1(i) = XSteam('sL_T',T(i));
  S2(i)= XSteam('sV_T',T(i));
  H1(i) = XSteam('hV_T',T(i));
  H2(i) = XSteam('hL_T',T(i));
end
for j = 1:length(T1)
  S3(j) = XSteam('s_pT',p2,T1(j));
  H3(j) = XSteam('h_pT',p2,T1(j));
end
%for k = 1:length(T2)
%  S4(k) = XSteam('s_pT',p2,T2(k));
%end
for l = 1:length(T3)
  S5(l) = XSteam('s_pT',p3,T3(l));
  H5(l) = XSteam('h_pT',p3,T3(l));
end

%Plotting
%Although the plots could be done by combining them in single plot command, it is splitted for better readability
%T-S Diagram
figure(1)
plot(S1,T,'color','g')       %Saturated liquid line
hold on
plot(S2,T,'color','g')       %Saturated Vapor line
hold on
plot([s1 s2 s3 s4],[t1 t2 t3 t4],'*','markersize',5) %State points
hold on
plot([ssl2 ssg2],[ts2 ts2],'color','c')  %Condenser pressure line in dome
hold on
plot([ssl1 ssg1],[ts1 ts1],'color','r')  %Boiler pressure line in dome
hold on
plot(S3,T1,'color','r')       %Boiler pressure in Superheated region
hold on
%plot(S4,T2,'color','r')
%hold on
plot([s1 ssl1],[t1 ts1],'color','r')   
plot([s3 s2],[t3 t2],'color','b')      %Joining points 2-3
hold on
plot([s4 s1],[t4 t1],'color','k')      %Joining points 4-1
hold on
plot(S5,T3,'color','c')       %Condenser pressure in superheated region
hold on
%Critical point of water plotting
scr1 = XSteam('s_pT',220.6,374);
scr2 = XSteam('s_pT',220.6,373);
plot(scr1,373,'o','markersize',10)
plot(scr2,374,'o','markersize',10)
plot([scr1 scr2],[373 374],'color','m')
xlabel('Entropy(KJ/K)')
ylabel('Temperature(degC)')
title('T-S Diagram')
legend('Saturated liquid line','Sat vapor line','State points','Condenser pressure','Boiler pressure','.','.','Turbine expansion','Pump compression')

%H-S Diagram
figure(2)
plot([s1 s2 s3 s4],[h1 h2 h3 h4],'*','markersize',5)  %State points
hold on
plot(S2,H1,'color','g')                       %Saturated vapor line
plot(S1,H2,'color','g')                       %Saturated liquid line
plot([s3 s2],[h3 h2],'color','b')             %Joining 2-3
hold on
plot([s4 s1],[h4 h1],'color','k')             %Joining 1-4
hold on
plot(S3,H3,'color','r')                       %Superheated region Boiler
hold on
plot(S5,H5,'color','c')                       %Superheated region Condenser
hold on
plot([ssl2 ssg2],[hsl2 hsg2],'color','c')     %Saturated vapor and liquid state in Condenser
hold on
plot([ssl1 ssg1],[hsl1 hsg1],'color','r')     %Saturated vapor and liquid state in Boiler
hold on
plot([s1 ssl1],[h1 hsl1],'color','r')         
%Critical point of water
hcr1 = XSteam('h_pT',220.6,374);
hcr2 = XSteam('h_pT',220.6,373);
plot(scr1,hcr1,'o','markersize',10)
plot(scr2,hcr2,'o','markersize',10)
plot([scr1 scr2],[hcr1 hcr2],'color','m')
xlabel('Entropy(KJ/K)')
ylabel('Enthalpy(KJ/kg-C)')
title('h-s diagram')
legend('State points','Sat vapor line','Sat liquid line','Turbine expn','Pump compress','Boiler','Condenser',"location",'southeast')

Results:

The following plots are obtained, following parameters are calculated and displayed in the command window.

Discussion on results:

1) State points cannot be connected together and it results in the errors as shown in fig

2) Water changes its phase and it could be used to advantage

3) Design of Boiler and condenser depends on state properties calculated

4) Efficiency could be improved by Reheating and Regeneration

5) Actual work output would be lesser than the work calculated here due to non isentropic processes and losses in turbine and pump

6) Pump work is negligible

7) Better results could be obtained with higher boiler pressure and lower condenser pressure, but it would become extremely difficult to manage and operate

8) Parameters such as Steam rate, Heat rate, Back work ratio, Efficiency, Quality, Net work, Net heat is an output calculated from the simulator.

References:

1) Thermodyanmics by Cengel

2) Engineering Thermodynamics by PK Nag

3) Engineering Thermodynamics by Rajput

4) http://hyperphysics.phy-astr.gsu.edu/hbase/thermo/pvtsur.html

for images

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.