Challenge

Project 2 - Rankine cycle Simulator

Aim:- Create a Rankine Cycle Simulator using MATLAB.

Objective:-

  • Calculate the state points of the Rankine Cycle based on user inputs.
  • plot the corresponding T-s and h-s plots for the given set of inputs.

Outputs:-

  • Net work output
  • Back work ratio

Given Inputs Value:-

  • Turbine Inlet temperature = 400° C
  • Turbine Inlet Pressure = 30 bars
  • Turbine Outlet Pressure = 0.05 bars = Condenser Inlet Pressure

Steam Table Data:- Standard XSteam library

Rankine Cycle:- 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.

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) in order to turn a turbine. After passing over the turbine the fluid is allowed to condense back into a liquid state as waste heat energy is rejected before being returned to boiler, completing the cycle. Friction losses throughout the system are often neglected for the purpose of simplifying calculations as such losses are usually much less significant than thermodynamic losses, especially in larger systems.

Four Processes in the 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.

Formulae:-

  • Workdone & Efficiency

  • Specific Stem Consuption

  • Back Work Ratio

Matlab Code :-

close all 
clear all 
clc

% Subscript for different state points
% 1 = Turbine inlet or Boiler outlet, 2 = Condenser inlet or Turbine outlet,
% 3 = Pump inlet or Condenser outlet, 4 = Boiler inlet or Pump outlet
% Input parameters -
% p1 = Turbine inlet pressure (bar),   
% T1 = Temperature at turbine inlet(deg C), 
% p2 = Turbine outlet pressure (bar),
% Description about four process,
fprintf('Process (1-2) - Isentropic Expansion in the Turbine\n');
fprintf('Process (2-3) - Isobaric Heat Rejection by the Condenser\n')
fprintf('Process (3-2) - Isentropic Compression in the Pump\n')
fprintf('Process (4-1) - Isobaric Heat Addition by the Boiler\n')

% For Inputting state variables at point 1,
p1 = input('Enter the Pressure at the Turbine Inlet (in bar): ');
T1 = input('Enter the Temperature at the Turbine inlet (in Degree celsius): ');
p2 = input('Enter the Pressure at the Turbine Outlet (in bar): ');

% Calculating state variables at all points from given datafile,

% At point 1
hg_1=XSteam('hV_p',p1);
sg_1=XSteam('sV_p',p1);
Tsat_P1=XSteam('Tsat_p',p1);
Cp1_L=XSteam('CpL_p',p1);

% At point 2
hg_2=XSteam('hV_p',p2);
sg_2=XSteam('sV_p',p2);
Tsat_P2=XSteam('Tsat_p',p2);
Cp2_V=XSteam('CpV_p',p2);
 
% At point 3
hf_3=XSteam('hL_p',p2);
sf_3=XSteam('sL_p',p2);

% At point 4
hf_4=XSteam('hL_p',p1);
sf_4=XSteam('sL_p',p1);

% state variables at point 1,

fprintf('At State 1\n');

fprintf('p1 is :%f bar\n',p1);

fprintf('T1 is :%f degrees C\n',T1);

h1=XSteam('h_pT',p1,T1);
fprintf('h1 is :%f kJ/kg\n',h1);

s1=XSteam('s_pT',p1,T1);
fprintf('s1 is :%f kJ/kgK\n',s1);

% state variables at point 2,

fprintf('At State 2\n');

fprintf('p2 is : %f bar\n', p2);

% entropy remains the same through turbine ( ideal )
s2 = s1; 
fprintf('s2 is : %f kJ/kgK\n', s2);

% Calculating value of x(dryness fraction)
if(s2 <= sg_2)
    x2 = (s2 - sf_3) / (sg_2-sf_3);   
else
    x2=1;    
end
fprintf('x2 is :%f \n', x2);

% For calculating value of T2,
if(x2<1)
    T2 = Tsat_P2;
else
   % s2 = sg_2 + Cp2_V*(log(T2/Tsat_P2))-formula for calculating entropy in
   % superheated region
    T2 = (Tsat_P2+273.15)*exp((s2-sg_2)/Cp2_V);
    T2 = T2 - 273.15;
end    

fprintf('T2 is : %f degrees C\n', T2)

% For calculating value of h2,
if(x2<1)
   h2 = hf_3 + x2 * (hg_2-hf_3);
else
   h2 = XSteam('h_pT',p2,T2);
end  

fprintf('h2 is : %f kJ/kg\n', h2)

% state variables at point 3,

fprintf('At state 3\n')
p3 = p2;
fprintf('p3 is : %f bar\n', p3)

V3 = XSteam('vL_p', p3);

T3 = Tsat_P2;    
fprintf('T3 is : %f degrees C\n', T3)

h3 = hf_3;
fprintf('h3 is : %f kJ/kg\n', h3)

s3 = sf_3;
fprintf('s3 is : %f kJ/kgK\n', s3)

% Calculating state variables at point 4,

fprintf('At state 4\n')

p4 = p1;
fprintf('p4 is : %f bar\n', p4)

% Isentropic pumping process
s4 = s3;
fprintf('s4 is : %f kJ/kgK\n', s4)

T4 = XSteam('T_ps' ,p4,s4);
fprintf('T4 is : %f degrees C\n', T4)

W_p = V3 * (p4 - p3) * 100; % work done by pump(W_p = h4-h3)
h4 = W_p + h3;
fprintf('h4 is : %f kJ/kg\n', h4)

% Calculation of net work output,net heat,back work ratio and thermal
% efficiency and other parameters

% Work done by turbine
W_T = h1 - h2;
fprintf('Work by turbine is : %f kJ/kg\n', W_T)

fprintf('Work by pump is : %f kJ/kg\n', W_p)

% Net work done
Wnet = W_T - W_p;
fprintf('Net Wok done is : %f kJ/kg\n', Wnet)

% Net heat supplied
Qin = h1 - h4;

% Thermal Effieciency
eff_thermal = Wnet/Qin ;    
fprintf('Thermal efficiency is : %f\n', eff_thermal); 

% Back work ratio
b_w_r = (W_p/W_T);
fprintf('Back work ratio is : %f \n ', b_w_r)
% Work ratio
w_r = (Wnet/W_T);
fprintf('Work ratio is : %f \n ', w_r)
% summation of b_w_r and w_r should be 1
fprintf('Back work ratio + Work ratio is : %f \n ', (b_w_r+w_r))

% Heat rate and specific steam consumption
H_R = (1./eff_thermal);
fprintf('Heat Rate is : %f kJ/kWs\n ', H_R)
ssc = (1./Wnet);
fprintf('Specific steam consumption is : %f kg/kWs\n ', ssc)

% Iterating saturation Liquid and Vapour lines from 0 to value of T1 for plotting 
% property diagram of water 

temperature = linspace(0,T1, 5000);
for i = 1 : length(temperature)
     H_l(i) = XSteam('hL_T', temperature(i));
     H_v(i) = XSteam('hV_T', temperature(i));
     S_l(i) = XSteam('sL_T', temperature(i));
     S_v(i) = XSteam('sV_T', temperature(i));
end

% Plotting T-s Diagram

figure(1)
hold on
plot([s1 s2], [T1 T2],'color','blue', 'linewidth', 3)

plot([s2 sg_2], [T2 Tsat_P2],'color','green', 'linewidth', 3)

plot([sg_2 s3], [Tsat_P2 T3],'color','green', 'linewidth', 3)

plot([s3 s4], [T3 T4],'color','blue', 'linewidth', 3)

plot([s4 sf_4], [T4 Tsat_P1],'color','blue', 'linewidth', 3)

plot([sf_4 sg_1], [Tsat_P1 Tsat_P1],'color','green', 'linewidth', 3)

plot([sg_1 s1], [Tsat_P1 T1],'color','green', 'linewidth', 3)

text(s1,T1,' 1','FontSize',15)
text(s2,T2,' 2','FontSize',15)
text(s3,T3,' 3','FontSize',15)
text(sf_4,Tsat_P1,' 4','FontSize',15)

plot(S_l, temperature, 'black', 'linestyle','--','linewidth', 1)
plot(S_v, temperature, 'black', 'linestyle','--','linewidth', 1)

axis([0 10 0 500])
title('T-s Diagram of Ideal Rankine Cycle')
ylabel('Temprature (degrees C)')
xlabel('Specific Entropy (kJ/kgK)')
grid on

% Plotting h-s Diagram

figure(2)
hold on
plot([s1 s2], [h1 h2],'color','green', 'linewidth', 3)

plot([s2 sg_2], [h2 hg_2],'color', 'red', 'linewidth', 3)

plot([sg_2 s3], [hg_2 h3],'color', 'red', 'linewidth', 3)

plot([s3 s4], [h3 h4],'color', 'green', 'linewidth', 3)

plot([s4 sf_4], [h4 hf_4],'color', 'green', 'linewidth', 3)

plot([sf_4 sg_1], [hf_4 hg_1],'color', 'red', 'linewidth', 3)

plot([sg_1 s1], [hg_1 h1],'color', 'red', 'linewidth', 3)

text(s1,h1,' 1','FontSize',15)
text(s2,h2,' 2','FontSize',15)
text(s3,h3,' 3','FontSize',15)
text(sf_4,hf_4,' 4','FontSize',15)

plot(S_l, H_l,'color','black','linestyle','--', 'linewidth', 1)
plot(S_v, H_v,'color', 'black','linestyle','--', 'linewidth', 1) 
  
title('h-s Diagram of Ideal Rankine Cycle')
ylabel('Specific Enthalpy (kJ/kg)')
xlabel('Specific Entropy (kJ/kgK)')
grid on

Steps:-

1. clear all, close all, clc, use to clear any previosly defined values.

2. FIrst step is bring the given inputs to the program, for that the 'input()' command use. The user inputs includes tempareture and pressure entry to the turbine and pressue after existing to the turbine.

3. Using the given inputs all four stages points are calculated.

(H-Enthalpy, S-Entropy, T-Temperature, P-Pressure, x-Dryness factor, )

4. After calculating all parameters, now calculate the Pumpwork, Turbine Work, Net work output, Back Ratio, Thermal Efficiency.

5. Now to display all inputs .

6. Next is to plot the grapt, H-S & T-S, First step to calculate the saturation curve for loop use.

Result :-

T-S plot :-

H-S plot :-

CONCLUSION :

Various programs to compute property values of water at three regions have been developed using MATLAB. Those programs are then used by another program that can simulate a Rankine cycle. This program should be useful for lecturers for the teaching of Rankine cycle as a part of thermodynamics subject. Students can also benefit from the program as well.

References:-

1. https://en.wikipedia.org/wiki/Rankine_cycle

2. https://energyeducation.ca/encyclopedia/Rankine_cycle#:~:text=The%20Rankine%20cycle%20or%20Rankine,a%20turbine%20producing%20useful%20work.

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.