Project 2 - Rankine cycle Simulator
RANKINE CYCLE SIMULATOR
AIM-
- To simulate a Rankine cycle using MATLAB
- Extract the steam and water properties from Xsteam file.
- Calculate all the state points of the cycle based on user inputs.
- Plotting the T-S and H-S diagram for the given input.
Objective
- Write a MATLAB code to simulate the Rankine cycle
- Calculate the state points of cycle
- Plot the diagram
- Program explanation.
Rankine Cycle:
The Rankine Cycle is a mechanical cycle commonly used in power plants to convert the pressure energy of steam into mechanical energy through steam turbines The Rankine Cycle’s major components include a rotating steam turbine, a boiler pump, a stationary condenser, and a boiler.
A boiler is used to heat the water for steam at the required pressure and temperature as per the turbine’s requirement for power generation.
The turbine exhaust is directed to the radial or axial flow condenser for condensing the steam to condensate and recycled back to the boiler through boiler pumps for heating again.
The four processes of an ideal Rankine cycle are;
- Process 1-2: Isentropic compression in a pump. Here the working fluid is pumped from low to high pressure.
- 2-3: Constant pressure heat addition in the boiler. In this process, the high-pressure liquid is added to the boiler and is heated at constant pressure to become a dry saturated vapour.
- 3-4: Isentropic expansion in a turbine. The dry saturated vapour expands through the turbine resulting in the generation of power.
- 4-1: Constant pressure heat rejection in a condenser. Wet vapour is condensed at a constant pressure to become a saturated liquid.
Given inputs:
- Turbine inlet temperature=400 deg c.
- Turbine Inlet pressure=30 bars;
- Turbine Outlet pressure=0.05bar=Inlet pressure of condenser;
Main program:
clear all
close all
clc
%Heading &process in the cycle.
fprintf('%40s','Rankine cycle simulator');
fprintf('\n');
fprintf('\n');
fprintf('1-2 : Isentropic expansion');
fprintf('\n');
fprintf('2-3 : Constant pressure heat rejection by condenser');
fprintf('\n');
fprintf('3-4 : Isentropic compression in the pump');
fprintf('\n');
fprintf('4-5 : Constant pressure heat addition by the boiler');
fprintf('\n');
fprintf('5-6 : Constant boiler pressure to generate steam');
fprintf('\n');
fprintf('6-1 : Constant boiler pressure to turbine inlet temperature');
fprintf('\n');
fprintf('\n');
%inputs
%Inlet pressure at turbine
p1=30;
%Inlet temperature at turbine
t1=400;
%Outlet pressure at turbine
p2=0.05;
%input data
disp('Input data:');
fprintf('Turbine inlet temperature,T1(deg c):');
fprintf('%.f',t1);
fprintf(' deg c');
fprintf('\n')
fprintf('Turbine inlet pressure,P1(bar):');
fprintf('%.f',p1);
fprintf(' Bar');
fprintf('\n')
fprintf('Turbine outlet pressure,P2(bar):');
fprintf('%.2f',p2);
fprintf(' Bar');
fprintf('\n')
fprintf('\n')
%At state point 1 there is turbine inlet and superheated steam from boiler
v1=XSteam('v_pT',p1,t1);
s1=XSteam('s_pT',p1,t1);
h1=XSteam('h_pT',p1,t1);
%Result of state point 1
fprintf('state point 1');
fprintf('\n');
fprintf('p1=');
fprintf('%.2f',p1);
fprintf(' Bar');
fprintf('\n');
fprintf('v1=');
fprintf('%.2f',v1);
fprintf(' m^3/kg');
fprintf('\n');
fprintf('T1=');
fprintf('%.f',t1);
fprintf(' deg c');
fprintf('\n');
fprintf('s1=');
fprintf('%.2f',s1);
fprintf(' kj/kg deg c');
fprintf('\n')
fprintf('H1=');
fprintf('%.2f',h1);
fprintf(' kj/kg');
fprintf('\n');
fprintf('\n');
%point 2 - turbine outlet
t2=XSteam('Tsat_p',p2);
sg2=XSteam('sV_p',p2);
sf2=XSteam('sL_p',p2);
sfg2=sg2-sf2;
x=(s1-sf2)/sfg2;
s2=sf2+x*sfg2;
hf2=XSteam('hL_p',p2);
hg2=XSteam('hV_p',p2);
hfg2=hg2-hf2;
h2=hf2+x*hfg2;
vg2=XSteam('vV_p',p2);
v2=x*vg2;
%pv^n=constant
%p1*v1^n=p2*v2^n
n=(log(p2)-log(p1))/(log(v1)-log(v2));
c=p1*v1^n;
v_exp=linspace(v1,v2,100);
p_exp=c./(v_exp).^n;
%Result of state point 2
fprintf('state point 2');
fprintf('\n');
fprintf('p2=');
fprintf('%.2f',p2);
fprintf(' Bar');
fprintf('\n');
fprintf('V2=');
fprintf('%.2f',v2);
fprintf(' m^3/kg');
fprintf('\n');
fprintf('T2=');
fprintf('%.2f',t2);
fprintf(' deg c');
fprintf('\n');
fprintf('S2=');
fprintf('%.2f',s2);
fprintf(' kj/kg deg c');
fprintf('\n');
fprintf('H2=');
fprintf('%.2f',h2);
fprintf(' kj/kg');
fprintf('\n');
fprintf('\n');
% State point 3
p3=p2;
t3=t2;
v3=XSteam('vL_p',p3);
hf3=hf2;
h3=hf3;
s3=sf2;
%Result of state point 3
fprintf('State point 3');
fprintf('\n');
fprintf('P3=');
fprintf('%.2f',p3);
fprintf(' Bar');
fprintf('\n');
fprintf('V3=');
fprintf('%.2f',v3);
fprintf(' m^3/kg');
fprintf('\n');
fprintf('T3=');
fprintf('%.2f',t3);
fprintf(' deg c');
fprintf('\n');
fprintf('S3=');
fprintf('%.2f',s3);
fprintf(' kj/kg deg c');
fprintf('\n');
fprintf('H3=');
fprintf('%.2f',h3);
fprintf(' kj/kg');
fprintf('\n');
fprintf('\n');
%At State point 4
p4=p1;
s4=s3;
%feed pump work
wp=v3*(p4-p3)*100;
%finding t4 using cp,cv
cp4=XSteam('cp_ps',p4,s4);
cv4=XSteam('cv_ps',p4,s4);
k=cp4/cv4;
t4=t3/((p3/p4)^((k-1)/k));
v4=XSteam('v_pt',p4,t4);
h4=h3+wp;
%Result of state point 4
fprintf('State point 4');
fprintf('\n');
fprintf('P4=');
fprintf('%.f',p4);
fprintf(' Bar');
fprintf('\n');
fprintf('V4=');
fprintf('%.2f',v4);
fprintf(' m^3/kg');
fprintf('\n');
fprintf('T4=');
fprintf('%.2f',t4);
fprintf(' deg c');
fprintf('\n');
fprintf('S4=');
fprintf('%.2f',s4);
fprintf(' kj/kg deg c');
fprintf('\n');
fprintf('H4=');
fprintf('%.2f',h4);
fprintf(' kj/kg');
fprintf('\n');
% State Point 5
p5=p1;
v5=XSteam('vL_p',p5);
t5=XSteam('Tsat_p',p5);
h5=XSteam('hL_p',p5);
s5=XSteam('sL_p',p5);
%Results of sate point 5
fprintf('State point 5');
fprintf('\n');
fprintf('P5=');
fprintf('%.2f',p5);
fprintf(' Bar');
fprintf('\n');
fprintf('V5=');
fprintf('%.2f',v5);
fprintf(' m^3/kg');
fprintf('\n');
fprintf('T5=');
fprintf('%.2f',t5);
fprintf(' deg c');
fprintf('\n');
fprintf('S5=');
fprintf('%.2f',s5);
fprintf(' kj/kg deg c');
fprintf('\n');
fprintf('H5=');
fprintf('%.2f',h5);
fprintf(' kj/kg');
fprintf('\n');
% State point 6
p6=p1;
v6=XSteam('vV_p',p6);
t6=t5;
h6=XSteam('hV_p',p6);
s6=XSteam('sV_p',p6);
%Results of state point 6
fprintf('State point 6');
fprintf('\n');
fprintf('P6=');
fprintf('%.2f',p6);
fprintf(' Bar');
fprintf('\n');
fprintf('V6=');
fprintf('%.2f',v6);
fprintf(' m^3/kg');
fprintf('\n');
fprintf('T6=');
fprintf('%.2f',t6);
fprintf(' deg c');
fprintf('\n');
fprintf('S6=');
fprintf('%.2f',s6);
fprintf(' kj/kg deg c');
fprintf('\n');
fprintf('H6=');
fprintf('%.2f',h6);
fprintf(' kj/kg');
fprintf('\n');
fprintf('\n');
%work done by turbine
w_t=h1-h2;
%net workdone
w_net=w_t-wp;
%back work ratio
bwr=wp/w_t;
%rankine cycle efficiency
e_r=(w_net/(h1-hf3-wp))*100;
%specific heat consumption(ssc)
ssc=3600/w_net;
%for getting data related to saturated water line and dry satureted steam
%line
t=linspace(1,374.15,1000);
for i=1:length(t)
sl(i)=XSteam('sL_T',t(i));
sg(i)=XSteam('sV_T',t(i));
hl(i)=XSteam('hL_T',t(i));
hg(i)=XSteam('hv_T',t(i));
end
%Workdone by turbine
fprintf('Workdone by turbine=');
fprintf('%.2f',w_t);
fprintf(' kj/kg');
fprintf('\n');
%Workdone by Pump
fprintf('Workdone by feed pump=');
fprintf('%.2f',wp);
fprintf(' kj/kg');
fprintf('n');
%Net workdone
fprintf('Net workdone=');
fprintf('%.2f',w_net);
fprintf(' kj/kg');
fprintf('\n');
%Backwork ratio
fprintf('Back work ratio=');
fprintf('%.2f',bwr);
fprintf('\n');
%Rankine cycle efficiency
fprintf('rankine cycle efficiency=');
fprintf('%.2f',e_r);
fprintf('%s','%');
fprintf('\n');
%Specific steam consumption
fprintf('Specific steam consumption=');
fprintf('%.2f',ssc);
fprintf('kg/kw hr');
fprintf('\n')
%plotting T-S diagram
figure(1)
hold on
%liquid line of T-S diagram
plot(sl,t,'color','r','linewidth',2)
%saturated steam line
plot(sg,t,'color','r','linewidth',2)
%plotting T-S diagram through state points
plot(s1,t1,'+','color','k')
text(s1,t1,'1')
plot([s1,s2],[t1,t2],'color','b','linewidth',2)
plot(s2,t2,'+','color','k')
text(s2,t2,'2')
plot([s2,s3],[t2,t3],'color','b','linewidth',2)
plot(s3,t3,'+','color','k')
text(s3,t3-10,'3')
plot([s3,s4],[t3,t4],'color','b','linewidth',2)
plot(s4,t4,'+','color','k')
text(s4-0.2,t4+20,'4')
plot([s4,s5],[t4,t5],'color','b','linewidth',2)
plot(s5,t5,'+','color','k')
text(s5,t5,'5')
plot([s5,s6],[t5,t6],'color','b','linewidth',2)
plot(s6,t6,'+','color','k')
text(s6,t6,'6')
s61=linspace(s6,s1,1000);
for k=1:length(s61)
t61(k)=XSteam('T_ps',p1,s61(k));
end
plot(s61,t61,'color','b','linewidth',2)
xlabel('Entropy(kj/kg k)')
ylabel('Temperature(deg c)')
title('T-S diagram')
%plotting S-H diagram
figure(2);
hold on
plot(sl,hl,'color','k','linewidth',2)
plot(sg,hg,'color','k','linewidth',2)
plot(s1,h1,'*','color','c')
text(s1,h1,'1')
plot([s1,s2],[h1,h2],'color','b','linewidth',2)
plot(s2,h2,'*','color','c')
text(s2,h2,'2')
h23=linspace(h2,h3,1000);
for q=1:length(h23)
s23(q)=XSteam('s_ph',p2,h23(q));
end
plot(s23,h23,'color','b','linewidth',2)
plot(s3,h3,'*','color','c')
text(s3,h3-50,'3')
plot([s3,s4],[h3,h4],'color','b','linewidth',2)
plot(s4,h4,'*','color','c')
text(s4-0.2,h4+100,'4')
h45=linspace(h4,h5,500);
for m=1:length(h45)
s45(m)=XSteam('s_ph',p1,h45(m));
end
plot(s45,h45,'color','b','linewidth',2)
plot(s5,h5,'*','color','c')
text(s5-0.4,h5+70,'5')
s56=linspace(s5,s6,1000);
for r=1:length(s56)
h56(r)=XSteam('h_ps',p1,s56(r));
end
plot(s56,h56,'color','b','linewidth',2)
plot(s6,h6,'*','color','c')
text(s6-0.2,h6+100,'6')
h61=linspace(h6,h1,1000);
for n=1:length(h61)
s61(n)=XSteam('s_ph',p1,h61(n));
end
plot(s61,h61,'color','b','linewidth',2)
xlabel('entropy(kj/kg k)')
ylabel('enthalpy(kj/kg)')
title('H-S diagram')
Code Explanation:
- Print all the four process of Rankine cycle
- Assigning the input data which are Turbine inlet pressure, Turbine inlet temperature, Turbine outlet pressure.
- State variables are calculated by using XSteam
- XSteam data is used to extract the steam and water properties of enthalpy, entropy at specific pressure and temperatures for sat liquid, sat vapour conditions etc.
- At state point 1, we have the given inputs, by using XSteam data specific volume, specific enthalpy and specific entropy are obtained.
- Isentropic expansion of steam in turbine at process(1-2) the steam becomes wet, so here entropy remains constant(s2=s1).
- Now p2 is already given as input data, Dryness fraction(x) of steam is calculated at state point 2, with the value of dryness fraction, we find the values of s2,h2,v2,t2 by using XSteam data
- At constant pressure and temperature process wet steam from turbine is condensed in condenser into water completely.
- At state point 2&3 there is no change in pressure and temperature.so s3 and h3 are calculated and v3 is obtained from XSteam data.
- During Isentropic compression of saturated water by feed pump entropy remains constant(s3=s4).
- P4=p1 here the work is done by feed pump on water, this work done is used to find out enthalpy at state point 4
- Specific heat of water at constant pressure and constant volume for state point 4 are calculated by using XSteam data.
- Process 4-5 is heating of water in boiler at constant boiler pressure(p4=p5=p1) and at the end of process it will be saturated water at pressure p1. Saturation temperature at p1 is T5. At state point 5 the values of V5, t5, h5 and s5 are calculated by XSteam data.
- At process 6-1 superheating the dry saturated steam at constant boiler pressure to raise the temperature of steam to T1, here the pressure remains constant p6=p1.
- Now we found all the state variables and work done by turbine, work done by feed pump, net work done, back work ratio, Specific steam consumption are also calculated.
- Getting points of liquid line and dry saturated line in T-S and H-S diagram, a for loop & XSteam data is used.
- Use fprintf command to print all the calculated values in command window
RESULT:
Finally all the state variables of Rankine cycle are calculated and the plots are derived.
Hence the Rankine cycle simulation is achieved.