Rankine Cycle Simulator
REPORT:
I. AIM:
To write a code to simulate Rankine Cycle
RANKINE CYCLE:
The Rankine cycle is an idealized thermodynamic cycle of a heat engine that converts heat into mechanical work while undergoing phase change
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.
Rankine Cycle consists of the following processess:
1-2: Reversible adiabatic expansion of steam in Turbine
2-3: Isobaric heat rejection of steam in Condenser
3-4: Reversible adiabatic compression of fluid in Pump
4-1: Isobaric heat addition in Boiler
- 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.
In other words Process 1-2 is [Isentropic compression in pump]
- 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 (h–s chart, or Mollier diagram), or numerically, using steam tables.
In other words Process 2-3 is [Constant pressure heat addition in boiler]
- Process 3–4: The dry saturated vapour expands through a turbine, 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.
In other words Process 3-4 is [Isentropic expansion in turbine]
- Process 4–1: The wet vapour then enters a condenser, where it is condensed at a constant pressure to become a saturated liquid.
In other words Process 4-1 is [Constant pressure heat rejection in condenser]
II. EXPLANATION:
STEP 1: As mentioned, the name of the cycle and various other variables are to be displayed on the command window. The \'fprintf\' command is used to print the required variables.
STEP 2: The variables at each state (namely STATE 1 to STATE 4) along with their initial conditions are declared.
- STATE POINT 1: Here, the region is in superheated condition so the enthalpy and the entropy values are to be found.
- STATE POINT 2: At this region, the steam attain saturated liquid vapour and hence, the dryness factor is calculated.
- STATE POINT 3: Liquid state is attained and the saturated temperation is calculated.
- STATE POINT 4: The enthalpy and the saturated temperature is calculated.
STEP 3: Providing the texts that are to be displayed.
STEP 4: Plotting the T-S and H-S diagram.
III. ERRORS:
There were certain spell and errors that did not get the plot of the graph.
IV. CODE:
clear all
close all
clc
% DISPLAY INFORMATION
fprintf(\'n RANKINE CYCLE SIMULATOR \');
fprintf(\'nn 1-2: Isentropic Expansion in Turbine\');
fprintf(\'n 2-3: Constant Pressure Heat Rejected in the Condenser\');
fprintf(\'n 3-4 Isentropic Compression in the Pump\');
fprintf(\'n 4-1 Constant Pressure Heat Addition by the Boiler\');
% INPUT VALUES
p1 = input(\'Pressure at the Turbine inlet (bar) : \');
t1 = input(\'Temperature at the Turbine inlet(in Degree Celcius) : \');
p2 = input(\'Pressure at the Condenser (in bar) : \');
% Stage 1: Turbine Inlet
% adding p1 and t1 values
h1 = XSteam(\'h_pT\', p1, t1);
s1 = XSteam(\'s_pT\', p1, t1);
% Stage 2: Condenser Inlet
% intoduce p2
s2 = s1;
sf2 = XSteam(\'sL_p\', p2);
sg2 = XSteam(\'sV_p\', p2);
hf2 = XSteam(\'hL_p\', p2);
hg2 = XSteam(\'hV_p\', p2);
% Dryness Fraction
x2 = (s2-sf2)/(sg2-sf2);
h2 = (hf2 + (x2*(hg2-hf2)));
% Stage 3: Pump Inlet
p3 = p2;
h3 = XSteam(\'hL_p\', p3);
s3 = XSteam(\'sL_p\', p3);
% Saturation Temperature
t3 = XSteam(\'Tsat_p\', p3);
t2 = t3;
% Stage 4: Boiler Inlet
p4 = p1;
s4 = s3;
h4 = XSteam(\'h_ps\', p4, s4);
% Cp Specific isobaric heat capacity
cp4 = XSteam(\'Cp_ps\', p4, s4);
% Cv Specific isochoric heat capacity
cv4 = XSteam(\'Cv_ps\', p4, s4);
% Lambda = cp4/cv4
lambda = cp4/cv4;
t4 = (t3/((p3/p4)^((lambda-1)/(lambda))));
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);
% Work done in Turbine
Wt = h1 - h2;
% Work done in pump
Wp = h4 - h3;
% Net Work done
Wnet = Wt - Wp;
% Heat flow in and out of the system
Q_in = h1 - h4;
Q_out = h2 - h3;
% Thermal Efficiency
Ntherm = (Wnet/Q_in)*100;
% Steam rate
SSC = 3600/Wnet;
% Ratio to find the amount of work done (work back ratio)
BWR = ((h1 - h4)/(h2 - h3));
% Plotting
% Saturation Curve
T = linspace(1,400,500);
for i = 1:length(T)
h_l(i) = XSteam(\'hL_T\', T(i));
h_v(i) = XSteam(\'hV_T\', T(i));
s_l(i) = XSteam(\'sL_T\', T(i));
s_v(i) = XSteam(\'sV_T\', T(i));
end
% T-S DIAGRAM
figure(1)
hold on
plot([s1 s2],[t1 t2], \'linewidth\',3,\'color\',\'g\');
plot([s2 s3],[t2 t3], \'linewidth\',3,\'color\',\'g\');
plot([s3 s4],[t3 t4], \'linewidth\',3,\'color\',\'g\');
plot([s4 s5],[t4 t5], \'linewidth\',3,\'color\',\'g\');
plot([s5 s6],[t5 t6], \'linewidth\',3,\'color\',\'g\');
title(\'T-S Diagram\');
xlabel(\'Entropy\');
ylabel(\'Temperature\');
s_1 = linspace(s6,s1,500);
for j = 1:length(s_1);
t_1(j) = XSteam(\'T_ps\', p1, s_1(j));
end
plot(s_1,t_1,\'linewidth\',3,\'color\',\'g\');
plot(s_l,T,\'linewidth\',2,\'color\',\'r\');
plot(s_v,T,\'linewidth\',2,\'color\',\'r\');
% Text(numbers to show differnt stages)
text(s1,h1,\'1\',\'fontsize\',10);
text(s2,h2,\'2\',\'fontsize\',10);
text(s3,h3,\'3\',\'fontsize\',10);
text(s4,h4,\'4\',\'fontsize\',10);
text(s5,h5,\'5\',\'fontsize\',10);
text(s6,h6,\'6\',\'fontsize\',10);
figure(2)
hold on
plot([s1 s2], [h1 h2], \'linewidth\', 3, \'color\', \'g\')
plot([s2 s3], [h2 h3], \'linewidth\', 3, \'color\', \'g\')
plot([s3 s4], [h3 h4], \'linewidth\', 3, \'color\', \'g\')
h_4 = linspace(h4,h5,500);
for k=1:length(h_4);
s_4(k) = XSteam(\'s_ph\', p1, h_4(k));
end
h_6 = linspace(h6,h1,500);
for m = 1:length(h_6);
s_6(m) = XSteam(\'s_ph\', p1, h_6(m));
end
plot(s_4,h_4,\'linewidth\',3,\'color\',\'g\')
plot([s5 s6], [h5 h6], \'linewidth\', 3, \'color\', \'g\')
plot(s_6,h_6,\'linewidth\',3,\'color\',\'g\')
xlabel(\'Specific Entropy (KJ/kgK)\');
ylabel(\'Specific Enthalpy (KJ/kg)\');
plot(s_l,h_l,\'linewidth\',1,\'color\',\'r\')
plot(s_v,h_v,\'linewidth\',1,\'color\',\'r\')
% Text(numbers to show differnt stages)
text(s1,h1,\'1\',\'fontsize\',10);
text(s2,h2,\'2\',\'fontsize\',10);
text(s3,h3,\'3\',\'fontsize\',10);
text(s4,h4,\'4\',\'fontsize\',10);
text(s5,h5,\'5\',\'fontsize\',10);
text(s6,h6,\'6\',\'fontsize\',10);
% Output
fprintf(\'n RESULTS n\');
fprintf(\'At State Point 1 : n\');
fprintf(\'P1=%f (bar) n\',p1);
fprintf(\'T1=%f (Deg Celcius) n\',t1);
fprintf(\'H1=%f (KJ/kg)\',h1);
fprintf(\'S1=%f (KJ/kgK)\',s1);
fprintf(\'At State Point 2 : n\');
fprintf(\'P2=%f (bar) n\',p2);
fprintf(\'T2=%f (Deg Celcius) n\',t2);
fprintf(\'H2=%f (KJ/kg)\',h2);
fprintf(\'S2=%f (KJ/kgK)\',s2);
fprintf(\'At State Point 3 : n\');
fprintf(\'P3=%f (bar) n\',p3);
fprintf(\'T3=%f (Deg Celcius) n\',t3);
fprintf(\'H3=%f (KJ/kg)\',h3);
fprintf(\'S3=%f (KJ/kgK)\',s3);
fprintf(\'At State Point 4 : n\');
fprintf(\'P4=%f (bar) n\',p4);
fprintf(\'T4=%f (Deg Celcius) n\',t4);
fprintf(\'H4=%f (KJ/kg)\',h4);
fprintf(\'S4=%f (KJ/kgK)\',s4);
fprintf(\'Work done by the Turbine = %f (KJ/kg)\', Wt);
fprintf(\'Work done by the Pump = %f (KJ/kg)\', Wp);
fprintf(\'Net Work done on the system = %f (KJ/kg)\', Wnet);
fprintf(\'Specific Steam Consumption = %f\', SSC);
fprintf(\'Net Thermal Efficiency of the system = %f n\', Ntherm);
fprintf(\'Back Work Ratio = $f n\', BWR);
V. OUTPUT:
1. T-S Diagram
2. H-S Diagram
RESULT:
Thus the Rankine Cycle is obtained.