Project 2 - Rankine cycle Simulator
RANKINE CYCLE SIMULATOR
AIM: To Create a Rankine Cycle Simulator using OCTAVE/MATLAB
OBJECTIVE:
• Create a Rankine Cycle Simulator using MATLAB.
• Your code should calculate the state points of the Rankine Cycle based on user
inputs
• Plot the corresponding T-s and h-s plots for the given set of inputs Title and axes labels are a must, while
legends could be used if necessary
• The presentation of your code will be taken into consideration while grading Labeling sections of
your code
using comments is appreciated
• Attach a report explaining the working of a Rankine cycle simulator and also the research was done by you
THEORY:
The 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 a phase change. It is an idealized Rankine 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.
There are four processes in the Rankine cycle. The states are identified by numbers in the T-s diagram.
• 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
Process 2-3: The high-pressure liquid enters a boiler, it is heated at constant pressure by an external
heat source to be in a dry saturated vapor state. The input energy required can be easily calculated graphically, using an enthalpy-entropy chat (h-s chat, or Mollier diagram), or numerically, using the steam table
In other words Process 2-3 is (Constant pressure heat addition in boiler]
• Process 3-4: The dry saturated vapor state expands through a turbine, generating power. This decreases the temperature and pressure of the vapor, 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
• Process 4-1 The wet vapor 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
EXPLANATION OF CODE:
• We start the program by reading about the Rankine cycle and the given data of the XSteam
• First we need input data of pressure at turbine inlet, the temperature at turbine inlet, the pressure at condenser inlets
Now we return the pressure and the temperature, by using the above given data and XSteam. With this, we further simplify using the same data and the study over the Rankine cycle.
By all the study we calculate saturated liquid and saturated vapor through the plots • Then we calculate the total work work done on the turbine, and work done on the pump • We also calculate the efficiency and the specific steam consumption
After the 4th stage of variation, we observe the plot by extracting the temperature enthalpy and entropy.
Plotting graph of temperature vs enthalpy and enthalpy vs entropy while giving them line color and linewidth And the results will be displayed on the window command
% rankine cycle simulator
close all
clear all
clc
disp('Rankine cycle Simulator');
disp('1-2 is Constant pressure heat addition in the bolier');
disp('2-3 is Isentropic Expansion in the Turbine');
disp('3-4 is Constant pressure heat removal in the Condenser');
disp('4-5 is Isentropic compression in thye pump');
p1= input('nvalue of pressure at turbine inlet in bar, p1 =');
T1 = input('nvalue of temperature at trubine inlet in degree.C, T1 =');
p2 = input('nvalue of pressure at condenser inlet in bar, p2=');
%At Strate 1
h1 = XSteam('h_pT',p1, T1);
s1 = XSteam('s_pT',p1, T1);
% At State 2
s2 = s1;
sf2=XSteam('sL_p', p2);
sg2=XSteam('sv_p', p2);
x2=(s2-sf2)/(sg2-sf2);
hf2=XSteam('hL_p', p2);
hg2=XSteam('hv_p', p2);
h2 = hf2 + (x2*(hg2-hf2));
% At State 3
p3=p2;
s3= XSteam('sL_p', p3);
h3=XSteam('hL_p',p3);
% At State 4
s4=s3;
p4=p1;
% Work done to run turbine
Wt=h1-h2;
% Work done to run pump
v3=XSteam('vL_p', p3);
Wp=v3*(p4-p3)*100;
h4=h3+Wp;
%Network
Wnet = Wt - Wp;
% Heat into the system
Qin=h1-h4;
%Heat out of the system
Qout=h2-h3;
%Thermal Efficiency
thermal_eff= (Wnet/Qin)*100;
%Specific Steam Consumption
%SSC=Mass flow/power
SSC=(3600/Wnet);
%Back Work Ratio
BW=(Wp/Wt);
%Calcuattion of the temoerature at the state points
T3 = XSteam('Tsat_p', p3);
T2 = T3;
Cp4=XSteam('Cp_ps', p4, s4);
Cv4=XSteam('Cv_ps', p4, s4);
k=Cp4/Cv4;
T4 = T3/(p3/p4)^((k-1)/k);
%Calculating Temoerature, Entrtopy and Enthalpy at the vapour
T6=XSteam('Tsat_p',p1);
s5=XSteam('sL_p',p1);
s6=XSteam('sV_p',p1);
h5=XSteam('hL_p',p1);
h6=XSteam('hv_p',p1);
T5=T6;
%Plotting the Saturation Curve
T=linspace(1,375,1000);
for i = 1: length(T)
sf(i)=XSteam('sL_T', T(i));
sg(i)=XSteam('sV_T', T(i));
hf(i)=XSteam('hL_T', T(i));
hg(i)=XSteam('hV_T', T(i));
end
%plotting T-s diagram
figure(1)
hold on
plot(sf, T, 'r','linewidth',1)
plot(sg, T, 'r','linewidth',1)
plot([s1 s2], [T1 T2],'b','linewidth',2)
plot([s2 s3], [T2 T3],'b','linewidth',2)
plot([s3 s4], [T3 T4],'b','linewidth',2)
plot([s4 s5], [T4 T5],'b','linewidth',2)
plot([s5 s6], [T5 T6],'b','linewidth',2)
sc1=linspace(s6,s1,1000);
for l = 1: length(sc1)
Tc1(l)=XSteam('T_ps', p1, sc1(l));
end
plot(sc1,Tc1,'b','linewidth',2)
text(s1+0.1, T1, '1')
text (s2+0.1, T2, '2')
text(s3, T3-20, '3')
text(s4, T4+20, '4')
title('Temp vs Entropy plot')
xlabel('Entropy,S (Kj/kgk)')
ylabel('Temperature (degree C)')
legend('Saturation curve')
%plotting h-s diagram
figure(2)
hold on
plot(sf, hf, 'k', 'linewidth', 1)
plot(sg, hg,'k', 'linewidth', 1 )
plot([s1 s2], [h1 h2],'r', 'linewidth', 2)
plot([s2 s3], [h2 h3],'r', 'Linewidth', 2)
plot([s3 s4], [h3 h4],'r', 'linewidth', 2)
plot([s4 s1], [h4 h1],'r', 'linewidth', 2)
hc = linspace(h4, h5, 100);
for r= 1: length(hc)
sch(r) = XSteam('s_ph', p1, hc (r));
end
for m = 1: length(hc)
hc1(m) = XSteam('h_ps', p1, sc1(m));
end
text (s1+0.1,h1, '1')
text (s2+0.1, h2, '2')
text (s3, h3-108, '3')
text(s4, h4 +200, '4')
title('Enthalpy vs Entropy plot')
xlabel('Entropy, S (KJ/kg)')
ylabel('Enthalpy, H (KJ/kg)')
legend( 'Saturation curve', 'location', 'northwest')
%Displaying the Results in the Command Window:
disp('Results');
p1 = p1;
T1 = T1;
p2 = p2;
disp('At stage point 1')
n1 = sprintf('P1 is %.3f bar',p1);
disp(n1);
n2= sprintf('T1 is %.3f C',T1);
disp(n2);
n3= sprintf('h1 is %.3f kJ/kg',h1);
disp(n3);
n4 = sprintf('s1 is %.3f k3/kgK', s1);
disp(n4);
disp('At stage point 2');
n11 = sprintf('P2 is %.3f bar',p2);
disp(12);
n21= sprintf('T2 is %.3f C',T2);
disp(n21);
n31= sprintf('h2 is %.3f k3/kg', h2);
disp(n31);
n41 = sprintf('s2 is %.3f kJ/kgk', s2);
disp(n41);
disp('At stage point 3');
n12= sprintf('P3 is %.3f bar', p3);
disp(12);
n22 = sprintf('T3 is %.3f C', T3);
disp(n22);
n32= sprintf('h3 is %.3f kJ/kg',h3);
disp(n32);
n42 = sprintf('s3 is %.3f k/kgK', s3);
disp(n42);
disp('At stage point 4');
n13=sprintf('P4 is %.3f bar',p4);
disp(n13);
n23= sprintf('T4 is %.3f C', T4);
disp(n23);
n33 = sprintf('h4 15 %.3f k3/kg',h4);
disp(n33);
n43 = sprintf('54 is %.3f kJ/kgK',s4);
disp(43);
n14 = sprintf("Wt is %.3f k3/kg",Wt);
disp(14);
n15= sprintf('Wp is %.3f kJ/kg',Wp);
disp(n15);
n16= sprintf('Wnet is %.3f k3/kg',Wnet);
disp(16);
n17 = sprintf('Thermal efficiency is %.2f Percent', thermal_eff);
disp(n17);
n18 =sprintf('SSC is %.2f kg/kWh',SSC);
disp(n18);
n19 =sprintf('Back work ratio is %.3f', BW);
disp(n19);
then give the p1=30,T1=400,p2=0.05 in the command window.
Results and plots:


TEMPERATURE VS ENTROPY:

ENTHALPY VS ENTROPY:

Errors:
No complicated errors occurred while running the MATLAB program.
Conclusion:
• Rankine cycle is the basic cycle for understanding about the steam turbine systems in thermodynamics. •The required output values are obtained for the given input parameters:
Net work output - 1117.87 KJ/kg
Back work ratio = 0.003
• Thus, the Rankine cycle is successfully simulated using MATLAB.
References:
1. http://www.ecourses.ou.edu/cgi-bin/ebook.cgi?topic=th&chap_sec=10.1&page=theory
2.https://skill-lync.com/student-projects/Parsing-NASA-thermodynamic-data-56600