Rankine cycle Simulator (MATLAB)
Rankine cycle Simulator
1. OBJECTIVES:
1) To Develop a basic program that calculates the state points
2) To add the thermodynamic relation to get the points inbetween the state variables.
3) To plot rankine cycle on T-s and H-s curve.
2. THEORY:
The Rankine cycle is a model used to predict the performance of steam turbine systems. It was also used to study the performance of reciprocating steam engines. The Rankine cycle is an idealized thermodynamic cycle of a heat engine that converts heat into mechanical work while undergoing phase change. It is an idealized cycle in which friction losses in each of the four components are neglected. The heat is supplied externally to a closed loop, which usually uses water as the working fluid. It is named after William John Macquorn Rankine, a Scottish polymath and Glasgow University professor.

The Rankine cycle closely describes the process by which steam-operated heat engines commonly found in thermal power generation plants generate power.
Power depends on the temperature difference between a heat source and a cold source. The higher the difference, the more mechanical power can be efficiently extracted out of heat energy, as per Carnot's theorem.
The heat sources used in these power plants are usually nuclear fission or the combustion of fossil fuels such as coal, natural gas, and oil, or concentrated solar power. The higher the temperature, the better.
The efficiency of the Rankine cycle is limited by the high heat of vaporization of the working fluid. Also, unless the pressure and temperature reach super critical levels in the steam boiler, the temperature range the cycle can operate over is quite small: steam turbine entry temperatures are typically around 565 °C and steam condenser temperatures are around 30 °C. This gives a theoretical maximum Carnot efficiency for the steam turbine alone of about 63.8% compared with an actual overall thermal efficiency of up to 42% for a modern coal-fired power station. This low steam turbine entry temperature (compared to a gas turbine) is why the Rankine (steam) cycle is often used as a bottoming cycle to recover otherwise rejected heat in combined-cycle gas turbine power stations.
The cold source (the colder the better) used in these power plants are usually cooling towers and a large water body (river or sea). The efficiency of the Rankine cycle is limited on the cold side by the lower practical temperature of the working fluid.
The working fluid in a Rankine cycle follows a closed loop and is reused constantly. The water vapor with condensed droplets often seen billowing from power stations is created by the cooling systems (not directly from the closed-loop Rankine power cycle). This 'exhaust' heat is represented by the "Qout" flowing out of the lower side of the cycle shown in the T–s diagram below. Cooling towers operate as large heat exchangers by absorbing the latent heat of vaporization of the working fluid and simultaneously evaporating cooling water to the atmosphere.
While many substances could be used as the working fluid in the Rankine cycle, water is usually the fluid of choice due to its favorable properties, such as its non-toxic and unreactive chemistry, abundance, and low cost, as well as its thermodynamic properties. By condensing the working steam vapor to a liquid the pressure at the turbine outlet is lowered and the energy required by the feed pump consumes only 1% to 3% of the turbine output power and these factors contribute to a higher efficiency for the cycle. The benefit of this is offset by the low temperatures of steam admitted to the turbine(s). Gas turbines, for instance, have turbine entry temperatures approaching 1500 °C. However, the thermal efficiency of actual large steam power stations and large modern gas turbine stations are similar.
The four processes in the Rankine cycle

T–s diagram of a typical Rankine cycle operating between pressures of 0.06 bar and 50 bar. Left from the bell-shaped curve is liquid, right from it is gas, and under it is saturated liquid–vapour equilibrium.
There are four processes in the Rankine cycle. The states are identified by numbers (in brown) in the T–s diagram.
- Process 1–2: The working fluid is pumped from low to high pressure. As the fluid is a liquid at this stage, the pump requires little input energy.
In other words Process 1-2 is [Isentropic compression]
- Process 2–3: The high-pressure liquid enters a boiler, where it is heated at constant pressure by an external heat source to become a dry saturated vapour. The input energy required can be easily calculated graphically, using an enthalpy–entropy chart (h–s chart, or Mollier diagram), or numerically, using steam tables.
In other words Process 2-3 is [Constant pressure heat addition in boiler]
- Process 3–4: The dry saturated vapour expands through a turbine, generating power. This decreases the temperature and pressure of the vapour, and some condensation may occur. The output in this process can be easily calculated using the chart or tables noted above.
In other words Process 3-4 is [Isentropic expansion]
- Process 4–1: The wet vapour then enters a condenser, where it is condensed at a constant pressure to become a saturated liquid.
In other words Process 4-1 is [Constant pressure heat rejection in condenser]
In an ideal Rankine cycle the pump and turbine would be isentropic, i.e., the pump and turbine would generate no entropy and hence maximize the net work output. Processes 1–2 and 3–4 would be represented by vertical lines on the T–s diagram and more closely resemble that of the Carnot cycle. The Rankine cycle shown here prevents the state of the working fluid from ending up in the superheated vapor region after the expansion in the turbine, which reduces the energy removed by the condensers.
The actual vapor power cycle differs from the ideal Rankine cycle because of irreversibilities in the inherent components caused by fluid friction and heat loss to the surroundings; fluid friction causes pressure drops in the boiler, the condenser, and the piping between the components, and as a result the steam leaves the boiler at a lower pressure; heat loss reduces the net work output, thus heat addition to the steam in the boiler is required to maintain the same level of net work output.
Variables:
Equations:
3.PROGRAM:
3.1 MATLAB CODE:
clear all
close all
clc
disp(' RANKINE CYCLE SIMULATOR');
disp('1-2 is Isentropic Expansion in the turbine');
disp('2-3 is const Pressure heat Rejection by the Condenser');
disp('3-4 is Isentropic Compression in the pump');
disp('4-1 is const Pressure heat Addition by the Boiler');
p1=input('Enter the Pressure at the Turbine Inlet(in bar):');
t1=input('Enter the temperature at the Turbine Inlet(in degree Celcius):');
p2=input('Enter the Pressure at the Condenser(in bar):');
% conditions at the inlet of the Turbine
tsat=XSteam('Tsat_p',p1);
sf1=XSteam('sL_p',p1);
sg1=XSteam('sV_p',p1);
if t1>tsat
tsup=t1;
h1=XSteam('h_pT',p1,tsup);
s1=XSteam('s_pT',p1,tsup);
elseif t1==tsat
h1=XSteam('hL_p',p1);
s1=XSteam('sL_p',p1);
else
disp('Temperature entered must be greater than or equal to saturation temperature')
end
%conditions at the condenser inlet or the Turbine exhaust
t2=XSteam('Tsat_p',p2);
hf2=XSteam('hL_p',p2);
hg2=XSteam('hV_p',p2);
s2=s1;
sg2=XSteam('sV_p',p2);
sf2=XSteam('sL_p',p2);
x2=(s2-sf2)/(sg2-sf2);
h2=hf2+(x2*(hg2-hf2));
%conditions at the condenser exit
p3=p2;
t3=t2;
h3=hf2;
s3=sf2;
%conditions at the boiler inlet
p4=p1;
s4=s3;
cp4=XSteam('Cp_ps',p4,s4);
cv4=XSteam('Cv_ps',p4,s4);
gamma=cp4/cv4;
t4=t3*(p4/p3)^((gamma-1)/gamma);
vf=XSteam('vL_p',p3);
wp=vf*(p1-p2)*100;%input power to pump
h4=wp+h3;
wt=h1-h2;% work output from turbine
Qin=h1-h4;%heat input
Qout=h2-h3;%heat output
wnet=wt-wp; %net work
Ntherm=(wnet/Qin)*100;% thermalefficiency
ssc=3600/wnet;%specific fuel consumption
%plotting of T-S and H-S diagram
%T-S diagram
figure(1)
hold on
%plotting saturation lines
temp = linspace(1, 373, 500);
for i = 1 : length(temp)
hl(i) = XSteam('hL_T', temp(i));
hv(i) = XSteam('hV_T', temp(i));
sl(i) = XSteam('sL_T', temp(i));
sv(i) = XSteam('sV_T', temp(i));
end
plot(sl, temp, 'k', 'linestyle','-','linewidth', 1.5)
plot(sv, temp, 'k', 'linestyle','-','linewidth', 1.5)
xlabel('Specific Entropy (kJ/kgK)')
ylabel('Temprature (degree C)')
grid on
title('T-S diagram','fontweight','bold','fontsize',16);
plot([s1 s2 s3 s4 sf1 sg1],[t1 t2 t3 t4 tsat tsat],'color','b','linewidth', 1.5)
text(s1,t1,'1')
text(s2,t2,'2')
text(s3,t3-10,'3')
text(s4,t4+10,'4')
t=linspace(tsat,tsup,1000);
for j =1:length(t)
sinst(j) = XSteam('s_pT',p1,t(j));
end
plot(sinst,t,'color','b','linewidth', 1.5);
%H-S diagram
figure(2)
hold on
grid on
title('H-S diagram','fontweight','bold','fontsize',16);
plot(sl, hl, 'k','linestyle','-', 'linewidth', 1.5)
plot(sv, hv, 'k','linestyle','-', 'linewidth', 1.5)
plot([s1 s2 s3 s4 s1], [h1 h2 h3 h4 h1], 'color', 'b','linewidth', 1.5);
text(s1,h1,'1')
text(s2,h2,'2')
text(s3,h3-100,'3')
text(s4,h4+100,'4')
ylabel('Specific Enthalpy (kJ/kg)')
xlabel('Specific Entropy (kJ/kgK)')
%OUTPUTS
%at state 1
fprintf('rn')
disp('RESULTS -');
fprintf('n')
fprintf('At State Point 1:n')
fprintf('P1 is : %.2f Barn',p1);
fprintf('nT1 is : %.2f Deg Celciusn',t1);
fprintf('nH1 is : %.2f kJ/kgn',h1);
fprintf('nS1 is : %.2f kJ/kgKrnn',s1);
fprintf('rn')
%at state 2
fprintf('At State Point 2:n')
fprintf('P2 is : %.2f Barn',p2);
fprintf('T2 is : %.2f Deg Celciusn',t2);
fprintf('H2 is : %.2f kJ/kgn',h2);
fprintf('S2 is : %.2f kJ/kgKrnn',s2);
fprintf('rn')
%at state 3
fprintf('At State Point 3:n')
fprintf('P3 is : %.2f Barn',p3);
fprintf('T3 is : %.2f Deg Celciusn',t3);
fprintf('H3 is : %.2f kJ/kgn',h3);
fprintf('S3 is : %.2f kJ/kgKrnn',s3);
fprintf('rn')
%at state 4
fprintf('At State Point 4:n')
fprintf('P4 is : %.2f Barn',p4);
fprintf('T4 is : %.2f Deg Celciusn',t4);
fprintf('H4 is : %.2f kJ/kgn',h4);
fprintf('S4 is : %.2f kJ/kgKrnn',s4);
fprintf('rn')
fprintf('Wt is : %.2f kJ/kgn',wt);
fprintf('Wp is : %.2f kJ/kgn',wp);
fprintf('Wnet is : %.2f kJ/kgn',wnet);
fprintf('Ntherm is : %.2f Percentn',Ntherm);
fprintf('S.S.C is : %.2f kg/kWhn',ssc);
3.2 EXPLANATION OF THE MATLAB CODE:-
- Display the some information about Rankine cycle.
- Take the inputs from user.
- Find the state point properties (temperature, enthalpy, entropy) from the XSteam.m file.
- Calculate the Turbine work, pump work, net work, thermal efficiency , specific fuel consumption.
- Plot the saturation dome along with the rankine cycle process curves in T-S diagram.
- Plot the saturation dome along with the rankine cycle process curves in H-S diagram.
- Print the output variables.
3.3 OUTPUT:-
- Specific entropy vs Temperature
- Specific enthalpy vs Specific enthalpy
- Command window