Rankine Cycle Simulator Using Matlab
Objective:
The aim of this project is to write the code to stimulate a Rankine cycle i.e to calculate the state variables at four different states, plot the T-S and H-s diagram for the given condition and to calculate the thermal efficiency of the Rankine cycle.
Introduction:
Rankine cycle is the ideal thermal powerplant cycle, which is used to predict the efficiency of the steam turbine. It is the idealized cycle of heat engine which converts the heat energy into the mechanical energy by the phase changes(vapour power cycle). The working fluid in the Rankine cycle is water.
The below figure is the basic layout of the thermal powerplant which operates on a Rankine cycle.
- High-pressure steam is expanded in the turbine and the work is done (W_T).
- In the condenser, the water is cooled and the phase of the water is changed from steam to the water. Rejection of heat takes places in the condenser.
- This water is pumped to the boiler through the feed pump. Generally, these are centrifugal pumps
- Boiler heats the water and sends it to the turbine and process repeats.
- Superheating increases the thermal efficiency of the Rankine cycle.
Basically, the Rankine cycle consists of four processes they are
- 1-2 Isentropic Expansion in the Turbine
- 2-3 Constant Pressure Heat rejection by the Condenser
- 3-4 Isentropic Compression in the Feed Pump
- 4-1 Constant Pressure Heat addition by the Boiler
The efficiency of the Rankine cycle is calculated by this formula
`η=(W_t-W_p)/Q_b`
W_t - work done at the turbine.
W_p- work done at the feed pump.
Q_b - Heat input at the boiler.
Procedure:
- The input values at the turbine (P1, T1) and the condenser input (P2).Then calculate the remaining state variable at all the points by the \'XSteam.m\' file (Steam table).
- Net work done and Thermal efficiency is calculated by using the respective equations.
- plotting the H-S and T-S graphs are done by plot command.
- Text command is used for the description of the data points in the plots.
Main code:
clear all
close all
clc
% code for rankine cycle simulator
fprintf(\' RANKINE CYCLE SIMULATOR \\n\')
fprintf(\'1-2 Isentropic Expansion in the Turbine\\n\')
fprintf(\'2-3 Constant Pressure Heat rejection by the Condenser\\n\')
fprintf(\'3-4 Isentropic Compression in the Feed Pump\\n\')
fprintf(\'4-1 Constant Pressure Heat addition by the Boiler\\n\')
disp(\' RESULTS \')
%Inputs
P1 = input(\' Enter the Pressure at the Turbine Inlet(in bar): \')
T1 = input(\' Enter the Temperature at the Turbine Inlet(in degree celcius): \')
P2 = input(\' Enter the Pressure at the Condensor Input(in bar): \')
% calculating the state variables
P4=P1; % because constant pressure Heat addition process
P3=P2; %because constant pressure Heat rejection process
% at the condensor outlet
H3=XSteam(\'hL_p\',P3);
S3=XSteam(\'sL_p\',P3);
S4=S3; % because process takes place at constant entropy
V3=XSteam(\'vL_p\',P3);
T3=XSteam(\'Tsat_p\',P3);
T2= T3; % because the only phase is changed in condenser(latent heat)
% at the
H4=H3+(V3*(P4-P3)); %T
cp4=XSteam(\'Cp_ps\',P4,S4);
cv4=XSteam(\'Cv_ps\',P4,S4);
% for adiabatic or reversible adiabatic process (T2/T1)=(P2/P1)^((gamma-1)/gamma)
g4=cp4/cv4;
o=(g4-1)/g4;
T4=T3*((P4/P3)^o);
V4=V3*((P3/P4)^(1/g4));
% at the turbine inlet
S1=XSteam(\'s_pT\',P1,T1);
H1=XSteam(\'h_pT\',P1,T1);
%state variables at the condenser input
S2=S1; %process takes place at constant entropy.
% H2= (1-x2)*hf+(x2*hg)|| S2=(1-x2)*sf+(x*sg) here x2 is dryness fraction
sf2=XSteam(\'sL_p\',P2); % entropy at the saturated liquid point
sg2=XSteam(\'sV_p\',P2); % entropy at the dry vapour
x2=((S2-sf2)/(sg2-sf2)); % S2=(1-x2)*sf+(x2*sg)
hf2=XSteam(\'hL_p\',P2); % enthalpy at the saturated liq
hg2=XSteam(\'hV_p\',P2); %enthalpy
H2=(1-x2)*hf2+(x2*hg2);
% the two point beween the 4-1 process
T5=XSteam(\'Tsat_p\',P1);
T6=T5;
S5=XSteam(\'sL_p\',P1);
S6=XSteam(\'sV_p\',P1);
H5=XSteam(\'hL_p\',P1);
H6=XSteam(\'hV_p\',P1);
% calculation of thermal efficiency
W_t=H1-H2; %workdone at the turbine
W_p=H4-H3; %workdone at the feed pump
Q_b=H1-H4; % heat supplied at the boiler
Q_c=H2-H3; % at the condenser
W_n= (W_t)-(W_p); % net workdone
E = W_n/Q_b; % Thermal effiency of the rankine cycle
Ntherm = E*100;
% state variables at the point 1
disp(\' At state poin 1: \')
fprintf(\'P1 is : %f Bar\\n\',P1)
fprintf(\'T1 is : %f Deg Celcius\\n\',T1)
fprintf(\'H1 is : %f kJ/Kg\\n\',H1)
fprintf(\'S1 is : %f KJ/kgK\\n\',S1)
%state variables at the point 2
disp(\' At state Point 2: \')
fprintf(\'P2 is : %f bar\\n\',P2)
fprintf(\'T2 is : %f Deg Celcius\\n\',T2)
fprintf(\'H1 is : %f kJ/kg\\n\',H1)
fprintf(\'S2 is : %f kJ/kgK\\n\',S2)
fprintf(\'x2 is : %f\\n\',x2)
% state variables at the point 3
disp(\' At state point 3: \')
fprintf(\'P3 is : %f bar\\n\',P3)
fprintf(\'T3 is : %f Deg Celcius\\n\',T3)
fprintf(\'H3 is : %f kJ/kg\\n\',H3)
fprintf(\'S3 is : %f kJ/kgK\\n\',S3)
% state variables at the point 4
disp(\' At state point 3: \')
fprintf(\'P4 is : %f bar\\n\',P4)
fprintf(\'T4 is : %f Deg Celcius \\n\',T4)
fprintf(\'H4 is : %f kJ/kg\\n\',H4)
fprintf(\'S4 is : %f kJ/kgK\\n\',S4)
disp(\' \');
fprintf(\'Wt is : %f kJ/kg\\n\',W_t)
fprintf(\'Wp is : %f kJ/kg\\n\',W_p)
fprintf(\'Wnet is : %f kJ/kg\\n\',W_n)
fprintf(\'Ntherm is : %f percent\\n\',Ntherm)
% plotting
% state variables for liquid and vapour curve
temp= linspace(1,500,500);
for i= 1:length(temp)
s_l(i)=XSteam(\'sL_T\',temp(i)); % entropy at the liquid phase
s_v(i)=XSteam(\'sV_T\',temp(i)); % entropy at the vapour phase
h_l(i)=XSteam(\'hL_T\',temp(i)); % enthalpy at the liquid phase
h_v(i)=XSteam(\'hV_T\',temp(i)); % enthalpy at the vapour phase
end
%T-S diagram
figure(1)
hold on
plot([S1 S2 S3 S4 S5 S6 S1],[T1 T2 T3 T4 T5 T6 T1],\'linewidth\',3,\'color\',\'g\',\'marker\',\'x\',\'MarkerFaceColor\',\'k\',\'MarkerEdgeColor\',\'k\',\'markersize\',5)
hold on
plot([s_l s_v],[temp temp],\'linewidth\',2,\'color\',\'r\')
title(\'T-S plot of Rankine cycle\')
xlabel(\'Entropy\')
ylabel(\'Temperature\')
% adding text to the data points
text(S1,T1,\'1\') %adds text description to the data points
text(S2,T2,\'2\')
text(S3,T3,\'3\')
text(S4,T4,\'4\')
%H-s diagram
figure(2)
hold on
plot([S1 S2 S3 S4 S5 S6 S1],[H1 H2 H3 H4 H5 H6 H1],\'linewidth\',3,\'color\',\'y\',\'marker\',\'x\',\'markersize\',5,\'markerFaceColor\',\'k\',\'markerEdgeColor\',\'k\')
hold on
plot([s_l s_v],[h_l h_v],\'linewidth\',2,\'color\',\'r\')
title(\'H-S plot of Rankine cycle\')
xlabel(\'Entropy\')
ylabel(\'Enthalpy\')
% adding text to the data points
text(S1,H1,\'1\') % adds text description to the data points
text(S2,H2,\'2\')
text(S3,H3,\'3\')
text(S4,H4,\'4\')
Results:
Plots
Reference:
https://www.youtube.com/watch?v=4-BI22Wx4Pc&list=PLD8E646BAB3366BC8&index=20
http://www.thermopedia.com/content/1072/
http://home.iitk.ac.in/~suller/lectures/lec29.htm
Referred \'XSteam.m\' file for the state variable values(Steam table).