Challenge

Project 2 - Rankine cycle Simulator


AIM :

To create a Rankine cycle simulator by calculating all the state points and thus, plotting its T-S & H-S Diagram respectively in MATLAB.

THEORY :

  • When the energy is extracted from the energy of steam, the plant is known as steam power plant. A simple steam plant works on Rankine cycle.
  • It is an idealized thermodynamic cycle of heat engine that converts heat into mechanical work while undergoing phase change.
  • The Rankine cycle closely describes the process by which steam-operated heat engines commonly found in thermal power generation plants generate power. Rankine cycle is an idealized cycle in which friction losses in each of the four components are neglected.

There are four processes in the Rankine cycle such as,

  1. Process 1-2 : Isentropic Expansion Process
  • The process 1-2 is the isentropic expansion of steam in the turbine from pressure P1 to pressure P2.
  1. Process 2-3 : Constant Pressure Heat Rejection
  • At constant pressure P2 & temperature T2 the exhaust steam is condensed in condenser giving the latent heat to cooling water.
  1. Process 3-4 : Isentropic Compression Process
  • The water from hot well which is at low pressure is pumped isentropically into the boiler at high pressure. Here, the compression takes place isentropically in the pump.
  1. Process 4-1 : Constant Pressure Heat Addition
  • At constant pressure & temperature water is completely converted to steam. In this process heat is added at constant pressure.

Inputs Parameters for project –

  • Turbine Inlet Pressure (P1) = 30 bars
  • Turbine Outlet or Condenser Inlet Pressure (P2) = 0.05 bars
  • Turbine Inlet temperature (T1) = 400° C

GOVERNING EQUATIONS :


  • Heat transferred for condenser in KJ/Kg

`Q_"Condenser" = h2 - h3`

  • Heat transferred for boiler in KJ/Kg

`Q_"Boiler" = h1 - h4`

  • Work Done by Turbine in KJ/Kg

`W_"Turbine" = h1 - h2`

  • Work Done by Pump in KJ/Kg

`W_"Pump" = h4 - h3`

  • Net Work Done in KJ/Kg

`W_"net" = W_"Turbine" - W_"Pump"`

  • Specific Steam Consumption in KJ/KWh

`SSC = 3600/(W_"Turbine" - W_"Pump")`

  • Back Work Ratio (BWR) in KJ/Kg

`BWR = W_"Turbine" / W_"Pump"`

  • Rankine cycle Thermal Efficiency in %

`eta _"rankine" = W_"net"/Q_"Boiler"`

  • OBJECTIVES OF THE PROJECT:
  1. Determine the state points of the Rankine Cycle based on user inputs.
  2. To calculate the Net work output & Back work ratio for this cycle.
  3. Plot the corresponding T-S and H-S plots for the given set of inputs.



  • MATLAB PROGRAM FOR RANKINE CYCLE -


%% RANKINE CYCLE SIMULATOR 
clear all
close all
clc

fprintf('         RANKINE CYCLE SIMULATOR \n \n')                                    % Printing the Heading or title 
fprintf('Process 1-2 Isentropic Expansion Process - Turbine \n')                     % Printing the Process 1-2 for cycle
fprintf('Process 2-3 Constant Pressure Heat Rejection - Condensor \n')               % Printing the Process 2-3 for cycle
fprintf('Process 3-4 Isentropic Compression Process - Pump \n')                      % Printing the Process 3-4 for cycle
fprintf('Process 4-1 Constant Pressure Heat Addition - Boiler \n \n')                % Printing the Process 4-1 for cycle

% Assigning the Inputs for the Cycle 

T1 = input('Enter the inlet temperature for Turbine = ');                            % Taking the input for T1 
P1 = input('Enter the inlet pressure for Turbine = ');                               % Taking the input for P1
P2 = input('Enter the outlet pressure for Turbine = ');                              % Taking the input for P2

fprintf('\r    RESULTS  \r \n')

% For State Point 1 -

H1 = XSteam('h_pt',P1,T1);                                                           % Calling the h_pt function from XSteam library and stating the points
S1 = XSteam('s_pt',P1,T1);

% For State Point 2 -

Hf2 = XSteam('hL_p',P2);                                                             % Calling the function from XSteam library and stating the points
Sf2 = XSteam('sL_p',P2);
Hg2 = XSteam('hV_p',P2);
Sg2 = XSteam('sV_p',P2);
T2 = XSteam('Tsat_p',P2);
S2 = S1;                                                                             % Entropy at state point 1 is equal to point 2

x2 = ((S2-Sf2)/(Sg2-Sf2));
H2 = Hf2 + (x2*(Hg2-Hf2));                                                           % Calculating the value for H2

% For State Point 3 -
P3 = P2;                                                                             
T3 = XSteam('Tsat_p',P2);                                                            % Calling the function Tsat_p from XSteam library and stating the points
S3 = XSteam('sL_p',P3);
H3 = XSteam('hL_p',P3);

% For Calculating the Gamma Value -
Cp4 = XSteam('cpL_p',P3);                                                            % Calling the function from XSteam library and stating the point P3
Cv4 = XSteam('cvL_p',P3);                                                            % Calling the function from XSteam library and stating the point P3
Gamma = (Cp4/Cv4);
g = (Gamma-1)/Gamma;                                                                       

% For State Point 4 -
P4 = P1;
S4 = S3;
H4 = XSteam('h_ps',P4,S4);                                                            % Calling the function h_ps from XSteam library and stating the points
T4 = T3 * ((P4/P3)^g);

% Calculating the WORKDONE for cycle
W_t = H1 - H2;                                                                         % Calculating the work done by the turbine
W_p = H4 - H3;                                                                         % Calculating the work done by the pump
W_net = W_t - W_p;                                                                     % Calculating the Net work done 
Back_W_R = W_t/W_p;                                                                    % Calculating the back work ratio

% Calculating HEAT TRANSFERED in cycle
Q_in = H1 - H4;                                                                        % Calculating the Heat addition 
Q_out = H2 - H3;                                                                       % Calculating the Heat rejection

% Calculating the Thermal Efficiency of the cycle
Np = (W_net/Q_in) * 100;

SSC = 3600/W_net;                                                                      % Calculating the Specific Steam Consumption                                               
Tf_sat = XSteam('Tsat_p',P1);
Sf_sat = XSteam('sL_p',P1);
hf_sat = XSteam('hL_p',P1);
Sg_sat = XSteam('sV_p',P1);
hg_sat = XSteam('hV_p',P1);

% For Plotting T-S Diagram 

figure(1)
hold on

Temp = linspace(0,400,1000);                                                            % Assigning the Temperature range between 0 to 400

for i = 1:length(Temp)
    A(i) = XSteam('sL_T',Temp(i));
end

for j = 1:length(Temp)
    B(j) = XSteam('sV_T',Temp(j));
end

plot(A,Temp,'linewidth',1.35,'color','k')                                                % Plotting for saturation curve
plot(B,Temp,'linewidth',1.35,'color','k')                                                % Plotting for saturation curve

Temp = XSteam('Tsat_p',P1);
T0 = linspace(Temp,T1,300);

for i = 1 : length(T0)
    C(i) = XSteam('s_pt',P1,T0(i));
end

T5 = XSteam('Tsat_p',P4);
s5 = XSteam('sL_T',T5);

plot([S1 S2],[T1 T2],'linewidth',1.5,'color','r')                                        % Plotting for Temperature points T vs entropy points S
plot([S2 S3],[T2 T3],'linewidth',1.5,'color','r')
plot([S3 S4],[T3 T4],'linewidth',1.5,'color','r')
plot([S4 s5],[T4 T5],'linewidth',1.5,'color','r')

plot([Sf_sat Sg_sat],[Tf_sat Tf_sat],'linewidth',1.5,'color','r')
plot(C,T0,'linewidth',1.5,'color','r')

title('T-S Diagram for RANKINE CYCLE')
xlabel('Entropy(S) in [KJ/Kg.K]')
ylabel('Temperature(T) in [K]')

text(S1,T1,'1');                                                                          % Assigning the points 
text(S2,T2,'2');
text(S3,T3,'3');
text(S4,T4,'4');

% For Plotting H-S Diagram
figure(2)
hold on

Temp_t = linspace(0,400,1000);                                                            % Assigning the Temperature range between 0 to 400
for i = 1 : length(Temp_t)
    D(i) = XSteam('hL_T',Temp_t(i));
end

for j = 1 : length(Temp_t)
    E(j) = XSteam('hV_T',Temp_t(j));
end

plot(A,D,'linewidth',1.35,'color','k')                                                    % Plotting for saturation curve
plot(B,E,'linewidth',1.35,'color','k')                                                    % Plotting for saturation curve

plot([S1 S2],[H1 H2],'linewidth',1.5,'color','b')
plot([S2 S3],[H2 H3],'linewidth',1.5,'color','b')
plot([S3 S4],[H3 H4],'linewidth',1.5,'color','b')
plot([S4 S1],[H4 H1],'linewidth',1.5,'color','b')

title('H-S Diagram for RANKINE CYCLE')
xlabel('Entropy(S) in [KJ/Kg.K]')                                                      
ylabel('Enthalpy(H) in [KJ/KG]')

text(S1,H1,'1');                                                                           % Assigning the data point 1
text(S2,H2,'2');                                                                           % Assigning the data point 2
text(S3,H3,'3');                                                                           % Assigning the data point 3
text(S4,H4,'4');                                                                           % Assigning the data point 4

% Displaying the Results 

fprintf('At STATE POINT 1 -\n  P1 = %d bar\n  T1 = %.3f Deg C\n  H1 = %.3f KJ/Kg\n  S1 = %.3f KJ/Kg.K\r\n',P1,T1,H1,S1)          % Showing the results for State point 1 by printing
fprintf('At STATE POINT 2 -\n  P2 = %.3f bar\n  T2 = %.3f Deg C\n  H2 = %.3f KJ/Kg\n  S2 = %.3f KJ/Kg.K\r\n',P2,T2,H2,S2)        % Showing the results for State point 2 by printing   
fprintf('At STATE POINT 3 -\n  P3 = %.3f bar\n  T3 = %.3f Deg C\n  H3 = %.3f KJ/Kg\n  S3 = %.3f KJ/Kg.K\r\n',P3,T3,H3,S3)        % Showing the results for State point 3 by printing
fprintf('At STATE POINT 4 -\n  P4 = %d bar\n  T4 = %.3f Deg C\n  H4 = %.3f KJ/Kg\n  S4 = %.3f KJ/Kg.K\r\n',P4,T4,H4,S4)          % Showing the results for State point 4 by printing

disp('FINAL RESULTS FOR CYCLE')
fprintf('Work Done by Turbine : Wt = %.3f KJ/Kg\n',W_t)                                                                          % Printing the final calculated value for Wt
fprintf('Work Done by Pump : Wp = %.3f KJ/Kg\n',W_p)                                                                             % Printing the final calculated value for Wp
fprintf('Net Work Done : W_net = %.3f KJ/Kg\n',W_net)                                                                            % Printing the final calculated value for W_net
fprintf('Back Work Ratio : B_W_R = %.3f KJ/Kg\n',Back_W_R)                                                                       % Printing the final calculated value for Back Work Ratio
fprintf('Specific Steam Consumption : SSC = %.3f KJ/KWh\n',SSC)                                                                  % Printing the final calculated value for SSC
fprintf('Net Thermal Efficiency : N_th = %.3f Percent\n',Np)                                                                     % Printing the final calculated value for Thermal Efficiency

OUTPUTS :

  • T-S Diagram -


  • The above figure shows the plot for the temperature vs the Entropy for rankine cycle involing the 4 main processes in which 2 are isentropic and 2 are constant pressure process.


  • H - S Diagram -




  • The above figure shows the plot for the Enthalpy vs the Entropy for rankine cycle involing the 4 main processes in which 2 are isentropic and 2 are constant pressure process.



  • The above images shows the zoomed view to clearly understand the variation in T-S & H-S graph for process 3-4 respectively.


OUTPUT IN COMMAND WINDOW -



  • The above image shows the calculated results i.e the values for Rankine cycle including its Efficiency which is around 36.16 %.


STEPWISE EXPLANATION OF THE CODE :


  • We start the code with regular usual commands by using clear all ; close all ; clc ; for clearing the windows with previous data and closing any previous figures/plots generated.
  • 1st various processes from 1-4 for Rankine cycle are printed using fprintf command.
  • Initializing the known variables by giving the input using input command for T1, P1 & P2 variables.
  • Then extracting all the required values from the XSteam.m file library which act as a Standard Steam table to calculate the values for state points.
  • By using XSteam library file we call it by XSteam in MATLAB then required function are taken and then giving the input accordingly to that particular function like in case of State point 1 input given is P1 & T1.
  • Similarly, state point 2,3, & 4 are calculated for Enthalpy, Entropy, Pressure & Temperature using XSteam functions.
  • Next calculation had been done by using the basic formulae for Work done (W.D) and Heat transferred (Q) in the Rankine cycle along with the thermal efficiency respectively.
  • Then, temperature range has been specified using linspace command & figure 1 has been plotted in which the for loop is used logically to construct the saturation curve in graph .
  • Finally, for figure 1 Temperature vs Entropy has been plotted using plot command by mentioning S1 to S4 for X-axis & T1 to T4 points for Y-axis along with plotting for saturated cuvre respectively.
  • A command named text is used further in last step for plotting the T-S graph in which text command is used add text descriptions to data points like 1,2,3 & 4 we had added easily.

Syntax used for text command – text(x,y,text)

  • Same procedure which is used to plot T-S graph had been followed and coded further for H-S Enthalpy vs Entropy Graph to get the output.
  • In the final step all the calculated state points and the necessary values like net work done, efficiency, back ratio, etc had been printed step by step using fprintf command in MATLAB respectively.

Errors faced while programming :

  • Error faced in plotting T-S just because of silly mistake in typing in plot command used decimal . instead of comma , to separate for x , y axis shown below.

Syntax error - plot(B.Temp,'linewidth',1.35,'color','k')

Steps taken to overcome the Errors Faced –

  • Used comma and eliminated decimal (.) to separate x for B & y axis for Temp while using plot command.

Correct syntax - plot(B,Temp,'linewidth',1.35,'color','k')

Screenshots showing ERRORS :



CONCLUSION :

  • Hence, we had briefly understood the concept of Rankine cycle for steam generation and the ways to code for the program for rankine cycle simulator in MATLAB. Also, calculation of all the state points of rankine cycle , the work output , Back work ratio & Efficiency is calculated. Finally, the figure for T-S & H-S diagram is plotted using various commands in MATLAB respectively.


REFERENCES -


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.