Project 2 - Rankine cycle Simulator
Aim: To simulate the Rankine Cycle and plot the corresponding T-S and H - S plots using MATLAB.
Objective:
Calculate the state points of the Rankine Cycle based on given inputs.
• Plot the corresponding T-s and h-s plots for the given set of inputs.
Given:
Input Values:
Turbine Inlet temperature =400^ C
Turbine Inlet Pressure =30 bars
Turbine Outlet Pressure =0.05 bars Condenser Inlet Pressure
Required Output Values:
.Net work output
Back work ratio
Introduction:
- Rankine cycle converts thermal energy to mechanical energy.
- On-road vehicles, which convert around one-third of the fuel energy into useful mechanical energy for propulsion, are moving energy conversion systems that generate considerable waste heat.
- It is found from prior research that the Rankine Cycle has great potential in automobile waste heat harvesting applications which can, in turn, be connected to the combustion engine which will result in better-wasted heat consumption and increasing the performance of the vehicle and helping the environment.
- Rankine cycle is the most basic thermodynamic cycle for any steam powerplant. It starts with the heating of water in the boiler at constant pressure to produce steam. The steam produced is then isentropically expanded in the turbine to produce work. After the turbine, the steam goes into the condenser where it is cooled and converted into the water at constant pressure. The water is then again pumped back to the boiler by a pump and the cycle continues.
The ideal Rankine cycle consists of the following four processes:

- 1-2: Isentropic expansion in a turbine
- 2-3: Constant pressure heat rejection in a condenser
- 3-4:Isentropic compression in pump
- 4-1: Constant pressure heat addition in a boiler
Process 1 - 2 Isentropic expanstion
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 difference of enthalpy at turbine inlet to outlet.
The maximum superheated temperature is 600 degree celsius it not beyond that temperature. The steam possing through the turbine, it gets starts to condensing with denoted in terms of dryness fraction (x).
At the end of the turbine shaft, we coupled with the generator shaft. The mechanical energy is converted into electrical energy.
Process 2-3 Constant pressure heat rejecton
The wetvapour entering into the condensor then it starts condensed by measures we calculate dryness fraction. When we condensing the saturated vapour steam to liquid, the volume of saturated liquid is very less compare to the volume of saturated vapour.
The volume of saturated steam is approximately 1600m ^ 3 / kg times of greater thanthe volume of saturated liquid.
The absolute temperature of the steam is crossing below or equal to the dew point temperature, at the steam has starts to precipitating. Moreover, the pressure and temperature is decreased.
Process 3 - 4 Isentropic compression
At the end of the previous process the steam had been completely condensed. So, we want to boost up the pressure of the water for which liquid gets entered to the boiler. We use the pump for increase the pressure of working fluid.
It have taken some small amount of energy from our turbine work.
Process 4 - 1 Constant pressure heat addition
The high pressure fluid is passed to boiler by the help of pump, adding the heat by using the any burnable substance. Over the period, liquid has increasing the heat of sensible and at some temperature the liquid is phase change into vapour state that heat is called Latent heat.
Main programe
%A program for simulate Rankine cycle.
clear all
close all
clc
% Displaying the processes undergoing in the cycle
disp('PROCESSES IN RANKINE CYCLE :')
fprintf('n')
disp('Process 1-2 is Isentropic expansion.')
disp('Process 2-3 is Constant pressure heat rejection.' )
disp('Process 3-4 is Isentropic compression.')
disp('Process 4-1 is Constant pressure heat addition.')
fprintf('n')
% initialization of variables and parameters
t = linspace(0,374,500);
P1=input('Enter the pressure at turbine inlet (Bar):');
T1 = input('Enter the temperature at turbine inlet (C): ');
P2 = input('Enter the pressure at Condenser (Bar) :');
fprintf('nn')
% Assigning the values of P,T,h,s for each state using 'Xstrem' Library
% At state 1
h1=XSteam('h_pT',P1, T1); %Enthalpy in Library
s1=XSteam('s_pT',P1, T1); %Entropy in Library
hf1 =XSteam('hL_p',P1); %saturated liquid Enthalpy in Library
hg1 =XSteam('hV_p',P1); %saturated vapour Enthalpy in Library
sf1= XSteam('sL_p',P1); %saturated liquid Entropy in Library.
sg1 =XSteam('sV_p',P1); %saturated vapour Entropy in Library
Tsat1= XSteam('Tsat_p',P1); %saturation temperature in Library
% At state 2
s2=s1;
sf2= XSteam('sL_p',P2);
sg2=XSteam('sV_p',P2);
hf2 =XSteam('hL_p',P2);
hg2=XSteam('hV_p',P2);
x2=(s2-sf2)/(sg2-sf2); % dryness factor
h2=hf2+x2*(hg2-hf2);
T2=XSteam('Tsat_p', P2);
% at state 3
h3=hf2;
s3=sf2;
P3=P2;
T3=T2;
% at state 4
P4=P1;
s4=s3;
cp =XSteam('CpL_p',P3);
cv= XSteam('CvL_p',P3);
% Calculating a Gamma value
gamma=cp/cv;
T4=T3*((P4/P3)^((gamma-1)/gamma));
h4= XSteam('h_ps',P4, s4);
% Calculating the state point 5
T5 = XSteam('Tsat_p',P1);
s5 = XSteam('SL_p',P1);
% Calculating the state point 6
T6 = T5;
s6= XSteam('sV_p',P1);
% plotting T-s Graph
figure(1);
hold on
plot([s1 s2],[T1 T2],'linewidth',3,'Color','r');
plot([s2 s3],[T2 T3],'linewidth',3,'Color','r');
plot([s3 s4],[T3 T4],'linewidth',3,'Color','r');
plot([s4 s5],[T4 T5],'linewidth',3,'Color','r');
plot([s5 s6],[T5 T6],'linewidth',3,'Color','r');
plot([s6 s1],[T6 T1],'linewidth',3,'Color','r');
% saturation Curve
t=linspace(0,T1,500);
for i=1:length(t)
S_l(i)= XSteam('sL_T',t(i));
S_v(i)=XSteam('sV_T', t(i));
h_l(i)=XSteam('hL_T',t(i));
h_v(i)=XSteam('hv_T',t(i));
end
plot(S_l,t, 'linewidth',3,'color','g');
plot(S_v,t, 'linewidth',3,'color','g');
text(s1,T1,'1', 'FontSize', 15);
text(s2,T2,'2', 'FontSize', 15);
text(s3,T3,'3', 'FontSize', 15);
text(s4,T4+10,'4', 'FontSize', 15);
xlabel('Entropy (KJ/Kg-K)')
ylabel('Temperature(K)')
title('T-s Diagram')
% for h-s Graph
figure(2);
hold on
plot([s1 s2 s3 s4 s1], [h1 h2 h3 h4 h1], 'linewidth', 2,'Color','b')
% Saturation curve
plot(S_l,h_l,'LineWidth',2,'Color','y');
plot(S_v,h_v,'LineWidth',2,'Color','y');
text(s1,h1, '1', 'FontSize', 15)
text(s2, h2, '2', 'FontSize', 15)
text(s3, h3, '3', 'FontSize', 15)
text(s4, h4+90, '4', 'FontSize', 15)
xlabel('Entropy (KJ/Kg-K)')
ylabel('Enthalpy (KJ/Kg)')
title('h-s Diagram')
% Calculation
% Work done by turbine
WT=h1-h2;
% work done by pump
WP=h4-h3;
%net work done
Wnet = WT -WP;
%Thermal Efficiency
Eff=(1-((h2-h3)/(h1-h4)))*100;
% Back Work Ratio
BWR = WP / WT;
%Specific Steam Conductivity
S.S.C=3600/WT;
% displaying result in command window
disp('RESULTS :')
disp('At state point 1:' )
fprintf('P1= %.2f bar n',P1)
fprintf('T1=%.2f C n' ,T1 )
fprintf('h1= %.2f KJ/Kg n',h1)
fprintf('s1=%.2f kJ/Kg nn',s1)
disp('At state point 2:' )
fprintf('P2=%.2f bar n',P2 )
fprintf('T2 =%.2f C n',T2)
fprintf('h2=%.2f KJ/Kg n', h2)
fprintf('s2=%.2f kJ/kgK n' ,s2 )
fprintf('x2=%.2f nn', x2)
disp('At state point 3:')
fprintf('P3=%.2f bar n',P3)
fprintf('T3=%.2f C n',T3)
fprintf('h3=%.2f KJ/Kg n',h3)
fprintf('s3=%.2f KJ/KgK nn',s3)
disp('At state point 4:' )
fprintf('P4 =%.2f bar n',P4)
fprintf('T4=%.2f C n',T4)
fprintf('h4 =%.2f KJ/Kg n', h4)
fprintf('s4= %.2f KJ/KgK nn',s4)
fprintf('Work done by Turbine =%.2f KJ/Kg n',WT)
fprintf('Work done by pump =%.2f KJ/Kg n',WP)
fprintf('Net work done =%.2f KJ/Kg n' ,Wnet)
fprintf('Thermal Efficiency =%.2f n' , Eff)
fprintf('Back-work ratio =%.3f n', BWR)
fprintf('Specific Steam Conductivity =%.2f Kg/KWh n', S.S.C)
STEPS
- Start the program with 'clear all, close all', and 'clc' command.
- As our task is to take user input, to facilitate users to continue or end the program, we have introduced a while statement at the start of the script. While statement, the first step is to make provision for Matlab to accept user input. 'input()' is used to provide the user input. The user input includes temperature and pressure before entry to the turbine and pressure after exiting to the turbine.
- Now based on user inputs parameters at 4 state points are calculated. Thermodynamic parameters include enthalpy h, entropy s, temperature T pressure P , and dryness factor x at state point 2. For calculating these parameters XSteam() i.e. steam table MatLab program is used. This program consists of functions for all thermodynamic properties. After calling these functions in the main script gives us thermodynamic properties based on other properties like temperature and pressure.
- After calculating all parameters, the next objective is to calculate pump work, turbine work, net work output, back ratio, and thermal efficiency.
- Now, we need to display all these results in the command window which is done by using command 'fprintf().
- The next objective is to plot the graph for h - s and T - s . The first step in plotting this graph is to plot the saturation curve which is calculated using 'for' loop. Under 'for' loop, values for entropy and enthalpy are calculated over a temperature range. Plotting these calculated values, the plot of a saturation curve can is obtained. Other processes are plotted by plotting respective values of h, s, T.
- Now, when the program is run it asks the user to input Turbine Inlet temperature, Turbine Inlet Pressure, Turbine Outlet Pressure which is Condenser Inlet Pressure.
- After the input parameters are given, all the results are displayed in the command window.
Results
Temperature vs entropy Diagram

Enthalpy vs Entropy diagram

