Rankine cycle Simulator using Matlab
IDEAL RANKINE CYCLE SIMULATOR USING MATLAB
AIM :-
To create a program for plotting H-S and T-S diagram of Ideal Rankine Cycle.
PLATFORM USED :-
- Software – MATLAB R2019a
- Programming Language – C/C++
SYSTEM SPECIFICATIONS :-
- Manufacturer - DELL
- Model – Vostro 3478
- Operating System - Windows 10
- Processor - Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz 1.80GHz
- RAM – 8 GB
OBJECTIVE :-
- To plot H-S and T-S diagram of Ideal Rankine Cycle.
- Evaluate the Net Work Done and Cycle Efficiency.
THEORY :-
The Rankine cycle is a model used to predict the performance of steam turbine 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 named after William John Macquorn Rankine, a Scottish polymath and Glasgow University professor.
There are four process in Rankine Cycle,
- Process 1-2 : Isentropic Compression in Pump
- Process 2-3 : Constant Pressure Heat Addition by the Boiler
- Process 3-4 : Isentropic Expansion in Turbine
- Process 4-1 : Constant Pressure Heat Rejection by the Condenser
PROCESS 1-2 :-
In this process the water is pumped to the boiler where the entropies remain constant (S1 = S2).
PROCESS 2-3 :-
In this process the boiler heats the pumped water and the state gets converted into steam at constant pressure (P2 = P3).
PROCESS 3-4 :-
In this process the steam gets expanded in the turbine to generate power where the entropies remain constant (S3 = S4).
PROCESS 4-1 :-
In this process the steam gets converted back into water by removing the heat from the steam at constant pressure (P4 = P1).
NOTE :-
Here I had considered that the Ideal Rankine Cycle starts from Turbine and ends in Boiler for easy calculations and plotting graphs. And also the formulae subject to change as the state points vary.
There four processes are,
- Process 1-2 : Isentropic Expansion in Turbine
- Process 2-3 : Constant Pressure Heat Rejection by the Condenser
- Process 3-4 : Isentropic Compression in Pump
- Process 4-1 : Constant Pressure Heat Addition by the Boiler
GOVERNING EQUATIONS :-
i.Efficiency of Rankine Cycle,
`ƞ_(Rank) = (TWD)/(Heat__Supplied)`
Where,
ii.Work Done by the Turbine,
`W_{Turb} = H1 – H2`
Where,
iii.Work Done by the Pump,
`W_{Pump} = H4 – H3`
Where,
iv.Net Work Done,
`TWD = W_{Turb} - W_{Pump}`
Where,
v.Heat Supplied,
`Q_(add) = H1 – H4`
Where,
vii.Heat Rejected,
`Q_{out} = H2 – H3`
Where,
viii.Back Work Ratio,
`BWR = frac{W_{Pump}}{W_{Turb}}`
Where,
ix.Specific Steam Consumption,
`SSC = frac{3600}{W_{Turb}}`
Where,
CODE :-
% Clearing all previous memory in Workspace
clear all
% Terminating all the previous plots
close all
% Clearing all the values in Command Window
clc
% Printing the title of the project
fprintf('------------------------------------------- RANKINE CYCLE SIMULATOR -----------------------------------------------------------------n');
% Printing all the four process in Rankine Cycle
fprintf('RANKINE CYCLE PROCESS :-n')
fprintf('Process 1-2 : Isentropic Expansion in Turbinen')
fprintf('Process 2-3 : Constant Pressure Heat Rejection by the Condensern')
fprintf('Process 3-4 : Isentropic Compression in Pumpn')
fprintf('Process 4-1 : Constant Pressure Heat Addition by the Boilernn')
% Getting the thermodynamic properties from the user
% Pressure (P1) at Turbine Inlet
P1 = input('Enter the Pressure at Turbine Inlet (in bar) :n');
% Temperature (T1) at Turbine Inlet
T1 = input('Enter the Temperature at Turbine Inlet (in Degree Celcius) :n');
% Pressure (P3) at Condenser Inet
P2 = input('Enter the Pressure at Turbine Outlet (in bar) :n');
% CALCULATING THE THERMODYNAMIC PROPERTIES IN ALL FOUR STATE POINTS
% AT STATE POINT 1
% Enthalpy (H1)
H1 = XSteam('h_pt',P1,T1);
% Entropy (S1)
S1 = XSteam('s_pt',P1,T1);
% AT STATE POINT 2
% Entropy (S2)
% Isentropic process - entropy is constant
S2 = S1;
% Calculating X2
sf2 = XSteam('sL_p',P2);
sg2 = XSteam('sV_p',P2);
hf2 = XSteam('hL_p',P2);
hg2 = XSteam('hV_p',P2);
X2 = ((S2-sf2)/(sg2-sf2));
% Enthalpy (H2)
H2 = (hf2 + (X2*(hg2-hf2)));
% Temperature (T2)
T2 = XSteam('T_ps',P2,S2);
% AT STATE POINT 3
% Pressure (P3)
% Constant Pressure Heat Addition
P3 = P2;
% Temperature (P3)
% Temperature is constant in condenser
T3 = T2;
% Enthalpy (H3)
H3 = XSteam('hL_p',P3);
% Entropy (S3)
S3 = XSteam('sL_p',P3);
% STATE POINT 4
% Entropy (S4)
% Isentropic process - entropy is constant
S4 = S3;
% Pressure (P4)
% Constant Pressure Heat Rejection
P4 = P1;
% Enthalpy (H4)
H4 = XSteam('h_ps',P4,S4);
% Temperature (T4)
T4 = XSteam('T_hs',H4,S4);
% STATE POINT 5
% Temperature (T5)
T5 = XSteam('Tsat_p',P4);
% Entropy (S5)
S5 = XSteam('sL_p',P4);
% STATE POINT 6
% Temperature (T6)
T6 = T5;
% Entropy (S6)
S6 = XSteam('sV_T',T6);
% Rankine Cycle Parameters
% Turbine Work
Wt = H1-H2;
% Pump Work
Wp = H4-H3;
% Net Work Done
Wnet = Wt - Wp;
% Heat Supplied
Qin = H1-H4;
% Heat Rejected
Qout = H2-H3;
% Efficiency of Rankine Cycle
Eff = (Wnet/Qin)*100;
% Back Work Ratio
BWR = (Wp/Wt);
% Specific Steam Consumption
SSC = 3600/Wt;
% Printing the evaluated parameters
fprintf('------------------------------------------- STATE POINTS -----------------------------------------------------------------n');
% State Point 1
fprintf('At State Point 1,n');
fprintf('Enthalpy (H1) is : %0.2f KJ/Kgn',H1);
fprintf('Entropy (S1) is : %0.2f KJ/Kgkn',S1);
fprintf('Temperature (T1) is : %0.2f Degree Celciusn',T1);
fprintf('Pressure (P1) is : %0.2f Barnn',P1);
% State Point 2
fprintf('At State Point 2,n');
fprintf('Enthalpy (H2) is : %0.2f KJ/Kgn',H2);
fprintf('Entropy (S2) is : %0.2f KJ/Kgkn',S2);
fprintf('Temperature (T2) is : %0.2f Degree Celciusn',T2);
fprintf('Pressure (P2) is : %0.2f Barnn',P2);
% State Point 3
fprintf('At State Point 3,n');
fprintf('Enthalpy (H3) is : %0.2f KJ/Kgn',H3);
fprintf('Entropy (S3) is : %0.2f KJ/Kgkn',S3);
fprintf('Temperature (T3) is : %0.2f Degree Celciusn',T3);
fprintf('Pressure (P3) is : %0.2f Barnn',P3);
% State Point 4
fprintf('At State Point 4,n');
fprintf('Enthalpy (H4) is : %0.2f KJ/Kgn',H4);
fprintf('Entropy (S4) is : %0.2f KJ/Kgkn',S4);
fprintf('Temperature (T4) is : %0.2f Degree Celciusn',T4);
fprintf('Pressure (P4) is : %0.2f Barnn',P4);
fprintf('------------------------------------------- RANKINE CYCLE PARAMETERS -----------------------------------------------------------------n');
% Turbine Work
fprintf('Work Done by the Turbine is : %0.2f KJ/Kgn',Wt);
fprintf('Work Done by the Pump is : %0.2f KJ/Kgn',Wp);
fprintf('Net Work Done is : %0.2f KJ/Kgn',Wnet);
fprintf('Efficiency of the Rankine Cycle is : %0.2f Percantagen',Eff);
fprintf('Back Work Ratio of the Cycle is : %f n',BWR);
fprintf('SSC of the Cycle is : %0.2f Kg/KWhnn',SSC);
% PLOTTING
% HS Diagram
% Points for Saturation Curve
s_c = (1:1000);
for i = 1:1000
s_l(i) = XSteam('sL_T',i);
h_l(i) = XSteam('hL_T',i);
s_v(i) = XSteam('sV_T',i);
h_v(i) = XSteam('hV_T',i);
end
%Saturation Curuve
figure(1)
plot(s_l,h_l,'-','linewidth',1.5,'color','r')
hold on
plot(s_v,h_v,'-','linewidth',1.5,'color','r')
% State Points
plot([S1 S2 S3 S4 S1],[H1 H2 H3 H4 H1],'linewidth',2,'color','blue')
text(7,H1,'leftarrow 1','FontSize',12)
text(7,H2,'leftarrow 2','FontSize',12)
text(0.6,H3,'leftarrow 3','FontSize',12)
text(0.3,380,'downarrow 4','FontSize',12)
xlim([0 8])
ylim([0 3400])
xlabel('Entropy (KJ/Kg-K)')
ylabel('Enthalpy (KJ/Kg)')
title('H-S Diagram')
grid on
hold off
%TS Diagram
% Saturation Curve
figure(2)
plot(s_l,s_c,'-','linewidth',1.5,'color','r')
hold on
plot(s_v,s_c,'-','linewidth',1.5,'color','r')
% State Points
plot([S1 S2 S3 S4 S5 S6 S1],[T1 T2 T3 T4 T5 T6 T1],'linewidth',2,'color','blue')
text(7,T1,'leftarrow 1','FontSize',12)
text(7,T2,'leftarrow 2','FontSize',12)
text(S3,26,'leftarrow 3','FontSize',12)
text(0.2,65,'downarrow 4','FontSize',12)
text(7.1,200,'rightarrow W(turbine)','FontSize',12)
text(4,60,'downarrow Q(out)','FontSize',12)
text(4,260,'downarrow Q(in)','FontSize',12)
text(-1.6,50,'W(pump)','FontSize',12)
ylim([0 450])
xlim([-2,10])
xlabel('Entropy (KJ/Kg-K)')
ylabel('Temperature (Degree Celcius)')
title('T-S Diagram')
grid on
hold off
PROGRAM PROCESS :-
- The compiler starts the program.
- The Rankine Cycle process chart is printed
- The values of P1,T1 and P2 are obtained from the user.
- Next the H1 and S1 for state point 1 are calculated.
- Then H2,T2 and S2 for state point 2 are calculated.
- Next P3,T3,H3 and S3 for state point 3 are calculated.
- Next P4,T4,H4 and S4 for state point 4 are calculated
- Next T5,T6,S5 and S6 values are calculated.
- Turbine and Pump work done are evaluated.
- Net work done is evaluated.
- Heat added and rejected are evaluated.
- Thermal Efficiency, back work ratio and specific steam consumption are evaluated.
- Next the values of S, T, P and H are displayed for all the four state points.
- Also, the Rankine Cycle parameters are displayed in the command window.
- Next the H-S and T-S diagram are plotted.
- The compiler terminates the program.
OUTPUT :-
- The T-S graph and H-S graph of Ideal Rankine Cycle was plotted successfully.
- The Net Work Done and Efficiency of the Cycle was evaluated successfully.
DATA FILES :-
REFERENCES :-