Rankine cycle Simulator
Aim : Write program for Rankine cycle simulator by using Octave.
objective:
- write code to calculate state point of rankine cycle
- write code to plot H-S and T-S diagram
Therotical background:
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. It is an idealized 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 brown) 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, 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]
- 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]
In an ideal Rankine cycle the pump and turbine would be isentropic, i.e., the pump and turbine would generate no entropy and hence maximize the net work output. Processes 1–2 and 3–4 would be represented by vertical lines on the T–s diagram and more closely resemble that of the Carnot cycle. The Rankine cycle shown here prevents the state of the working fluid from ending up in the superheated vapor region after the expansion in the turbine, which reduces the energy removed by the condensers.
The actual vapor power cycle differs from the ideal Rankine cycle because of irreversibilities in the inherent components caused by fluid friction and heat loss to the surroundings; fluid friction causes pressure drops in the boiler, the condenser, and the piping between the components, and as a result the steam leaves the boiler at a lower pressure; heat loss reduces the net work output, thus heat addition to the steam in the boiler is required to maintain the same level of net work output.
T-S Diagram:
operating pressure : 0.06 to 50 bar
Main Program:
close all
clear all
clc
% printing title and process of rankine cycle
fprintf(' Rankine Cycle \n ')
fprintf( '1-2 Isobaric heat transfer \n' )
fprintf( '2-3 Isentropic expansion \n' )
fprintf( '3-4 Isobaric heat rejection\n')
fprintf( '4-1 Isentropic compression \n')
% asking the user for input
p1= input('Enter the pressure at the turbine inlet( bar):');
T1= input ('Enter the temprature at the Turbine inlet (Degree celcius): ');
p2= input('Enter the pressure at the condensor (bar):');
% calculate state point with help xstem file
% state_point_1
h1=XSteam('h_pt',p1,T1);
s1=XSteam('s_pt',p1,T1);
% state_point_2
s2=s1;
sf2 = XSteam('sL_p',p2);
sg2 = XSteam('sV_p',p2);
hf2 = XSteam('hL_p',p2);
hg2 = XSteam('hV_p',p2);
s2=sg2;
h2=hg2;
T2=XSteam('T_hs',h2,s2);
% state_point_3
T3=T2;
p3=p2;
s3=XSteam('sL_T',T3);
h3=XSteam('hL_T',T3);
v3=XSteam('vL_p',p2);
% state_point_4
p4=p1;
s4=s3;
Cp4 = XSteam('Cp_ps',p4,s4);
Cv4 = XSteam('Cv_ps',p4,s4);
gamma=Cp4/Cv4;
r = (gamma - 1)/gamma;
T4 =T3*(p4/p3)^r ;
% calculating parameter
% turbine work done
Wt = h1-h2 ;
%pump work required
Wp = v3*(p1-p2)*100 ;
% net work (kj/kg)
h4 = Wp + h3;
W_net = Wt-Wp;
% heat supplied
Qs = h1-h4 ;
% Efficiency calculation
N_ther = (W_net/Qs)*100;
% Steam rate per second
steam_rate = 3600/(Wt-Wp);
% state point 5 and 6
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);
% printing all state_point
fprintf('\n RESULT \n ')
fprintf('At State point 1:\nP1 is : %4.2f Bar\nT1 is : %4.2f Degree Celcius\nH1 is : %4.2f KJ/Kg\nS1 is : %4.2f Kj/kgk\n\n',p1,T1,h1,s1)
fprintf('At State point 2:\nP1 is : %4.2f Bar\nT2 is : %4.2f Degree Celcius\nH2 is : %4.2f KJ/Kg\nS2 is : %4.2f Kj/kgk\n\n',p2,T2,h2,s2)
fprintf('At State point 3:\nP1 is : %4.2f Bar\nT3 is : %4.2f Degree Celcius\nH3 is : %4.2f KJ/Kg\nS3 is : %4.2f Kj/kgk\n\n',p3,T3,h3,s3)
fprintf('At State point 4:\nP1 is : %4.2f Bar\nT4 is : %4.2f Degree Celcius\nH4 is : %4.2f KJ/Kg\nS4 is : %4.2f Kj/kgk\n\n',p4,T4,h4,s4)
fprintf('WT is :%4.2f Kj/kg \n WP is : %4.2f Kj/kg \nWnet is : %4.2f KJ/kg\nEffi is : %4.2f percentage\nSSC is : %4.2f kg/kwh',Wt,Wp,W_net,N_ther,steam_rate)
% T-s Diagram
subplot(1,2,1)
T_rankine = linspace(T5,T1,5000);
for i = 1:length(T_rankine)
s_rankine(i) = XSteam('s_pT',p1,T_rankine(i));
end
plot([s1 s2 s3 s4 s5 s6 s_rankine],[T1 T2 T3 T4 T5 T6 T_rankine],'linewidth',1.5);
hold on
T_curve = linspace (1,400,500);
for i=1:length(T_curve)
s_l(i)=XSteam('sL_T',T_curve(i));
s_v(i)=XSteam('sV_T',T_curve(i));
h_l(i)=XSteam('hL_T',T_curve(i));
h_v(i)=XSteam('hL_T',T_curve(i));
end
plot(s_l,T_curve);
plot(s_v,T_curve);
text(s1,T1,'1','fontsize',15)
text(s2,T2,'2','fontsize',15)
text(s3,T3,'3','fontsize',15,'HorizontalAlignment','right','VerticalAlignment','Top')
text(s4,T4,'4','fontsize',15,'HorizontalAlignment','right','VerticalAlignment','bottom')
text(s5,T5,'5','fontsize',15)
text(s6,T6,'6','fontsize',15)
title('T-S Diagram');
xlabel('Entropy in KJ/kgk');
ylabel('Temprature in Degree Celcius');
% H-S Diagram
subplot(1,2,2)
plot([s1 s2 s3 s4 s1 ],[h1 h2 h3 h4 h1 ],'linewidth',2)
hold on
plot(s_v,h_v,'color','r');
plot(s_l,h_l,'color','r');
text(s1,h1,'1','Fontsize',15)
text(s2,h2,'2','Fontsize',15)
text(s3,h3,'3','Fontsize',15,'HorizontalAlignment','right','VerticalAlignment','Top')
text(s4,h4,'4','Fontsize',15,'HorizontalAlignment','right','VerticalAlignment','bottom')
title('H-S Diagram');
xlabel('Entropy in KJ/kgk');
ylabel('Enthalpy in KJ/Kg');
Procedure:
- First we will print heading and process involve in rankine cycle
- Then we will ask for user to input temprature of steam at inlet of turbine , Inlet pressure of steam at inlet of turbine and outlet pressure at turbine.
- With the help of user information we will extract information form XStem file and we will find state point properties
- Once all state point properties will be calculated then we will print all state point and parameter we have found out like turbine work,pump work ,net work done and thermal effficiency and specific fuel consumption.
- Then we will plot temprature and entropy and label it.
- Then we will plot enthalpy and entropy plot.
Output:
Result: Script for Rankine cycle simulator has been executed successfully.