Challenge

Rankine cycle Simulator

RANKINE CYCLE SIMULATOR using MATLAB

Theory:

The Rankine cycle is a model used to predict the performance of steam turbine systems. It was also used to study the performance of reciprocating steam engines. The Rankine cycle is an idealized thermodynamic cycle of a heat engine that converts heat into mechanical work while undergoing 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. It is named after William John Macquorn Rankine, a Scottish polymath and Glasgow University professor.

The four processes in the Rankine cycle

There are four processes in the Rankine cycle. The states are identified by numbers in the T–s diagram.

  1. 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. In other words, Process 3-4 is Isentropic compression.
  2. 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 vapour. The input energy required can be easily calculated graphically, using an enthalpy–entropy chart (h–s chart, or Mollier diagram), or numerically, using steam tables. In other words, Process 4-1 is Constant pressure heat addition in boiler.
  3. Process 1-2: 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 chart or tables noted above. In other words, Process 1-2 is Isentropic expansion.
  4. Process 2-3: The wet vapour then enters a condenser, where it is condensed at a constant pressure to become a saturated liquid. In other words, Process 2-3 is Constant pressure heat rejection in condenser.

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 net work 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, which reduces the energy removed by the condensers. ref[1]

Equations and terminologies related to performance of Rankine cycle

  • SFEE (Steady Flow Energy Equation) for turbine

`W_(turb)= m*(h_1-h_2 )`

Considering mass flow rate of steam to be 1 kg/sec in the entire system

`W_(turb)= h_1-h_2`

  • SFEE (Steady Flow Energy Equation) for condenser

`Q_(rejected)= h_2-h_3`

  • SFEE (Steady Flow Energy Equation) for pump

`W_(pump= h_4-h_3`

  • SFEE (Steady Flow Energy Equation) for Boiler

`Q_(sp)= h_1-h_4`

  • Thermal Efficiency of the Cycle

`η_(th)=1-(Q_(rejected)/Q_(spp))`

  • Net work output

`W=W_(turb)-W_(pump)`

  • Back Work Ratio

`BWR=W_(pump)/W_(turb)`

  • Specific Steam Consumption

The capacity of a steam plant is often expressed in terms of steam rate or specific steam consumption which is defined as the rate of steam flow (kg/sec) required to produce unit shaft output.

`SSC= 3600/W`

where, `W_(turb)` = Work done by the turbine (kJ/kg)

`m` = mass flow rate of steam (kg/sec)

`h_1` = Enthalpy at the inlet of the turbine or at the exit of the Boiler (kJ/kg)

`h_2` = Enthalpy at the exit of the turbine or at the inlet of the COndenser (kJ/kg)

`h_3` = Enthaalpy at the inlet of the pump or at the exit of the Condenser (kJ/kg)

`h_4` = Enthalpy at the inlet of boiler or at the exit of the pump (kJ/kg)

`Q_(sp)` = Heat supplied in the boiler (kJ)

`Q_(rejected)` = Heat rejected in condenser (kJ)

`W_(pump)` = Work done by the pump (kJ/kg)

Two Different methods were adopted to make the Rankine Cycle Simulator which are discussed as below:

Method I : Using XSteam sub funcion

%% RANKINE CYCLE SIMULATOR
%% METHOD I

clear all
close all
format compact
clc

%INPUTS
fprintf('--------------------RANKINE CYCLE SIMULATOR-------------------- \n');
T1 = input('Enter the Inlet Temperature of Turbine (in degree Celcius): ');
if T1 < 100 
    error('Inlet Temperture must be above the saturation temperature of water i.e 100 degree C. Please Rerun the program ensuring this error')
end
    
P_high = input('Enter the boiler pressure(in bar): ');
if P_high > 220
    error ('Boiler pressure cannot be higher than critical pressure of water. Please Rerun the program ensuring this error')
else if P_high < 1
        error ('Practically, Boiler pressure cannot be equal to this value, please enter a valid value which musb be above 1 bar')
    end
end

P_low = input('Enter the Condenser pressure(in bar): ');
if P_low < 0.01
    error ('Condenser pressure cannot have such a low value. Please Rerun the program ensuring this error')
end

% Properties at state points
s1 = XSteam('s_pT',P_high,T1);
h1 = XSteam('h_pT',P_high,T1);

T2 = XSteam('Tsat_p',P_low);
s2_ideal = s1;
s2 = XSteam('sV_p',P_low);
h2 = XSteam('hV_p',P_low);

T3 = XSteam('Tsat_p',P_low);
s3 = XSteam('sL_p',P_low);
h3 = XSteam('hL_p',P_low);
v3 = XSteam('vL_p',P_low);

% PUMP WORK = h4 - h3 = v3*(P_high - P_low)*100 where, v3 = m^3/kg and
%pressure is in bar
W_pump = v3*(P_high - P_low)*100;
h4 = h3 + W_pump;
T4 = XSteam('T_ph',P_high,h4);
s4 = s3;
% s4 = XSteam('s_ph',P_high,T4);

Ta = XSteam('Tsat_p',P_high);
sa = XSteam('sL_p',P_high);
ha = XSteam('hL_p',P_high);

Tb = Ta;
sb = XSteam('sV_p',P_high);
hb = XSteam('hV_p',P_high);

S = [s1 s2 s3 s4];
H = [h1 h2 h3 h4];

% PLOTTING THE DOME 
% SATURATED REGION DATA
temp = linspace(1, 373, 500);
for i = 1 : length(temp)
     H_L(i) = XSteam('hL_T', temp(i));
     H_V(i) = XSteam('hV_T', temp(i));
     S_L(i) = XSteam('sL_T', temp(i));
     S_V(i) = XSteam('sV_T', temp(i));
end

% APPROXIMATE ENTROPY AT CRITICAL POINT
SL_app = XSteam('sL_T',373);
SV_app = XSteam('sV_T',373);
S_critical = (SL_app + SV_app)/2;

% APPROXIMATE ENTHALPY AT CRITICAL POINT
HL_app = XSteam('hL_T',373);
HV_app = XSteam('hV_T',373);
H_critical = (HL_app + HV_app)/2;

% SUPERHEATED REGION DATA
temp1 = linspace(Tb,T1,150);
for i = 1 : length(temp1)
    Ssup(i) = XSteam('s_pT',P_high,temp1(i));
end

% SUBCOOLED REGION DATA
temp3 = linspace(T4,Ta,150);
for i = 1 : length(temp3)
    Ssub(i) = XSteam('s_pT',P_low,temp3(i));
end

% PLOTTING THE TS DOME
figure(1)
hold on
plot(S_L, temp, 'b', 'linestyle','-','linewidth', 1)
plot(S_V, temp, 'b', 'linestyle','-','linewidth', 1)
plot(Ssup,temp1,'r')
plot(Ssub,temp3,'r')

% PLOTTING THE STATE POINTS in TS PLANE
xlabel('Entropy (kJ/K)')
ylabel('Temperature (\circC)')
title('TS plot of Rankine Cycle')
grid on
axis([0 10 0 (T1+50)])
plot(s1,T1,'s','color','k')
text(s1+0.25,T1,'1')
plot(s2,T2,'s','color','k')
text(s2+0.25,T2,'2')
plot(s3,T3,'s','color','k')
text(s3,T3-15,'3')
plot(s4,T4,'s','color','k')
text(s4-0.1,T4+15,'4')
plot(sa,Ta,'s','color','k')
text(sa+0.1,Ta-10,'a')
plot(sb,Tb,'s','color','k')
text(sb+0.1,Tb,'b','FontSize',10)
plot([sa sb],[Ta Tb],'color','r')
plot([s2 s3],[T2 T3],'color','r')
plot([s3 s4],[T3 T4],'color','r')
plot([s1 s2],[T1 T2],'color','r')
plot([s4 sa],[T4 Ta],'color','r')
plot(S_critical,373,'*','MarkerSize',10,'color','b')
text(S_critical,373+15,'CP','color','b')

% PLOTTING THE HS DOME
figure(2)
hold on
plot(S_L, H_L, 'b', 'linestyle','-','linewidth', 1)
plot(S_V, H_V, 'b', 'linestyle','-','linewidth', 1)
xlabel('Entropy (kJ/K)')
ylabel('Enthalpy (kJ/kg)')
title('HS plot of Rankine Cycle')
grid on
axis([0 10 0 h1+500])

% PLOTTING THE STATE POINTS in HS PLANE
H_crit_V = XSteam('hV_T',373);
H_crit_s = XSteam('hL_T',373);
H_critical = (H_crit_V + H_crit_s)/2;

plot(s1,h1,'s','color','k')
text(s1+0.25,h1,'1')
plot(s2,h2,'s','color','k')
text(s2,h2-100,'2')
plot(s3,h3,'s','color','k')
text(s3+0.1,h3-15,'3')
plot(s4,h4,'s','color','k')
text(s4,h4+100,'4')
plot(sa,ha,'s','color','k')
text(sa+0.1,ha-10,'a')
plot(sb,hb,'s','color','k')
text(sb,hb-150,'b','FontSize',10)
plot([s2 s3],[h2 h3],'color','r')
plot([s3 s4],[h3 h4],'color','r')
plot([s4 sa],[h4 ha],'color','r')
plot([sa sb],[ha hb],'color','r')
plot([sb,s1],[hb,h1],'color','r')
plot([s1 s2],[h1 h2],'color','r')
plot(S_critical,H_critical,'*','MarkerSize',10,'color','b')
text(S_critical-0.5,H_critical+200,'CP','color','b')


% PERFORMANCE PARAMETERS
W_turbine = h1 - h2;
Q_supplied = h1 - h4;
Q_rejected = h2 - h3;
W_net = W_turbine - W_pump;

% Efficiency of Rankine cycle
efficy = (1 - (Q_rejected/Q_supplied))*100;

% Specific Steam Consumption kg/kW.hr
SSC = 3600/W_net;

% Back Work Ratio
BWR = W_pump/W_turbine;

% CREATING STRUCTURE FOR DISPLAYING IMPORTANT DATA
Results.Boiler_Pressure = P_high;
Results.Condenser_Pressure = P_low;
Results.Heat_Supplied = Q_supplied;
Results.Heat_Rejected = Q_rejected;
Results.Turbine_Work = W_turbine;
Results.Pump_Work = W_pump;
Results.Net_Work_output = W_net;
Results.Back_Work_Ratio = BWR;
Results.Efficiency = efficy;
Results.Specific_Steam_Consumption = SSC;
fprintf('\n')
fprintf('----------------------------RESULTS----------------------------\n')
Results

% TABLE CONTATING STATE PROPERTIES
STATES = {'1';'2';'3';'4'};
TEMPERATURE = [T1; T2; T3; T4];
ENTHALPY = [h1; h2; h3; h4];
ENTROPY = [s1; s2; s3; s4];

% DISPLAYING STATE CONDITIONS
fprintf('\n')
fprintf('FOLLOWING ARE THE THERMODYNANIC PROPERTIES AT 4 STATES \n')
fprintf('TEMPERATURE(Degree C), ENTHALPY(kJ/kg),ENTROPY(kJ/kg.K)\n')
T = table(STATES,TEMPERATURE,ENTHALPY,ENTROPY)
fprintf('\n')
fprintf('-------------DETAILS OF THE PROCESS SHOWN IN PLOTS-------------\n')
fprintf('1-2 is Isentropic Expansion in Turbine \n')
fprintf('2-3 is Constant Pressure Heat Rejection in Condenser \n')
fprintf('3-4 is Isentropic Compression in Pump \n')
fprintf('4-1 is Constant Pressure Heat Addition in Boiler \n')

Code Explanation

  1. Code is started with clearing and closing all the previous commands present in the current window.
  2. Then the three starting inputs to the Rankine Cycle (Maximum Turbine Inlet temperature, Boiler Pressure and Condenser pressure) are asked from the user using input.
  3. error commands are used for fool proofing the simulator so that the user doesn’t enter any invalid inputs.
  4. Then the state properties (enthalpy, temperature and entropy) are all calculated from XSteam subfunction. Note: Just make sure that while running the Program, the directory must contain the XSteam sub-function within it. ref
  5. As we know that steam being a binary phase mixture, we need to first define the dome in order to plot the plots. So, a for loop is used to calculate all the liquid and vapor entropy from 0 to 373 degree Celsius.
  6. Similarly, liquid and vapor enthalpy is also calculated as mentioned I the above step in order to plot HS diagram.
  7. Then TS and HS plots are made by plotting all the state points and joining them according to the relation as explained in the theory.
  8. The points are also marked by using text ref
  9. Finally a structure is made with the fields as follows:
    • Boiler pressure
    • Condenser pressure
    • Heat Supplied
    • Heat Rejected
    • Turbine Work
    • Pump Work
    • Thermal Efficiency
    • Net Work output
    • Back Work Ratio
    • Specific Steam Consumption
  10. The above structure is Displayed just by entering ‘Results’ in the command Window.
  11. Finally, a table is made that contains all the details of state properties and is displayed on the command Window. ref

Outputs Generated

Method II: Using thermo_ diagram_plot sub funcion

%% RANKINE CYCLE SIMULATOR
%% METHOD 2 USING SUB FUNCTION

clear all
close all
clc

% INPUTS
fprintf('--------------------RANKINE CYCLE SIMULATOR-------------------- \n');
T1 = input('Enter the Inlet Temperature of Turbine (in degree Celcius): ');
if T1 < 100 
    error('Inlet Temperture must be above the saturation temperature of water i.e 100 degree C. Please Rerun the program ensuring this error')
end
    
P_high = input('Enter the boiler pressure(in bar): ');
if P_high > 220
    error ('Boiler pressure cannot be higher than critical pressure of water. Please Rerun the program ensuring this error')
else if P_high < 1
        error ('Practically, Boiler pressure cannot be equal to this value, please enter a valid value which musb be above 1 bar')
    end
end

P_low = input('Enter the Condenser pressure(in bar): ');
if P_low < 0.01
    error ('Condenser pressure cannot have such a low value. Please Rerun the program ensuring this error')
end

% Properties at state points
s1 = XSteam('s_pT',P_high,T1);
h1 = XSteam('h_pT',P_high,T1);

T2 = XSteam('Tsat_p',P_low);
s2_ideal = s1;
s2 = XSteam('sV_p',P_low);
h2 = XSteam('hV_p',P_low);

T3 = XSteam('Tsat_p',P_low);
s3 = XSteam('sL_p',P_low);
h3 = XSteam('hL_p',P_low);
v3 = XSteam('vL_p',P_low);

% PUMP WORK = h4 - h3 = v3*(P_high - P_low)*100 where, v3 = m^3/kg and
%pressure is in bar
W_pump = v3*(P_high - P_low)*100;
h4 = h3 + W_pump;
T4 = XSteam('T_ph',P_high,h4);
s4 = s3;
% s4 = XSteam('s_ph',P_high,T4);

Ta = XSteam('Tsat_p',P_high);
sa = XSteam('sL_p',P_high);
ha = XSteam('hL_p',P_high);

Tb = Ta;
sb = XSteam('sV_p',P_high);
hb = XSteam('hV_p',P_high);

% ARRAY OF STATE POINTS
S = [s1 s2 s3 s4];
H = [h1 h2 h3 h4];
T = [T1 T2 T3 T4];
P = [P_high P_low P_low P_high];

% TS PLOT FOR RANKINE CYCLE
p_sub = [P_high P_low];
[temp5 ,temp6] = thermo_diagram_plot('Ts',p_sub,'Legend','off','XLim',[-1 10],...
    'YLim',[-100 700]);
hold on
title('TS plot of Rankine Cycle')
plot(s1,T1,'s','color','k')
text(s1+0.25,T1,'1')
plot(s2,T2,'s','color','k')
text(s2+0.25,T2,'2')
plot(s3,T3,'s','color','k')
text(s3,T3-15,'3')
plot(s4,T4,'s','color','k')
text(s4-0.1,T4+15,'4')
plot(sa,Ta,'s','color','k')
text(sa+0.1,Ta-10,'a')
plot(sb,Tb,'s','color','k')
text(sb+0.1,Tb,'b','FontSize',10)
plot([sa sb],[Ta Tb],'color','r')
plot([s2 s3],[T2 T3],'color','r')
plot([s3 s4],[T3 T4],'color','r')
plot([s1 s2],[T1 T2],'color','r')
plot([s4 sa],[T4 Ta],'color','r')

% HS PLOT FOR RANKINE CYCLE
[temp3,temp4] = thermo_diagram_plot('hs',p_sub,'MultiplePoints','On', ...
'XLim',[-1 10],'YLim',[-100 5000],'Legend','off');
hold on
title('HS plot of Rankine Cycle')
plot(s1,h1,'s','color','k')
text(s1+0.25,h1+100,'1')
plot(s2,h2,'s','color','k')
text(s2,h2-200,'2')
plot(s3,h3,'s','color','k')
text(s3+0.5,h3-15,'3')
plot(s4,h4,'s','color','k')
text(s4,h4+150,'4')
plot(sa,ha,'s','color','k')
text(sa+0.1,ha-10,'a')
plot(sb,hb,'s','color','k')
text(sb,hb-150,'b','FontSize',10)
plot([s2 s3],[h2 h3],'color','r')
plot([s3 s4],[h3 h4],'color','r')
plot([s4 sa],[h4 ha],'color','r')
plot([sa sb],[ha hb],'color','r')
plot([sb,s1],[hb,h1],'color','r')
plot([s1 s2],[h1 h2],'color','r')

% PERFORMANCE PARAMETERS
W_turbine = h1 - h2;
Q_supplied = h1 - h4;
Q_rejected = h2 - h3;
W_net = W_turbine - W_pump;

% Efficiency of Rankine cycle
efficy = (1 - (Q_rejected/Q_supplied))*100;

% Specific Steam Consumption kg/kW.hr
SSC = 3600/W_net;

% Back Work Ratio
BWR = W_pump/W_turbine;

% Displayying Results
fprintf('\n')
fprintf('----------------------------RESULTS----------------------------\n')
fprintf('1] Boiler Pressure is %4.4f bars \n',P_high)
fprintf('2] Condenser Pressure is %4.4f bars \n',P_low)
fprintf('3] Heat Supplied to Boiler is %4.4f kJ \n',Q_supplied)
fprintf('4] Heat Rejected in Condenser is %4.4f kJ \n',Q_rejected)
fprintf('5] Turbine Work is %4.4f kJ/kg \n',W_turbine)
fprintf('6] Pump Work is %4.4f kJ/kg \n',W_pump)
fprintf('7] Net Work Output of Cycle is %4.4f kJ/kg \n',W_net)
fprintf('8] Back Work Ratio of Cycle is %4.4f \n',BWR)
fprintf('9] Thermal Efficiency of Cycle is %4.4f \n',efficy)
fprintf('10] Specific Steam Consumption in the Cycle is %4.4f kg/kWhr \n',SSC)

% TABLE CONTATING STATE PROPERTIES
STATES = {'1';'2';'3';'4'};
TEMPERATURE = [T1; T2; T3; T4];
ENTHALPY = [h1; h2; h3; h4];
ENTROPY = [s1; s2; s3; s4];

% DISPLAYING STATE CONDITIONS
fprintf('\n')
fprintf('---------------------------------------------------------------\n')
fprintf('FOLLOWING ARE THE THERMODYNANIC PROPERTIES AT 4 STATES \n')
fprintf('TEMPERATURE(Degree C), ENTHALPY(kJ/kg),ENTROPY(kJ/kg.K)\n')
T = table(STATES,TEMPERATURE,ENTHALPY,ENTROPY)
fprintf('\n')
fprintf('------------DETAILS OF THE PROCESSES SHOWN IN PLOTS------------\n')
fprintf('1-2 is Isentropic Expansion in Turbine \n')
fprintf('2-3 is Constant Pressure Heat Rejection in Condenser \n')
fprintf('3-4 is Isentropic Compression in Pump \n')
fprintf('4-1 is Constant Pressure Heat Addition in Boiler \n')

Code Explanation

  1. This program is also similar to the previous function, just the difference in them is the nature of drawing the plot
  2. The thermo_diagram_plot function allows us to directly plot the function without manually calculating the values (as done in step 5 of previous command). ref
  3. Also, this subfunction automatically creates a pdf plot which can be easily printed without and additional commands.
  4. Finally, the results are displayed using display command, ref

Output generated

No such major errors were occurred while developing the program

Conclusion:

  1. Efficiency of Rankine cycle depends upon Boiler and condenser pressure.

References:

  1. https://en.wikipedia.org/wiki/Rankine_cycle
  2. https://www.mathworks.com/matlabcentral/fileexchange/9817-x-steam-thermodynamic-properties-of-water-and-steam
  3. https://www.mathworks.com/help/matlab/ref/text.html
  4. https://www.mathworks.com/help/matlab/ref/table.html
  5. https://www.mathworks.com/help/matlab/ref/table.html
  6. https://www.mathworks.com/matlabcentral/fileexchange/24903-diagrams-of-thermodynamic-state-of-water
  7. https://www.mathworks.com/help/matlab/ref/display.html
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.