All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
Rankine Cycle Simulator
Aim:
Creating a program of Rankine Cycle Simulator using MATLAB.
Objective:
Fig: Rankine Cycle
Theory:
The Rankine cycle or Rankine Vapor Cycle is the process widely used by power plants such as coal-fired power plants or nuclear reactors. In this mechanism, a fuel is used to produce heat within a boiler, converting water into steam which then expands through a turbine producing useful work. This process was developed in 1859 by Scottish engineer William J.M. Rankine. This is a thermodynamic cycle that converts heat into mechanical energy, which usually gets transformed into electricity by electrical generation.
Fig: Working and Application of Rankine Cycle
The steps in the Rankine Cycle as shown in the figure below:
Fig: State of Rankine Cycle
The efficiency of the Rankine cycle is limited by the high heat of vaporization by the fluid. The fluid must be cycled through and reused constantly, therefore, water is the most practical fluid for this cycle. This is not why many power plants are located near a body of water—that's for the waste heat.
As the water condenses in the condenser, waste-heat is given off in the form of water vapor—which can be seen billowing from a plant's cooling towers. This waste heat is necessary for any thermodynamic cycle. Due to this condensation step, the pressure at the turbine outlet is lowered. This means the pump requires less work to compress the water—resulting in higher overall efficiencies.
The (p-h) and (T-s) diagrams are useful in understanding the working of the Rankine cycle along with the description given below:
Fig: T-s diagram of Rankine Cycle
Fig: h-s diagram of Rankine Cycle
Isobaric Heat Transfer or Constant Pressure heat addition in a Boiler
The boiler is a large heat exchanger where heat liberating fuel like coal, lignite, or oil transfers the heat indirectly to water at constant pressure. Water enters the steam boiler from the boiler feed pump as a compressed liquid at state-1 and is heated to the saturation temperature as shown in the T-s diagram as state-3.
The energy balance in the boiler is or energy added in a steam generator,
qin= h3-h1
Isentropic Expansion in a Turbine
Vapor from the boiler outlet enters the turbine at state 3, where it expands isentropically over the turbine fixed and moving blade to produce work done in the form of mechanical rotation of the turbine shaft, which is connected to the electrical generator.
Work delivered by the turbine (Neglecting heat transfer with the surroundings)
Wturbine out= h3-h4
Isobaric Heat Rejection or Constant Pressure heat rejection in a Condenser
At state-4, vapor enters the condenser. The change of phase occurs as vapor is condensed to liquid at constant-pressure in the condenser by transferring the steam’s heat to the circulating water flow through the tubes of the condenser. Change of phase occurs in the condenser, and the working fluid leaving the condenser is in a liquid state and marked as point 5.
Energy rejected in the condenser, qout= h4-h5
Isentropic Compression in a Pump
Water exits the condenser at state 5 and enters the pump. This pump raises the pressure of the water by imparting work during the processes. In units of smaller size and low specific volume, this small work can be neglected compared to the work-output of a steam turbine.
Work was done on the pump per kg of water, W51= h5-h1.
The thermal efficiency of the Rankine cycle is given by:
OR
Rankine Cycle Components | Heat | Work |
Boiler feed Pump Wpump-in | ![]() |
![]() |
Boiler | ![]() |
![]() |
Turbine | ![]() |
![]() |
Condenser | ![]() |
![]() |
The thermal efficiency of the Ideal Rankine cycle | ![]() |
![]() |
Methodology:
First, we will gather information about Xsteam.
Then we will start by displaying the Rankine Cycle stages. It is displayed using the simple fprintf command
The value of Turbine Inlet Pressure (p1), Turbine Inlet Temperature (t1), and Turbine Outlet Pressure (t2) is taken as an input from the user.
The Enthalpy (h1) and Entropy (s1) are determined at stage 1 from the steam table on the basis of t1 and p1.
As the process from stage 1 to stage 2 is an isentropic process, s2 = s1.
We need to determine the dryness fraction (x), as a result of which we will find sf2 and sg2 from the steam table on the basis of p2.
To calculate the enthalpy (h2), we will use the same dryness fraction and use hf2, and hg2 from the steam table on the basis of p2.
During stages 2 to 3, the process is isobaric. Hence p3 = p2.
The value of t3, s3, and h3 are determined using this p3 from a steam table.
From the T-s diagram, it is evident that t3 = t2.
As heat addition is isobaric therefore p4 = p1. The heat rejection is isentropic, therefore s4 = s3.
For h4, we will use a steam table and determine its value on the basis of p4 and s4.
For t4, we will use the equation of pressure and temperature from gas law. For that, we need a ratio of specific heat (gamma). For the adiabatic process, it is the ratio of Isobaric Specific Heat to Isochoric Specific Heat.
Once we determine the ratio of specific heat, we will find t4.
Once all the values are determined, from the above equation we will find the work done by the turbine (Wt), energy taken by the pump (Wp), heat added by the boiler (Qin), and heat rejected by the condenser (Qout).
This will help us in calculating efficiency which is the ratio of the difference between Wt and Wp to Qin. Then we will calculate Specific Steam Consumption which is 3600/Wnet.
Using simple fprintf command we will display this result.
For the T-s diagram, we will make use of for loop. The basis of this is the inlet temperature of the turbine. The temperature is converted to an array of temperatures using the linspace command.
Then on the basis of this inlet temperature, we will find liquid entropy (sl) and vapor entropy (sv) at every point of the temperature. Then we will plot the Temperature against this entropy.
Using simple plot command we will plot state 1 to state 2, state 2 to state 3, state 3 to state 4. But between state 4 and state 1 there are three intermediate states.
Let's say the point on T-s curves are p and q. We will find tp, tq, sp, and sq using a steam table and rule of isentropic as well as the isobaric process.
Then we will plot the graph from state 4 to state p, state p to state q, and from state q to state 1.
Using Text we will name the points, taking temperature and entropy as inputs.
For the h-s diagram, we will do the same step as done in the T-s diagram that is plotting Enthalpy against Entropy.
For this, we will determine liquid enthalpy (hl) and vapor enthalpy (hv). We already have the value of liquid entropy (sl) and vapor entropy (sv) from the T-s diagram.
Now we will plot state 1 to state 2, state 2 to state 3, state 3 to state 4, and state 4 to state 1.
Using Text we will name the points, taking enthalpy and entropy as inputs.
Using xlabel and ylabel we will give the naming to X and Y Co-ordinates. The title will give the name to the heading of the plot.
The following is the MATLAB program to Simulate Rankine Cycle:
%A Program to Simulate Rankine Cycle
clear all
close all
clc
%User Input
fprintf('%55s','Rankine Cycle Simulator')
fprintf('nn1 - 2 is Isentropic Expansion in the Turbine')
fprintf('n2 - 3 Constant Pressure Heat Rejection by the Condenser')
fprintf('n3 - 4 is Isentropic Compression in the Pump')
fprintf('n4 - 1 is Constant Pressure Heat Addition by the Boiler')
p1 = input('nnEnter the Pressure at the Turbine Inlet (in bar):n');
t1 = input('nEnter the Temperature at the Turbine Inlet (in Degree Celcius):n');
p2 = input('nEnter the Pressure at the Condenser Inlet (in bar):n');
%Turbine Inlet
s1 = XSteam('s_pT',p1,t1);
h1 = XSteam('h_pT',p1,t1);
%Condenser Inlet
s2 = s1;
sf2=XSteam('sL_p',p2);
sg2=XSteam('sV_p',p2);
hf2=XSteam('hL_p',p2);
hg2=XSteam('hV_p',p2);
%`Determining Dryness fraction`
if(s2 <= sg2)
x2 = ((s2 - sf2) / (sg2 - sf2));
else
x2 = 1;
end
h2 = hf2 + (x2 * (hg2 - hf2));
%Pump Inlet
p3 = p2;
t3 = XSteam('Tsat_p',p3);
s3 = XSteam('sL_p',p3);
h3 = XSteam('hL_p',p3);
t2 = t3;
%Boiler Inlet
p4 = p1;
s4 = s3;
h4 = XSteam('h_ps',p4,s4);
cp = XSteam('Cp_ps',p4,s4); %Isobaric specific heat
cv = XSteam('Cv_ps',p4,s4); %Isochoric specific heat
%Determining Gamma
gamma = ( cp / cv );
t4 = (t3 * (( p3 / p4 )^(( 1 - gamma) / gamma)));
%Work Done
%Work Done by the Turbine
Wt = h1 - h2;
%Work Done by the Pump
Wp = h4 - h3;
%Net Work Done
Wnet = Wt - Wp;
%Heat Added
%Heat Added in the Boiler
qin = h1 - h4;
%Heat Rejected in the Condensor
qout = h2 - h3;
%Thermal Efficiency
n = (Wnet / qin) * 100;
%Specific Steam Consumption
SSC = (3600/Wnet);
%Result
fprintf('%45s nnn','Result');
fprintf('%s %50s n','At State Point 1','At State Point 4');
fprintf('%s %.2f%s %40s %.2f%s n',' P1 is :',p1,' Bar',' P4 is :',p4,' Bar');
fprintf('%s %.2f%s %31s %.2f%s n',' T1 is :',t1,' Deg Celcius',' T4 is :',t4,' Deg Celcius');
fprintf('%s %.2f%s %36s %.2f%s n',' H1 is :',h1,' kJ/kg',' H4 is :',h4,' kJ/kg');
fprintf('%s %.2f%s %38s %.2f%s nn',' S1 is :',s1,' kJ/kgK',' S4 is :',s4,' kJ/kgK');
fprintf('%s %41s %.2f%s n','At State Point 2','Wt is :',Wt,' kJ/kg');
fprintf('%s %.2f%s %40s %.2f%s n',' P2 is :',p2,' Bar','Wp is :',Wp,' kJ/kg');
fprintf('%s %.2f%s %33s %.2f%s n',' T2 is :',t2,' Deg Celcius','Wnet is :',Wnet,' kJ/kg');
fprintf('%s %.2f%s %39s %.2f%s n',' H2 is :',h2,' kJ/kg','Ntherm is :',n,' Percent');
fprintf('%s %.2f%s %40s %.2f%s n',' S2 is :',s2,' kJ/kgK','S.S.C is :',SSC,' kg/kWh');
fprintf('%s %.2fnn','X2 is :',x2);
fprintf('%s n','At State Point 4');
fprintf('%s %.2f%s n',' P1 is :',p4,' Bar');
fprintf('%s %.2f%s n',' T1 is :',t4,' Deg Celcius');
fprintf('%s %.2f%s n',' H1 is :',h4,' kJ/kg');
fprintf('%s %.2f%s n',' S1 is :',s4,' kJ/kgK');
%Plotting
%TS Diagram
t = linspace(1,t1,2000);
for i = 1: 2000
sl(i) = XSteam('sL_T',t(i));
end
for i = 1: 2000
sv(i) = XSteam('sV_T',t(i));
end
figure(1)
plot(sl,t,'-.r','LineWidth',2)
hold on
plot(sv,t,'-.r','LineWidth',2)
title(' T-s Diagram of an Ideal Rankine Cycle')
xlabel('Entropy(KJ/KgK)')
ylabel('Temperature(k)')
%1-2 State
plot([s1 s2],[t1 t2],'k','LineWidth',1)
%2-3 State
plot([s2 s3],[t2 t3],'k','LineWidth',1)
%3-4 State
plot([s3 s4],[t3 t4],'k','LineWidth',1)
%4-1 State
tp = XSteam('TSat_p',p4);
sp = XSteam('sL_T',tp);
tq = tp;
sq = XSteam('sV_T',tq);
plot([s4,sp],[t4,tp],'k','LineWidth',1)
plot([sp sq],[tp tq],'k','LineWidth',1)
plot([sq,s1],[tq,t1],'k','LineWidth',1)
text(s1,t1,' 1');
text(s2,t2,' 2');
text(s3,t3,' 3');
text(s4,t4,' 4');
%PV Diagram
for i = 1: 2000
hl(i) = XSteam('hL_T',t(i));
end
for i = 1: 2000
hv(i) = XSteam('hV_T',t(i));
end
figure(2)
plot(sl,hl,'-.r','LineWidth',2)
hold on
plot(sv,hv,'-.r','LineWidth',2)
title(' H-S Diagram of an Ideal Rankine Cycle')
xlabel('Entropy(KJ/KgK)')
ylabel('Enthalpy(KJ/Kg)')
%1-2 State
plot([s1 s2],[h1 h2],'k','LineWidth',1)
%2-3 State
plot([s2 s3],[h2 h3],'k','LineWidth',1)
%3-4 State
plot([s3 s4],[h3 h4],'k','LineWidth',1)
%4-1 State
plot([s4 s1],[h4 h1],'k','LineWidth',1)
text(s1,h1,' 1');
text(s2,h2,' 2');
text(s3,h3,' 3');
text(s4,h4,' 4');
Result:
The following is the Desired Result of Rankine Cycle displayed on the Command Window:
Fig: Outcome of the Rankine Cycle Simulator
The following is the T-s Diagram of the Rankine Cycle from the determined result:
Fig: T-s Diagram
The following is the h-s Diagram of the Rankine Cycle from the determined result:
Fig: h-s Diagram
Conclusion:
Created a MATLAB program to Simulate Rankine Cycle as well as plotted the T-s and h-s diagram from the determined value at each state.
Leave a comment
Thanks for choosing to leave a comment. Please keep in mind that all the comments are moderated as per our comment policy, and your email will not be published for privacy reasons. Please leave a personal & meaningful conversation.
Other comments...
Simulation of Whitworth Quick Return Mechanism using MATLAB
…
19 Mar 2021 08:00 PM IST
Related Courses
Skill-Lync offers industry relevant advanced engineering courses for engineering students by partnering with industry experts.
© 2025 Skill-Lync Inc. All Rights Reserved.