Project 2 - Rankine cycle Simulator
RANKINE CYCLE:
the rankine cycle is an an idealized thermodynamic cycle describing the process by which certain heat engines,such as steam turbines or reciprocating steam engines,allow mechanicalwork to be extracted from he fluid as it moves between a heat source and heat sink

all four components associated with the ideal rankine cycle are steadycycle are steady devices and thus all the processes that make up the rankine cycle can be analyzed as steady flow process
1.pump:
pump pressurized the liquid water from the condeser prior to going back to the boiler
w_pump=h4-h3
2.boiler:
liquid water enters the boiler and is heated up to super heated state in the boiler
q_in=h1-h4
3.turbine:
steam fro the boiler ,which has elevated temperatures and pressures,expand through the turbine to produce work and then discharged in to condenser
w_turbine=h1-h2
4.condenser;
steam from the turbine is condensed to liquid water in the condenser
q_out=h2-h3

t-s diagram:
1-2 isentopic compression in a pump
2-3 constant pressure heat addition in the bolier
3-4 isentropic expansion in the turbine
4-1 constant pressure heat rejectionin a condenser
REPORT:
aim:
to perform a program on rankine cycle to plot the T-S and H-S graphs and also to calculate thermal efficiency of cycle
governing equations:
turbine_work= h1-h2
pump_work= h4-h3
total work=turbine_work-pump_work
heat_in=h1-h4
heat_out=h2-h3
thermal efficiency=work / heat_in
thermal efficency is ratio of total work to the heat supplied
dryness fraction = ((s2-sf2)/(sg2-sf2))
objective:
the main objective of the program to plot the graphs of h-s and t-s and also to find thermal efficiency of the rankine cycle
body:
the programing language used is matlab
clear all
close all
clc
%process
fprintf("rankine cycle simulator \n")
fprintf("1_2 isentropic expansion in turbine\n")
fprintf("2_3 is constant pressure heat rejection\n")
fprintf("3_4 is isentropic compression in the pump\n")
fprintf("4_1 is comstant volume heat addition\n")
%inputs
p1=input("enter the pressure at inlet of the turbine(in bars): ");
t1=input("enter the temperature at the inlet of the turbine(in degree celcius): ");
p2=input("enter the pressure at the condenser (in bar): ");
% stage1
% xsteam is command to get values of enthalpy,entropy,pressure etc
h1 = XSteam('h_pT',p1,t1);
s1 = XSteam('s_ph',p1,h1);
disp(" RESULTS\n\n")
fprintf('at state point1 \n')
fprintf('p1 is:%f bars \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)
%stage 2
s2=s1;
t2=XSteam('T_ps',p2,s2);
sf2=XSteam('sL_p',p2);
sg2=XSteam('sV_p',p2);
hf2=XSteam('hL_p',p2);
hg2=XSteam('hV_p',p2);
x=((s2-sf2)/(sg2-sf2));
h2=hf2+(x*(hg2-hf2));
v2=XSteam('v_ph',p2,h2);
fprintf('at state point2 \n')
fprintf('p2 is:%f bars \n',p2)
fprintf('t2 is:%f deg celcius \n',t2)
fprintf('h2 is:%f KJ/Kg \n',h2)
fprintf('s2 is:%f KJ/KgK \n',s2)
%atage3
t3=t2;
p3=p2;
s3=XSteam('sL_p',p3);
h3=XSteam('hL_T',t3);
v3=XSteam('v_ph',p3,h3);
fprintf('at state point3 \n')
fprintf('p3 is:%f bars \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)
%state4
s4=s3;
v4=v3;
p4=p1;
h4=XSteam('h_ps',p4,s4);
t4=XSteam('T_hs',h4,s4);
fprintf('at state point4 \n')
fprintf('p4 is:%f bars \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)
%state5
p5=p4;
t5=XSteam('Tsat_p',p5);
h5=XSteam('hL_T',t5);
s5=XSteam('sL_p',p5);
fprintf('at state point5 \n')
fprintf('p5 is:%f bars \n',p5)
fprintf('t5 is:%f deg celcius \n',t5)
fprintf('h5 is:%f KJ/Kg \n',h5)
fprintf('s5 is:%f KJ/KgK \n',s5)
%state6
t6=t5;
p6=XSteam('psat_T',t6);
s6=XSteam('sV_T',t6);
h6=XSteam('hV_T',t6);
fprintf('at state point6 \n')
fprintf('p6 is:%f bars \n',p6)
fprintf('t6 is:%f deg celcius \n',t6)
fprintf('h6 is:%f KJ/Kg \n',h6)
fprintf('s6 is:%f KJ/KgK \n',s6)
% temperature is an array which stores the set of temperature values
% between 1 to 400
temperature=linspace(1,400,500);
% for loop is used to get the set of entropy and enthalpy values at vapour
% and liquid phases for consective temperatures
for i=1:length(temperature)
sV(i)=XSteam('sV_T',temperature(i));
sL(i)=XSteam('sL_T',temperature(i));
end
for i=1:length(temperature)
hV(i)=XSteam('hV_T',temperature(i));
hL(i)=XSteam('hL_T',temperature(i));
end
%net work output calculation
w_turbine=h1-h2;
w_pump=h4-h3;
work=w_turbine-w_pump;
q_in=h1-h4;
q_out=h2-h3;
%thermal efficiency
n=work/q_in
%back_work ratio
BWR= w_pump/w_turbine
%specific steam consumption
ssc=3600/work
%T-S graph plot
figure(1)
hold on
plot(sV,temperature)
plot(sL,temperature)
plot([s1 s2 s3 s4 s5 s6 s1],[t1 t2 t3 t4 t5 t6 t1])
text(s1,t1,'1')
text(s2,t2,'2')
text(s3,t3,'3')
text(s4,t4,'4')
text(s5,t5,'5')
text(s6,t6,'6')
title("rankine cycle t-s diagram")
ylabel("temperature(k)")
xlabel("entropy(kj/kgk)")
axis([0,8,0,450])
% H-s graph plot
figure(2)
hold on
plot(sV,hV)
plot(sL,hL)
plot([s1 s2 s3 s4 s5 s6 s1],[h1 h2 h3 h4 h5 h6 h1])
text(s1,h1,'1')
text(s2,h2,'2')
text(s3,h3,'3')
text(s4,h4,'4')
text(s5,h5,'5')
text(s6,h6,'6')
title("rankine cycle h-s diagram")
ylabel("enthalpy(kj/kg)")
xlabel("entropy(kj/kgk)")
axis([0,8,0,3500])
result:
rankine cycle simulator
1_2 isentropic expansion in turbine
2_3 is constant pressure heat rejection
3_4 is isentropic compression in the pump
4_1 is comstant volume heat addition
enter the pressure at inlet of the turbine(in bars): 30
enter the temperature at the inlet of the turbine(in degree celcius): 400
enter the pressure at the condenser (in bar): 0.05
RESULTS\n\n
at state point1
p1 is:30.000000 bars
t1 is:400.000000 deg celcius
h1 is:3231.571027 KJ/Kg
s1 is:6.923260 KJ/KgK
at state point2
p2 is:0.050000 bars
t2 is:32.875490 deg celcius
h2 is:2110.708472 KJ/Kg
s2 is:6.923260 KJ/KgK
at state point3
p3 is:0.050000 bars
t3 is:32.875490 deg celcius
h3 is:137.765119 KJ/Kg
s3 is:0.476254 KJ/KgK
at state point4
p4 is:30.000000 bars
t4 is:32.963066 deg celcius
h4 is:140.762226 KJ/Kg
s4 is:0.476254 KJ/KgK
at state point5
p5 is:30.000000 bars
t5 is:233.858445 deg celcius
h5 is:1008.371370 KJ/Kg
s5 is:2.645621 KJ/KgK
at state point6
p6 is:30.000000 bars
t6 is:233.858445 deg celcius
h6 is:2803.264739 KJ/Kg
s6 is:6.185788 KJ/KgK
n =
0.3617
BWR =
0.0027
ssc =
3.2204
graphs:


conclusion:
rankine cycle consists of 2 isentropic and 2 constant pressure processes .rankine cycle is a improved cycle to the carnot cycle ,the main components of the cycle are turbine ,condenser,pump and a boiler which are alligned to a closed cycle
all the values of entropy ,enthalpy and pressure etc can be obtained from XSteam by passing the corresponding functions.its consists of 6 states by taking enthalpy,entropy and temperature we can plot the T-S and H-S diagrams