Challenge

Project 2 - Rankine cycle Simulator

Aim: Create a Rankine Cycle Simulator using MATLAB.

objective:

  • To calculate the state points of the Rankine Cycle (any type of your choice) based on user inputs.
  • Then, plot the corresponding T-s and h-s plots for the given set of inputs. Title and axes labels are a must, while legends could be used if necessary.

theory:

Rankine cycle

The Rankine cycle is the fundamental operating cycle of all power plants where an operating fluid is continuously evaporated and condensed. The selection of operating fluid depends mainly on the available temperature range.

The Rankine cycle operates in the following steps:

  • 1-2-3 Isobaric Heat Transfer. High pressure liquid enters the boiler from the feed pump (1) and is heated to the saturation temperature (2). Further addition of energy causes evaporation of the liquid until it is fully converted to saturated steam (3).

  • 3-4 Isentropic Expansion. The vapor is expanded in the turbine, thus producing work which may be converted to electricity. In practice, the expansion is limited by the temperature of the cooling medium and by the erosion of the turbine blades by liquid entrainment in the vapor stream as the process moves further into the two-phase region. Exit vapor qualities should be greater than 90%.

  • 4-5 Isobaric Heat Rejection. The vapor-liquid mixture leaving the turbine (4) is condensed at low pressure, usually in a surface condenser using cooling water. In well designed and maintained condensers, the pressure of the vapor is well below atmospheric pressure, approaching the saturation pressure of the operating fluid at the cooling water temperature.

  • 5-1 Isentropic Compression. The pressure of the condensate is raised in the feed pump. Because of the low specific volume of liquids, the pump work is relatively small and often neglected in thermodynamic calculations.

Figure 1. Rankine cycle.

Figure 2. T-s and p-h diagrams.

1 2: Isentropic Expansion

Turbine (1-2): Superheated steam enters into the Turbine and expands isentropically resulting in the production of work. The shaft of the turbine is connected to the generator. This results in the production of electricity i.e Mechanical energy gets converted into electric energy. Work produced by the turbine,

WT=m(h1−h2)KWT=m(h1-h2)K


2-3: Constant Pressure Heat Rejection

Condenser (2-3): The expanded vapour is then passed through a condenser, where it gets condensed and converts into liquid again. This liquid is again pumped to the boiler.

Qr=m(h2−h3)KQr=m(h2-h3)K


3-4: Isentropic Compression by the Pump

Pump (3-4): The water enters into the pump in a saturated state. Then the liquid is compressed isentropically until it meets the boiler pressure. Work done by the pump is,

WP=m(h3−h4)KWP=m(h3-h4)K

4-1: Constant Pressure Heat Addition

Boiler (4-1): The water enters into the boiler as compressed and leaves as superheated from the boiler. Thus the phase changes from liquid to vapour. The heat supplied by the boiler is

Qb=m(h1−h4)KQb=m(h1-h4)K

Here we take mass flow rate m = 1 for this code.

  • The efficiency of the Steam Cycle is given by

η=WnQ1=WT−WPQ1η=WnQ1=WT-WPQ1

  • Applying the Steady Flow Energy Equation (SFEE) to all the process, neglecting the Friction losses and changs in Kinetic & Potential Energy,

    • Q1=h1-h4 @Boiler
    • Wt=h1-h2 @Turbine
    • Q2=h2-h3 @Condenser
    • Wp=h4-h3 @Pump
  • The Capacity of the Steam Plant is often expressed interms of Steam Rate (SR) or Specific Steam Consumption (SSC)
  • S.S.C.=3600WnkgkWh

Matlab code

clear all
close all
clc
% Rankine cycle
fprintf('1-2 is isentrophic expansion in turbine\n')
fprintf('2-3 is constant pressure heat removal\n')
fprintf('3-4 isentrophic compression\n')
fprintf('4-1 constant pressure heat addition in boiler\n')

% entering the inputs
p1= 30; % inlet pressure 
T1= 400; % inlet temperature
p2= 0.05;% pressure at condeser

% taking the state points values form the Xsteam file.
% state point1
 h1 = XSteam('h_pT',p1,T1);    % Enthaply at pressure and Temp 1
 s1 = XSteam('s_pT',p1,T1);    %entropy at pressure and temp 1
 
 % state point2 
 s2 =s1;
 sf2 = XSteam('sL_p',p2);
 sg2 = XSteam('sV_p',p2);
 X2 = (s2-sf2)/(sg2-sf2);
 hf2 = XSteam('hL_p',p2);
 hg2 = XSteam('hV_p',p2);
 h2 = hf2+(X2*(hg2-hf2));
 
 
% state point 3
p3= p2;                         % constant pressure heat removal
s3 = XSteam('sL_p',p3);
h3 = XSteam('hL_p',p3);

% state point 4
s4 = s3;
p4 =p1;

% workdone in turbine 
w_t = h1-h2;

% workdone requied for pump
v3 = XSteam('vL_p',p3);
w_p = v3*(p4-p3)*100;
h4 = h3 -w_p;

% net wworkdone for rankine cycle
w_net = w_t-w_p;

% work ratio 
w = (w_t-w_p)/w_t;

% heat addition
Qin = h1-h4;

% heat rejection
Qout = h2 -h3;

% thermal efficiency 
T_eff = (w_net/Qin)*100;

% specific steam consumption
ssc = (3600-w_net);

% calculating the temperature at all state points 2,3&4
T3 = XSteam('Tsat_p',p3);         % saturation temperature at pressure 3
T2 =T3;
cp4 =  XSteam('Cp_ps',p4,s4);
cv4 =  XSteam('Cv_ps',p4,s4);
k = cp4/cv4;
T4 = T3/((p3/p4)^((k-1)/k));

% calculating of other constant for saturated liquid and vapour

T6 =  XSteam('Tsat_p',p1);
s5 =  XSteam('sL_p',p1);
s6 =  XSteam('sV_p',p1);
h5 =  XSteam('hL_p',p1);
h6 =  XSteam('hV_p',p1);
T5 = T6;

% plotting saturation line
T = linspace(1,400,600)
for i = 1:length(T)
    sf(i) =  XSteam('sL_T',T(i));
    sg(i) = XSteam('sV_T',T(i));
    hf(i) =  XSteam('hL_T',T(i));
    hg(i) =  XSteam('hV_T',T(i));
end

% plotting T-S diagram for rankine cycle
figure(1)
hold on

plot(sf,T,'linewidth',2,'color','g')
plot(sg,T,'linewidth',2,'color','g')

plot([s1 s2],[T1 T2],'linewidth',3,'color','b')
plot([s2 s3],[T2 T3],'linewidth',3,'color','b')
plot([s3 s4],[T3 T4],'linewidth',3,'color','b')
plot([s4 s5],[T4 T5],'linewidth',3,'color','b')
plot([s5 s6],[T5 T6],'linewidth',3,'color','b')

s_1 =linspace(s6,s1,1000)
for j =1:length(s_1)
    Tc(j) = XSteam('T_ps',p1,s_1(j));
end

plot(s_1,Tc,'color','r','linewidth',3)
text(s1+0.1, T1, '1')
text(s2+0.1, T2, '2')
text(s3, T3-20, '3')
text(s4, T4+20, '4')
title('Temperature Vs Entropy')
xlabel('Entropy (Kj/kg-k)')
ylabel('Temeperature (Deg. Celcius)')
legend('Saturation Curve')


% Plotting H-S Diagram for Rankine Cycle
figure(2)
hold on
plot(sf,hf,'color','b','linewidth',2)
plot(sg,hg,'color','b','linewidth',2)
plot([s1 s2],[h1 h2],'color','r','linewidth',3)
plot([s2 s3],[h2 h3],'color','r','linewidth',3)
plot([s3 s4],[h3 h4],'color','r','linewidth',3)
hc = linspace(h4,h5,100);
for k = 1:length(hc)
    s_c(k) = XSteam('s_ph',p1,hc(k));
end
plot(s_c,hc,'color','r','linewidth',3)
plot([s5 s6],[h5 h6],'color','r','linewidth',3)
for l = 1:length(s_1)
    h_c(l) = XSteam('h_ps',p1,s_1(l));
end
plot(s_1,h_c,'color','r','linewidth',3)
text(s1+0.1,h1,'1')
text(s2+0.1,h2,'2')
text(s3,h3-100,'3')
text(s4,h4+200,'4')
title('Enthalpy Vs Entropy')
xlabel('Entropy (Kj/kg-k)')
ylabel('Enthalpy (KJ/Kg)')
legend('Saturation Curve')

% Displaying Results in Command window
disp('Results of Rankine Cycle')
fprintf('At state point 1\t\t\t\t\t')
fprintf('At state Point 2\n')
fprintf('P1 = %10f in Bar\t\t\t\t',p1);
fprintf('P2 = %10f in Bar\n',p2);
fprintf('T1 = %11f in Deg.Celcius\t\t',T1);
fprintf('T2 = %11f in Deg.Celcius\n',T2);
fprintf('H1 = %12f in KJ/Kg\t\t\t',h1);
fprintf('H2 = %12f in KJ/Kg\n',h2);
fprintf('S1 = %9f in KJ/Kg-k\t\t\t',s1);
fprintf('S2 = %9f in KJ/Kg-k\n',s2);
fprintf('\n')
fprintf('At state point 3\t\t\t\t\t')
fprintf('At state Point 4\n')
fprintf('P3 = %10f in Bar\t\t\t\t',p3);
fprintf('P4 = %10f in Bar\n',p4);
fprintf('T3 = %11f in Deg.Celcius\t\t',T3);
fprintf('T4 = %11f in Deg.Celcius\n',T4);
fprintf('H3 = %12f in KJ/Kg\t\t\t',h3);
fprintf('H4 = %12f in KJ/Kg\n',h4);
fprintf('S3 = %9f in KJ/Kg-k\t\t\t',s3);
fprintf('S4 = %9f in KJ/Kg-k\n',s4);
fprintf('\n')
fprintf('Turbine Work Done = %14f in KJ/Kg\n',w_t)
fprintf('Pump Work Done = %15f in KJ/Kg\n',w_p)
fprintf('Net Work Done  = %17f in KJ/Kg\n',w_net)
fprintf('Thermal Efficiency = %13f in percent\n',T_eff)
fprintf('Sp. Steam Consumption = %f in KJ/Kw\n',ssc)

explanation of code:

  • The code is start with clear all,close all and clc command.
  • Input variables p1,T1,p2 are given by input command whose values are entered in command window while executing the Program.
  • h_pT, s_pT, hL_p, sV_p etc.... are the default variables whose value is stored in XSteam file.
  • Similarly, all the variables for all states are extracted using a suitable format.
  • after all the extraction the workdone calculation is performed.
  • the requied graphs are extracted from the data.
  • the t s and H-S diagram are shown in the below.

results:

conclusion:

so finally we performed the rankine cycle based on the inputs from the Xsteam file.

References:

https://www.thermopedia.com/content/1072/

https://in.mathworks.com/help/physmod/simscape/ug/rankine-cycle-steam-turbine.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.