Challenge

Project 2 - Rankine cycle Simulator

RANKINE CYCLE SIMULATOR

Aim:-

  • Study of the concept of the Rankine cycle.
  • Coding Program for Rankin cycle simulator.
  • Code to plot T-S diagram.
  • Code to plot H-S diagram.
  • Calculate Net Work out & Back work Ratio.

Objective:-

  • Study the properties of steam.
  • Study the concepts of Rankine cycle.
  • Write code to put inputs for the Rankin cycle problems.
  • Find out Entropy, Enthalpy, Temperature and Pressure at each point from the XSteam library.
  • Calculate Pump work, Turbine work, Heat supply by boiler, Heat rejected in condenser, Thermal efficiency, Net Workout and Back work Ratio.
  • Write codes to plot Temperature and Entropy points for T-S diagram.
  • Write codes to plot Enthalpy and Entropy points for H-S diagram.
  • Write code to print properties at each point in command windows.
  • Write Report for Rankin Cycle Simulator.

Heat engines:-

  • One of the most significant engineering applications of thermodynamics is the design and optimization of energy conversion devices which take in heat and produce useful work (heat engines).
  • Any thermodynamic process which takes a substance through a sequence of states eventually returning it to the original state is known as a cycle.Virtually all heat engines are implemented as cycles.
  • Usually, the substance the cycle operates on is a fluid, although in principle any substance could be used, as long as it has some reversible work mode.

Working Fluid:-

  • The fluid used in the cycle is known as the working fluid. During the cycle, the working fluid may or may not change phase. In vapor power cycles, the working fluid changes phase from liquid to vapor and back to liquid over the course of the cycle; in gas power cycles, the working fluid remains gaseous during the entire cycle. In many types of cycles, the working fluid circulates continuously in a loop.
  • To carry out thermodynamic analysis of cycles, we need to keep track of how the thermodynamic state of the fluid changes as the cycle proceeds. Since for a Fluid in equilibrium only two properties are required to specify its state, a fluid in thermodynamic equilibrium may be represented as a point on a plot of one thermodynamic property vs. another one (e.g. T vs. s, P vs. v, etc.) Any such plot of the working fluid state at various points in the cycle is known as a process representation.
  • Concept of Rankine cycle used in Steam powered power plant. Where water is use d as a working fluid. Therefor, it is vital to first understand the property of water and stem.

Steam And Its Types:-

When we provide continuous heat to water then at 100˚C temperature and 1 atm pressure, it boils and changes its phase from liquid to vapour. This vapour is known as steam. And their are three types of steam we will see Wet steam, Dry steam and Superheated steam.

Wet Steam: When steam contains water particles then it is known as Wet steam

Dry Steam: When wet steam is further heated then all water particles get converted into vapour and resulted steam is called dry steam.

Superheated Steam: When dry saturated steam is heated to higher temperatures then steam obtained is in superheated state. This steam is mostly used in Power generation.

Before going into formation of steam lets understand why steam is being formed/produced at constant pressure.

The boiling temperature is 100˚C at one particular pressure that is 1 atm. Now if we change the pressure then the boiling temperature also changes. Since both are directly proportional then if we decrease pressure, boiling temperature decreases and vice versa.

T-h diagram of formation of steam at constant pressure:-

After having understood the temperature and pressure fundamentals, let we discuss how we are going to produce steam from 1 kg piece of ice.

Suppose the initial temperature of ice is a solid phase of water is -10˚C.Now, keeping pressure constant which is again assumed as 1 atm, we provide continuous heat to the ice.

  • Overview of the above formation of steam diagram depict the graph is plotted between T and h. Let’s start with point A at which ice is at temperature -10˚C.
  • Now, as we provide heat to the piece of ice, its temperature as well as Enthalpy increases simultaneously upto point ‘B’.
  • Point B is at 0˚C at which the phase transformation of solid ice into liquid takes place. This point is called melting point and temperature will remain constant until the whole transformation process is completed i.e all ice will convert in liquid at 0˚C. This is so because of latent heat of fusion. All the heat we are providing is actually increasing the energy of the molecules of the water not its temperature, that’s why enthalpy increases but the temperature remains constant upto point C. Heat provided from point ‘B’ to point ‘C’ is hidden and cannot be measured using thermometer.
  • Since we are providing continuous heat the temperature and the enthalpy both increases (sensible heating). At ‘D’ which is boiling point of water. The next phase transformation i.e. liquid to vapour (steam) takes place. Since, the temperature again remains constant and enthalpy keep increasing, the heat absorbed during this is latent heat of vaporization. This process goes upto ‘E’. At ‘E’ we have converted all liquid into steam. If we keep providing heat then ultimately at ‘F’ superheated steam is obtained.

T-S (Temperature - Entropy) Diagram:-

Diagram below shows the state of the water and steam in T-S diagram.

T-S diagram

There is curve passing through B-Critical point-c is called saturated liquid and vapour curve. At its left portion water remains in completely liquid state and its right side complete vapour state, as per exhibited in figure

a critical point (or critical state) is the end point of a phase equilibrium curve. The most prominent example is the liquid–vapor critical point, the end point of the pressure–temperature curve that designates conditions under which a liquid and its vapor can coexist.

In water, the critical point occurs at 647.096 K (373.946 °C; 705.103 °F)

From B - C, their is a liquid - Vapour reason, can be calculated using dryness fraction which we are going to understand next in the properties of steam.

Properties of steam

Understand the property is impotent as we use it at different state to in power plant to produce work. It also help to calculate Output and efficiency of the system. So following are the properties of the steam and water we are going to use to code Rankine cycle Simulator.

(1) Quality of steam (Dryness fraction)

Dryness fraction in simple words denotes the mass of dry steam in given steam. Or how much steam is dry or in other words how much water vapour is present in steam. It is denoted by ‘`x`’.

`x =frac{M}{M+m}`

Where,

  • M=mass of the dry steam
  • m=mass of water vapour

The use of dryness fraction allow us to know both the mass of dry steam and mass of water vapour.

Now, see

If `x`=0.9 that means dry steam is 0.9 kg and water vapour is 0.1 kg in 1 kg of given steam.

Obviously for dry steam, `x`=1

Quality is represented in percentage but meaning is same as ‘`x`’.

If quality of steam is 80%, then it has 80% of dry steam and 20 % water vapour by mass.

(2) Specific volume :

Gases (steam is a gas) occupy less space under higher pressure than under lower pressure. This means 1 kilogram of steam occupies different volumes, depending upon its pressure. The term specific volume refers to the volume that one kg of steam occupies at a given pressure and temperature. It is denoted as ‘`v`’.

It unit is `frac{m^2}{kg}`

(3) Enthalpy

The total heat content of a substance is called enthalpy. It is denoted by ‘H’.

‘`h`‘ is generally used term which represents specific enthalpy, unit for which is `frac{KJ}{Kg}`.

(4) Entropy

Entropy is basically determines a irreversibility associated with the process.

‘`S`‘ is generally used term which represents specific entropy, unit for which is `frac{J}{K}`.

Now, we are ready to dive into concept of Rankine cycle.

Rankine cycle

Rankine cycle was named after Scottish Polymath and Glasgaw University professor William John Macquorn Rankine

It is vapour power cycle.

Power cycle use heat to generate work since it’s a vapour cycle it uses the vapour phase or in this case steam to rotate the blades of the turbine.

It actually utilize heat energy contained in coal, oil or natural gas and converts it into mechanical energy and eventually electrical energy which provide electricity in cities.

Rankine cycle closely describe s the process of steam steam turbine system and its derived from the Carnot cycle, the most efficient thermodynamic cycle, which tells us that power is dependent on the temperature difference between a heat source and cold source the higher difference the more mechanical power can be efficiently extracted out of heat energy.

Rankine cycle T-S Chart For Rankine cycle

Form above figure of the Rankine cycle an it T-S diagram we can define the process involve in it and how it works.

Following are the process in Rankine cycle:-

  • 1-2 Isentropic expansion of steam in Turbine
  • 2-3 Constant pressure heat removal in the Condenser
  • 3-4 Isentropic compression of water in the Pump
  • 4-1 Constant Pressure heat addition in the Boiler

1-2 Isentropic expansion of steam in Turbine

In process 1-2 Superheated steam from boiler strike on turbine blades to generate power output in which its expand without changing in entropy of the system. Temperature reduces from T1 to T2. Pressure and enthalpy also drops in this process from p1 to p2 and H1 to H2 respectively.

2-3 Constant pressure heat removal in the Condenser

In process 2-3 temperature and pressure remain constant steam give its latent heat and change its phase from vapour to liquid. Entropy in this process decreases from s2 to s3. and Enthalpy also reduce from H2 to H3.

3-4 Isentropic compression of water in the Pump

In this process pump increase the pressure and temperature of the liquid water and supply it to the boiler. Entropy and enthalpy remain same in this phase.

4-1 Constant Pressure heat addition in the Boiler

In this process water is heated to form superheated steam first phase change occur because of latent heat. And the vapor is converted into dry steam. Both entropy and enthalpy increases in this case.

From hear, we can start coding for Rankine Cycle simulator

Usually, it is good practice to begin the program with clearing all the previous inputs/ data, closing all the previous plots/figures and clearing command windows. Hence use below code to do that.

%% RANKINE CYCLE SIMULATOR
clear all                               % Clear all the previous inputs and data
close all                               % Close all plots and figure
clc                                     % Clear the command windows

First start with fprint command to print the name of the simulator in command window. To skip next line or to leave next line blank use ‘n’ as ‘enter’ button on the keyboard. Secondly define all the process sequence so that user can understand the sequence of the Rankine cycle processes. Again use skip for proper organized presentation.

%% Print Simulator name 
fprintf('               RANKINE CYCLE SIMULATOR            n');
 
fprintf('n') % skip line bank
 
%% Define/ print all the process in command box
disp('1-2 is Isentropic expansion in 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');
 
fprintf('n') % skip line bank

After that provide entities for the user which ask for the inputs as per following code:-

%% Entity requre to set input parameters
p1 = input('Enter of pressure at turbine inlet, p1(bar)     = ');
T1 = input('Enter of temperature at turbine inlet, T1(°C)   = ');
p2 = input('Enter of temperature at condenser inlet, p2(bar)= ');
 
fprintf('n')

Now, program the code to calculate entities at each point of the Rankine cycle. In normal practice we use Steam Table to find out the respective values but in this case we are going to use XSteam function to extract the value of properties in relation of other entities.

To select proper steam or liquid condition we refer T-S chart which we understood before.

For Example at point 1

Steam is at superheated reason according to T-S chart so we select ‘h_pT Entalpy as a function of pressure and temperature’ as it is not on saturated line and we have the input value of pressure and temperature at inlet on the turbine, using that we can find out value for enthalpy ‘h1’at point 1.

By using same procedure now we can find out value for Entropy ‘s1’.

So, we got value of entities for T-S and H-S plot at inlet of turbine, at point 1.

%% Extracting data - defining variables 
%% [1] Property of steam at point 1
     % Steam at the entry of the turbine
h1 = XSteam('h_pT', p1, T1);
s1 = XSteam('s_pT', p1, T1); 

Lets jump toward point 2, which is exit of turbine and also entry point of condenser

As it 1-2 was Isentropic expansion of steam in Turbine entropy will be same so s1= s2

Now their will be chances the vapors can leave the turbine could be superheated in some cases so we have to define it for both condition for that we are going to use both case using ‘if’,’else’ conditions. Using the relation of the dryness fraction we are going to implement that condition

Dryness fraction '`x`'can be calculated by following way,

`s2 = s f2 + x( s fg2)`

`s f g2 = s g 2-s f 2`

:. `x2 = (s 2- s f 2)/(s f g2)`

Then, temperature at point 2 can be calculated using following way

`s2 = sg2+CpV2xx(logfrac{T2}{Ts2})`

where,

`CpV_p`= Saturated vapour heat capacity

`logfrac{T2}{Ts2} = frac{s2-sg2}{CpV2}`

:. `frac{T2}{Ts2} =exp( frac{s2-sg2}{CpV2})`

:. `T2 =Ts2xxexp( frac{s2-sg2}{CpV2})`

Next, to calculate enthalpy use below formulas

hear to calculate enthalpy we are going to use condition. if condition of steam is vapour +liquid then we use below formula:-

`h2 = hf2 + x2xxhfg2`

Else, steam will be at its superheated condition so we implemet following formula for that:-

`h2 = hg2 + CpV2xx(T2-Ts2)`

So, the coding at point 2 will be-

%% [2] Property of steam at point 2 
     % Steam at the exit of the turbine
     
s2 = s1;
%For Dryness factor s2 = sf2 + x(sfg)
sf2 = XSteam('sL_p',p2);
sg2 = XSteam('sV_p',p2); 
sfg2 = sg2-sf2;
 
if(s2<=sg2)
    x2 = (s2-sf2)/(sfg2);
else
    x2 = 1;
end 
 
Ts2 = XSteam('Tsat_p',p2);
 
if (x2<1)
    T2 = Ts2;
else
    % s2 = sg2+CpV2*(log(T2/Ts2))
    % CpV_p Saturated vapour heat capacity
    CpV2 = XSteam('CpV_p',p2); 
    %(log(T2/Ts2)) = (s2-sg2)/CpV2
    % T2/Ts2 = exp((s2-sg2)/CpV2)
    % T2 = Ts2 * exp((s2-sg2)/CpV2)
    % add 273.15 to convert tempreture unit from degree Celsius to Kelvin
    T_2 = (Ts2+273.15)*exp((s2-sg2)/CpV2);
    T2 = T_2-273.15;
end
 
x2 = (s2-sf2)/(sfg2);
hf2 = XSteam('hL_p',p2);
hg2 = XSteam('hV_p',p2);
hfg2 = hg2-hf2;
%h2 = XSteam('h_ps',p2,s2);
if (x2<1)
    h2 = hf2 + x2*hfg2;
else
    h2 = hg2 + CpV2*(T2-Ts2);
end

Point 3 will be always positioned on the liquid saturated line as phase change occur in the condenser at constant pressure. From 2-3 heat is rejected at constant pressure in which vapor give its latent heat and convert into liquid water.

Other entities, Enthalpy, entropy, and Temperature, can be calculated using steam table or XSteam function, considering they are on the saturated liquid line.

%% [3] Property of steam at point 3
     % water and vapors after leaving condenser
p3 = p2;
h3 = hf2;
s3 = sf2;
T3 = Ts2;

After condensation, water is pumped with water pump towards the boiler. Pump pressurize the water from p3 to p1 so p1 is equal to p4.

This is Isentropic compression process where entropy remain same.

Here we consider reheating of water in order to improve net work, which increase the temperature and entropy of the system

In this process enthalpy also increases.

To calculate Enthalpy

Work Done by Pump:-

Energy in working fluid at output deducted by energy at input. Basicaly enthalpy difference.

`Wp = h4-h3`

and `Wp = v3(p4-p3)`

find `v3` from XSteam function.

:. `Wp = v3(p4-p3)xx100`

:. `h4 = h3 + Wp`

To calculate temperature

`s4 = s f4-cpL4xxlogfrac{Ts4}{T4}`

find out the values for `s f4`, `Ts4` and `CpL4` From XSteam function.

:. `frac{Ts4}{T4}=exp(frac{s f4-s4}{CpL4})`

:. `T4=frac{Ts4}{exp(frac{s f4-s4}{CpL4})}`

OR

`T4 = {T3}/{({p3}/{p4})^((k-1)/k})`

where,

`k = {Cp4}/{Cv4}`

value of `Cp4` and `Cv4` find with the help of XSteam function.

After implementing above formulas codes will look line this :-

%% [4] Property of steam at point 4
     % Water after leaving pump
p4 = p1;
s4 = s3;
%h4 = XSteam('h_ps',p4,s4);
%T4 = XSteam('T_ps',p4,s4);
% Work done to run pump = v3(p4-p3) = h4-h3
v3 = XSteam('vL_p',p3);
Wp = v3*(p4-p3)*100;
h4 = h3 + Wp;
 
 
% s4 = sf4-cpL4*log(Ts4/T4)
sf4 = XSteam('sL_p',p4);
Ts4 = XSteam('Tsat_p',p4);
CpL4 = XSteam('CpL_p',p4);
% log(Ts4/T4)=(sf4-s4)/CpL4
% Ts4/T4 = exp((sf4-s4)/CpL4)
T4 = Ts4/(exp((sf4-s4)/CpL4));
 
 
%----------- OR -----------%
%Cp4 = XSteam('Cp_ps',p4,s4);
%Cv4 = XSteam('Cv_ps',p4,s4);
%k = Cp4/Cv4;
%T4 = T3/(p3/p4)^((k-1)/k);

Upto this point, we got our state points for vapor and water, by using all the enthalpy at this points we can calculate Work done by each component in the system as Enthalpy differences indicate amount of energy produce or consumed by component.

Work done by Turbine:-

Work output from turbine can be calculated by deducting energy produce from energy supply.

`Wt = h1 - h2`

%% Work done by Turbine
Wt = h1 - h2;

Net work :-

Net work is work supplied removed from total work generated in the system.

`Wnet = Wt - Wp`

%% Net work 
Wnet = Wt - Wp;

Back work Ratio:-

Back work Ratio (BWR) is the ratio of pump work to turbine work.

`BWR = {Wp}/{Wt}`

%% Back work Ratio
BWR = (Wp/Wt);

Heat into the system:-

It is the total heat supplied in boiler, calculated by enthalpy difference at boiler in and out.

`Qi n = h1 - h4`

%% Heat into the system
Qin = h1 - h4;

Heat Out of the system:-

It is the total heat Rejected in condenser, calculated by enthalpy difference at condenser in and out.

`Qout = h2 - h3`

%% Heat Out of the system
Qout = h2 - h3;

Thermal Efficiency:-

The thermal efficiency of the Rankine cycle is the ratio between the work produced by the steam turbine that has been reduced by the pump work, with the incoming heat energy from the boiler.

`T eff = (1-{Qout}/{Qi n})xx100`

%% Thermal Efficiency
eff = (1-(Qout/Qin))*100;

Specific Steam Consumption:-

Specific Steam consumption is the ration of mass flow rate to the power .

It relates the power output to the steam flow necessary to produce steam. The steam flow indicates the size of plart, and the specific steam consumption is a means whereby the relative sizes of different plants can be compare.

The specific steam consumption is the steam flow in kw/h required to develop 1 kw power.

`SSC = {mass flow rate}/{power}`

%% Specific Steam Consumption
   % SSC = mass flow rate/power
SSC = (3600/Wnet);

Find out all the requried point on the saturated vapour and liquid line, from XSteam function.

%% Calculating temperature, entropy and enthalpy at the saturated vapour and liquid line
   % Line for Plotting
T1_1 = XSteam('Tsat_p',p1);
T4_1 = T1_1;
s4_1 = XSteam('sL_p',p4);
hf4  = XSteam('hL_p',p4);
h4_1  = hf4;
s1_1 = XSteam('sV_p',p1);
h1_1 = XSteam('hV_p',p1);
T2_1 = XSteam('T_ps',p2,s2);

Extract out all the entopy, enthalpy points at aprox 0 bar pressure from XSteam function to plot saturated liquid - vapour line.

%% Create Entophy Enthapy point at 0 constant pressure range
p = 0.01:0.01:400;
for i = 1:length(p)
    T(i) = XSteam('Tsat_p',p(i)); 
    sf(i) = XSteam('sL_T',p(i));
    sg(i) = XSteam('sv_T',p(i));
    hf(i) = XSteam('hl_T',p(i));
    hg(i) = XSteam('hv_T',p(i));
end

Plotting T-S diagram:-

First plot saturated liquid - vapour line

Then plot other entities using calculated point. use range fo data to create proper curve.

%% Plotting T-S diagram
figure(1)
hold on
 
% Plot saturated vapour and liquid line
plot(sf,p,':','color','g','linewidth',2)
plot(sg,p,':','color','g','linewidth',2)
 
% [1-2] Isentropic expansion of steam in Turbine
plot([s1 s2],[T1 T2], 'm', 'linewidth',1)
 
 
% [2-3] Constant pressure heat removal in the Condenser
if (x2<1)
    str2=0;
    plot(s2,T2,'.');
    plot([s2 s3],[T2 T3],'k', 'linewidth',1);
else
    st2 = linspace(s2,sg2,500);
    for j = 1:length(st2)
        Tt2(j) = XSteam('T_ps',p2,st2(j));
    end
    plot(st2,Tt2,'m', 'linewidth',1);
    plot([sg2 s3],[T3 T3],'m', 'linewidth',1);
end
 
 
% [3-4] Isentropic compression of water in the Pump
plot([s3 s4],[T3 T4], 'b', 'linewidth',1)
 
Tr = linspace(T4,T1_1,20);
hr = linspace(h4,hf4,20);
for r = 1:length(hr)
    sr(r) = XSteam('s_ph',p4,hr(r));
end
plot(sr,Tr,'b','linewidth',1)
 
sp1 = linspace(s4,s4_1,500);
for f = 1:length(sp1)
    Tp1(f) = XSteam('T_ps',p1,sp1(f));
end
plot(sp1,Tp1,'color','c','linewidth',2)
 
 
% [4-1] Constant Pressure heat addition in the Boiler
plot([s4_1 s1_1],[T4_1 T1_1], 'r', 'linewidth',1)
sb1 = linspace(s1_1,s1,500);
for l = 1:length(sb1)
    Tc1(l) = XSteam('T_ps',p1,sb1(l));
end
plot(sb1, Tc1, 'r', 'linewidth',1)
 
 
% [1-2-3-4] Labeling points 
text(s1+0.1,T1,'1')
text(s1_1-0.3,T1_1-10,"1'")
text(s2+0.1,T2,'2')
if (x2<1)
   str2=0;
else
   text(sg2+0.1,T3,"2'")
end
text(s3,T3-20,'3')
text(s4,T4+20,'4')
text(s4_1,T4_1-10,"4'")
 
title('Temperature vs Entropy plot')            % Title for the diagram 
xlabel('S (Entropy in J/K)')                    % label X-axis
ylabel('T (Temperature in °C)')                 % label Y-axis
 
% Legend for saturated line
legend('saturated liquid and vapour line','location','northwest') 
grid on                                         % Turn on the grid
hold off                                        % Turn off hold on of current plot

Output of Plot T-S diagram:-

Plotting h-s diagram:-

First plot saturated liquid - vapour line

Then plot other entities using calculated point. use range fo data to create proper curve.

following are the codes to plot h-s diagram

%% Plotting h-s diagram
figure(2)
hold on
 
% Plot saturated vapour and liquid line
plot(sf, hf,':','color','g','linewidth',2)
plot(sg, hg,':','color','g','linewidth',2)
 
% [1-2] Isentropic expansion of steam in Turbine
plot([s1 s2],[h1 h2],'m','linewidth',1)
 
% [2-3] Constant pressure heat removal in the Condenser
plot([s2 s3],[h2 h3],'k','linewidth',1)
 
% [3-4] Isentropic compression of water in the Pump
plot([s3 s4],[h3 h4],'b','linewidth',1)
 
% [4-1] Constant Pressure heat addition in the Boiler
hc = linspace(h4,h4_1,100);
for k = 1:length(hc);
    sch(k) = XSteam('s_ph',p1,hc(k));
end
plot(sch,hc,'r','linewidth',1)
plot([s4_1 s1],[h4_1 h1],'r','linewidth',1)
 
 
% [1-2-3-4] Labeling points 
text(s1+0.1,h1,'1')
text(s2+0.1,h2,'2')
text(s3+0.3, h3,'3,4')
text(s4+0.3, h4,'3,4')
 
title('Enthalpy vs Entropy plot')               % Title for the diagram
xlabel('S (Entropy in KJ/kgk)')                 % label X-axis
ylabel('H (Enthalpy in KJ/kg)')                 % label Y-axis
 
% Legend for saturated line
legend('saturated liquid and vapour line','location','northwest')
grid on                                         % Turn on the grid
hold off                                        % Turn off hold on of current plot

Output of above code to create h-s diagram:-

Print all the results in the command window:-

following are the codes to print all the Results and output of the Rankine Cycle Simulator

%% Displaying Results
   % print all the state points parameters and outputs in command window 
fprintf('     Results    n')
 
fprintf('n') % skip line bank
 
 
fprintf('At State Point 1 n')
fprintf('p1: %.3f bar n',p1)
fprintf('T1: %.3f °C n', T1)
fprintf('h1: %.3f KJ/Kg n',h1)
fprintf('s1: %.3f Kj/Kgk n',s1)
 
fprintf('n') % skip line bank
 
 
fprintf('At State Point 2 n')
fprintf('p2: %.3f bar n',p2)
fprintf('T2: %.3f °C n', T2)
fprintf('h2: %.3f KJ/Kg n',h2)
fprintf('s2: %.3f Kj/Kgk n',s2)
 
fprintf('n') % skip line bank
 
 
fprintf('At State Point 3 n')
fprintf('p3: %.3f bar n',p3)
fprintf('T3: %.3f °C n', T3)
fprintf('h3: %.3f KJ/Kg n',h3)
fprintf('s3: %.3f Kj/Kgk n',s3)
 
fprintf('n') % skip line bank
 
 
fprintf('At State Point 4 n')
fprintf('p4 : %.3f bar n',p4)
fprintf('T4 : %.3f °C n', T4)
fprintf('h4 : %.3f KJ/Kg n',h4)
fprintf('s4 : %.3f Kj/Kgk n',s4)

Results:-

Error faced during Programming

[1] CpL4 is not defined in the program.

[2] Typo error while providing pressure range, miss typed capital ‘P’.

[3] Miss typed capital ‘P’

[4] Typo error - small ‘s’ in XStream name

[5] Typed ‘T4s’ instead of ‘Ts4’

[6] CpV2 is not defined in the program.

[7] Missing ‘=’ sign in loop.

[8] 'sf1' is not defined in the program.

[9] For loop string name not mentioned in entities of the loop.

Conclusion:-

  • Rankine cycle is use in Thermal power plant so it is vital to understand as its help to calculate all the properties of the steam so that it gives ease to improve power output and efficiency of the plant.
  • As water is the working fluid it is necessity to understand all its properties for this cycle, which we get to learn in this project.
  • Setting/ coding one program to calculate all the plots/figures and steam property at every stage of Rankin cycle will we easy for any one , as one have to put just three input, p1, T1 and p2, even non-technical person can simulate it.
  • At last, This simulator help to reduce enormous amount of time to generate results.

References:-

[1] K. Rajput- Thermal Engineering - Book

[2] Cengel and Boles - Thermodynamics an engineering approach - Book

[3] Learn Thermo - https://www.learnthermo.com/T1-tutorial/ch09/lesson-E/pg10.php#:~:text=Back%20Work%20Ratio&text=The%20fraction%20of%20the%20work,is%20consumed%20by%20the%20compressor.

[4] Ahmad Hussain- The steam powered cycle -https://www.slideshare.net/ahmad_hussain/unit11-13508873

Complete program:-

%% RANKINE CYCLE SIMULATOR
clear all                               % Clear all the previous inputs and data
close all                               % Close all plots and figure
clc                                     % Clear the command windows


%% Print Simulator name 
fprintf('               RANKINE CYCLE SIMULATOR            n');

fprintf('n') % skip line bank

%% Define/ print all the process in command box
disp('1-2 is Isentropic expansion in 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');

fprintf('n') % skip line bank



%% Entity requre to set input parameters
p1 = input('Enter of pressure at turbine inlet, p1(bar)     = ');
T1 = input('Enter of temperature at turbine inlet, T1(°C)   = ');
p2 = input('Enter of temperature at condenser inlet, p2(bar)= ');

fprintf('n')


%% Extracting data - defining variables 

%% [1] Property of steam at point 1
     % Steam at the entry of the turbine
h1 = XSteam('h_pT', p1, T1);
s1 = XSteam('s_pT', p1, T1); 



%% [2] Property of steam at point 2 
     % Steam at the exit of the turbine
     
s2 = s1;
%For Dryness factor s2 = sf2 + x(sfg)
sf2 = XSteam('sL_p',p2);
sg2 = XSteam('sV_p',p2); 
sfg2 = sg2-sf2;

if(s2<=sg2)
    x2 = (s2-sf2)/(sfg2);
else
    x2 = 1;
end 

Ts2 = XSteam('Tsat_p',p2);

if (x2<1)
    T2 = Ts2;
else
    % s2 = sg2+CpV2*(log(T2/Ts2))
    % CpV_p	Saturated vapour heat capacity
     CpV2 = XSteam('CpV_p',p2); 
    %(log(T2/Ts2)) = (s2-sg2)/CpV2
    % T2/Ts2 = exp((s2-sg2)/CpV2)
    % T2 = Ts2 * exp((s2-sg2)/CpV2)
    % add 273.15 to convert tempreture unit from degree Celsius to Kelvin
    T_2 = (Ts2+273.15)*exp((s2-sg2)/CpV2);
    T2 = T_2-273.15;
end

x2 = (s2-sf2)/(sfg2);
hf2 = XSteam('hL_p',p2);
hg2 = XSteam('hV_p',p2);
hfg2 = hg2-hf2;
%h2 = XSteam('h_ps',p2,s2);
if (x2<1)
    h2 = hf2 + x2*hfg2;
else
    h2 = hg2 + CpV2*(T2-Ts2);
end



%% [3] Property of steam at point 3
     % water and vapors after leaving condenser
p3 = p2;
h3 = hf2;
s3 = sf2;
T3 = Ts2;



%% [4] Property of steam at point 4
     % Water after leaving pump
p4 = p1;
s4 = s3;
%h4 = XSteam('h_ps',p4,s4);
%T4 = XSteam('T_ps',p4,s4);
% Work done to run pump = v3(p4-p3) = h4-h3
v3 = XSteam('vL_p',p3);
Wp = v3*(p4-p3)*100;
h4 = h3 + Wp;


% s4 = sf4-cpL4*log(Ts4/T4)
sf4 = XSteam('sL_p',p4);
Ts4 = XSteam('Tsat_p',p4);
CpL4 = XSteam('CpL_p',p4);
% log(Ts4/T4)=(sf4-s4)/CpL4
% Ts4/T4 = exp((sf4-s4)/CpL4)
T4 = Ts4/(exp((sf4-s4)/CpL4));


%----------- OR -----------%
%Cp4 = XSteam('Cp_ps',p4,s4);
%Cv4 = XSteam('Cv_ps',p4,s4);
%k = Cp4/Cv4;
%T4 = T3/(p3/p4)^((k-1)/k);
%----------- OR -----------%
%T4 = XSteam('T_ps',p4,s4);



%% Work done by Turbine
   %Net work out
Wt = h1 - h2;


%% Net work in
Wnet = Wt - Wp;

%% Back work Ratio
BWR = (Wp/Wt);

%% Heat into the system
Qin = h1 - h4;


%% Heat Out of the system
Qout = h2 - h3;

%% Thermal Efficiency
eff = (1-(Qout/Qin))*100;


%% Specific Steam Consumption
   % SSC = mass flow rate/power
SSC = (3600/Wnet);


%% Calculating temperature, entropy and enthalpy at the saturated vapour and liquid line
   % Line for Plotting
T1_1 = XSteam('Tsat_p',p1);
T4_1 = T1_1;
s4_1 = XSteam('sL_p',p4);
hf4  = XSteam('hL_p',p4);
h4_1  = hf4;
s1_1 = XSteam('sV_p',p1);
h1_1 = XSteam('hV_p',p1);
T2_1 = XSteam('T_ps',p2,s2);


%% Create Entophy Enthapy point at 0 constant pressure range
p = 0.01:0.01:400;
for i = 1:length(p)
    T(i) = XSteam('Tsat_p',p(i)); 
    sf(i) = XSteam('sL_T',p(i));
    sg(i) = XSteam('sv_T',p(i));
    hf(i) = XSteam('hl_T',p(i));
    hg(i) = XSteam('hv_T',p(i));
end



%% Plotting T-S diagram
figure(1)
hold on

% Plot saturated vapour and liquid line
plot(sf,p,':','color','g','linewidth',2)
plot(sg,p,':','color','g','linewidth',2)

% [1-2] Isentropic expansion of steam in Turbine
plot([s1 s2],[T1 T2], 'm', 'linewidth',1)


% [2-3] Constant pressure heat removal in the Condenser
if (x2<1)
    str2=0;
    plot(s2,T2,'.');
    plot([s2 s3],[T2 T3],'k', 'linewidth',1);
else
    st2 = linspace(s2,sg2,500);
    for j = 1:length(st2)
        Tt2(j) = XSteam('T_ps',p2,st2(j));
    end
    plot(st2,Tt2,'m', 'linewidth',1);
    plot([sg2 s3],[T3 T3],'m', 'linewidth',1);
end


% [3-4] Isentropic compression of water in the Pump
plot([s3 s4],[T3 T4], 'b', 'linewidth',1)

Tr = linspace(T4,T1_1,20);
hr = linspace(h4,hf4,20);
for r = 1:length(hr)
    sr(r) = XSteam('s_ph',p4,hr(r));
end
plot(sr,Tr,'b','linewidth',1)

sp1 = linspace(s4,s4_1,500);
for f = 1:length(sp1)
    Tp1(f) = XSteam('T_ps',p1,sp1(f));
end
plot(sp1,Tp1,'color','c','linewidth',2)


% [4-1] Constant Pressure heat addition in the Boiler
plot([s4_1 s1_1],[T4_1 T1_1], 'r', 'linewidth',1)
sb1 = linspace(s1_1,s1,500);
for l = 1:length(sb1)
    Tc1(l) = XSteam('T_ps',p1,sb1(l));
end
plot(sb1, Tc1, 'r', 'linewidth',1)


% [1-2-3-4] Labeling points 
text(s1+0.1,T1,'1')
text(s1_1-0.3,T1_1-10,"1'")
text(s2+0.1,T2,'2')
if (x2<1)
   str2=0;
else
   text(sg2+0.1,T3,"2'")
end
text(s3,T3-20,'3')
text(s4,T4+20,'4')
text(s4_1,T4_1-10,"4'")

title('Temperature vs Entropy plot')            % Title for the diagram 
xlabel('S (Entropy in J/K)')                    % label X-axis
ylabel('T (Temperature in °C)')                 % label Y-axis

% Legend for saturated line
legend('saturated liquid and vapour line','location','northwest') 
grid on                                         % Turn on the grid
hold off                                        % Turn off hold on of current plot



%% Plotting h-s diagram
figure(2)
hold on

% Plot saturated vapour and liquid line
plot(sf, hf,':','color','g','linewidth',2)
plot(sg, hg,':','color','g','linewidth',2)

% [1-2] Isentropic expansion of steam in Turbine
plot([s1 s2],[h1 h2],'m','linewidth',1)

% [2-3] Constant pressure heat removal in the Condenser
plot([s2 s3],[h2 h3],'k','linewidth',1)

% [3-4] Isentropic compression of water in the Pump
plot([s3 s4],[h3 h4],'b','linewidth',1)

% [4-1] Constant Pressure heat addition in the Boiler
hc = linspace(h4,h4_1,100);
for k = 1:length(hc);
    sch(k) = XSteam('s_ph',p1,hc(k));
end
plot(sch,hc,'r','linewidth',1)
plot([s4_1 s1],[h4_1 h1],'r','linewidth',1)


% [1-2-3-4] Labeling points 
text(s1+0.1,h1,'1')
text(s2+0.1,h2,'2')
text(s3+0.3, h3,'3,4')
text(s4+0.3, h4,'3,4')

title('Enthalpy vs Entropy plot')               % Title for the diagram
xlabel('S (Entropy in KJ/kgk)')                 % label X-axis
ylabel('H (Enthalpy in KJ/kg)')                 % label Y-axis

% Legend for saturated line
legend('saturated liquid and vapour line','location','northwest')
grid on                                         % Turn on the grid
hold off                                        % Turn off hold on of current plot



%% Displaying Results
   % print all the state points parameters and outputs in command window 
fprintf('     Results    n')

fprintf('n') % skip line bank


fprintf('At State Point 1 n')
fprintf('p1: %.3f bar n',p1)
fprintf('T1: %.3f °C n', T1)
fprintf('h1: %.3f KJ/Kg n',h1)
fprintf('s1: %.3f Kj/Kgk n',s1)

fprintf('n') % skip line bank


fprintf('At State Point 2 n')
fprintf('p2: %.3f bar n',p2)
fprintf('T2: %.3f °C n', T2)
fprintf('h2: %.3f KJ/Kg n',h2)
fprintf('s2: %.3f Kj/Kgk n',s2)

fprintf('n') % skip line bank


fprintf('At State Point 3 n')
fprintf('p3: %.3f bar n',p3)
fprintf('T3: %.3f °C n', T3)
fprintf('h3: %.3f KJ/Kg n',h3)
fprintf('s3: %.3f Kj/Kgk n',s3)

fprintf('n') % skip line bank


fprintf('At State Point 4 n')
fprintf('p4 : %.3f bar n',p4)
fprintf('T4 : %.3f °C n', T4)
fprintf('h4 : %.3f KJ/Kg n',h4)
fprintf('s4 : %.3f Kj/Kgk n',s4)

fprintf('n') % skip line bank


fprintf('Turbine Work   : %.3f KJ/Kg  n',Wt)
fprintf('Punp Work      : %.3f KJ/Kg  n',Wp)
fprintf('Efficiency     : %.2f%%',eff)
fprintf('n')
fprintf('S.S.C          : %.3f KJ/KWh n',SSC)
fprintf('Net Work out   : %.3f KJ/Kg  n',Wnet)
fprintf('Back work Ratio: %.4f KJ/Kg  n',BWR)

%-----------------------------------end-----------------------------------%

[1] - For input :- P1=30 bar; T1=400°C; P2=0.05bar

Results:-

[2] - For input :- P1=44 bar; T1=538°C; P2=5.83bar

Results:-

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.

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.