Challenge

Project 2 - Rankine cycle Simulator

AIM:-To write code in MATLAB that can solve Rankine Cycle and make plots for it.

OBJECTIVE:-

  • To calculate the performance of a steam turbine engine.
  • To plot the T-S and H-S diagram of a Rankine cycle.

INTRODUCTION:-

The Rankine cycle is the fundamental operating cycle of all power plants where an operating fluid is continuously evaporated and condensed. The selection of operating fluid depends mainly on the available temperature range.

The pressure-enthalpy (p-h) and temperature-entropy (T-s) diagrams of this cycle are given in figure. The Rankine cycle operates in the following steps:

  • 1-2-3 Isobaric Heat Transfer. High-pressure liquid enters the boiler from the feed pump (1) and is heated to the saturation temperature (2). Further addition of energy causes evaporation of the liquid until it is fully converted to saturated steam (3).

  • 3-4 Isentropic Expansion. The vapor is expanded in the turbine, thus producing work which may be converted to electricity. In practice, the expansion is limited by the temperature of the cooling medium and by the erosion of the turbine blades by liquid entrainment in the vapor stream as the process moves further into the two-phase region. Exit vapor qualities should be greater than 90%.

  • 4-5 Isobaric Heat Rejection. The vapor-liquid mixture leaving the turbine (4) is condensed at low pressure, usually in a surface condenser using cooling water. In well-designed and maintained condensers, the pressure of the vapor is well below atmospheric pressure, approaching the saturation pressure of the operating fluid at the cooling water temperature.

  • 5-1 Isentropic Compression. The pressure of the condensate is raised in the feed pump. Because of the low specific volume of liquids, the pump work is relatively small and often neglected in thermodynamic calculations.

The given input value are:-

  • Turbine inlet temperature = 400 C.
  • Turbine Inlet Pressure = 30 bars.
  • Turbine Outlet Pressure = 0.05 bars = Condenser Inlet Pressure.

Main code for Rankine cycle:-

%Rankine cycle
% inputs 
disp('Rankine Cycle Simulator')
disp('1-2 corresponds to isentropic expansion in turbine')
disp('2-3 corresponds to constant pressure heat rejection in condenser')
disp('3-4 corresponds to isentropic compression in pump')
disp('4-1 corresponds to constant pressure heat addition in boiler')
fprintf('n')


p1 = input('Enter the pressure at the inlet of turbine (bar):');
t1 = input('Enter the temp at the inlet of the turbine (degree C):');
p2 = input('Enter the pressure at the inlet of condensor (bar):');

% At state point 1
h1 = XSteam('h_pT',p1,t1);
s1 = XSteam('s_pT', p1, t1);


%Since 1-2 is isentropic process
s2 = s1;
sf2 = XSteam('sL_p', p2);
sg2 = XSteam('sV_p', p2);
sfg2 = (sg2 - sf2);


%Finding dryness fraction (s2 = sf2 + x2* sfg2)
x2 = (s2 - sf2)/sfg2;
x2<1;
disp('Steam is wet at the inlet of the condenser')
fprintf('n')


%Finding Enthalpy
hf2 = XSteam ('hL_p',p2);
hg2 = XSteam ('hV_p',p2);
hfg2 = hg2 - hf2;
h2 = hf2 + x2*hfg2;
t2 = XSteam('Tsat_p',p2);

%Workdone by Turbine
wt = h1 - h2;


%Workdone by Turbine
wt = h1 - h2;


%For state point 3

%Work done by pump
p3 = p2;
vf3 = XSteam('vL_p',p3);
v3 = vf3;
wp = v3*(p1 - p2)*100;
t3 = XSteam('Tsat_p',p2);
h3 = XSteam('hL_p', p2);
s3 = XSteam('sL_p',p2);
%At point 4
p4 = p1;
h4 = wp + h3;
t4 = XSteam('T_ph',p4, h4);
s4 = s3;


%Heat supplied to boiler 
qs = h1 - h4; 


%Heat Rejected by condenser 
qr = h2 - h3; 


%Work ratios and efficiency of turbine 
w_net = wt - wp; 
net_work_ratio = w_net/wt; 
efficiency = w_net/qs; 


%back work ratio 
back_work_ratio = wp/wt; 


%Specific Steam Consumption 
SSC = 3600/w_net; 
tf_sat = XSteam('Tsat_p',p1); 
sf_sat = XSteam('sL_p',p1); 
hf_sat = XSteam('hL_p',p1); 
sg_sat = XSteam('sV_p',p1); 
hg_sat = XSteam('hV_p',p1);


%Plotting saturation liquid and vapour lines 
temp_range = linspace(1,373,1000);
for i = 1:length(temp_range) 
S_L(i) = XSteam('sL_T',temp_range(i)); 
S_V(i) = XSteam('sV_T', temp_range(i)); 


end 


%Plotting T-S diagram 
figure(1) 
hold on 
plot(S_L,temp_range,'b','LineWidth',2)
plot(S_V,temp_range,'b','LineWidth',2)
plot([s1 s2], [t1 t2],'r','LineWidth',2)
plot([s2 s3], [t2 t3],'g','LineWidth',2)
plot([s3 s4], [t3 t4],'b','LineWidth',2)


%Plotting curved constant pressure line 3 to 4 
t_cons_p = linspace(t4, XSteam('Tsat_p',p1),30); 
for i = 1:length(t_cons_p) 
S(i) = XSteam('s_pt',p1,t_cons_p(i)); 
end 
plot(S,t_cons_p,'k') 
t0_cons_p = linspace(XSteam('Tsat_p',p1),t1,300); 
for i=1:length(t0_cons_p) 
S0(i)=XSteam('s_pt',p1,t0_cons_p(i)); 
end 
plot(S0,t0_cons_p,'k')


%Plotting the straight line of the phase change region 
plot([sf_sat sg_sat], [tf_sat tf_sat], 'k') 
title('T-S diagram') 
xlabel('Entropy kJ/kgK') 
ylabel('Temperature In Degree C') 
axis([0 10 0 700]) 
legend('Saturation Curve L', 'Saturation Curve R', 'Turbine', 'Condenser', 'Pump', 'Boiler', 'Location','Northwest') 


%Plotting H-S diagram 
figure(2) 
hold on 

%Plotting saturation curves 
temp_range1 = linspace(1, 373, 1000); 
for i=1:length(temp_range1) 
H_L1(i) = XSteam('hL_T', temp_range1(i)); 
H_V1(i) = XSteam('hV_T', temp_range1(i));

end 

plot(S_L, H_L1,'b','LineWidth',2) 
plot(S_V, H_V1,'b','LineWidth',2) 
plot([s1 s2], [h1 h2],'r','LineWidth',2) 
plot([s2 s3], [h2 h3],'g','LineWidth',2) 
plot([s3 s4], [h3 h4],'r','LineWidth',2)


%For plotting the line between the pump and boiler 
s_pump = linspace(s3, s1, 1000); 
for i =1:length(s_pump) 
h_pump(i)=XSteam('h_ps',p1,s_pump(i)); 
end 
plot(s_pump, h_pump, 'k') 
title('H-S Diagram') 
xlabel('Entropy kJ/kgK') 
ylabel('Enthalpy kJ/kgK') 
legend('Saturation Curve L','Saturation Curve R','Turbine','Condenser','Pump','Boiler','Location','Northwest') 


%Displaying the value of state point variables at each point
P_final = [p1 p2 p3 p4]; 
T_final = [t1 t2 t3 t4]; 
H_final = [h1 h2 h3 h4]; 
S_final = [s1 s2 s3 s4]; 
for i=1:4 
fprintf('At state point %d n', i) 
fprintf('Pressure p%d : %4.4f (bar) n',i,P_final(i)) 
fprintf('Temperature t%d : %4.4f (degree C) n',i,T_final(i)) 
fprintf('Enthalpy h%d : %4.4f (kJ/kgK) n',i,H_final(i)) 
fprintf('Entropy s%d : %4.4f (kJ/kg) n',i,S_final(i)) 
fprintf('n') 
end 


fprintf('The net work ratio is: %f n', net_work_ratio) 
fprintf('The back work ratio is: %f n', back_work_ratio) 
fprintf('The entered values are not valid as the steam is either Saturated or Super-saturated at the inlet of the condenser n') 
fprintf('Enter the valid values by running the program again n') 
return;

Comand window output:-

>> rankine_cycle
Rankine Cycle Simulator
1-2 corresponds to isentropic expansion in turbine
2-3 corresponds to constant pressure heat rejection in condenser
3-4 corresponds to isentropic compression in pump
4-1 corresponds to constant pressure heat addition in boiler
nEnter the pressure at the inlet of turbine (bar):30
Enter the temp at the inlet of the turbine (degree C):400
Enter the pressure at the inlet of condensor (bar):0.05
Steam is wet at the inlet of the condenser
nAt state point 1 nPressure p1 : 30.0000 (bar) nTemperature t1 : 400.0000 (degree C) nEnthalpy h1 : 3231.5710 (kJ/kgK) nEntropy s1 : 6.9233 (kJ/kg) nnAt state point 2 nPressure p2 : 0.0500 (bar) nTemperature t2 : 32.8755 (degree C) nEnthalpy h2 : 2110.7082 (kJ/kgK) nEntropy s2 : 6.9233 (kJ/kg) nnAt state point 3 nPressure p3 : 0.0500 (bar) nTemperature t3 : 32.8755 (degree C) nEnthalpy h3 : 137.7651 (kJ/kgK) nEntropy s3 : 0.4763 (kJ/kg) nnAt state point 4 nPressure p4 : 30.0000 (bar) nTemperature t4 : 32.9639 (degree C) nEnthalpy h4 : 140.7761 (kJ/kgK) nEntropy s4 : 0.4763 (kJ/kg) nnThe net work ratio is: 0.997314 nThe back work ratio is: 0.002686 nThe entered values are not valid as the steam is either Saturated or Super-saturated at the inlet of the condenser nEnter the valid values by running the program again n>> 

Output:-

  • T-S diagram

  • H-S Diagram:-

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.