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.

Theory:-

The Rankine cycle is an idealized thermodynamic cycle describing the process by which specific 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 the 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.

The ideal Rankine cycle does not involve any internal irreversibilities and consists of the following four processes:

(1-2) Isentropic compression in a pump

(2-3) Constant-pressure heat addition in a boiler

(3-4) Isentropic expansion in a turbine

(4-1) Constant-pressure heat rejection in a condenser

There are four processes in the Rankine cycle. The states are identified by numbers (in brown) in the T–s diagram.

  • 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, or numerically, using steam tables or software. Process 2-3 is constant pressure heat addition in the boiler.
  • Process 3–4: The dry saturated vapour expands through turbines, 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 the condenser.

The kinetic and potential energy changes of the steam are usually small relative to the work and heat transfer terms and are therefore usually neglected. Then the steady-flow energy equation per unit mass of steam reduces to

The boiler and the condenser do not involve any work, and the pump and the turbine are assumed to be isentropic. Then the conservation of energy relation for each device can be expressed as follows:

The thermal efficiency of the Rankine cycle is determined from:-

Procedure:-

1. The First step is to use basic commands clear all, close all and clc for clearing the command window and workspace.

2. After that I define all the points or we can say the four major components of Rankine cycle Pump, Turbine, Condenser, and Boiler.

3. With the help of the input command I gave some input parameters:-

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

4. After that find all the state variables at these four points using xsteam file.

5. Plotting all the points on Graphs.

6. After that we calculate work and efficiency for Rankine Cycle.

7. At the end with help of the display command fprintf we print all the state variables points on the command window.

Code:

% MATLAB Program to simulate the Rankine cycle and also plot the required T-S and H-S Graphs for Inputs 
 
clear all 

close all

clc

% Rankine cycle has four main components Turbine, Condensor, Pump, and Boiler as according to diagram they are divided as follows

% 1= Turbine Inlet or boiler Outlet
% 2= Condensor Inlet or Turbine Outlet
% 3= Pump Inlet or Consendor Outlet 
% 4= Boiler Inlet and Pump Outlet

% Input Parameters which are given as 

% p1= Turbine Inlet Pressure 30 bar
% T1= Turbine inlet Temperature 400 Celcius
% p2= Turbine outlet pressure 0.05 bar

% Rankine cycle is operated on the four process 

fprintf('Process (1-2) - Isentropic Expansion in Turbine\n')

fprintf('Process (2-3) - Isobaric Heat Rejection By Condensor\n')

fprintf('Process (3-4) - Isentropic Compression in Pump\n')

fprintf('Process (4-1) - Isobaric Heat Addition by Boiler\n')

% For Inputting State variable at point one- Turbine

p1=input('Enter the value of pressure at turbine inlet (in bar): ');

t1=input('Enter the value of temperature at turbine inlet (in degree celcius): ');

p2=input('Enter the value of pressure at turbine outlet (in bar): ');

% State variable at state 1 - Turbine inlet

% Enthalpy In [KJ/Kg]
h1=XSteam('h_pT',p1,t1);

% Specific ENtropy In [KJ/kg k]
s1=XSteam('s_pT',p1,t1);

%specific Volume In [m^3/kg]
v1=XSteam('v_pT',p1,t1);

% State Variable at state point 2 - Condensor inlet 

% Specific Entropy in [KJ/kg K]
s2=s1;

% Enthalpy In [KJ/Kg]
h2=XSteam('h_px',p2,XSteam('x_ps',p2,s2));

% Temperature in [Degree Celcius]
t2=XSteam('T_ps',p2,s2);

% Specific volume in [m^3/kg]
v2=XSteam('v_ps',p2,s2);

% State Variable at state point 3- Pump inlet

% Pressure in [bar]
p3=p2;

%Temperature in [Degree Celcius]
t3=XSteam('Tsat_p',p3);

% Enthalpy in [KJ/kg]
h3=XSteam('hL_p',p3);

% Entropy in [KJ/kg K]
s3=XSteam('sL_p',p3);

% Specific volume in[ m^3/kg]
v3=XSteam('vL_p',p3);

% State variable at state point 4 - Boiler inlet

% Specific entropy  in [kJ/kg K]
s4 = s3;     

% Pressure in [bar]
p4 = p1;  

% Enthalpy in [kJ/kg]
h4 = XSteam('h_ps',p4,s4);   

% Temperature in [degree C]
t4 = XSteam('T_ps',p4,s4); 

% Specific volume in [m3/kg]
v4 = XSteam('v_ps',p4,s4); 

% Plotting the Graph for ideal Rankine Cycle In "T' Vs "S'

figure(1)

hold on

plot([s1 s2],[t1 t2],'LineWidth',3,'Color','r');

plot([s2 s3],[t2 t3],'LineWidth',3,'Color','k');

plot([s3 s4],[t3 t4],'LineWidth',3,'Color','c');

Trange=linspace(t4,t1,500);

for i=1:length(Trange)

     s_range(i) = XSteam('s_pT',p1,Trange(i));

     h_range23(i) = XSteam('h_ps',p1,s_range(i));

     h_range41(i) = XSteam('h_ps',p2,s_range(i));

end

plot(s_range,Trange,'LineWidth',3,'Color','b');

legend('Reversible Adiabatic Expansion', 'Constant Pressure Heat Rejection', 'Reversible Isentropic Compression', 'Constant Pressure Heat Addtion');

% Plotting Graph for Ideal Rankine cycle in 'h' vs 's'.

figure(2)

hold on

plot([s1 s2],[h1 h2],'color','r','linewidth',3);

plot(s_range,h_range23,'color','k','linewidth',3);

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

plot(s_range,h_range41,'color','b','linewidth',3);

legend('Reversibl eAdiabatic Expansion', 'Constant Pressure Heat Rejection', 'Reversible Isentropic Compression', 'Constant Pressure Heat Addtion');

% Plotting graphs for 'T' vs 's' 

t_range = linspace(0,374.15,500);                   % Temperature from 0 to critical point of water in [degree C]

figure(1)

hold on

for i = 1:length(t_range)

    plot(XSteam('sL_t',t_range(i)),t_range(i),'.','color','g')

    plot(XSteam('sV_t',t_range(i)),t_range(i),'.','color','g')

end

% Plotting graphs for  'h' vs 's' 

figure(2)

hold on

for i = 1:length(t_range)

    plot(XSteam('sL_t',t_range(i)),XSteam('hL_t',t_range(i)),'.','color','g')

    plot(XSteam('sV_t',t_range(i)),XSteam('hV_t',t_range(i)),'.','color','g')

end 

% Plotting Diagram for All state points for Ideal Rankine cycle in 'T' vs 'S' 

figure(1)

hold on

plot(s1,t1,'ko')

plot(s2,t2,'ko')

plot(s3,t3,'ko')

plot(s4,t4,'ko')

grid on

title('T-s Diagram of RANKINE CYCLE')

xlabel('Temperature in [degree C]')

ylabel('Specific entropy  in [kJ/kg K]')

% Plotting Diagram for All state points for Ideal Rankine cycle in 'h' vs 's'

figure(2)

hold on

plot(s1,h1,'ko')

plot(s2,h2,'ko')

plot(s3,h3,'ko')

plot(s4,h4,'ko')

grid on

title('h-s Diagram of RANKINE CYCLE')

xlabel('Enthalpy in [kJ/kg]')

ylabel('Specific entropy  in [kJ/kg K]')


% Finally Calculating Work and Efficiency

Work_turbine = h1 - h2;                              % work transferred from the working fluid (kJ/kg) 

Q_taken_out_condenser = h2 - h3;                           % heat rejected from the working fluid (kJ/kg) 

Work_pump = h4 - h3;                                 % work transferred into the working fluid (kJ/kg)

Q_given_boiler = h1 - h4;                               % heat transferred to the working fluid (kJ/kg) 

Back_Work_Ratio = Work_turbine / Work_pump;                          % Back Work Ratio

SSE = 3600/(Work_turbine - Work_pump);                   % Specific Steam Consumption [kg/kWh]

Work_net = Work_turbine - Work_pump;                         % Net work on the working fluid (kJ/kg) 

Effi_rankine = Work_net/Q_given_boiler;                       % Rankine Cycle Efficiency

clc

% Printing Results to the USER GIVING input

fprintf('**********RANKINE CYCLE:IDEAL CYCLE FOR VAPOUR POWER CYCLE**********\n\n');

fprintf('Process 1-2: Reversible adiabatic expansion process in the steam turbine\n');
fprintf('Process 2-3: Constant pressure heat transfer process in the condenser\n');
fprintf('Process 3-4: Reversible adiabatic compression process in the pump\n');
fprintf('Process 4-1: Constant pressure heat transfer process in the boiler\n\n');

fprintf('----------State variable at state point 1----------\n');
fprintf('Turbine Inlet Temperature T1 = %.4f in [degree C]\n',t1);
fprintf('Turbine Inlet Pressure p1 = %.4f in [bar]\n',p1);
fprintf('Turbine Inlet Enthalpy h1 = %.4f in [kJ/kg]\n',h1);
fprintf('Turbine Inlet Specific entropy s1 = %.4f in [kJ/kg K]\n',s1);
fprintf('Turbine Inlet Specific volume v1 = %.4f in [m3/kg]\n\n',v1);

fprintf('----------State variable at state point 2----------\n');
fprintf('Conderser Inlet Temperature T1 = %.4f in [degree C]\n',t2);
fprintf('Conderser Inlet Pressure p1 = %.4f in [bar]\n',p2);
fprintf('Conderser Inlet Enthalpy h1 = %.4f in [kJ/kg]\n',h2);
fprintf('Conderser Inlet Specific entropy s1 = %.4f in [kJ/kg K]\n',s2);
fprintf('Conderser Inlet Specific volume v1 = %.4f in [m3/kg]\n \n',v2);

fprintf('----------State variable at state point 3----------\n');
fprintf('Pump Inlet Temperature T1 = %.4f in [degree C]\n',t3);
fprintf('Pump Inlet Pressure p1 = %.4f in [bar]\n',p3);
fprintf('Pump Inlet Enthalpy h1 = %.4f in [kJ/kg]\n',h3);
fprintf('Pump Inlet Specific entropy s1 = %.4f in [kJ/kg K]\n',s3);
fprintf('Pump Inlet Specific volume v1 = %.4f in [m3/kg]\n\n',v3);

fprintf('----------State variable at state point 4----------\n');
fprintf('Boiler Inlet Temperature T1 = %.4f in [degree C]\n',t4);
fprintf('Boiler Inlet Pressure p1 = %.4f in [bar]\n',p4);
fprintf('Boiler Inlet Enthalpy h1 = %.4f in [kJ/kg]\n',h4);
fprintf('Boiler Inlet Specific entropy s1 = %.4f in [kJ/kg K]\n',s4);
fprintf('Boiler Inlet Specific volume v1 = %.4f in [m3/kg]\n \n',v4);

fprintf('----------Work and Efficiency----------\n'); 
fprintf('Work transferred from the working fluid Wturbine = %.4f in [kJ/kg]\n',Work_turbine);
fprintf('Heat rejected from the working fluid Qcondenser = %.4f in [kJ/kg]\n',Q_taken_out_condenser);
fprintf('Work transferred into the working fluid Wpump = %.4f in [kJ/kg]\n',Work_pump);
fprintf('Heat transferred to the working fluid Qboiler = %.4f in [kJ/kg]\n \n',Q_given_boiler);

fprintf('Back Work Ratio BWR = %.4f \n',Back_Work_Ratio);
fprintf('Specific Steam Consumption SSE = %.4f in [kg/kWh] \n',SSE);
fprintf('Net work on the working fluid Wnet = %.4f in [kJ/kg] \n',Work_net);
fprintf('Rankine Cycle Efficiency ETArankine = %.4f %% \n\n',Effi_rankine*100);

fprintf('*************** THANK YOU ***************');

Result and Conclusion:-

1-All the state variables points are calculated with the help of steam table data.

2-Both the charts T-s and h-s are drawn successfully.

3-Work and efficiency have been calculated as follows:

W=1117.86 [kJ/kg]

eta=36.16%

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.