Rankine Cycle Simulator
Objective :
The objective of this project is plot T-S and h-s curve of the rankine cycle and determine the net work output and the back work ratio.
Theory of Rankine Cycle :
The Rankine cycle is the fundamental operating cycle of all power plants where an operating fluid is continuously evaporated and condensed. The consists of mainly 4 processes :
1) Isentropic Expansion (1-2) - The vapor is expanded in the turbine, thus producing work which may be converted to electricity.
2) Isobaric Heat rejection (2-3) - The vapour pressure mixture is condensed in a condenser. The process is assumed be a constant pressure heat rejection.
3)Isentropic Compression (3-4) - The saturated liquid is pumped to increase the pressure upto boiler pressure. The process is assumed to ideal.
4)Isobaric Heat Addition (4-1) - The fluid's temperature is slowly raised while passing through various componets such as economiser, superheater at constant presure. The outlet of the boiler is a superheated steam.
Code :
clear all
close all
clc
disp(' RANKINE CYCLE SIMULATOR')
disp('1-2 is Isentropic Expansion in Turbine')
disp('2-3 is Isbaric Heat Rejection in Condensor')
disp('3-4 is Isentropic Compression in Pump')
disp('4-1 is Isobaric Heat addition in Boiler')
%Inputs for our program
t1 = input('Enter the turbine inlet temperatur(celcius): ');
p1 = input('Enter the turbine inlet pressure(bar): ');
p2 = input('Enter the turbine outlet pressure(bar): ');
%Inlet conditions of turbine
s1 = XSteam('s_pT',p1,t1);
h1 = XSteam('h_pT',p1,t1);
%Outlet conditions of turbine or Inlet of condenser
s2 = s1; %Isentropic Expansion
t2 = XSteam('Tsat_p',p2);
sf2 = XSteam('sL_T',t2);
sg2 = XSteam('sV_T',t2);
x2 = (s2 - sf2)/(sg2 - sf2); %Dryness Fraction or Vapour Fraction
h2 = XSteam('h_px',p2,x2);
%Outlet of Condenser or Inlet of Pump
p3 = p2;
t3 = t2;
h3 = XSteam('hL_p',p3);
s3 = sf2;
%Outlet of Pump or Inlet of
p4 = p1;
s4 = s3; %Isentropic Compression
h4 = XSteam('h_ps',p4,s4);
%Calculating t4(boiler inlet temperature) assuming isentropic compression in pump
cp4 = XSteam('Cp_ps',p4,s4);
cv4 = XSteam('Cv_ps',p4,s4);
gamma4 = cp4/cv4;
t4 = ((p4/p3)^(1-(1/gamma4)))*t3;
%RESULTS
%Work output (by turbine)
w_out = h1-h2;
%Heat rejection by condenser
q_rej = h2-h3;
%Work input (by pump)
w_inp = h4-h3;
%Heat addition in boiler
q_add = h1-h4;
%Net work of the cycle
w_net = w_out - w_inp;
%Thermal Efficiency of the cycle
Efficiency = w_net/q_add;
%Back work ratio
r_back = w_inp/w_out;
%PLOTTING DIFFERENT PLOTS
%1st Plot
%Plotting T-S diagram of the rankine cycle
temp_range = linspace(1,400,400);
for i = 1:length(temp_range)
s_liquid_line(i) = XSteam('sL_T',temp_range(i));
s_vapour_line(i) = XSteam('sV_T',temp_range(i));
end
figure(1)
plot(s_liquid_line,temp_range,'-','LineWidth',2,"Color",'k')
hold on
plot(s_vapour_line,temp_range,'-','LineWidth',2,"Color",'k')
plot([s1,s2] ,[t1,t2],'LineWidth',3,"Color",'b') %Turbine Work output(1-2)
plot([s2,s3],[t2,t3],'LineWidth',3,"Color",'g' ) %Condenser Heat Rejection(2-3)
plot([s3,s4],[t3,t4],'LineWidth',3,"Color",'r') %Pump Work Input (3-4)
%Boiler heat addition is divide into 3 part
sf1 = XSteam('sL_p',p1);
sg1 = XSteam('sV_p',p1);
t_sat1 = XSteam('Tsat_p',p1);
plot([s4,sf1,sg1,s1],[t4,t_sat1,t_sat1,t1],'LineWidth',3,"Color",'m') %Boiler Heat Addition (4-1)
title('T-s diagram of Rankine Cycle')
xlabel('Entropy(Kj/kg-K')
ylabel('Temprature(K)')
axis([0 12 -20 500])
%Adding description to data point
text(s1,t1,'1','FontSize',10);
text(s2,t2,'2','FontSize',10);
text(s3,t3,'3','FontSize',10);
text(s4,t4,'4','FontSize',10);
%Second plot
%Plotting h-s diagram of the rankine cycle
for i = 1:length(temp_range)
h_liquid_line(i) = XSteam('hL_T',temp_range(i));
h_vapour_line(i) = XSteam('hV_T',temp_range(i));
end
%ploting h-s saturation curve
figure(2)
plot(s_liquid_line,h_liquid_line,'-','LineWidth',2,"Color",'k')
hold on
plot(s_vapour_line,h_vapour_line,'-','LineWidth',2,"Color",'k')
plot([s1,s2],[h1,h2],'LineWidth',3,"Color",'b') %Turbine Work output(1-2)
plot([s2,s3],[h2,h3],'LineWidth',3,"Color",'g') %Condenser Heat Rejection(2-3)
plot([s3,s4],[h3,h4],'LineWidth',3,"Color",'r') %Pump Work Input (3-4)
plot([s4,s1],[h4,h1],'LineWidth',3,"Color",'m') %Boiler Heat Addition (4-1)
title('h-s diagram of Rankine Cycle')
xlabel('Entropy(KJ/kg-K)')
ylabel('Enthalpy(KJ/kg')
%Adding description to data point
text(s1,h1,'1','FontSize',12)
text(s2,h2,'2','FontSize',12)
text(s3,h3,'3','FontSize',12)
text(s4,h4,'4','FontSize',12)
%RESULTS
fprintf('%25s\n\n','RESULTS')
fprintf('%s\n','At State Point 1:')
fprintf('%s %4.2f %s\n','P1 is :',p1,'bar')
fprintf('%s %4.2f %s\n','T1 is :',t1,'Deg Celcius')
fprintf('%s %6.1f %s\n','H1 is :',h1,'KJ/Kg')
fprintf('%s %5.4f %s\n\n','S1 is :',s1,'KJ/Kg-K')
fprintf('%s\n','At State Point 2:')
fprintf('%s %4.2f %s\n','P2 is :',p2,'bar')
fprintf('%s %4.2f %s\n','T2 is :',t2,'Deg Celcius')
fprintf('%s %6.1f %s\n','H2 is :',h2,'KJ/Kg')
fprintf('%s %5.4f %s\n','S2 is :',s2,'KJ/Kg-K')
fprintf('%s %5.4f\n\n','X(dryness fraction) :',x2)
fprintf('%s\n','At State Point 3:')
fprintf('%s %4.2f %s\n','P3 is :',p3,'bar')
fprintf('%s %4.2f %s\n','T3 is :',t3,'Deg Celcius')
fprintf('%s %6.1f %s\n','H3 is :',h3,'KJ/Kg')
fprintf('%s %6.5f %s\n\n','S3 is :',s3,'KJ/Kg-K')
fprintf('%s\n','At State Point 4:')
fprintf('%s %4.2f %s\n','P4 is :',p4,'bar')
fprintf('%s %4.2f %s\n','T4 is :',t4,'Deg Celcius')
fprintf('%s %6.1f %s\n','H4 is :',h4,'KJ/Kg')
fprintf('%s %5.4f %s\n\n','S4 is :',s4,'KJ/Kg-K')
fprintf('%25s\n\n','Final Results')
fprintf('%s %.2f %s\n','Turbine Work Output : ',w_out,'KJ/Kg')
fprintf('%s %5.2f %s\n','Pump Work Input : ',w_inp,'KJ/Kg')
fprintf('%s %.2f %s\n','Net Work : ',w_net,'KJ/Kg')
fprintf('%s %.2f\n ','Efficiency : ',Efficiency)
fprintf('%s %.5f\n','Back Work Ratio : ',r_back)
Note:
- XSteam is function which is called to get the values at a particular point.
- Input function let user enter any arbitrary value.
- fprintd function is used to write data to text file.
Results :
1. T- S diagram
Fig.1 Fig.2
Fig.1 - T-s Diagram
Fig.2 - Magnified Image of T-S diagram to show the pump work
2. h-s Diagram
Fig.3 Fig.4
Fig.3 - h-s diagram
Fig.4 - Magnified Image of h-s diagram to show the pump work
3. Command Window
Conclusion :
From the above result and from graph we can conclude that pump work input is insignificant in comparison to turbine work.