Project

Rankine cycle simulator

Aim: Write a program to calculate Rankine cycle efficiency and plot T-S and H-S diagram.

Introduction: Rankine cycle is also called as vapour power cycle. For the steam boiler, this would be a reversible constant pressure heating process of water to from steam, for the turbine the ideal process would be a reversible adiabatic expansion of steam, for the condenser it would be a reversible constant pressure heat rejection as the steam condenses till it becomes saturated liquid and for the pump, the ideal process would be the reversible adiabatic compression of this liquid ending at the initial pressure. When all these four processes are ideal, the cycle is an ideal cycle, called as Rankine cycle. This is a reversible 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. In other words Process 1-2 is [Isentropic compression in pump]

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.

In other words 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.

In other words Process 3-4 is [Isentropic expansion in turbine]

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

In other words Process 4-1 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 vapour region after the expansion in the turbine, [1] which reduces the energy removed by the condensers.

The actual vapour power cycle differs from the ideal Rankine cycle because of irreversibilities in the inherent components caused by fluid friction and heat loss to the surroundings; fluid friction causes pressure drops in the boiler, the condenser, and the piping between the components, and as a result the steam leaves the boiler at a lower pressure; heat loss reduces the net-work output, thus heat addition to the steam in the boiler is required to maintain the same level of net-work output.

  • Pump work = h2 –h1
  • Turbine work = h3- h4
  • Heat input = h3 – h2
  • Net work = Turbine work – pump work
  • Thermal efficiency = Net work/ Heat input

Program:

clear all
close all
clc

disp(\'Rankine cycle\')
disp(\'1-2: Isentropic Expansion\')
disp(\'2-3: Constant pressure heat rejection\')
disp(\'3-4: Isentropic Compression\')
disp(\'4-1: Constant pressure heat addition\')

% Required initial input data
p1 = input(\'Enter the pressure at turbine inlet in [bar]\\n\')
t1 = input(\'Enter the temperature at turbine inlet in [Kelvin] \\n\')
p3 = input(\'Enter the pressure at pump inlet [bar] \\n\')

% State point values 
p2 = p3;
p4 = p1;
h3 = XSteam(\'hL_p\', p3);
s3 = XSteam(\'sL_p\', p3);
t3 = XSteam(\'Tsat_p\', p3);
v3 = XSteam(\'vL_p\', p3);

t2 = t3;
s4 = s3;
cp4 = XSteam(\'Cp_ps\', p4,s4);
cv4 = XSteam(\'Cv_ps\', p4,s4);
gamma = cp4/cv4;
K = (gamma-1)/gamma;
t4= t3*(p4/p3)^K;

% work input required
Pump_work = v3*(p4 -p3)*100 ; 
h4 = h3 + Pump_work;
h1 = XSteam(\'h_pT\', p1,t1);
s1 = XSteam(\'s_pT\', p1,t1);
s2 = s1;

sf2 = XSteam(\'sL_p\', p2);
sg2 = XSteam(\'sV_p\', p2);
hf2 = XSteam(\'hL_p\', p2);
hg2 = XSteam(\'hV_p\', p2);

x2 = ( s2 - sf2 )/(sg2 - sf2);
h2 = hf2 + x2*( hg2 -hf2);

% Output work 
Turbine_work = h1 - h2;
% Net work obtained
Net_work = Turbine_work - Pump_work;
% heat input
q_in = h1 - h4;
% heat output
q_out = h2 - h3;

% Thermal Efficiency of Rankine cycle
n_th =  (Net_work/q_in)*100;

% Back work ratio
Back_work_ratio = Pump_work/Turbine_work;
% State point 6 values
p6 = p1;
t6 = XSteam(\'Tsat_p\',p6);
h6 = XSteam(\'hV_p\', p6);
s6 = XSteam(\'sV_p\',p6);

% State point 5 values
p5 = p1;
t5 = XSteam(\'Tsat_p\',p5);
h5 = XSteam(\'hL_p\', p5);
s5 = XSteam(\'sL_p\',p5);

% State point 6 to 1 values
t_6_1 = linspace(t6,t1,1000);
for i = 1:1000
    s_6_1(i)= XSteam(\'s_pT\', p6, t_6_1(i));
    h_6_1(i) = XSteam(\'h_pT\', p6, t_6_1(i));
end

% Entropy and Enthalpy from Xsteam data
% saturation curve
A = linspace(0,t1,500);
for i=1:length(A)
    s_tot(i) = XSteam(\'sV_t\',A(i));
    S_tot(i) = XSteam(\'sL_t\', A(i));
    h_tot(i) = XSteam(\'hV_t\',A(i));
    H_tot(i) = XSteam(\'hL_t\',A(i));
end

% plots of T-S and H-S curve
% plotting Temperature vs Entropy [T-S] diagram
figure(1)
plot(s_6_1, t_6_1, \'r\')
hold on
% Plot the saturation curve
plot(s_tot, A)
hold on
plot(S_tot,A)
hold on
plot([s4 s5],[t4 t5])
hold on
plot([s5 s6],[t5 t6])
hold on
plot([s1 s2],[t1 t2])
hold on
plot([s2 s3],[t2 t3])
hold on
plot([s3 s4],[t3 t4])
hold on
xlabel(\'Entropy [KJ/Kg-K]\')
ylabel(\'Temperature [C]\')
title(\' Temperature vs Entropy [T-S] diagram\')

% plotting Enthapy vs Entropy [h-s] diagram
figure(2)
plot(s_tot, h_tot)
hold on
plot(S_tot, H_tot)
hold on
plot(s_6_1, h_6_1)
hold on
plot([s4 s5], [h4 h5])
hold on
plot([s5 s6], [h5 h6])
hold on
plot([s1 s2], [h1 h2])
hold on
plot([s2 s3], [h2 h3])
hold on
plot([s3 s4], [h3 h4])
hold on
xlabel(\'Entropy [KJ/Kg-K]\')
ylabel(\'Enthalpy [KJ/Kg]\')
title(\' Enthalpy vs Entropy [h-S] diagram\')

% Results of state point after calculations
fprintf(\'\\n Results of each state point \\n\')
fprintf(\'\\n AT State point 1 \\n\')
fprintf(\'\\n P1 = %4.2f in [bar] \\n\', p1)
fprintf(\'\\n T1 = %4.2f in [celcious] \\n\', t1)
fprintf(\'\\n h1 = %4.2f in [KJ/Kg] \\n\', h1)
fprintf(\'\\n s1 = %4.2f in [KJ/Kg-K] \\n\', s1)

fprintf(\'\\n AT State point 2 \\n\')
fprintf(\'\\n P2 = %4.2f in [bar] \\n\', p2)
fprintf(\'\\n T2 = %4.2f in [celcious] \\n\', t2)
fprintf(\'\\n h2 = %4.2f in [KJ/Kg] \\n\', h2)
fprintf(\'\\n s2 = %4.2f in [KJ/Kg-K] \\n\', s2)
fprintf(\'\\n x2 = %4.2f  \\n\', x2)

fprintf(\'\\n AT State point 3 \\n\')
fprintf(\'\\n P3 = %4.2f in [bar] \\n\', p3)
fprintf(\'\\n T3 = %4.2f in [celcious] \\n\', t3)
fprintf(\'\\n h3 = %4.2f in [KJ/Kg] \\n\', h3)
fprintf(\'\\n s3 = %4.2f in [KJ/Kg-K] \\n\', s3)

fprintf(\'\\n AT State point 4 \\n\')
fprintf(\'\\n P4 = %4.2f in [bar] \\n\', p4)
fprintf(\'\\n T4 = %4.2f in [celcious] \\n\', t4)
fprintf(\'\\n h4 = %4.2f in [KJ/Kg] \\n\', h4)
fprintf(\'\\n s4 = %4.2f in [KJ/Kg-K] \\n\', s4)

fprintf(\'\\n Turbine_work = %4.2f in [KJ/Kg] \\n\', Turbine_work)
fprintf(\'\\n Pump_work = %4.2f in [KJ/Kg] \\n\', Pump_work)
fprintf(\'\\n Net_work = %4.2f in [KJ/Kg] \\n\', Net_work)
fprintf(\'\\n Efficiency = %4.2f in percent \\n\', n_th)
fprintf(\'\\n Back work ratio = %4.2f  \\n\', Back_work_ratio)

Code explaination:

  1. \'disp\' command is used for showing the data which have taken in this process.
  2. Before plotting T-S and H-S plot we need each state point values in terms of entropy, enthalpy and temperature.
  3. XSteam library used here to collect data directly at a given point data as pressure, temperture, enthalpy, entropy and specific volume etc.
  4. \'fprintf\' command is used to display result data in command window.
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.