Project 2 - Rankine cycle Simulator
AIM :
- To Simulate a Rankine cycyle using matlab.
- Extracting Steam and water properties from XSteam data(IAPWS IF - (& standard)
- Calculating all the state points of the cycle based on User inputs.
- Plotting the T vs s and H vs s plot for the given input.
Rankine Cycle:
- Rankine cycle is an idealized thermodynamic cycle or heat engine in which 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. It is a cycle which converts heat into mechanical energy which usually is converted into electical energy.
- In this project an idealized cycle is simulated. Hence neglecting losses.
- Rankine cycle is derived out of carnot cycle.its power depends on the temperature difference between the heat source and a cold source. The more the difference the more mechanical power can be efficiently extracted out of heat energy.
- Since ideal cycles are only in theory , Efficiency of rankine cycle is limited by high heat of vaporization of the working fluid, friction losses ect.
- 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 a higher efficiency for the cycle. The benefit of this is offset by the low temperatures of steam admitted to the turbine
Processes and Working:
There are four processes in the rankine cycle (order maybe varied):
- Process 1-2 : Isentropic Expansion in the turbine.
- Process 2-3 : Constant pressure Heat rejection in condenser.
- Process 3-4 : Isentopic compression in the pump.
- Process 4-1 : Constant pressure heat addition in the boiler.

(Plot obtained form matlab program,T vs S plot)
- Working of the rankine cycle simulator
- In process 1-2 ,The dry saturated vapour expands through a turbine,generating power. This decreases the temperature and pressure of the vapour,and same condensation may occur.
- Process 2-3 , The vapor-liquid mixture leaving the turbine(2) is condensed at low pressure,usually in a surface condenser using cooling water.In well designed and maintanined condensers,the pressure of the vapor is well below atmospheric pressure,approaching the saturation pressure of the operating fluid at the cooling water temperature.
- Process 3-4 , The pressure of the condensate is raised in the feed pump.Because of the low specific volume of liqudis,the pump work is relatively small and often neglected in thermodynamic calculations.
- Process 4-1 , High pressure liquid enters the boiler from the feed pump (4) and is heated to the saturation temperature (on the saturation curve). Futher addition of energy causes evaporation of the liquid until it is fully converted to saturated steam (1) or superheated (1).
(Rankine cycle in a nuclear power plant)
Elabourating (Rankine cycle paragraph point v):
As the water condenses in the condenser,waste heat is given off in the form of water vapour which can be seen billowing from a plant's cooling towers. This waste heat is necessary in any thermodynamic cycle. Due to this condensation step, the pressure at the turbine outlet is lowered.This means the pump reqires less work to compress the water-resulting in higher overall efficiencies.
Matlab Project Program:
%%Rankine Cycle Simulator
%Objective of this program is to simulate the rankine cycle
%Plotting t-s and h-s diagram using data from XSteam data
%Water and steam properties according to IAPWS IF-97
clear all
close all
clc
%%
disp('RANKINE CYCLE'); %Displaying
disp('1-2 is Isentropic Expansion in the turbine');
disp('2-3 is constant pressure heat removal in the condenser');
disp('3-4 is Isentropic Compression in the pump');
disp('4-1 is constant pressure heat addition in the boiler');
%%
%Obtaining the input data
p1 = input('nValue of pressure at turbine inlet,p1(in bar) = ');
T1 = input('nValue of temperature at turbine inlet,T1(in degree.C) = ');
p2 = input('nValue of temperature at condenser inlet,p1(in bar) = ');
%%
% Extracting data_defining variables
% State 1
h1 = XSteam('h_pT', p1,T1); %extracting enthalpy at state pt 1
s1 = XSteam('s_pT', p1,T1); %similarly
%State 2
s2 = s1;
sf2 = XSteam('sL_p', p2);
sg2 = XSteam('sV_p', p2);
x2 = (s2-sf2)/(sg2-sf2);
hf2 = XSteam('hL_p',p2);
hg2 = XSteam('hV_p',p2);
h2 = hf2 + (x2*(hg2-hf2));
%State 3
p3 = p2;
s3 = XSteam('sL_p', p3);
h3 = XSteam('hL_p', p3);
%State 4
s4 = s3;
p4 = p1;
%%
% Work done by turbine
Wt = h1 - h2;
%Work done to run pump
v3 = XSteam('vL_p',p3);
Wp = v3*(p4 - p3)*100;
h4 = h3 + Wp;
%net work
Wnet = Wt - Wp;
%Heat out of the system
Qin = h1 - h3;
%Heat out of the system
Qout = h2 - h3;
%Thermal efficiency
eff = (Wnet/Qin)*100;
%Specific Steam Consumption
%SSC = mass flow rate/power
SSC = (3600/Wnet);
%%
%Calculating temperatures at the state points
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));
%Calculating temperature, entropy and enthalpy at the vapour and liquid
%line for plotting
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
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 T-s diagram
figure(1)
hold on
plot(sf, T, 'r','LineWidth', 1)
plot(sg, T, 'r','LineWidth', 1)
plot([s1 s2], [T1 T2], 'k', 'LineWidth', 2)
plot([s2 s3], [T2 T3], 'k', 'LineWidth', 2)
plot([s3 s4], [T3 T4], 'k', 'LineWidth', 2)
plot([s4 s5], [T4 T5], 'k', 'LineWidth', 2)
plot([s5 s6], [T5 T6], 'k', 'LineWidth', 2)
sc1 = linspace(s6, s1, 1000);
for l = 1:length(sc1)
Tc1(l) = XSteam('T_ps', p1, sc1(l));
end
plot(sc1, Tc1, 'k', 'LineWidth', 2)
text(s1+0.1, T1, '1')
text(s2+0.1, T2, '2')
text(s3, T3-20, '3')
text(s4, T4+20, '4')
title('Temp 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', 1)
plot(sg, hg, 'r', 'linewidth', 1)
plot([s1 s2], [h1 h2], 'k', 'LineWidth', 2)
plot([s2 s3], [h2 h3], 'k', 'LineWidth', 2)
plot([s3 s4], [h3 h4], 'k', 'LineWidth', 2)
hc = linspace(h4, h5, 100);
for k = 1:length(hc)
sch(k) = XSteam('s_ph', p1, hc(k));
end
plot(sch,hc, 'k', 'LineWidth', 2)
plot([s5 s6], [h5 h6], 'k', 'linewidth', 2)
for m = 1:length(sc1)
hc1(m) = XSteam('h_ps', p1, sc1(m));
end
plot(sc1, hc1, 'k', 'LineWidth', 2)
text(s1+0.1, h1, '1')
text(s2+0.1, h2, '2')
text(s3+0.1, h3-100, '3')
text(s4+0.1, h4+200, '4')
title('Enthalpy vs Entropy plot')
xlabel('Entopy , S(KJ/kgk) ')
ylabel('Enthalpy , H(KJ/kg) ')
legend('Saturation curve','location','northwest')
%%
% Displaying Results
disp(' RESULTS');
disp('At State point 1');
n1 = sprintf('p1 is %.3f bar', p1);
disp (n1);
n2 = sprintf('T1 %.3f C', T1);
disp (n2);
n3 = sprintf('h1 %.3f kJ/kg', h1);
disp (n3);
n4 = sprintf('s1 %.3f kJ/kgK', s1);
disp (n4);
disp('At State point 2');
n5 = sprintf('p2 %.3f bar', p2);
disp (n5);
n6 = sprintf('T2 %.3f C', T2);
disp (n6);
n7 = sprintf('h2 %.3f kJ/kg', h2);
disp (n7);
n8 = sprintf('s2 %.3f kJ/kgK', s2);
disp (n8);
n9 = sprintf('x2 %.3f', x2);
disp (n9);
disp ('At State point 3:');
n10 = sprintf('p3 %.3f bar', p3);
disp (n10);
n11 = sprintf('T3 %.3f C', T3);
disp(n11);
n12 = sprintf('h3 %.3f kJ/kg', h3);
disp(n12);
n13 = sprintf('s3 %.3f kJ/kgK', s3);
disp(n13);
disp ('At State point 4: ');
n14 = sprintf('p4 %.3f bar', p4);
disp(n14);
n15 = sprintf('T4 %.3f C', T4);
disp(n15);
n16 = sprintf('h4 %.3f kJ/kg', h4);
disp(n16);
n17 = sprintf('s4 %.3f kJ/kgK', s4);
disp(n17);
n18 = sprintf('Turbine Work: %.3f kJ/kg', Wt);
disp(n18);
n19 = sprintf('Pump Work %.3f kJ/kg', Wp);
disp(n19);
n20 = sprintf('Wnet %.3f KJ/kg', Wnet);
disp(n20);
n21 = sprintf('Efficiency %.3f Percent ', eff);
disp(n21);
n22 = sprintf('S.S.C %.3f KJ/kWh', SSC);
disp(n22);
- XSteam data is used to extract steam and water propertires of enthalpy,entropy at specific pressure and temperatures for sat liquid,sat vapour condition etc.
- The programe requires the input of Pressure (in bar) at state point 1 (turbine inlet),Temperature at same point (degcelcius) and Temp at condenser inlet (point 2).
- With the help of these inlets & from XSteam data, the program calculates all the state points of the Rankine cycle.
- The XSteam data works as,
- h1 = XSteam ('h_pT, p1 ,T1) ; (Returns the enthalpy of water at given pressure and temperature in bar and extract their data from XSteam.
- As we extract the data ,we use thermodynamic relation to further find state points and extract their data from XSteam.
- Sf and sg,hf and hg,where f and g stands for saturated liquid and saturated vapour respectively.
- The net work,work done by turbine, work done to run the pump, Heat in and heat out are calculated using standard thermodynamic relation
- Efficiency and Specific steam consumption (s.s.c) of the Rankine cycle is calculated.
- T,s and h are extracted at vapour and liquid line for plotting purpose,after 4 th point for the variation you observe in the plot.
- Saturation curve is plotted in red for saturated liquid and saturated gas.
- Plot of T vs s and h vs s is created from all the points obtained from the program.
- The plot changes as the user input changes for the above mentioned inputs.
- Results are displayed in the command window.
[T vs S]&[H vs S] plots :


Results in the command window for entire Calculation :


RANKINE CYCLE
1-2 is Isentropic Expansion in the turbine
2-3 is constant pressure heat removal in the condenser
3-4 is Isentropic Compression in the pump
4-1 is constant pressure heat addition in the boiler
nValue of pressure at turbine inlet,p1(in bar) = 44
nValue of temperature at turbine inlet,T1(in degree.C) = 538
nValue of temperature at condenser inlet,p1(in bar) = 5.83
RESULTS
At State point 1
p1 is 44.000 bar
T1 538.000 C
h1 3528.829 kJ/kg
s1 7.154 kJ/kgK
At State point 2
p2 5.830 bar
T2 157.712 C
h2 2920.821 kJ/kg
s2 7.154 kJ/kgK
x2 1.079
At State point 3:
p3 5.830 bar
T3 157.712 C
h3 665.638 kJ/kg
s3 1.920 kJ/kgK
At State point 4:
p4 44.000 bar
T4 232.874 C
h4 669.834 kJ/kg
s4 1.920 kJ/kgK
Turbine Work: 608.008 kJ/kg
Pump Work 4.196 kJ/kg
Wnet 603.812 KJ/kg
Efficiency 21.089 Percent
S.S.C 5.962 KJ/kWh