Challenge

Project 2 - Rankine cycle Simulator

Aim: To create a Rankine Cycle simulator using Matlab.

Objective:

  • To calculate the state points of the Rankine cycle.
  • To plot the T-S, H-S Diagrams of Rankine cycle.

Theory:

  • 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.
  • It closely describes the process by which steam engines commonly found in thermal power generation plants harness the thermal energy of a fuel or other heat source to generate electricity.
  • Possible heat sources include combustion of fossil fuels such as coal, natural gas, or oil, renewable fuels like biomass or ethanol, nuclear fission, and concentrated solar power.
  • Common heat sinks include ambient air above or around a facility and bodies of water such as rivers, ponds, and oceans.

The Four process of Rankine Cycle:

Process 1-2: 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 1-2 is isentropic compression.

Process 2-3: 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 or software. Process 2-3 is constant pressure heat addition in boiler.

Process 3-4: 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. Process 3-4 is isentropic expansion.

Process 4-1: The wet vapour then enters a condenser, where it is condensed at a constant pressure to become a saturated liquid. Process 4-1 is constant pressure heat rejection in condenser.

Fig_1: Physical layout of Rankine Cycle.

Equation:

In general, the efficiency of a simple Rankine cycle can be written as

Program for Rankine cycle simulation:

%% Rankine Cycle Simulation using Matlab
% Taking the Thermal properties using Xsteam data file
% To calculate the work done by turbine, pump, net workdone, efficiency

clear all
close all
clc
   
%% Rankine Cycle Process
% Process 1-2 is Isentropic Expansion in Turbine 
% Process 2-3 is Constant Pressure heat reduction in Condensor
% Process 3-4 is Isentropic Compression in Pump
% Process 4-1 is Constant pressure Heat addition in the boiler

disp('Rankine Cycle Process')
disp('Process 1-2 is Isentropic Compression in Turbine')
disp('Process 2-3 is Constant pressure Heat reduction in the Condensor')
disp('Process 3-4 is Isentropic Expansion in Pump')
disp('Process 4-1 is Constant Pressure heat addition in Boiler')

%% Inputs
% Inputs pressure is taken in "bar", Temperature is taken in degree Celcius
p3 = input('Inlet Pressure of the Turbine p3(bar) = ')
T3 = input('Inlet Temperature for Turbine T3(C) = ')
p4 = input('Outlet Pressure of the Turbine p4(bar) = ')

%% State_Points
% State_1 Inputs
T1 = XSteam('Tsat_p', p4);
p1 = p4;
h1 = XSteam('hL_p', p4);
s1 = XSteam('sL_p', p4);

% State_3 Inputs
h3 = XSteam('h_pT', p3, T3);
s3 = XSteam('s_pT', p3, T3);

% State_2 Inputs
T2 = XSteam('Tsat_p', p3, s1);
p2 = p3;
h2 = XSteam('h_ps', p3, s1);
s2 = s1;

% Intermediate State points
T5 = XSteam('Tsat_p', p3);
h5 = XSteam('hL_p', p3);
s5 = XSteam('sL_p', p3);
T6 = XSteam('Tsat_p',p3);
h6 = XSteam('hV_p', p3);
s6 = XSteam('sV_p', p3);
p5 = p3;
p6 = p3;

% State_4 Inputs

sg4 = XSteam('sV_p', p4)-XSteam('sL_p', p4);
hg4 = XSteam('hV_p', p4)-XSteam('hL_p', p4);
s4 = s3;
X = (s4-s1)/sg4;
h4 = h1+(X*hg4);
v4 = XSteam('vL_p', p4);
T4 = XSteam('T_ph',p4, h4);

%% Calculating Net workdone
% workdone by Turbine
W_t = h3-h4;

% workdone by Pump
W_p = v4*(p3-p4)*100;
hf2 = W_p+h1;
% Net workdone
W_net = W_t-W_p;

% Calculating Heat_in to the system
Q_in = h3-h2;

% Calculating Thermal Efficiency
n_eff = (W_net/Q_in)*100;

% Calculating Specific Steam Consumption (S.S.C) = mass flow rate/net workdone
SSC = (3600/W_net);

% Calculating Back Work Ratio
B_w = (W_p/W_t);
 
%% Plot for the Saturation Curve
S = linspace(0.1,8,1000);
for i = 1:length(S)
    Tsat(i) = XSteam('Tsat_s',S(i));
end

%% Plotting T-S diagram
figure(1)
plot(S,Tsat,'--','LineWidth',1,'Color','r')
hold on 
plot([s1,s5,s5,s6,s3,s4,s1], [T1,T2,T5,T6,T3,T4,T1],'linewidth',2,'Color','g')
xlim([0 10])
ylim([0 500])
title('T-S Diagram of Rankine Cycle')
xlabel('Entropy, S(Kj/kgk)')
ylabel('Temperature (degree C)')
legend('Saturation curve')
hold off
%% marking State points
text(s1,T1,"1");
text(s5,T2,"2");
text(s3,T3,"3");
text(s4,T4,"4");

%% Plotting H_S diagram
T = (1:2000);
for j = 1:length(T)
    h_L(1,j) = XSteam('hL_T',j);
    h_V(1,j) = XSteam('hV_T',j);
    s_L(1,j) = XSteam('sL_T',j);
    s_V(1,j) = XSteam('sV_T',j);
end
figure(2)
plot(s_L, h_L,'--', 'LineWidth',1, 'Color','r')
hold on
plot(s_V, h_V,'--', 'LineWidth',1, 'Color','r')
plot([s1,s2,s5,s6,s3,s4,s1], [h1,h2,h5,h6,h3,h4,h1],'linewidth',2,'Color','b')
title('H-S Diagram of Rankine Cycle')
xlabel('Entropy (KJ/Kg K)')
ylabel('Enthalpy (KJ/Kg)')
legend('Saturation Curve')
%% marking State points
text(s1,h1,"1");
text(s2,h2,"2");
text(s3,h3,"3");
text(s4,h4,"4");

%% Results
disp('Results');
p3 = p3;
p4 = p4;
T3 = T3;

% Stage_point_1
disp('At stage point 1');
S_p1 = sprintf('p1 is %.3f bar', p1);
disp(S_p1);
S_T1 = sprintf('T1 is %.3f *C', T1);
disp(S_T1);
S_h1 = sprintf('h1 is %.3f KJ/Kg', h1);
disp(S_h1);
S_s1 = sprintf('s1 is %.3f KJ/Kg K', s1);
disp(S_s1);

% Stage_point_2
disp('At stage point 2');
S_p2 = sprintf('p2 is %.3f bar', p2);
disp(S_p2);
S_T2 = sprintf('T2 is %.3f C', T2);
disp(S_T2);
S_h2 = sprintf('h2 is %.3f KJ/Kg', h2);
disp(S_h2);
S_s2 = sprintf('s2 is %.3f KJ/Kg K', s2);
disp(S_s2);

% Stage_point_3
disp('At stage point 3');
S_p3 = sprintf('p3 is %.3f bar', p3);
disp(S_p3);
S_T3 = sprintf('T3 is %.3f C', T3);
disp(S_T3);
S_h3 = sprintf('h3 is %.3f KJ/Kg', h3);
disp(S_h3);
S_s3 = sprintf('s3 is %.3f KJ/Kg K', s3);
disp(S_s3);

% Stage_point_4
disp('At stage point 4');
S_p4 = sprintf('p4 is %.3f bar', p4);
disp(S_p4);
S_T4 = sprintf('T4 is %.3f C', T4);
disp(S_T4);
S_h4 = sprintf('h4 is %.3f KJ/Kg', h4);
disp(S_h4);
S_s4 = sprintf('s4 is %.3f KJ/Kg K', s4);
disp(S_s4);

% efficiency, back work ratio.....
Wt = sprintf('Wt is %.3f KJ/Kg', W_t);
disp(Wt);
Wp = sprintf('Wp is %.3f KJ/Kg', W_p);
disp(Wp);
Wnet = sprintf('W_net is %.3f KJ/Kg', W_net);
disp(Wnet);
neff = sprintf('Thermal Efficiency is %.3f percent', n_eff);
disp(neff);
Ssc = sprintf('SSC is %.2f Kg/KWh', SSC);
disp(Ssc);
BW = sprintf('Back Work Ratio is %.3f', B_w);
disp(BW);


Results:

T-S diagram of Rankine cycle:

H-S diagram of Rankine cycle:

Explanation of Code:

  • Initially using the command 'disp' we are displaying the process of Rankine cycle.
  • Now to calculate the other process parameters like thermal efficiency, back work ratio, net work done.
  • We need some inputs (i.e. p3, T3, p4) which are pressure values at inlet & outlet of turbine, Inlet Temperature of the turbine.
  • Using the command 'input' we are giving the values of pressure and temperature.
  • Now using the XSteam library we are taking the required data like pressure, temperature, entropy, enthalpy etc...
  • After loading all the data now, we are calculating the net work done, thermal efficiency, Specific Steam Consumption, back work ratio.
  • The next step is to plot the saturation curve, for the saturation curve we are using for loop to determine the curve.
  • Using 'plot' command we are plotting T-S, H-S diagrams.
  • Using 'xlim', 'ylim' commands we are specifying the limits of xaxis, yaxis.
  • For labeling the plot we used ' title, xlabel, ylabel, legend commands.
  • For marking the state points, we used a command called 'text', which indicates the state points.
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.