Challenge

Project 2 - Rankine cycle Simulator

Aim -

Creation of Rankine cycle simulator from given input and reading the data from standard thermodynamic library of steam table.

Objective -

1. To create a Rankine Cycle simulator in MATLAB.
2. To calculate the state point using function XSteam.
3. To plot the T-S and H-S curve for given input in Rankine Cycle.
4. To get output in the command window for each state point in cycle.

Description:

The Rankine cycle is one of the vapor powered cycle. This cycle is somewhat different than gas powered cycle in which working fluid remained gas throughout the entire cycle. In vapor powered cycle the working fluid is steam because of its many desirable characteristics such as low cost of production, availability and high enthalpy of vaporization. There are many impracticalities associated with Carnot cycle which can be eliminated by superheating the steam and condense in condenser which makes it best for nuclear power plants and other steam related power generation sources.

The process in Rankine cycle are given as:

1. Isentropic Compression in Pump.
2. Constant pressure heat addition in boiler.
3. Isentropic expansion in a turbine.
4. Constant pressure heat rejection in condenser.


Water enters the pump at state 1 as saturated liquid and is compressed isentropically to the operating pressure of the boiler. The water temperature increases somewhat during this isentropic compression process due to a slight decrease in the specific volume of water. The vertical distance between states 1 and 2 on the T-s diagram is greatly exaggerated for clarity.

Water enters the boiler as a compressed liquid at state 2 and leaves as a superheated vapor at state 3. The boiler is basically a large heat exchanger where the heat originating from combustion gases, nuclear reactors, or other sources is transferred to the water essentially at constant pressure. The boiler, together with the section where the steam is superheated (the superheater), is often called the steam generator.

The superheated vapor at state 3 enters the turbine, where it expands isentropically and produces work by rotating the shaft
connected to an electric generator. The pressure and the temperature of steam drop during this process to the values at state 4, where steam enters the condenser. At this state, steam is usually a saturated liquid–vapor mixture with a high quality. Steam is condensed at constant pressure in the condenser, which is basically a large heat exchanger, by rejecting heat to a cooling medium such as a lake, a river, or the atmosphere. Steam leaves the condenser as saturated liquid and enters the pump, completing the cycle. In areas where water is precious, the power plants are cooled by air instead of water. This method of cooling, which is also used in car engines, is called dry cooling.


Remembering that the area under the process curve on a T-s diagram represents the heat transfer for internally reversible processes, we see that the area under process curve 2-3 represents the heat transferred to the water in the boiler and the area under the process curve 4-1 represents the heat rejected in the condenser. The difference between these two is the net work produced during the cycle.
All the four components of Rankine cycle are steady flow devices hence the process regarding this device can be evaluated as
steady state process. The steady state flow energy equation per unit mass of steam reduces to:

(qIn − qout) + (WIn − Wout) = he − hi

The boiler and condenser are not involved in any mechanical work whereas pump and turbine are assumed to isentropic in nature while working throughout the cycle, then conservation of energy relation for each device can be expressed as:

Wpump = h2 − h1

Where,

h1 = hf at P1 and v1 = vf at P1

The heat added in boiler can be given as:

qIn = h3 − h2

The work which can be taken out of cycle from turbine is given as:

Wout = h3 − h4

The heat removed from the condenser is given as:

qout = h4 − h1

The thermal efficiency of Rankine cycle is given as:

ηth = = WNet/qIn = qout/qIn

where,

WNet = qIn − qout = Wturb − Wpump

Code Explanation:

1. The creation of Rankine cycle simulator starts with some input value which are required to calculate the other state point in
cycle eventually.

2. The Rankine cycle process is displayed in the command window and then inputs are entered which are inlet pressure for
turbine, temperature at turbine inlet and pressure at condenser.

3. Then we are using XSteam function file for reading state point. First, we get the value of enthalpy and entropy at state point 1 from the XSteam function file.

4. As process from 1-2 is isentropic compression the entropy at point 1 is equal to point 2. The term ‘(s_pT, p1, T1)’ refers to entropy at pressure and temperature point 1.

5. The term ‘sg’ and ‘sf’ are referred to saturated liquid and saturated vapor entropy respectively. This value is used to calculate other function according to mathematical relations.

6. Similarly, other points are taken from XSteam function file which are necessary to calculate other parameters. After that work done in turbine and pump are calculated for further getting the net work done Rankine cycle.

7. After calculating the net work done the efficiency of the Rankine cycle is calculated along with specific steam consumption
which is steam consumed by a locomotive cylinders per unit of output of work done.

8. Then temperature at each point of cycle is calculated using input taken from start of the program and data taken from XSteam file. For given temperature range from lower to higher entropy points are calculated to create the T-S plot. Similarly, another for loop is used to create the saturation curve in each plot.

9. Then plotting is done respectively for T-s and H-s graph in Rankine cycle and each state point value has been put in command window.

THE CODE FOR RANKINE CYCLE SIMULATOR IS GIVEN AS -

clear 
close all
clc

% Challenge 10 - RANKINE CYCLE

disp('Rankine cycle');
disp('1-2 is isentropic expansion in turbine');
disp('2-3 is constant pressure heat removal in condenser');
disp('3-4 is isentropic compression in pump');
disp('4-1 is constant pressure heat addition in boiler');

% Inputs to be given
p1 = input('P1(in bar):');
t1 = input('T1(in celsius):');
p2 = input('P2(in bar):');

% Extracting Data
% State 1
h1 = XSteam('h_pT',p1,t1);
s1 = XSteam('s_pT',p1,t1);

% State 2 
s2 = s1;
sf2 = XSteam('sL_p',p2);
sg2 = XSteam('sV_p',p2);
x2 = (s2-sf2)/(sg2-sf2);
hf2 = XSteam('hl_p',p2);
hg2 = XSteam('hV_p',p2);
h2 = hf2 + (x2*(hg2-hf2));

% State 3
p3 = p2;
s3 = XSteam('sL_p',p3);
h3 = XSteam('hL_p',p3);

% State 4
s4 = s3;
p4 = p1;

% Turbine Work 
W_T = h1-h2;
v3 = XSteam('vL_p',p3);

% Pump Work 
W_P = v3*(p4-p3)*100;
h4 = h3+W_P;

% Net Work 
W_net = W_T-W_P;
Q_in = h1-h4;
Q_out = h2-h3;
 
% Thermal Efficency
Thermal_eff = (W_net/Q_in)*100;

% Specific Steam consumption 
Sp_steam_consumption = (3600/W_net);

% Temperature at state points 
t3 = XSteam('Tsat_p',p3);
t2 = t3;
Cp4 = XSteam('Cp_ps',p4,s4);
Cv4 = XSteam('Cv_ps',p4,s4);
k = Cp4/Cv4;
t4 = t3/((p3/p4)^((k-1)/k));

% Temperature, entropy and enthalpy at the vapour and liquid line for 
% plotting 

t6 = XSteam('Tsat_p',p1);
s5 = XSteam('sL_p',p1);
s6 = XSteam('sV_p',p1);
h5 = XSteam('hL_p',p1);
h6 = XSteam('hV_p',p1);
t5 = t6;

% Plotting the saturation curve 
t = linspace(1,375,1000);
for i = 1: length(t)
    sf(i) = XSteam('sL_t',t(i));
    sg(i) = XSteam('sV_t',t(i));
    hf(i) = XSteam('hL_t',t(i));
    hg(i) = XSteam('hV_t',t(i));
end

% T-S Diagram 
figure(1)
grid on 
hold on 
plot(sf,t,'r','LineWidth',2)
plot(sg,t,'r','LineWidth',2)
plot([s1 s2],[t1 t2],'k','LineWidth',2)
plot([s2 s3],[t2 t3],'k','LineWidth',2)
plot([s3 s4],[t3 t4],'k','LineWidth',2)
plot([s4 s5],[t4 t5],'k','LineWidth',2)
plot([s5 s6],[t5 t6],'k','LineWidth',2)
s_c1 = linspace(s6,s1,1000);

for l = 1:length(s_c1);
    t_c1(l) = XSteam('t_ps',p1,s_c1(l));
end
plot(s_c1,t_c1,'k','linewidth',2)
% text(s1+0.1,t1,'1')
% text(s2+0.1,t2,'2')
% text(s3,t3-20,'3')
% text(s4,t4+20,'4')
text(s1,t1,'1')
text(s2,t2,'2')
text(s3,t3+0.1,'3')
text(s4,t4-0.1,'4')
title('Temperrature vs Entropy')
xlabel('Entropy S(KJ/kg.k)')
ylabel('Temperature T(degree C)')
legend('Saturation Curve','location','northwest')

% H-S Diagram
figure(2)
grid on 
hold on
plot(sf,hf,'g','linewidth',2)
plot(sg,hg,'g','linewidth',2)
plot([s1 s2],[h1 h2],'k','LineWidth',2)
plot([s2 s3],[h2 h3],'k','LineWidth',2)
plot([s3 s4],[h3 h4],'k','LineWidth',2)
plot([s4 s5],[h4 h5],'k','linewidth',2)
h_c = linspace(h4,h5,200);

for k = 1:length(h_c)
    sch(k) = XSteam('h_ps',p1,h_c(k));
end
plot(sch,h_c,'k','linewidth',2)

for m = 1:length(s_c1)
h_c1(m) = XSteam('h_ps',p1,s_c1(m));
end
plot(s_c1,h_c1,'k','linewidth',2)
% text(s1+0.1,h1,'1')
% text(s2+0.1,h2,'2')
% text(s3,h3-100,'3')
% text(s4,h4+200,'4')
text(s1,h1,'1')
text(s2,h2,'2')
text(s3,h3,'3')
text(s4,h4,'4')
title('Enthalpy vs Entropy')
xlabel('Entropy S(KJ/kg.k)')
ylabel('Enthalpy H(KJ/kg)')
legend('Saturation Curve','location','northwest')

% Displaying Results
disp('RESULTS')
fprintf('At state point 1:\n');
fprintf('P1: %8.3f bar\n',p1);
fprintf('T1:  %8.3f C\n',t1);
fprintf('H1:  %8.3f KJ/Kg\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\n',h2);
fprintf('S2:  %8.3f KJ/Kg.k\n',s2);
fprintf('x2: %8.3f\n',x2);
fprintf('At state point 3:\n');
fprintf('P3: %8.3f bar\n',p3);
fprintf('T3:  %8.3f C\n',t3);
fprintf('H3:  %8.3f KJ/Kg\n',h3);
fprintf('S3:  %8.3f KJ/Kg.k\n',s3);
fprintf('At state point 4:\n');
fprintf('P4: %8.3f bar\n',p4);
fprintf('T4:  %8.3f C\n',t4);
fprintf('H4:  %8.3f KJ/Kg\n',h4);
fprintf('S4:  %8.3f KJ/Kg.k\n',s4);
fprintf('Turbine work:  %8.3f KJ/Kg.k\n',W_T);
fprintf('pump work:  %8.3f KJ/Kg.k\n',W_P);
fprintf('Net. work done:  %8.3f KJ/Kg.k\n',W_net);
fprintf('Thermal Efficiency:  %8.3f percent\n', Thermal_eff);
fprintf('Specific Steam Consumption:  %8.3f kJ/Kwh', Sp_steam_consumption);

RESULT:

The Rankine cycle plots have generated by calculating the state points, efficiency and the output is printed in the command window.

Figure(1) OutPut shown in the command window for rankine cycle for given inputs

PLOTS -

T-S Diagram of actual rankine cycle

Figure(2) Temperature vs Entropy curve for rankine cycle above inputs

H-S Diagram of actual rankine cycle

Figure(3) Enthalpy vs Entropy curve for rankine cycle above inputs

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.