Challenge

Project 2 - Rankine cycle Simulator

AIM : RANKINE CYCLE SIMULATOR

Understand the concept of Rankine cycle by referring to standard thermal engineering text book.

  • Create a Rankine Cycle Simulator using OCTAVE/MATLAB.
  • Your code should calculate the state points of the Rankine Cycle (any type of your choice) based on user inputs.
  • Then, plot the corresponding T-s and h-s plots for the given set of inputs. Title and axes labels are a must, while legends could be used if necessary.
  • The presentation of your code will be taken into consideration while grading. Labelling sections of your code using comments is appreciated.
  • Attach a report explaining the working of a rankine cycle simulator and also the research done by you.

Required Inputs:

Turbine Inlet temperature = 400° C

Turbine Inlet Pressure = 30 bars

Turbine Outlet Pressure = 0.05 bars = Condenser Inlet Pressure

Calculate the followings,

  • Net work output
  • Back work ratio

Sample output of a Basic Rankine cycle simulator:

  • Type:Basic Rankine-
  • Code Snippet -

Output Screen -

WORKING PRINCIPLE OF A RANKINE CYCLE :

Principle :-

  • The Rankine cycle is an idealized thermodynamic cycle describing the process by which certain heat engines, such as steam turbines or reciprocating steam engines, allow mechanical work to be extracted from a fluid as it moves between a heat source and heat sink.
  • The Rankine cycle is named after William John Macquorn Rankine, a Scottish polymath professor at Glasgow University.
  • Heat energy is supplied to the system via a boiler where the working fluid (typically water) is converted to a high-pressure gaseous state (steam) to turn a turbine.
  • After passing over the turbine, the fluid can condense back into a liquid state as waste heat energy is rejected before being returned to the boiler, completing the cycle.
  • Friction losses throughout the system are often neglected to simplify calculations as such losses are usually much less significant than thermodynamic losses, especially in larger systems.

T-s PLOTS OF THE CYCLE :

Processes in the Rankine cycle - There are four processes in the Rankine cycle.

  1. Process 1–2: The dry saturated vapor expands through a turbine, generating power. This decreases the temperature and pressure of the vapor, and some condensation may occur. The output in this process can be easily calculated using the chart or tables noted above. Process 1-2 is isentropic expansion.
  2. Process 2–3: The wet vapor then enters a condenser, where it is condensed at a constant pressure to become a saturated liquid. Process 2-3 is constant pressure heat rejection in the condenser.
  3. Process 3–4: 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. Process 3-4 is isentropic compression.
  4. Process 4–1: The high-pressure liquid enters a boiler, where it is heated at constant pressure by an external heat source to become a dry saturated vapor. The input energy required can be easily calculated graphically, using an enthalpy–entropy chart (h–s chart), or numerically, using steam tables or software. Process 4-1 is constant pressure heat addition in the boiler.
  • 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 network 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, [1] which reduces the energy removed by the condensers.

Equations For the cycle -

  1. h2 = hf2+(x2*(hg2-hf2))
  2. x2 = (s2-sf2)/(sg2-sf2)
  3. hf2 = XSteam(‘hL_p’, p2)
  4. hg2 = XSteam(‘hV_p’, p2)
  5. sf2 = XSteam(’sL_p’, p2)
  6. sg2 = XSteam(‘sV_p’, p2)
  7. T4 = T3*((p4/p3)^(gamma-1)/gamma)
  8. gamma = Cp1/Cv1 |
  9. Cp1 = XSteam(‘CpL_p’, p4)
  10. Cv1 = XSteam(‘CvL_p’, p4)
  11. h4 = Wp+h3
  12. Wp = v3*(p4/p3)*100
  13. Wt = h1-h2
  14. Wnet = Wt+Wp
  15. Bwr = (h4-h3)/(h1-h2)

Where,

T = Temperature (deg C)

p = Pressure (bar)

h = Enthalpy (KJ/kg)

s = Entropy (KJ/K)

v = Volume (m3/kg)

Wt = Work done by Turbine

Wp = Work done to run Pump

Wnet = Net work done

Bwr = Back work ratio

Cp = Specific isobaric heat capacity

Cv = Specific isochoric heat capacity

f determines liquid state and g determines vapour/gas state of water.

MATLAB PROGRAM FOR THE RANKINE SIMULATOR

IT IS USED TO FIND THE ENTHALPY ,ENTROPY,TEMPERATURE AND PRESSURE,WORKDONE ETC..

% Rankine cycle simulator

clear all
close all
clc

% inputs
T1 = 400; % T Temperature (deg C)

p1 = 30; % Pressure (P)

p2 = 0.05; % Pressure bar
% state point 1
% enthalpy at state point 1
% h_pT enthalpy as a function of pressure and temperature
h1 = XSteam('h_pT',p1,T1);

% entropy at state point 1 
% s_pt specific entropy 
s1 = XSteam('s_pt',p1,T1);

% at point 2 ,T2 is Temperature at point 2,[1-2] is isentropic expansion
% process
s2 = s1  % entropy
T2 = XSteam('Tsat_p',p2);  % Tsat_p is saturation temperature
sf2 = XSteam('sL_p',p2);   % sL_p is saturated liquuid  entropy
sg2 = XSteam('sV_p',p2);   % sV_p is saturated vapour entropy  
hf2 = XSteam('hL_p',p2);   % hL_p is saturated liquid enthalpy
hg2 = XSteam('hV_p',p2);   % hV_p  is saturated vapour enthalpy
x2 = (s2-sf2)/(sg2-sf2);
h2 = hf2+(x2*(hg2-hf2));


%  at point 3, [2-3] is constant heat rejection process

p3 = p2; 
v3 = XSteam('vL_p',p3);  % vL_p is saturated liquid volume
T3 = T2;                 % Temperature at point 3 is T3
h3 = XSteam('hL_T',T3);  % hL_p is saturated liquid enthalpy
s3 = XSteam('sL_T',T3);  % sL_p is saturated liquid entropy

% at point 4 
% [3-4] is isentropic compression
% [4-1] is constant pressure heat addition

p4 = p1;                      
s4 = s3;                      % entropy at point 4
Cp1 = XSteam('Cp_ps',p4,s4);  % Cp_ps specific  isochoric  heat capacity as a function of pressure annd  entropy
                              % Cp is specific isochoric  heat capacity
Cv1 = XSteam('Cv_ps',p4,s4);  % Cv_ps specific  isochoric  heat capacity as a function of pressure annd  entropy

gamma = Cp1/Cv1;

T4 = T3*((p4/p3)^(gamma-1/gamma));
wp = v3*(p4-p3)*100;  % workdone by the pump
h4 = wp + h3;

% at point 5
% saturation process (saturation liquid - saturation vapour) during [4-1]

T5  = XSteam('Tsat_p',p4);  % Tsat_p saturation temperature 
h5 = XSteam('hL_p',p4);     % hL_p saturated liquid enthalpy
s5 = XSteam('sL_p',p4);     % sL_p is saturated  liquid entropy

% accordinng to T-S graph
T6 = T5;
h6 = XSteam('hV_p',p1);    % hV_p is saturated vapour enthalpy
s6 = XSteam('sV_p',p1);    % sV_p is saturated vapour entropy

% Creating saturation curve for T-s and h-s diagram
% Temperature array
T = linspace(0,400,500);
for i = 1:length(T)
    hf(i) = XSteam('hL_T',T(i));
    sf(i) = XSteam('sL_T',T(i));
    hg(i) = XSteam('hV_T',T(i));
    sg(i) = XSteam('sV_T',T(i));
end

% Net Workdone by  the turbine
wt = h1-h2;
wnet = wt - wp;

% Back work ratio 
Bwr = (h4-h3)/(h1-h2);

% plotting the graphs for Temperature Vs Entropy
hold on
plot([sf sg],[T T],'r','LineWidth',2)
text(s1,T1,'1','FontSize',16)
plot([s1 s2],[T1 T2],'green','LineWidth',2)
text(s2,T2,'2','FontSize',16)
plot([s2 s3],[T2 T3],'green','LineWidth',2)
text(s3,T3,'3','FontSize',16)
plot([s3 s4],[T3 T4],'green','LineWidth',2)
text(s4,T4,'4','FontSize',16)
plot([s4 s5],[T4 T5],'green','LineWidth',2)
plot([s5 s6],[T5 T6],'green','LineWidth',2)
plot([s6 s1],[T6 T1],'green','LineWidth',2)
title('Temperature vs Entropy')
xlabel('Entropy(s)')
ylabel('Temperature(T)')
legend('saturation curve','location','northwest')

% Enthalpy vs Entropy
figure(2)
hold on
plot([sf sg],[hf hg],'r','LineWidth',2)
text(s1,h1,'1','FontSize',16)
plot([s1 s2],[h1 h2],'green','LineWidth',2)
text(s2,h2,'2','FontSize',16)
plot([s2 s3],[h2 h3],'green','LineWidth',2)
text(s3,h3,'3','FontSize',16)
plot([s3 s4],[h3 h4],'green','LineWidth',2)
text(s4,h4,'4','FontSize',16)
plot([s4 s1],[h4 h1],'green','LineWidth',2)
title('Enthalpy(h) Vs Entropy(s)')
xlabel('Entropy(s)')
ylabel('Enthalpy(h)')
legend('Saturation curve','location','northoutside')

% displaying the outputs in the command window

% at point 1
fprintf('At point-1 :\r\n')
fprintf('p1 is : %f Bar \r\n',p1)
fprintf('T1 is : %f Deg Celcius\r\n',T1)
fprintf('h1 is : %f Kj/kg\r\n',h1)
fprintf('s1 is : %f Kj/kgk\r\n',s1)

% at point 2
fprintf('At point-2 :\r\n')
fprintf('p2 is : %f Bar \r\n',p2)
fprintf('T2 is : %f Deg Celcius\r\n',T2)
fprintf('h2 is : %f Kj/kg\r\n',h2)
fprintf('s2 is : %f Kj/kgk\r\n',s2)
fprintf('X is : %f \r\n',x2)

% at ppoint 3
fprintf('At point-3 :\r\n')
fprintf('p3 is : %f Bar \r\n',p3)
fprintf('T3 is : %f Deg Celcius\r\n',T3)
fprintf('h3 is : %f Kj/kg\r\n',h3)
fprintf('s3 is : %f Kj/kgk\r\n',s3)


% point 4
fprintf('At point-4 :\r\n')
fprintf('p4 is : %f Bar \r\n',p4)
fprintf('T4 is : %f Deg Celcius\r\n',T4)
fprintf('h4 is : %f Kj/kg\r\n',h4)
fprintf('s4 is : %f Kj/kgk\r\n',s4)

% calculations
fprintf('Workdone by the turbine : %f Kj/kg\r\\n',wt)
fprintf('Workdone by the pump : %f Kj/kg\r\n',wp)
fprintf('Back work ratio : %f %%\r\n',Bwr*100)






  • Based on the 4 processes of the Rankine cycle all the state variables of the cycle can be determine. With the help of the given inputs and using the XSteam function enthalpy and entropy if state point 1 is determined. This state point follows process [1-2] i.e isentropic expansion and [4-1] i.e constant pressure heat addition by the boiler. Similarly, every state point follows two corresponding processes, which can be used to determine the state variables of that state point.
  • At state point 2 due to the process [1-2] i.e isentropic expansion, entropy at state point 2 will be constant. The temperature at state point 2 is found using XSteam function saturation temperature. Using the equation for h2, the enthalpy of this point is calculated.
  • At state point 3, process [2-3] will apply i.e constant pressure heat rejection where the pressure at state point 3 will be constant and considering the same volume is determined. The temperature will be equal to the temperature of state point 2 as both use XSteam function saturation temperature. Enthalpy and entropy are calculated using the XSteam function saturated liquid enthalpy and saturated liquid entropy.
  • At state point 4, process [4-1] is applied i.e constant pressure heat addition, therefore pressure will be constant. Process [3-4] also applies to state point 4 i.e isentropic compression hence entropy will be constant. By the equation of T4 and h4 temperature and enthalpy are being calculated.
  • For every process phases of the water i.e liquid and vapor/gas are also considered. At state points 4 and 1 saturation process takes place where water is boiled and converted into a saturated liquid state and then it is converted to the saturated vapor state and then due to more boiling inside the boiler is converted to a superheated state. Two different phases are taking place between state points 4 and 1 hence temperature, enthalpy, and entropy for both the phases are calculated.
  • To create a saturation curve for T-s and h-s diagram different enthalpy and entropy values based on liquid state and vapor/gas state are being calculated using temperature as an array for values 0 to 400 considering 500 values in between them. Net work done is calculated by equating work done by the turbine and work done to run the pump, using the equation of Wnet. The back work ratio is calculated using the equation for Bwr.
  • Plots are created for T-s and h-s using the ‘hold on’ command for all the state points. At first saturation, the curve is made for both the graphs using h and s values that were calculated with temperature array at different phases of water. Then all the state points are joined using the ‘plot’ command. The t-s and h-s diagram includes title, axis labels and legends, and ‘text’ command to show the state points of the graph.

Results:-

  1. Below are the T-s and h-s diagrams generated through the program based on the given inputs.
  2. Both diagrams represent the Rankine cycle and how temperature and enthalpy change in the complete cycle.

  • In the T-s diagram, it can be seen how temperature changes throughout the process of the cycle.
  • In the saturation curve, the left side is the saturated liquid state line and the right side is the saturated vapor/gas state line.
  • In between state points [4-1] water changes from saturated liquid to saturated vapor/gas and then it goes to a superheated state.
  • This is how high-pressure steam is formed.

  • In the h-s diagram, it can be seen how enthalpy changes during the cycle.
  • The first part of the saturation curve is the saturated liquid state and the second part is the saturated vapor/gas state.
  • Enthalpy increases with an increase in heat energy.

Displayed Output in the command window -

All the required values are displayed in the command window by using fprintf command

WORKSPACE OF THE RANKINE CYCLE :

Workspace -1 :

Workspace -2 :

Workspace-3 :

Errors Which are occured during the code generation :

Error was resolved by giving single quotes to the input of the function.

Error 1 :

Error 2:

Error was resolved by altering the positions of the state points of entropy.

References taken for the given cycle :

  1. Rankine Cycle - Processes, Efficiency [P-v and T-s Diagram] (theengineerspost.com)
  2. https://en.wikipedia.org/wiki/Rankine_cycle.

*-----------------------------------------------------*----------------------------------------------------------*-------------------------------------------------*---------------------------------------------------*

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.