Challenge

Project 2 - Rankine cycle Simulator using MATLAB

AIM:

Write a program in MATLAB for Rankine cycle simulation.

Objective:

  • To Create a Rankine Cycle Simulator using MATLAB.
  • To calculate the state points of the Rankine Cycle (any type of your choice) based on user inputs.
  • To plot the corresponding T-s and h-s plots for the given set of inputs.

Theory:

The Rankine cycle is a model used to predict the performance of systems. It was also used to study the performance of reciprocating steam engines. The Rankine cycle is an idealized thermodynamic cycle of a heat engine that converts heat into mechanical work while undergoing phase change. It is an idealized cycle in which friction losses in each of the four components are neglected. The heat is supplied externally to a closed loop, which usually uses water as the working fluid. It is named after William John Macquorn Rankine, a Scottish polymath and Glasgow University professor.

Fig: Basic Rankine Cycle

Fig: T-S Diagram of Rankine Cycle

There are four processes in the Rankine cycle:

1.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. In other words, Process 3-4 is Isentropic expansion.

2.Process 2–3: The wet vapour then enters a condensor, where it is condensed at a constant pressure to become a liquid. In other words, Process 4-1 is Constant pressure heat rejection in condenser.

3.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. In other words, Process 1-2 is Isentropic compression.

4.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. In other words, Process 2-3 is Constant pressure heat addition in boiler.

FORMULA USE FOR THE CALCULATION

1.Turbine work, Wt = H1-H2

2.Pump work, Wp = H4-H3

3.Heat addition Qin = H1-H4

4.Heat rejection Qout = H3-H2

5.Efficiency, η=(Wt−Wp)/Qinη=(W_t-W_p)/Q_in

η=(Wt​−Wp​)/Qi​n

η=Wt-WpQin

6.Back-work ratio, BWR=Wp/Wt

BWR=W_p/W_t

BWR=Wp​/Wt​

BWR=WpWt

7.Specific steam consumption, SSC=3600/(Wt−Wp)

SSC=3600/(W_t-W_p )

SSC=3600/(Wt​−Wp​)

Required Inputs:

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

The link for the standard Xsteam library to get the steam table data for water, is given below:

https://drive.google.com/file/d/1RK_fvrOj38CIaQvmLT1S3daqHnxKCGU-/view

STEP-WISE EXPLANATION OF CODE :

  1. First, I will print the general information regarding the Rankine cycle like process occurs in Rankine cycle.
  2. I take the inputs like turbine inlet pressure(P1) and temperature(T1) and turbine outlet pressure(P2).
  3. Then we calculate the state point variable which is specific enthalpy(H), specific entropy(S) at each point with the help of Xsteam subfunction.
  4. For point 2, we calculate the dryness fraction with this formula. x=S2-Sf2Sg2-Sf2.
  5. We have to plot the saturation curve for T-S diagram so we use for loop to calculate the specific entropy at each temperature range. (For water the critical temperature is 374̊ C)
  6. Then we plot line to connect the S1 and S2 point.
  7. Then we use IF command for the dryness fraction greater than 1. So, if dryness fraction greater than 1 than we plot the right curve.
  8. We plot the line to connect the state point 2,3 and 4.
  9. To connect the state-point 4 and 1 we have to use for loop because it is not connected by the straight line.so we calculate the specific entropy at each temperature which is lies between T4 and T1. So, we get the complete T-S diagram.
  10. For plotting H-S diagram first we plot the saturation curve for H-S diagram with help of for loop to calculate the specific enthalpy at each temperature value.
  11. Then we plot the line to connect the state points.
  12. We have to calculate turbine work, pump work, heat addition and heat rejection to find efficiency of the cycle.
  13. We also calculate the back-work ration and specific steam consumption with help of formula.
  14. Then we print the variable at each point in command window and we also print the turbine work, pump work, efficiency, etc.

PROGRAM:

% General calculation for Rankine Cycle Simulator
clear all
close all
clc

% Printing Introduction
fprintf('RANKINE CYCLE SIMULATOR \n')
fprintf('1-2 is isentropic expansion in the Turbine \n')
fprintf('2-3 is Constant Pressure Heat Rejection by the Condenser \n')
fprintf('3-4 is isentropic Compression in pump \n')
fprintf('4-1 is Constant Pressure Heat Addition by the Boiler \n');

% User Inputs
P1 = input('Enter the Pressure at the Turbine Inlet (in bar): ');
T1 = input('Enter the Temprature at the Turbine Inlet (in Degree Celcius): ');
P2 = input('Enter the Pressure at the Turbine Outlet (in bar): ');

% State point 1
H1 = XSteam('h_pt',P1,T1);  %Enthalpy
S1 = XSteam('s_pt',P1,T1);  %Entropy
Hf1 = XSteam('hL_p',P1);    %Enthalpy of saturated liquid
Hg1 = XSteam('hV_p',P1);    %Enthaply of saturated vapour
Ts1 = XSteam('Tsat_p',P1);  %Saturation Temprature
Sf1 = XSteam('sL_p',P1);    %Entropy of saturated liquid
Sg1 = XSteam('sV_p',P1);    %Entropy of saturated vapour

% State point 2
S2 = S1;
Sf2 = XSteam('sL_p',P2);
Sg2 = XSteam('sV_p',P2);
x = (S2-Sf2)/(Sg2-Sf2);     % Dryness fraction
Hf2 = XSteam('hL_p',P2);
Hg2 = XSteam('hV_p',P2);
H2 = Hf2 + x*(Hg2-Hf2);
T2 = XSteam('T_ph',P2,H2);
Ts2 = XSteam('Tsat_p',P2);  

% State point 3
H3 = Hf2;
S3 = Sf2;
T3 = T2;
P3 = P2;

% State point 4
P4 = P1;
S4 = S3;
H4 = XSteam('h_ps',P4,S4);
T4 = XSteam('T_ps',P4,S4);

t = linspace(0,374,500);    % temp space for plotting saturation cutves

%Plot T-S Diagram
figure(1)
hold on
% Plot Saturation Curve
for i = 1 : length(t)
   plot(XSteam('sL_T',t(i)),t(i),'.','color','b')
   plot(XSteam('sV_T',t(i)),t(i),'.','color','b')
end
% Plot Cycle
plot([S1 S2],[T1 T2],'linewidth',2,'color','r')
if x>1
    T3 = Ts2;
    plot([S2 Sg2 S3 S4],[T2 Ts2 T3 T4],'linewidth',2,'color','r')
    T2 = Ts2;
else
    plot([S2 S3 S4],[T2 T3 T4],'linewidth',2,'color','r')
end
l = linspace(T1,T2,1000);
for i = 1 : length(l)
    plot(XSteam('s_pT',P1,l(i)),l(i),'.','color','r')
end
plot([Sf1 Sg1],[Ts1 Ts1],'linewidth',2,'color','r')
xlabel('Entropy[KJ/Kg-K]')
ylabel('Temprature[K]')
title('T-S Diagram')

% Plot H-S Diagram
figure(2)
hold on
% Plot Saturation Curve
for i = 1 : length(t)
    plot(XSteam('sL_T',t(i)),XSteam('hL_T',t(i)),'.','color','b')
    plot(XSteam('sV_T',t(i)),XSteam('hV_T',t(i)),'.','color','b')
end
% Plot Cycle
plot([S1 S2 S3 S4 S1],[H1 H2 H3 H4 H1],'linewidth',2,'color','r')
xlabel('Entropy[KJ/Kg-K]')
ylabel('Enthalpy[KJ/Kg]')
title('H-S Diagram')

%culations

% Turbine Work
Wt = H1-H2;

% Pump Work
Wp = H4-H3;

% Heat Addition
Qin = H1-H4;

% Heat Rejection
Qout = H2-H3;

% Net Work
Wnet = Wt-Wp;

%ficiency
Ntherm = (Wnet/Qin)*100;

% Specific steam consumption
SSC = 3600/Wnet;

% Work Ratio
BWR = Wp/Wt;

% Print Results
fprintf('Results \n')
fprintf('At State Point 1:\n');
fprintf('P1 is : %.2f bar \n',P1);
fprintf('T1 is : %.2f Deg Celcius \n',T1);
fprintf('H1 is : %.2f KJ/Kg \n',H1);
fprintf('S1 is : %.2f KJ/Kg-K \n',S1);

fprintf('At State Point 2: \n');
fprintf('P2 is : %.2f bar \n',P2);
fprintf('T2 is : %.2f Deg Celcius \n',T2);
fprintf('H2 is : %.2f KJ/Kg \n',H2);
fprintf('S2 is : %.2f KJ/Kg-K \n',S2);

fprintf('At State Point 3: \n');
fprintf('P3 is : %.2f bar',P3);
fprintf('T3 is : %.2f Deg Celcius \n',T3);
fprintf('H3 is : %.2f KJ/Kg \n',H3);
fprintf('S3 is : %.2f KJ/Kg-K \n',S3);

fprintf('At State Point 4: \n');
fprintf('P4 is : %.2f bar \n',P4);
fprintf('T4 is : %.2f Deg Celcius \n',T4);
fprintf('H4 is : %.2f KJ/Kg \n',H4);
fprintf('S4 is : %.2f KJ/Kg-K \n',S4);

fprintf('Wt is : %.2f KJ/Kg \n',Wt);
fprintf('Wp is : %.2f KJ/Kg \n',Wp);
fprintf('Wnet is : %.2f KJ/Kg \n',Wnet);
fprintf('Thermal Efficiency is : %.2f percentn \n',Ntherm);
fprintf('S.S.C. is : %.2f Kg/KWh \n',SSC);
fprintf('Back Work Ratio is : %.3f \n',BWR);

OUTPUT OF PROGRAM

RANKINE CYCLE SIMULATOR 
1-2 is isentropic expansion in the Turbine 
2-3 is Constant Pressure Heat Rejection by the Condenser 
3-4 is isentropic Compression in pump 
4-1 is Constant Pressure Heat Addition by the Boiler 
Enter the Pressure at the Turbine Inlet (in bar): 30
Enter the Temprature at the Turbine Inlet (in Degree Celcius): 400
Enter the Pressure at the Turbine Outlet (in bar): 0.05

Results
 
At State Point 1:
P1 is : 30.00 bar 
T1 is : 400.00 Deg Celcius 
H1 is : 3231.57 KJ/Kg 
S1 is : 6.92 KJ/Kg-K 

At State Point 2: 
P2 is : 0.05 bar 
T2 is : 32.88 Deg Celcius 
H2 is : 2110.71 KJ/Kg 
S2 is : 6.92 KJ/Kg-K
 
At State Point 3: 
P3 is : 0.05 barT3 is : 32.88 Deg Celcius 
H3 is : 137.77 KJ/Kg 
S3 is : 0.48 KJ/Kg-K 

At State Point 4: 
P4 is : 30.00 bar 
T4 is : 32.95 Deg Celcius 
H4 is : 140.76 KJ/Kg 
S4 is : 0.48 KJ/Kg-K 

Wt is : 1120.86 KJ/Kg 
Wp is : 3.00 KJ/Kg 
Wnet is : 1117.87 KJ/Kg 
Thermal Efficiency is : 36.17 percentn 
S.S.C. is : 3.22 Kg/KWh 
Back Work Ratio is : 0.003 
>> 

GRAPH

1.T-S Diagram



2. H-S Diagram

Error faced while programing:

Error in calling Xsteam file.

-Which was resolve by reviewing the command and calling the proper address of Xsteam file.

Conclusion:

Thus we have obtained the values of P,T,H and S for different state points and also the work,Efficiency,Back work ratio and Specific steam conductivity was calculated and also T-S and H-S of Rankine Cycle was ploted.

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.