Challenge

Rankine cycle Simulator Using MATLAB Program

Objective: To Program A Rankine cycle Simulator using a MATLAB Program

Introduction of Rankine Cycle:

The Rankine cycle closely describes the process by which steam-operated heat engines commonly found in thermal power generation plants generate power.

Power depends on the temperature difference between a heat source and a cold source. The higher the difference, the more mechanical power can be efficiently extracted out of heat energy, as per Carnot's theorem.

The heat sources used in these power plants are usually nuclear fission or the combustion of fossil fuels such as coal, natural gas, and oil, or concentrated solar power. The higher the temperature, the better.

The efficiency of the Rankine cycle is limited by the high heat of vaporization of the working fluid. Also, unless the pressure and temperature reach supercritical levels in the steam boiler, the temperature range the cycle can operate over is quite small: steam turbine entry temperatures are typically around 565 °C and steam condenser temperatures are around 30 °C.[citation needed] This gives a theoretical maximum Carnot efficiency for the steam turbine alone of about 63.8% compared with an actual overall thermal efficiency of up to 42% for a modern coal-fired power station. This low steam turbine entry temperature (compared to a gas turbine) is why the Rankine (steam) cycle is often used as a bottoming cycle to recover otherwise rejected heat in combined-cycle gas turbine power stations.

The cold source (the colder the better) used in these power plants are usually cooling towers and a large water body (river or sea). The efficiency of the Rankine cycle is limited on the cold side by the lower practical temperature of the working fluid.

The working fluid in a Rankine cycle follows a closed loop and is reused constantly. The water vapor with condensed droplets often seen billowing from power stations is created by the cooling systems (not directly from the closed-loop Rankine power cycle). This 'exhaust' heat is represented by the "Qout" flowing out of the lower side of the cycle shown in the T–s diagram below. Cooling towers operate as large heat exchangers by absorbing the latent heat of vaporization of the working fluid and simultaneously evaporating cooling water to the atmosphere.

There are four processes in the Rankine 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. 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 vapor. Process 2-3 is [Constant pressure heat addition in boiler]
  • Process 3–4: The dry saturated vapor expands through a turbine, generating power. This decreases the temperature and pressure of the vapor, and some condensation may occur. Process, 3-4 is [Isentropic expansion]
  • Process 4–1: The wet vapor 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 condenser]

The actual vapor power cycle differs from the ideal Rankine cycle because of irreversibility’s 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.

The equation for Performance of Rankine cycle

Work done by the Turbine

`W_(turb)= m*(Enthalpy _1 - Enthalpy _2)`

Considering the mass flow rate of steam to be 1kg/sec in the entire system

Work done by the Condenser

`W_(pump)= (Enthalpy _4 - Enthalpy _3)`

Net work output

`W=W_(turb)-W_(pump)`

Back Work ration

`BWR=W_(pump)/W_(turb)`

Specific Steam Consumption

The capacity of a steam plant is often expressed in terms of steam rate or specific steam consumption which is defined as the ratio of steam flow(kg/sec).

`SSC= 3600/W`

Enthalpy _1 = Enthalpy at the inlet of the turbine or exit of the boiler

Enthalpy _2 = Enthalpy at the exit of the turbine or inlet of the condenser

Enthalpy _3 = Enthalpy at the inlet of the pump or exit of condenser

Enthalpy _4 = Enthalpy at the inlet of the boiler or exit of pump

XSteam File :

X Steam for Matlab is an implementation of the IAPWS IF97 standard formulation. It provides accurate data for water and steam and mixtures of water and steam properties from 0 - 1000 bar and from 0 - 2000 deg C. It is programmed as a MATLAB .m file.

Calling syntax: XSteam(‘fun’,In1.[In2]). XSteam takes 2 or 3 arguments. The first argument must always be the steam table function you want to use. The other arguments are the inputs to that function.

  • Example: XSteam('h_pt',1,20) Returns the enthalpy of water at 1 bar and 20 degC
  • Example: XSteam('TSat_p',1) Returns the saturation temperature of water at 1 bar.

MATLAB CODE:

clc;
clear all;
close all;
disp('Rankine Cycle Simulator')
disp('1-2 is Isentropic Compression in pump')
disp('2-3 Constant Pressure heat addition in boiler')
disp('3-4 Isentropic expansion in the Turbine')
disp('4-1 Constant Pressure heat rejection by Condenser')
Turbine_in_Temp = input('Enter the Inlet Temperature of Turbine in degree Celcius: ');
Turbine_in_Pressure = input('Enter the Inlet Pressure of Turbine in bar: ');
Turbine_out_Pressure = input('Enter the Condenser Pressure in bar:' );
%Properties at Pump Inlet
Pressure_1 = Turbine_out_Pressure;
Temperature_1 = XSteam('TSat_p',Pressure_1);
Enthalpy_1 = XSteam('hL_p',Pressure_1);
Entropy_1 = XSteam('sL_p',Pressure_1);

%Properties of Pump Outlet
Pressure_2 = Turbine_in_Pressure;
Temperature_2 = XSteam('T_ps',Pressure_2,Entropy_1);
Enthalpy_2 = XSteam('h_pT',Pressure_2,Temperature_2);
Entropy_2 = Entropy_1;

%Properties at 2' Saturated liquid states
Pressure2_dash = Pressure_2;
Temperature2_dash = XSteam('TSat_p',Pressure_2);
Enthalpy2_dash = XSteam('hL_p',Pressure_2);
Entropy2_dash = XSteam('sL_p',Pressure_2);

%Properties at Turbine Inlet
T_Sat_3 = Temperature2_dash;
Temperature_3 = Turbine_in_Temp;
Pressure_3 = Turbine_in_Pressure;
Enthalpy_3 = XSteam('h_pT',Pressure_3,Temperature_3);
Entropy_3 =  XSteam('s_pT',Pressure_3,Temperature_3);
    
    
    Pressure3_dash = Pressure_3;
    Temperature3_dash = XSteam('TSat_p',Pressure_3);
    Enthalpy3_dash = XSteam('hV_p',Pressure_3);
    Entropy3_dash = XSteam('sV_p',Pressure_3);


 
%Properties at Turbine Output
    Pressure_4 = Turbine_out_Pressure;
    Temperature_4 = Temperature_1;
    Entropy_4 = Entropy_3;
    Enthalpy_4 = XSteam('h_ps',Pressure_4,Entropy_4);
    Work_turbine = Enthalpy_3 - Enthalpy_4;
    Work_compressor = Enthalpy_2 - Enthalpy_1;
    
    Net_workdone = (Enthalpy_3-Enthalpy_4)-(Enthalpy_2-Enthalpy_1);
    Back_work_ratio = (Enthalpy_2-Enthalpy_1)/(Enthalpy_3-Enthalpy_4);
    SCC = 3600/Work_turbine;
    Qin = Enthalpy_3 - Enthalpy_2;
    Thermal_eff = Net_workdone*100/Qin;
    
   T_f = Pressure_1;
   T_t = XSteam('Tsat_p',T_f);
   while ~isnan(T_t)
       T_f = T_f - 0.00001;
       T_t = XSteam('Tsat_p',T_f);
       
   end
   Pressure_min = T_f+0.00001;
   
   T_f1 = Pressure_3;
   T_t1 = XSteam('Tsat_p',T_f1);
   while ~isnan(T_t1)
       T_f1 = T_f1+1;
       T_t1 = XSteam('Tsat_p',T_f1);
   end
   Pressure_max = T_f1-1;
   
  Pressure = linspace(Pressure_min,Pressure_max,1000);
  for i = 1:length(Pressure)
      T_sat(i) = XSteam('Tsat_p',Pressure(i));
      S_sat_L(i) = XSteam('sL_p',Pressure(i));
      S_sat_V(i) = XSteam('sV_p',Pressure(i));
  end
  
  figure(1)
  hold on 
  plot(S_sat_L,T_sat,'c','linestyle','--','linewidth',2)
  plot(S_sat_V,T_sat,'c','linestyle','--','linewidth',2)
  
  plot([Entropy_1 Entropy_2],[Temperature_1 Temperature_2],'color','r','linewidth',2)
  Temp_range = linspace(Temperature_2,Temperature2_dash,100);
  for i = 1:length(Temp_range)
      S_range(i) = XSteam('s_pT',Pressure_2,Temp_range(i));
  end
  plot(S_range,Temp_range,'color','g','linewidth',2)
  
  if Temperature_3==T_Sat_3
      plot([Entropy2_dash Entropy_3],[Temperature2_dash Temperature_3],'color','b','linewidth',2)
 
  elseif Temperature_3>T_Sat_3
       plot([Entropy2_dash Entropy3_dash],[Temperature2_dash Temperature3_dash],'color','c','linewidth',2)
       
       Temp_range_1 = linspace(Temperature3_dash,Temperature_3,10000);
       for i = 1:length(Temp_range_1)
           S_range_1(i) = XSteam('s_pT',Pressure_3,Temp_range_1(i));
       end
       plot(S_range_1,Temp_range_1,'color','y','linewidth',2)
  end

  plot([Entropy_3 Entropy_4],[Temperature_3 Temperature_4],'color','r','linewidth',2)
   plot([Entropy_4 Entropy_1],[Temperature_4 Temperature_1],'color','b','linewidth',2)
  
  text(Entropy_1,Temperature_1,'1')  
  text(Entropy_2,Temperature_2,'2') 
  text(Entropy2_dash,Temperature2_dash,"2'")
  text(Entropy_3,Temperature_3,'3')
  text(Entropy3_dash,Temperature3_dash,"3'")
  text(Entropy_4,Temperature_4,'4')
  axis([-1 10 0 500])
  xlabel('Entropy(KJ/kgK)')
  ylabel('Temperature(K)')
  title('T-S Diagram of The Rankine Cycle')
  
  %plotting H-S curve
  for i = 1:length(Pressure)
      H_Sat_L(i) = XSteam('hL_p',Pressure(i));
      H_Sat_V(i) = XSteam('hV_p',Pressure(i));    
  end
  figure(2)
  hold on 
  axis([0 10 0 3500])
  plot(S_sat_L,H_Sat_L,'c','linestyle','--','linewidth',2)
  plot(S_sat_V,H_Sat_V,'c','linestyle','--','linewidth',2)
  plot([Entropy_1 Entropy_2],[Enthalpy_1 Enthalpy_2],'color','g','linewidth',2)
  text(Entropy_1,Enthalpy_1,'1')
  plot([Entropy_2 Entropy_3],[Enthalpy_2 Enthalpy_3],'color','g','linewidth',2)
  text(Entropy_2,Enthalpy_2,'2')
  plot([Entropy_3 Entropy_4],[Enthalpy_3 Enthalpy_4],'color','g','linewidth',2)
  text(Entropy_3,Enthalpy_3,'3')
  plot([Entropy_4 Entropy_1],[Enthalpy_4 Enthalpy_1],'color','g','linewidth',2)
  text(Entropy_4,Enthalpy_4,'4')
  title('H-S Diagram of The Rankine cycle')
  xlabel('Specific Entropy(S) kJ/kgK')
  ylabel('Specific Enthalpy(H) kJ/kg')
  
  fprintf('Results\n')
  fprintf('At State point 1 \n');
  fprintf('Pressure_1 is :%f Bar \n',Pressure_1)
  fprintf('Temperature_1 is :%f degC \n',Temperature_1)
fprintf('Entropy_1 is :%f kJ/kg \n',Entropy_1)
fprintf('Enthalpy_1 is :%f kJ/kg \n\n',Enthalpy_1)

fprintf('At State point 2 \n');
fprintf('Pressure_2 is :%f Bar \n',Pressure_2)
fprintf('Temperature_2 is :%f degC \n', Temperature_2)
fprintf('Entropy_2 is :%f kJ/kg \n',Entropy_2)
fprintf('Enthalpy_2 is :%f kJ/kg \n\n',Enthalpy_2)

fprintf('At State Point 3 \n')
fprintf('Pressure_3 is :%f Bar \n',Pressure_3)
fprintf('Temperature_3 is :%f degC \n', Temperature_3)
fprintf('Entropy_3 is :%f kJ/kg \n',Entropy_3)
fprintf('Enthalpy_3 is :%f kJ/kg \n\n',Enthalpy_3)

fprintf('At State Point 4 \n')
fprintf('Pressure_4 is :%f Bar \n',Pressure_4)
fprintf('Temperature_4 is :%f degC \n', Temperature_4)
fprintf('Entropy_4 is :%f kJ/kg \n',Entropy_4)
fprintf('Enthalpy_4 is :%f kJ/kg \n\n',Enthalpy_4)

fprintf('Work by turbine is :%f kJ/kg \n', Work_turbine)
fprintf('Work by Compressor is :%f kJ/kg \n',Work_compressor)
fprintf('Net Workdone is :%f kJ/kg \n',Net_workdone)
fprintf('Thermal Efficiency is :%f \n', Thermal_eff);
fprintf('S.S.C is :%f kg/kWh\n', SCC)
fprintf('Back work Ratio is :%f ', Back_work_ratio)

Explanation:

First clear all, close all, clc command is used to clear all the data from the workspace and command window and close all this figure which is open its always good to start with these three commands before starting a code

The percent sign is most commonly used to indicate non-executable text within the body of a program. those non-executable texts are for better understanding the code

disp command is used to Display value on the command window

input command is used for request user input for temperature and pressure for the turbine

input('Enter the Inlet Temperature of Turbine in degree Celcius: ') , displays the text and waits for the user to input a value and press the Return key.

Parameters for the different stage is taken form XSteam function using the input parameters.

If – else if command is used for the different conditions for turbine inlet, If the temperature inlet is less than the saturation temperature at boiler pressure that case is not practically possible.

Once all the stage parameters are calculated Net work, Back_work ratio, Thermal efficiency, and SSC is been evaluated using the formula.

For plotting Maximum and Minimum pressure limit is found using loop , isnan command is used for min and max pressure to keep decreasing and increasing till it cease to exit

Using parameter value found in each stage the graph between Enthalpy vs Entropy and Temperature vs Entropy is been plotted.

The state 2-state 2’ and state 3-state 3’ is superheating state from state 3-3’ variation is not linear the variation is captured by evaluating entropy at different temperature values between state 2- state 2’ using XSteam function.

Results:

Input:

Turbine Inlet temperature = 400° C

Turbine Inlet Pressure = 30 bars

Turbine Outlet Pressure = 0.05 bars = Condenser Inlet Pressure

State Points:

PLOTS:

Conclusion

Rankine Cycle Simulator is created using steam table data method from XSteam library, All The state point of Rankine Cycle is calculated with the given Input parameters along with the performance of Rankine Cycle and T-S and H-S graph is plotted based on the State point.

http://assets.openstudy.com/updates/attachments/4e134b420b8b56e555996beb-slnkktn-1310012884358-xsteamformatlab.pdf

https://in.mathworks.com/matlabcentral/fileexchange/29186-xsteamw-a-vectorizing-wrapper-for-xsteam

https://en.wikipedia.org/wiki/Rankine_cycle

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

https://energyeducation.ca/encyclopedia/Rankine_cycle

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.