Aim-Create a Rankine Cycle Simulator using MATLAB & Calculate the rankine cycle values and finding the a)Net work ratio
b)Back work ratio
1)Rankine cycle explain
Rankine cycle is a steam turbine cycle idealized ,thermodynamic cycle describing the process by which certain heat engines such as steam turbines or reciprocating steam engines allows mechanical work to be extracted from a fluid as it moves betwween a heat sink
Rankine Cycle stages 1-2=is isentropic expansion in turbine
2-3=is constant pressure heat removal condenser
3-4=is isentropic compression in pump
4-1=constant pressure heat addition in boiler
2)Enthalpy(h)=A thermodynamic quantity equivalent to the total heat content of a system it is equal to the internal energy of the system plus the product of pressure & volume
unit =j/mol h=U+P*V
3)Entropy(S)= A thermodynamic quantity representing the unavability of a system thermal energy for conversion into mechanical work often interpted as the degree of disorder or randmness in the system
Unit=Joules per kelvin
4)Formulas using in rankine cycle
a)Turbine work output=W_T=h1-h2
h1 & h2 value taking from XSteam table with perticular pressure and temp
b)Pump work=W_P=v3*(p4-p3)*100
p3=p2 Pressure is constant in this phase
p4=p1 Pressure is constant in this phase
p4=p3 Pump workoutput
h4=h3-W_P
c)Net Work
W_net=W_T-W_P Turbine Workoutput-Pump Workoutput
d)Q_in=h1-h4 Heat added
e) Q_out=h2-h3; Heat rejection
f)Thermal efficency=(wnet/Qin)*100
g)Specific Steam Consumption=(3600/W_net) with the help of specific steam consumption
#steps for rankine cycle programming
A)First download the file XSteam table XSteam table file like work as function,Under XSteam file include all over programs related Rankine cycle for example Pressure,temprature ,Enthalpy,specific volume, specific internal energy
specific isobaric heat capacity,specific isochoric heat capacity,speed of sound,viscosity,thermal conductivity,surface tension,vapour fraction,vapour volume fraction
a)Specific isobaric Heat Capacity (Cp)-Specific heat capacity of water in approximetly 4.2 j/gC thus it takes 4.2 joules of energy to raise 1 gram of water by 1 degree celsius Specific Heat Capacity is the Heat required to raise temperature of the unit mass of a given substance by a given units of specific heat are calories or joule per gram per degree celsius
b)Specific isochoric Heat Capacity(Cv)-The Specific isochoric heat capacity Cv is depedent on gas species and function of temperature and table we derived the specific isochoric heat capacity C,V which tells how much heat has to be
added to or removed from certain amount of substance in order to increase or decrease respectively the temp of the amount of substance in order to increase or decrease respectively the temp of the amount of substance by 1k at isochoric condition
c)Vapour fraction(X)-vapour fraction refers to the gaseous component present in a mixture of two or more physical states the higher temp of a metalic surface can propagate an increase in the vapour fraction of the metalic enviroment because more vapour informed at higher temperature
d)Vapour Volume fraction(Vx)-void fraction has been identified as one of the important ones among flow properties (Vapour volume fraction)The void fraction distrubution in the forced convection subcooled flow boiling in verticle channels is needed for predicting the inception of two phase instability
e)Tsat(Saturation Temperature) (deg C)-Thermal Engineering in thermodynamics the term saturation defines a condition in which a mixture of vapour and liquid can exist together at a given temperture and pressure the temperature at which
vapoursation (boiling)starts to accur for given pressure is called the saturation temperature or boiling point
f)Psat(Saturation Pressure)(bar)-saturated pressure is the pressure at which a liquid changes its phase from liquid state to vapour state
efficiency=WT-WP/Qin
g)Thermal efficeancy=The thermal efficiency, ηth, represents the fraction of heat, QH, that is converted to work. It is a dimensionless performance measure of a heat engine that uses thermal energy, such as a steam turbine, an internal combustion engine
Q_in=h1-h4
W_P=h4-h3
W_T=h1-h2
pump work is negligible then
efficiency=(h1-h2)/(h1-h4)
#Function Names & Their long form
1) First the wanted property then a _ then the wanted input properties.
Example. T_ph is temperature as a function of pressure and enthalpy.
For a list of valid functions se bellow or XSteam
%*** Valid Steam table functions. ****************************************************************************
1)Temperature
a)Tsat_p= Saturation temperature
b) T_ph =Temperture as a function of pressure and enthalpy
c) T_ps= Temperture as a function of pressure and entropy
d) T_hs =Temperture as a function of enthalpy and entropy
2)Pressure
a) psat_T= Saturation pressure
b) p_hs =Pressure as a function of h and s.
c) p_hrho =Pressure as a function of h and rho. Very unaccurate for solid water region since it's almost incompressible!
3)Enthalpy
a)hV_p= Saturated vapour enthalpy
b)hL_p= Saturated liquid enthalpy
c)hV_T =Saturated vapour enthalpy
d)hL_T= Saturated liquid enthalpy
e)h_pT= Enthalpy as a function of pressure and temperature.
f)h_ps =Enthalpy as a function of pressure and entropy.
g)h_px =Enthalpy as a function of pressure and vapour fraction
h)h_prho =Enthalpy as a function of pressure and density. Observe for low temperatures (liquid) this equation has 2 solutions.
i)h_Tx= Enthalpy as a function of temperature and vapour fraction
4)Specific volume
a)vV_p= Saturated vapour volume
b)vL_p =Saturated liquid volume
c)vV_T =Saturated vapour volume
d)vL_T =Saturated liquid volume
e)v_pT= Specific volume as a function of pressure and temperature.
f)v_ph= Specific volume as a function of pressure and enthalpy
g)v_ps= Specific volume as a function of pressure and entropy.
5)Density
a)rhoV_p =Saturated vapour density
b)rhoL_p =Saturated liquid density
c)rhoV_T =Saturated vapour density
d)rhoL_T =Saturated liquid density
e)rho_pT= Density as a function of pressure and temperature.
f)rho_ph =Density as a function of pressure and enthalpy
g)rho_ps =Density as a function of pressure and entropy.
6)Specific entropy
a)sV_p =Saturated vapour entropy
b)sL_p= Saturated liquid entropy
c)sV_T= Saturated vapour entropy
d)sL_T =Saturated liquid entropy
e)s_pT =Specific entropy as a function of pressure and temperature
f)s_ph =Specific entropy as a function of pressure and enthalpy
7)Specific internal energy
a)uV_p= Saturated vapour internal energy
b)uL_p= Saturated liquid internal energy
c)uV_T =Saturated vapour internal energy
d)uL_T =Saturated liquid internal energy
e)u_pT= Specific internal energy as a function of pressure and temperature.
f)u_ph =Specific internal energy as a function of pressure and enthalpy
g)u_ps= Specific internal energy as a function of pressure and entropy.
8)Specific isobaric heat capacity
a)CpV_p= Saturated vapour heat capacity
b)CpL_p= Saturated liquid heat capacity
c)CpV_T= Saturated vapour heat capacity
d)CpL_T =Saturated liquid heat capacity
e)Cp_pT =Specific isobaric heat capacity as a function of pressure and temperature.
f)Cp_ph =Specific isobaric heat capacity as a function of pressure and enthalpy
g)Cp_ps =Specific isobaric heat capacity as a function of pressure and entropy.
9)Specific isochoric heat capacity
a)CvV_p =Saturated vapour isochoric heat capacity
b)CvL_p =Saturated liquid isochoric heat capacity
c)CvV_T =Saturated vapour isochoric heat capacity
d)CvL_T= Saturated liquid isochoric heat capacity
e)Cv_pT =Specific isochoric heat capacity as a function of pressure and temperature.
f)Cv_ph= Specific isochoric heat capacity as a function of pressure and enthalpy
g)Cv_ps =Specific isochoric heat capacity as a function of pressure and entropy.
10)Speed of sound
a)wV_p= Saturated vapour speed of sound
b)wL_p =Saturated liquid speed of sound
c)wV_T =Saturated vapour speed of sound
d)wL_T= Saturated liquid speed of sound
e)w_pT =Speed of sound as a function of pressure and temperature.
f)w_ph= Speed of sound as a function of pressure and enthalpy
g)w_ps =Speed of sound as a function of pressure and entropy.
11)Viscosity
a)my_pT Viscosity as a function of pressure and temperature.
b)my_ph Viscosity as a function of pressure and enthalpy
c)my_ps Viscosity as a function of pressure and entropy.
12)Thermal Conductivity
a)Revised release on the IAPS Formulation 1985 for the Thermal Conductivity of ordinary water substance (IAPWS 1998)
b)tcL_p =Saturated vapour thermal conductivity
c)tcV_p= Saturated liquid thermal conductivity
d)tcL_T =Saturated vapour thermal conductivity
e)tcV_T= Saturated liquid thermal conductivity
f)tc_pT =Thermal conductivity as a function of pressure and temperature.
g)tc_ph= Thermal conductivity as a function of pressure and enthalpy
h)tc_hs =Thermal conductivity as a function of enthalpy and entropy
13)Surface tension
a)st_T =Surface tension for two phase water/steam as a function of T
b)st_p =Surface tension for two phase water/steam as a function of T
14)Vapour fraction
a)x_ph =Vapour fraction as a function of pressure and enthalpy
b)x_ps= Vapour fraction as a function of pressure and entropy.
15)Vapour volume fraction
a)vx_ph =Vapour volume fraction as a function of pressure and enthalpy
b)vx_ps =Vapour volume fraction as a function of pressure and entropy.
##############Rankine cycle explain################
p1=input('P1(in bar):'); input 30 bar input command use for taking input from user
t1=input('T1(in celsius):'); input 400 degree celsius
p2=input('P2(in bar):'); input 0.05 bar
%state 1(in state 1 calculate enthalpy & entropy for pressure 1 ,temperature 1) temp1=400,pressure 2=0.05bar
h1=XSteam('h_pT',p1,t1);h1=enthalpy XSteam is file which is provide a many functions like 'h_pt'is related function as p1&t1 h_pT= Enthalpy as a function of pressure and temperature.
s1=XSteam('s_pT',p1,t1);s1= entropy XSteam is file which is provide a many functons like 's_pt' is related function as p1&t1 s_pT =Specific entropy as a function of pressure and temperature
in these case calling functions'h_pt' & 's_pt' from XSteam file this function related to perticular pressure and temp
%state 2(in state 2 calculate enthalpy & entropy for pressure 2,temp 2)(temp2 is not a given then use another formula to calculate enthalpy h2 )
s2=s1; (entropy is constant then s2=s1 in T-S Diagram)
sf2=XSteam('sL_p',p2) (sf2=entropy2 at fluid state XSteam =file name 'sL_p' =function name p2=0.05Bar)
sg2=XSteam('sv_p',p2);(sg2=entropy 2 at gas state XSteam =file name 'sL_p'=function name p2=0.05 Bar)
x2=(s2-sf2)/(sg2-sf2); (X2=vapour fraction ,entropy2 ,entropy fluid 2 ,entropy at gaseous state -entropy at fluid state at gas state)
hf2=XSteam('hl_p',p2); (hf2=enthalpy at fluid state2 at XSteam =file name 'hl_p'=function name enthalpy at liquid state p2=0.05 Bar)
hg2=XSteam('hV_p',p2); (hg2=enthalpy 2 at gas state XSteam =file name 'sL_p'=function name entropy at liquid & pressure p2=0.05 Bar)
h2=hf2+(x2*(hg2-hf2)); (h2=enthalpy 2 at fluid state hf2=enthalpy fluid state 2 x2=vapour fraction hg2=enthalpy gas state hf2=enthalpy at fluid state )
%state3
p3=p2; at the state 2 & 3 pressure will be constant
s3=XSteam('sL_p',p3); s3=entropy 3 XSteam=filename 'sL_p'=function name entropy at liquid phase pressure
h3=XSteam('hL_p',p3); h3=enthalpy XSteam=filename 'sL_p'=function name entropy at liquid phase pressure
%state 4
s4=s3 at state 4 & 3 entropy will be constant in T-S Diagram
p4=p1 at state 4 & 1 pressure will be constant ( in this phase steam travel from boiler to turbine)
%Turbine work
W_T=h1-h2; Turbine Output=enthalpy 1-enthalpy2
v3=XSteam('vL_p',p3);v3 is calculated using value p3 'vL_p'=volume of liquid pressure function name
%Pump work
W_P=v3*(p4-p3)*100; p4 & p3 at this phase showing pump workoutput then using this workoutput equation
h4=h3-W_P; workoutput equation use for the calculating h4
%Net work
W_net=W_T-W_P; W_net=W_T-W_P Turbine Workoutput-Pump Workoutput
Q_in=h1-h4; Q_in=h1-h4 Heat added
Q_out=h2-h3; Q_out=h2-h3; Heat rejection
%Temperature at state points
t3=XSteam('Tsat_p',p3); t3 is calculated for using a p3 value & saturation temp value Tsat_p',=saturation temp function name
t2=t3; at this phase temp is to be constant according to T-S diagram
Cp4=XSteam('cp_ps',p4,s4); Cp4=Specific pressure 4 Cp_ps=Constant pressure for pressure4 & entropy4 function name,
Cv4=XSteam('Cv_ps',p4,s4);Cv4=Specific volume 4 'Cv_ps'=Constant volume for pressure4 & entropy4 function name
k=Cp4/Cv4; k=constant putting all values on t4
t4=t3/((p3/p4)^((k-1)/k));
%Temperature,entropy and enthalpy at the vapour and liquid line for plotting
t6=XSteam('Tsat_p',p1); temp6,entropy5,entropy6,enthalpy5,enthalpy6 is to be calculated for the connecting a line properly
s5=XSteam('sL_p',p1);
s6=XSteam('sV_p',p1);
h5=XSteam('hL_p',p1);
h6=XSteam('hV_p',p1);
t5=t4;
%plotting saturation curve for T-S diagram
t=linspace(1,400,1000); using linspace command finding temp value 1000 between 1 to 400 deg /celsius
for i= 1:length(t) 'i' taking a access of all over temp range
sf(i)=XSteam('sL_t',t(i));entropy at fluid state sL_t=entropy at liquid state temp
sg(i)=XSteam('sV_t',t(i));entropy at gaseous state 'sV_t'=entropy at volume temp
hf(i)=XSteam('hL_t',t(i));enthalpy at fluid state enthalpy at liquid state temp
hg(i)=XSteam('hV_t',t(i)); enthalpy at gaseous state enthalpy at volume state
end
above calculation is all over temp range between 1to 400 deg celsius
%T-S diagram plotting
figure(1)
grid on
hold on
plot (sf,t,'r','linewidth',1)ploting for saturation curve sf=entropy fo fluid t=temp r=red 1=linewidth
plot(sg,t,'r','linewidth',1)ploting for saturation curve sf=entropy fo gaseous t=temp r=red 1=linewidth
plot([s1 s2],[t1 t2],'k','linewidth',2) plot for the entropy 1 ,entropy 2 temp 1, temp2 k=black 2=linewidth
plot([s2 s3],[t2 t3],'k','linewidth',2)plot for the entropy 1 ,entropy 2 temp 2, temp3 k=black 2=linewidth
plot([s3 s4],[t3 t4],'k','linewidth',2)plot for the entropy 1 ,entropy 2 temp 3, temp4 k=black 2=linewidth
plot([s4 s5],[t4 t5],'k','linewidth',2)plot for the entropy 1 ,entropy 2 temp 4, temp5 k=black 2=linewidth
plot([s5 s6],[t5 t6],'k','linewidth',2)plot for the entropy 1 ,entropy 2 temp 5, temp6k=black 2=linewidth
s_c1=linspace(s6,s1,200); s_c1=entropy value 200 between s6 to s1
for l =1:length(s_c1) 'l' taking access for all values of S_c1
t_c1(l)=XSteam('t_ps',p1,s_c1(l)); t_c1(l)=temp value for perticular plotting area this plotting shows on linewidth 5
end
plot(s_c1,t_c1,'k','linewidth',5) plots sc1 & tc1 k=linewidth
text(s1+0.1,t1,'1') text command use for mannualy texting no on the inside of plotting s1+0.1 = its shown as position is shifting from orignal position s1 text=1
text(s2+0.1,t2,'2')
text command use for mannualy texting no on the inside of plotting s2+0.1 = its shown as position is shifting from orignal position s2 text=2
text(s3,t3-20,'3') text command use for mannualy texting no on the inside of plotting t3-20 = its shown as position is shifting from orignal position t3 text=3
text(s4,t4+20,'4') text command use for mannualy texting no on the inside of plotting t4+0 = its shown as position is shifting from orignal position t4 text=4
title('Temperature vs Entropy')
xlabel('Entropy S(kJ/Kg.K)')
ylabel('Temprature T(degree C)')
legend ('Saturation Curve','location','northwest') using legend command identifes lines of saturation temp
%H-S diagram
figure (2)
grid on
hold on
plot(sf,hf,'g','linewidth',1) sf=entropy for fluid hf=enthalpy for fluid Plotting saturation curve for enthalpy & entropy
plot(sg,hg,'g','linewidth',1) sg=entropy for gaseous hg= enthalpy for gaseous Plotting saturation curve for enthalpy & entropy
plot([s1 s2],[h1 h2],'k','linewidth',2)plot for the entropy 1 ,entropy 2 enthalpy 1, enthalpy2 k=black 2=linewidth
plot([s2 s3],[h2 h3],'k','linewidth',2)plot for the entropy 2 ,entropy 3 enthalpy 2, enthalpy3 k=black 2=linewidth
plot([s3 s4],[h3 h4],'k','linewidth',2)plot for the entropy 4 ,entropy 5 enthalpy3, enthalpy4 k=black 2=linewidth
plot([s5 s6 ],[h5 h6],'k','linewidth',5)plot for the entropy 5 ,entropy 6 enthalpy5, enthalpy 6 k=black 2=linewidth
legend ('Saturation Curve','location','northwest') using legend command identifes lines of plotting
h_c=linspace(h5,h6,200);enthalpy 5,enthalpy 6 value 200 between h5 to h6
for k =1:length(t_c1) 'i' taking a access of all over enthalpy range
h_c(k)=XSteam('h_ps',p1,s_c1(k)); plots h_ps & h_c(k) k=linewidth
end
plot(s_c1,h_c,'k','linewidth',5)
text(s1+0.1,h1,'1') text command use for mannualy texting no on the inside of plotting s2+0.1 = its shown as position is shifting from orignal position s2 text=1
text(s2+0.1,h2,'2') text command use for mannualy texting no on the inside of plotting s2+0.1 = its shown as position is shifting from orignal position s2 text=2
text(s3,h3-100,'3') text command use for mannualy texting no on the inside of plotting h3-100 = its shown as position is shifting from orignal position h3 text=3
text(s4,h4+200,'4') text command use for mannualy texting no on the inside of plotting h4+200 = its shown as position is shifting from orignal position h4 text=4
title('Enthalpy vs Entropy')
xlabel('Entropy s(KJ/Kg.K)')
ylabel('Enthalpy')
Displaying results
disp('RESULTS')
fprintf('At state Point 1:\n'); Fprintf =print the letters 'At state Point 1:\n' =is a string \n= use for sequence
fprintf('P1: %8.3f bar \n',p1); floating value =8.3 means 3 is the result shows after point within 3 digits 8 is the result previous of the point shows the digit 8 t1
fprintf('T1: %8.3f C\n',t1);
fprintf('H1: %8.3f KJ/Kg.k\n',h1)
fprintf('S1:%8.3f KJ/Kg.K\n',s1)
fprintf('At State point 2:\n');
fprintf('P2: %8.3f bar \n',p2);
fprintf('T2: %8.3f C\n',t2);
fprintf('H2: %8.3f KJ/Kg.k\n',h2)
fprintf('S2: %8.3f bar \n',p2);
fprintf('T2: %8.3f C\n',t2);
fprintf('H2: %8.3f KJ/Kg.k\n',h2)
fprintf('S2: %8.3f bar \n',s2);
fprintf('x2: %8.3f C\n',x2);
fprintf(('At State point 2:\n'));
fprintf('P3: %8.3f bar \n',p3);
fprintf('T3: %8.3f C\n',t3);
fprintf('H3: %8.3f KJ/Kg.k\n',h3)
fprintf('P3: %8.3f bar \n',p3);
fprintf('T3: %8.3f C\n',t3);
fprintf('H3: %8.3f KJ/Kg.k\n',h3)
fprintf('S3: %8.3f bar \n',s3);
fprintf(('At State point 2:\n'));
fprintf('P4: %8.3f KJ/Kg.k\n',p4)
fprintf('T4: %8.3f bar \n',t4);
fprintf('H4: %8.3f C\n',h4);
fprintf('S4: %8.3f KJ/Kg.k\n',h4);
fprintf('Turbine Work:%8.3f KJ/Kg\n ',W_T);
fprintf('Pump Work:%8.3f K/J/Kg\n',W_P);
fprintf('Net.Work done: %8.3f bar \n',W_net);
fprintf('Thermal Efficiency: %8.3f percent \n',Thermal_eff);
fprintf('Specific steam Consumption: %8.3f KJ/KWh',Sp_Steam_Consumption);
Error- in rankine cycle t2 value is not presented
h2=hf2+(x2*(hg2-hf2)) use this formula to calculate h2 (h2=enthalpy 2 at fluid state hf2=enthalpy fluid state 2 x2=vapour fraction hg2=enthalpy gas state hf2=enthalpy at fluid state )