Project 2 - Rankine cycle Simulator
AIM: Create a Rankine Cycle Simulator using MATLAB.
OBJECTIVE:
- Calculate each state points of the Rankine Cycle (any type of your choice) based on user inputs.
- Plot the corresponding T-s and h-s plots for the given set of inputs.
- Calculate Efficiency.
THEORY:
The Rankine cycle is an idealized thermodynamic cycle of a heat engine that converts heat into mechanical work while undergoing a 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.

- Four components of the Rankine cycle:
- Pump
- Boiler
- Turbine
- Condenser
- Four processes of the Rankine cycle:
1 2: Isentropic Expansion
Turbine (1-2): Superheated steam enters into the Turbine and expands isentropically resulting in the production of work. The shaft of the turbine is connected to the generator. This results in the production of electricity i.e Mechanical energy gets converted into electric energy. Work produced by the turbine,
WT=m(h1−h2)KWT=m(h1-h2)K
2-3: Constant Pressure Heat Rejection
Condenser (2-3): The expanded vapour is then passed through a condenser, where it gets condensed and converts into liquid again. This liquid is again pumped to the boiler.
Qr=m(h2−h3)KQr=m(h2-h3)K
3-4: Isentropic Compression by the Pump
Pump (3-4): The water enters into the pump in a saturated state. Then the liquid is compressed isentropically until it meets the boiler pressure. Work done by the pump is,
WP=m(h3−h4)K
4-1: Constant Pressure Heat Addition
Boiler (4-1): The water enters into the boiler as compressed and leaves as superheated from the boiler. Thus the phase changes from liquid to vapour. The heat supplied by the boiler is
Qb=m(h1−h4)KQb=m(h1-h4)K
Here we take mass flow rate m = 1 for this code.
- The efficiency of the Steam Cycle is given by
η=Wn/Q1=(WT−WP)/Q1
-
Applying the Steady Flow Energy Equation (SFEE) to all the process, neglecting the Friction losses and changs in Kinetic & Potential Energy,
- Q1=h1-h4 for Boiler
- Wt=h1-h2 for Turbine
- Q2=h2-h3 for Condenser
- Wp=h4-h3 for Pump
- The Capacity of the Steam Plant is often expressed interms of Steam Rate (SR) or Specific Steam Consumption (SSC)
- S.S.C.=(3600/Wn) kg/kWh
-
Required Inputs:
Turbine Inlet temperature = 400° C
Turbine Inlet Pressure = 30 bars
Turbine Outlet Pressure = 0.05 bars = Condenser Inlet Pressure
-
% Rankine Cycle Simulator clear all close all clc %intro for rankine cycle fprintf('Rankine cycle simulator\n') fprintf('\n1-2 isentropic expansion in the turbine \n ') fprintf('2-3 constant pressure heat rejection by condensor\n') fprintf('3-4 isentropic compression in pump \n') fprintf('4-1 constant pressure heat addition by boiler \n') %inputs P1 = input('\nEnter turbine pressure at inlet(in bar):'); T1 = input('Enter the teperature at turbine inlet(degree celcius):'); P2 = input('Enter the pressure at turbine outlet (in bar):'); %State 1 Points H1 = XSteam('h_pt',P1,T1); %enthalpy S1 = XSteam('s_pt',P1,T1); %entropy Hf1 = XSteam('hL_p',P1); %enthalpy for saturated liquid Hg1 = XSteam('hV_p',P1); %enthalpy of saturated vapour Ts1 = XSteam('Tsat_p',P1); %saturation temperature Sf1 = XSteam('sL_p',P1); %entropy of saturated liquid Sg1 = XSteam('sV_p',P1); %entropy of saturated vapour %State 2 point S2=S1; Sf2 = XSteam('sL_p',P2); Sg2 = XSteam('sV_p',P2); x = (S2-Sf2)/(Sg2-Sf2); %dryness fraction Hf2=XSteam('hL_p',P2); Hg2=XSteam('hV_p',P2); H2 = Hf2 + x*(Hg2-Hf2); T2 = XSteam('Tsat_p',P2,H2); Ts2 = XSteam('Tsat_p',P2); %State 3 points H3 = Hf2; S3 = Sf2; T3 = T2; P3 = P2; %State 4 points P4 = P1; S4 = S3; H4 = XSteam('h_ps',P4,S4); T4 = XSteam('T_ps',P4,S4); t = linspace(0,374,500); %temp space for plotting saturation curve %plot T-S diagram figure(1) hold on %Plot saturation curve for i = 1:length(t) plot(XSteam('sL_T',t(i)),t(i),'.','Color','b') plot(XSteam('sV_t',t(i)),t(i),'.','color','b') end % Plot Cycle plot ( [S1 S2], [T1 T2], 'linewidth', 2, 'color','r') if x>1 T3 = Ts2; plot ( [S2 Sg2 S3 S4], [T2 Ts2 T3 T4], 'linewidth', 2, 'color', 'r') T2 = Ts2; else plot ( [S2 S3 S4], [T2 T3 T4], 'linewidth', 2, 'color', 'r') end l = linspace(T1, T2,1000) ; for i = 1 : length(l) plot(XSteam( 's_pT', P1, l(i)), l(i),'.', 'color', 'r') end plot ( [Sf1 Sg1], [Ts1 Ts1], 'linewidth', 2, 'color', 'r') xlabel( 'Entropy [KJ/Kg-K]') ylabel ( 'Temprature [K] ') title('T-S Diagram') % Plot H-S Diagram figure(2) hold on % Plot Saturation Curve for i = 1 : length(t) plot(XSteam('sL_T',t(i)),XSteam('hL_T',t(i)),'.','color','b') plot(XSteam('sV_T',t(i)),XSteam('hV_T',t(i)),'.','color','b') end %Plot Cycle plot([S1 S2 S3 S4 S1],[H1 H2 H3 H4 H1],'linewidth',2,'color','r') xlabel ('Entropy [KJ/Kg-K]') ylabel( 'Enthalpy [KJ/Kg]') title('H-S Diagram') % calculations % Turbine Work Wt = H1-H2; % Pump Work Wp = H4-H3; % Heat Addition Qin = H1-H4; % Heat Rejection Qout = H2-H3 ; % Net Work Wnet= Wt-Wp; % Efficiency Ntherm = (Wnet/Qin)*100; % Specific steam consumption SSC = 3600/Wnet; % Back Work Ratio BWR = Wp/Wt; % Print Results fprintf('\n\nResults\n') fprintf('At State Point 1:\n') fprintf('P1 is : %.2f bar\n', P1) fprintf('T1 is : %.2f Deg Celcius\n', T1) fprintf('H1 is : %.2f KJ/Kg\n', H1) fprintf('S1 is : %.2f KJ/Kg-K\n',S1) fprintf('\nAt State Point 2: \n') fprintf ('P2 is : %.2f bar\n', P2) fprintf('T2 is : %.2f Deg Celcius\n', T2) fprintf('H2 is : %.2f KJ/Kg\n',H2) fprintf('S2 is : %.2f KJ/Kg-K\n',S2) fprintf('\nAt State Point 3: \n') fprintf('P3 is : %.2f bar\n', P3) fprintf('T3 is : %.2f Deg Celcius\n',T3) fprintf('H3 is : %.2f KJ/Kg\n',H3) fprintf('S3 is : %.2f KJ/Kg-K\n',S3) fprintf('\nAt State Point 4: \n') fprintf('P4 is : %.2f bar\n',P4) fprintf('T4 is : %.2f Deg Celcius\n', T4) fprintf('H4 is : %.2f KJ/Kg\n',H4) fprintf('S4 is : %.2f KJ/Kg-K\n',S4) fprintf('\nwt is : %.2f KJ/Kg\n', Wt) fprintf('Wp is : %.2f KJ/Kg\n', Wp) fprintf('Wnet is : %.2f KJ/Kg\n', Wnet) fprintf('Thermal Efficiency is : %.2f percent\n', Ntherm) fprintf('S.S.C. is : %.2f Kg/KWh\n',SSC) fprintf ('Back Work Ratio is : %.3f \n',BWR) EXPLANATION:
- The Program begins with clear all, close all, clc to erase the workspace and plots..
- Input variables p1,T1,p2 are given by input command whose values are entered in command window while executing the Program.
- @State-1, Values for Enthalpy & Entropy are extracted as a function of Pressure & Temperature.
- h_pT, s_pT, hL_p, sV_p etc.... are the default variables whose value is stored in XSteam file.
- Similarly, all the variables for all states are extracted using a suitable format.[**The Formulae for the State Variables and other depending factors are referred from Power Plant Reference Books.]
- Pressure, Temperature, Enthalpy, Entropy for all the State Variables are Extracted as a function of the dependent variable from the XSteam File.
- @State 2 is a Condenser inlet where the High-Pressure Steam is converted into Low-Pressure Water and hence Dryness Fraction, Enthalpy & Entropy for Saturated Vapour & Saturated Water are considered to Calculate the Specific Enthalpy.
- @State-3 The water is condensed back to its Saturation Temperature and fed to the Pump, This temperature of water at the exit of the Condenser and entry of Pump is the same.
- @State-4 This is Constant Pressure Heat addition, hence pressure is equal to p1, but the temperature increases on heating at Constant Pressure & Constant Volume as our Entropy remains same and hence Cp/Cv=gamma is considered to find temperature T4.
- define two more points 5 and 6 to plot cycle in detail.
- Finally Work done and Heat Evolved & SSC are calculated by basic formulae.
- To plot the Saturation Curve, a Temperature range is defined using linspace command and for the overall length of this Temperature values of Enthalpy and Entropy are calculated at every temperature point. The Break in the Saturation Curve separates the Liquid Phase & Vapour Phase.
- Now all the necessary data is found out, Plotting is done for both T-S & H-S curves using the plot commands. Annotations are assigned using text command.
- Results of the Cycle Simulation is displayed over Comand window using fprintf command.
RESULT:
The Rankine cycle plots have generated by calculating the state points, efficiency and the output is printed in the command window.

- [T vs S ] & [ H vs S ] plots


References :
- https://en.wikipedia.org/wiki/Rankine_cycle
- https://energyeducation.ca/encyclopedia/Rankine_cycle
- https://in.mathworks.com/matlabcentral/fileexchange/9817-x-steam-thermodynamic-properties-of-water-and-steam
- https://www.youtube.com/watch?v=QFZN71MY71o
- https://www.sciencedirect.com/topics/earth-and-planetary-sciences/rankine-cycle