Challenge

Project 2 - Rankine cycle Simulator

AIM:- Create a Rankine Cycle Simulator by using MATLAB

OBJECTIVE:-

  • calculate the state points of the Rankine Cycle (any type of your choice) based on user inputs.
  • plot the corresponding T-s and h-s plots for the given set of inputs.
  • Calculate efficiency.

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.

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 components of Rankine cycle

1.Pump

2.Boiler

3.Turbine

4.condenser

Four processes of Rankine cycle

  • 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. Process 1-2 is isentropic expansion. Work produced by turbine is

Wt = m(h1-h2)k

  • Process 2-3: The wet vapour then enters a condenser, where it is condensed at a constant pressure to become a saturated cycle. Process 2-3 is constant pressure heat rejection in condenser.

Qr = m(h2-h3)k

  • 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. Process 3-4 is isentropic compression. Work done by the pump is

Wp = m(h3-h4)k

  • 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. Process 2-3 is constant pressure heat addition in boiler. The heat supplied by the boiler is

Qb=m(h1-h4)k

  • The efficiency of the Steam Cycle is given by

`eta = (Wn)/(Q1)`

  • Applying the Steady Flow Energy Equations(SFEE) to all the process, neglecting the friction losses and change in Kinetic & Potential Energy,

Q1 = (h1-h4)@Boiler

Wt = (h1-h2)@Turbine

Q2 = (h2-h3)@Condenser

Wp = (h3-h4)@Pump

  • The capacity of the steam plant is often expressed in terms of Steam Rate (SR) or Specific Steam Consumption (SSC

`S.S.C =(3600)/(Wn)(Kg)/(kWh)`

Required inputs:-

Turbine Inlet temperature = 400° C

Turbine Inlet Pressure = 30 bars

Turbine Outlet Pressure = 0.05 bars = Condenser Inlet Pressure

Main program

% Code for Rankine cycle simulator 
clear all
close all
clc

% Print Process Description
fprintf('l-2 Isentropic Expansion in Turbine\n') 
fprintf('2-3 Isobaric heat rejection in Condensor\n ') 
fprintf('3-4 Isentropic Compression in Compressor\n ') 
fprintf('4-1 Isobaric heat addition in Boiler\n')

% Entering the input data for calculation of state points
p1= 30;   %Pressure at Turbine Inlet in Bar
T1=400;   %Temperature at Turbine Inlet in Degree Celcius
p2=0.05;  %Pressure at turbine outlet in bar
 
% Taking data from Xsteam file for state point 1
h1 = XSteam('h_pT', p1, T1); 
s1 = XSteam('s_pT', p1, T1);

% Taking data from Xsteam file for state point 2
s2 =  s1;                    % Because of Isentropic Expansion
sf2 = XSteam('sL_p',p2);     % saturated liquid entropy at pressure 2
sg2 = XSteam('sv_p', p2);    % Saturated vapour entropy at pressure 2
x2 = (s2-sf2)/(sg2-sf2);     % Vapour Fraction at state point 2
hf2 = XSteam('hL_p',p2);     % saturated liquid Enthalpy at pressure 2
hg2 = XSteam('hv_p' , p2);   % Saturated vapour Enthalpy at pressure 2
h2 = hf2 + (x2*(hg2-hf2));   % Enthalpy at state point 2

% Taking data from Xsteam file for state point 3
p3 = p2;	              % Constant Pressure heat removal process 
s3=XSteam('sL_p',p3);     % saturated liquid entropy at Pressure 3 
h3=XSteam('hL_p',p3);     % saturated liquid Enthalpy at Pressure 3

% Taking data from Xsteam file for State point 4
s4=s3;	% Isentropic Compression process
p4=p1;	% Constant Pressure heat rejection

% Work done in Turbine for the rankine cycle 
W_T = h1-h2;

% Work done required for pump 
v3 = XSteam ('vl_p' ,p3);  % Saturated Liquid Vapour at pressure 3
W_P = v3*(p4-p3)*100;      % Work supplied to pump
h4 = h3 - W_P;             % Enthalpy at State point 4 ,wp = h4-h3

% Met work done for Rankine Cycle 
W_net = W_T - W_P;

% Heat Addition to System 
Q_in = h1-h4;

% Heat Rejection from System
Q_out = h2-h3;

% Thermal Efficiency of Rankine Cycle 
T_eff = (W_net/Q_in)*100;


%specific steam consumption = (Mass flow rate / Net work done)
Sp_S =  (3600/W_net);

% Calculation of Temperature at All state Point 2, 3 and 4
T3 = XSteam ('Tsat_p',p3);	  % Saturation Temperature at Pressure 3
T2 =  T3;                     % Becuase of Constant Pressure Heat addition
Cp4 = XSteam('Cp_ps',p4,s4);  % Specific isobaric heat capacity
Cv4 = XSteam('Cv_ps',p4,s4);  % Specific isochoric heat capacity
k =  Cp4/Cv4;                 % Adiabatic index
T4 = T3/((p3/p4)^((k-1)/k));  % Temperature at State point 4

%  Calcula tion  of  Other  constant  for saturated  liquid  and  Vapour
T6=XSteam ('Tsat_p', p1) ;	%  Saturated  Temperature at Pressure 1
s5=XSteam ('sL_p', p1) ;	    %  Saturated  Liquid  entropy  at pressure 1 
s6=XSteam ('sV_p', p1) ;	    %  Saturated  Vapour  entropy  at Pressure 1
h5=XSteam ('hL_p', p1) ;	    %  Saturated  Liquid  Enthalpy  at Pressure1 
h6=XSteam ('hV_p', p1) ;	    %  Saturated  Vapour  Enthalpy  at pressure1
T5=T6;

%Plotting for Saturation Line 
T  =  linspace(1,700, 1000) ;
for i = 1:length (T)
    sf(i)=XSteam('sL_T',T(i)) ; %  Saturated  Liquid  Entropy 
    sg(i)=	XSteam('sV_T',T(i));	%  Saturated  Vapour  Entropy
    hf(i)=XSteam('hL_T',T(i));	%  Saturated  Liquid  Enthalpy 
    hg(i)=XSteam('hV_T',T(i));	%  Saturated  Vapour  Enthalpy
end

% Plotting T-S Diagram for Rankine Cycle 
figure(1)
hold on
plot(sf,T,'color','b','linewidth',2,'color','r');
plot(sg,T,'color','b','linewidth',2,'color','b');
plot([s1 s2],[T1 T2], 'color', 'g','linewidth',2);
plot([s2 s3],[T2 T3], 'color', 'c', 'linewidth',2); 
plot([s3 s4],[T3 T4], 'color', 'm', 'linewidth',2);
plot([s4 s5],[T4 T5], 'color', 'y', 'linewidth',2);
plot([s5 s6],[T5 T6], 'color', 'k', 'linewidth',2);

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.5)
legend('Saturated liquid curve','Saturated vapour curve','Isentropic expantion','Heat rejection','Isentropic compression','Heat addition in subcooled region','Heat addition in wet region','Heat addition in Superhetaed region')
grid on
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','FontWeight','Bold') 
xlabel ('Entropy (Kj/kg-k)', 'FontWeight','Bold')
ylabel ('Temeperature (Deg. Celcius)','FontWeight','Bold')

% Plotting H-S Diagram for Rankine Cycle 
figure(2)
hold on
plot(sf,hf,'color','b','linewidth',2,'color','r');
plot(sg,hg ,'color','b','linewidth',2,'color','b');
plot ([s1 s2],[h1 h2],'color','g','linewidth' ,2);
plot ([s2 s3],[h2 h3],'color','c','linewidth' ,2);
plot ([s3 s4],[h3 h4],'color','m','linewidth',2);

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',2)
plot ([s5 s6],[h5 h6],'color','r','linewidth',2) 

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) 
legend('Saturated liquid curve','Saturated vapour curve','Isentropic expantion','Heat rejection','Isentropic compression')
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','FontWeight','Bold') 
xlabel('Entropy (Kj/kg-k)','FontWeight','Bold') 
ylabel('Enthalpy (KJ /Kg)','FontWeight','Bold')
grid on


%  Displaying  Results  in  Command  window 
fprintf('\n--------------Results--------------\n')
fprintf('At state point 1:\n') 
fprintf('P1 is : %f Bar\n',p1); 
fprintf('T1 is : %f Degree Celcius\n',T1); 
fprintf('H1 is : %f kJ/Kg\n',h1); 
fprintf('S1 is : %f Kj/Kg.k\r\n',s1); 

fprintf('At state point 2:\n') 
fprintf('P2 is : %f Bar\n',p2); 
fprintf('T2 is : %f Degree Celcius\n',T2); 
fprintf('H2 is : %f kJ/Kg\n',h2); 
fprintf('S2 is : %f Kj/Kg.k\n',s2);
fprintf('X2 is : %f \r\n',x2);

fprintf('At state point 3:\n') 
fprintf('P3 is : %f Bar\n',p3); 
fprintf('T3 is : %f Degree Celcius\n',T3); 
fprintf('H3 is : %f kJ/Kg\n',h3); 
fprintf('S3 is : %f Kj/Kg.k\r\n',s3);

fprintf('At state point 4:\n') 
fprintf('P4 is : %f Bar\n',p4); 
fprintf('T4 is : %f Degree Celcius\n',T4); 
fprintf('H4 is : %f kJ/Kg\n',h4); 
fprintf('S4 is : %f Kj/Kg.k\r\n',s4);

% Other calculations
fprintf('\n--------------Other calculations--------------\n')
fprintf ('Work Done By Turbine : %f kJ/kg\n',W_T) 
fprintf ('Work supplied to Pump : %f kJ/kg\n',W_P) 
fprintf ('Heat Added in The Boiler: %f KJ/kg\n' ,Q_in)
fprintf ('Heat Rejected in The Condenser: %f KJ/kg\n' ,Q_out) 
fprintf ('Thermal Efficiency in percentage : %f \n',T_eff) 
fprintf ('Specific Steam Consumption : %f KJ/kWh\r\n' ,Sp_S)

Explanation of Code:

1. Input variables p1,T1,p2 are given by input command whose values are entered in command window while executing the program.

2. @State-1, values for enthalpy & entropy are extracted as afunction of pressure & temperature.

3. h_pt,s_pT,hL_p,sV_p etc... are the default variables whose value is stored in XSteam file.

4. Similarly, all the variables for all states are extracted using suitable format [**The Formulae for the state variables and other depending factors are refferd from power plant Reference Books.]

5. @State-2 is a condenser inlet where the high-pressure steam is converted into Low-pressure water and hence Dryness Fraction, Enthalpy & Entropy for saturated ZVapour &Saturated Water are considered to calculate the Specific Enthalpy.

6. @State-3 The water is considered back ti its Saturation Temperature and feed to the pump, This temperature of water at the exit of the Condenser and entry of Pump is the same.

7. @State-4 This is constant pressure heat addition, hence pressure is equal to p1,but the temperature increases on heating at constant pressure & constant volume as our entropy remains same and hence Cp/Cv=gamma is considered to find temperature T4.

8.Finally work done and heat envolved & SSC are calculated by basic formulae.

9. To plot the saturation curve, a temperature range is defined using linspace command and for the overall length of this tempertaure values of enthalpy and entropy are calculated at every temperature point. The break in the saturation curve separates the liquid phase &vapour phase.

10. Now all the necessary data is found out, Plotting is done for both T-S & H-S curves using the plot commands.

Annotations are assigned using text command.

11. Results of the Cycle simulation is displayed over command window using fprintf command.

Result:

The Rankine cycle plots have generated by calculating the state points, efficiency, and the output is printed in the command window.

Command Window:

Plots:

1. Temperture v/s Entropy

2. Enthalpy v/s Entropy

Workspace:

Error:

The errors occur while calling data from XSsteam library.

Solution#: By adding proper syntax

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.