Matlab Simulation Of Ideal Rankine Cycle
PROJECT OBJECTIVE
This project is intended to model an ideal Rankine cycle. The project aims are as follows.
- Give basic thermodynamic principles of the Rankine cycle.
- Give a basic understanding of vapour power systems.
- Calculate the parameters involved in the Rankine cycle.
- Use Matlab to solve Rankine cycle parameters.
- Calculate the thermal efficiency of an ideal Rankine cycle
REQUIRED THERMODYNAMICS PRINCIPLES TO SOLVE THE IDEAL RANKINE CYCLE
In order for one to solve the Rankine cycle, one has to have an understanding of the following thermodynamics principles.
- The first law of thermodynamics
- The second law of thermodynamics
- Basic understanding of Enthalpy
- Basic understanding of Entropy
The first law of thermodynamics
The first law of thermodynamics states that energy can't be created nor destroyed only changed from one form to another. For the Rankine cycle heat energy is transformed into electrical energy, by a turbine.
The second law of thermodynamics
The second law of thermodynamics introduces entropy, which is the disorder of a system. The entropy of the universe is always increasing. The second law is used to predict or calculate the flow of energy. It's noted that for a system there is a tendency towards higher entropy. The second law is very important for one to understand the Rankine cycle since one needs to know the flow of energy in the system.
Basic understanding of enthalpy
Enthalpy is the sum of the internal energy and the product of the pressure and volume of a thermodynamics system. Enthalpy has the dimensions of energy hence measured in joules. Its value is determined by temperature, pressure and the composition of the system.
Entropy
Is the measure of a systems thermal energy per unit temperature that is unavailable for doing useful work. Amount of entropy is a measure of the molecular disorder or randomness of a system.
RANKINE CYCLE THEORY
The Rankine cycle is a mathematical model of subprocess A, in a vapour power system.
The Rankine cycle is shown below.
Turbine
Vapour from the boiler enters the turbine. It expands through the turbine to produce work. This can be expressed using the following equation.
`w_t=h_1-h_2` :Where
`w_t` : is work done per unit mass
`h_1` : is the enthalpy at state 1
`h_2` :is the enthalpy at state 2
Condensor
In the condenser, heat is transferred from the working fluid hence lowering its enthalpy. This is since a pump can only pump liquids. This can be expressed using the following equation.
`q_(out)=h_2-h_3` :Where
`q_(out)` is the heat transferred from the working fluid to the cooling water per unit mass.
`h_2` is the enthalpy at state 2
`h_3` is the enthalpy st state 3
Pump
Pumps the condensed working fluid through the system. The pump in a vapour power system is used to depict the higher pressure the fluid will flow through the system. The pump pumps the low-pressure liquid to the boiler. This can be expressed using the following equation.
`w_p=h_1-h_3` :where.
`w_p` is work done by pump per unit mass
`h_1` is the enthalpy at state 1
`h_4` is the enthalpy at state 4
Ideal Rankine cycle
assumptions
- There is no heat transfer to the surroundings.
- There is no frictional pressure drops from the components. That is: boiler, turbine, pump and condenser
The ideal Rankine cycle has the following processes
Process 1-2: Isentropic expansion of the working through the turbine. Hence entropy at state 1 is equal to entropy at state 2
process 2-3:Heat transfer from the working fluid at constant pressure. Hence pressure at state 2 is equal to the pressure at state 3
process 3-4: Isentropic compression of the working fluid by the pump. Hence entropy at state 3 is equal to entropy at state 4.
process 4-1: Heat transfer to the working fluid at constant pressure. Hence pressure at state 4 is equal to the pressure at state 1.
Thermal efficiency
The thermal efficiency can be expressed using the following formulae.
`n=(w_t-w_p)/(q_(i n))=((h_1-h_2)-(h_4-h_3))/(h_1-h_4)` This can also be expressed as.
`n=1-((h_2-h_3)/(h_1-h_4))`
From the second formulae, it's easy to see that efficiency is directly proportional to the boiler temperature.
Back work ratio
Back work ratio (bwr) is the ratio of pimp work input to work developed by the turbine.
`bwr=w_p/w_t=(h_4-h_3)/(h_1-h_2)`
MATLAB FUNCTIONS AND LIBRARIES
- The XSteam library is used which gives access to steam properties for different parameters.
- Linspace Matlab function is used to generate equal spaces numbers as an array
- plot function is used to plot the required graphs
USER-DEFINED FUNCTION
The following are the user-defined functions.
- Rankine_State_1(). A function used to calculate the enthalpy and entropy at state 1. Inputs are pressure and temperature. Outputs are enthalpy and entropy at state 1
- Rankine_State_2(). A function used to calculate the enthalpy and entropy at state 2. Inputs are entropy and temperature. Outputs are enthalpy and entropy at state 2
- Rankine_State_3(). A function used to calculate the enthalpy and entropy at state 3. Inputs are pressure. Outputs are enthalpy and entropy at state 3.
- Rankine_State_4(). A function used to calculate the enthalpy and entropy at state 4. Inputs are pressure 1 and pressure 2 and enthalpy at state 3. The output is the enthalpy at state 4
MATLAB CODE
Their are two programs the first one calculates the parameters of the Rankine cycle and plots the t-s diagram and h-s diagram of the cycle.
The second program calculates the efficiency and plots a graph of the temperature of the boiler vs efficiency.
Program 1
clear all
close all
clc
%All Our Inputs
%Start and end temparature
start_temp=0
end_temp=374
%Pressure in Bars
p1_in=30
p2_in=0.05
%Temprature in degrees
t1_in=400
%State 1 calculation this is at entrance of turbine from boiler
state1=rankine_state_1(p1_in,t1_in)
%Entlapy and entropy at point 1
h1=state1(1)
s1=state1(2)
p1=p1_in
t1=t1_in
%State 2 calculation this is after the steam leaves the boiler and enters
%the condenser
state2=rankine_state_2(s1,p2_in)
%Entlapy ,entropy and temparature at point 2
h2=state2(1)
s2=state2(2)
p2=p2_in
t2=XSteam('T_hs',h2,s2)
%State 3 calculation this is after the steam leaves the condeser and enters
%the pump
state3=rankine_state_3(p2)
%Entlapy,entropy and temparature at point 3
h3=state3(1)
s3=state3(2)
p3=p2
t3=XSteam('T_hs',h3,s3)
%State 4 calculation this is after the steam leaves the pump and enters the
%boiler
%Entlapy,entropy and temparature at point 4
h4=rankine_state_4(p1,p2,h3)
s4=s3
p4=p1
t4=XSteam('T_hs',h4,s4)
%State a enthlapy and temp at (a)
n = linspace(t3,t1,500)
%Saturation Curve
t = linspace(0,374,400)
s3_s4=[]
for i = 1:length(n)
tmp=XSteam('s_pT',p1,n(i))
s3_s4=[s3_s4 tmp]
end
% Saturation curve
sat_curve_h=[]
sat_curve_t=[]
for i = 1:length(t)
tmp1=XSteam('sL_T',t(i))
tmp2=XSteam('sV_T',t(i))
sat_curve_h=[sat_curve_h tmp1]
sat_curve_t=[sat_curve_t tmp2]
end
%Plotting the values
figure(1)
%Ploting state 1 points
plot(s1,t1,'marker','x')
hold on
%Ploting state 2 points
plot(s2,t2,'marker','x')
%Ploting state 3 points
plot(s3,t3,'marker','x')
%Ploting state 4 points
plot(s4,t4,'marker','x')
%Ploting state 1 to 2
plot([s1 s2],[t1 t2],'marker','x','color','black')
%Ploting state 2 to 3
plot([s2 s3],[t2 t3],'marker','x','color','black')
%Ploting state 3 to 4
plot([s3 s4],[t3 t4],'marker','x','color','black')
%Plot the t s of water in liquid
plot(sat_curve_h,t,'marker','.','color','r')
%Plot the t s of water in Vapour
plot(sat_curve_t,t,'marker','.','color','r')
plot(s3_s4,n,'color','b')
title('Plot Of Entropy Vs Temprature Of An Ideal Rankine Cycle')
grid on
grid minor
xlabel('Entropy')
ylabel('Temprature in degrees celsius')
hold off
%Calculating values to plot h-s Graph From state 1 to 4
S_L=[]
S_V=[]
H_L=[]
H_V=[]
for i = 1:length(t)
tmp1=XSteam('sL_T',t(i))
tmp2=XSteam('sV_T',t(i))
tmp3=XSteam('hL_T',t(i))
tmp4=XSteam('hV_T',t(i))
S_L=[S_L tmp1]
S_V=[S_V tmp2]
H_L=[H_L tmp3]
H_V=[H_V tmp4]
end
figure(2)
%Ploting HS Graph
plot([s1 s2 s3 s4 s1],[h1 h2 h3 h4 h1],'linewidth',1,'color','g')
hold on
plot(S_L,H_L,'marker','.','color','r')
plot(S_V,H_V,'marker','.','color','r')
title('Plot Of Entropy Vs Enthlapy Of An Ideal Rankine Cycle')
grid on
grid minor
xlabel('Entropy')
ylabel('Enthlapy')
hold off
Function 1 for state 1 code
function[state_1_prop]=rankine_state_1(p1,t1)
h1=XSteam('h_pT',p1,t1)
s1=XSteam('s_pT',p1,t1)
state_1_prop=[h1 s1]
end
Function 2 for state 2 code
function[state_2_prop]=rankine_state_2(s1,p)
s2=s1
sf=XSteam('sL_p',p)
sg=XSteam('sV_p',p)
hf=XSteam('hL_p',p)
hg=XSteam('hV_p',p)
x=(s2-sf)/(sg-sf)
h2=hf+(x*(hg-hf))
state_2_prop=[]
state_2_prop=[h2 s2]
end
Function 3 for state 3 code
function[state_3_prop]=rankine_state_3(p)
h3=XSteam('hL_p',p)
s3=XSteam('sL_p',p)
state_3_prop=[h3 s3]
end
Function 4 for state 4 code
function[state_4_prop]=rankine_state_4(pb,pc,h3)
v4=XSteam('vL_p',pc)*1000
pb=pb/10
pc=pc/10
h4=h3+(v4*(pb-pc))
state_4_prop=h4
end
Program 1 plot 1
Program 1 plot 2
Program 2 Code
%Program to plot Eficiency of the rankine cycle vs boiler temp
t1=linspace(200,550,400)
p1=30
p2=0.05
%Thermal Eficiency
eff=[]
for j=1:length(t1)
state1=rankine_state_1(p1,t1(j))
h1=state1(1)
s1=state1(2)
state2=rankine_state_2(s1,p2)
h2=state2(1)
s2=state2(2)
t2=XSteam('T_hs',h2,s2)
state3=rankine_state_3(p2)
h3=state3(1)
s3=state3(2)
p3=p2
t3=XSteam('T_hs',h3,s3)
h4=rankine_state_4(p1,p2,h3)
s4=s3
p4=p1
t4=XSteam('T_hs',h4,s4)
n=((h1-h2)-(h4-h3))/(h1-h4)
n=n*100
eff=[eff n]
end
figure(2)
plot(t1,eff)
title('Plot Of Teprature Vs Eficiency Of An Ideal Rankine Cycle')
grid on
grid minor
xlabel('Temprature in degrees celsius')
ylabel('Eficency %')
Program 2 plot 1
Program 1 values
State 1
p1= 30 bar
t1=400
s1=6.9233
h1=3231.6
State 2
p2=0.05 bar
t2=32.8755
s2=6.9233
h2=2110.7
State 3
p3= 0.05 bar
t3=32.8956
s3=0.4763
h3=137.7651
State 4
p4= 30 bar
t4=32.9634
s4=0.4763
h4=140.7761
program values
bwr=0.27 %
Thermal Eficiency=-36.167 %
PROGRAM 2 EXPLANATION
The second Matlab program plots the efficiency of the Rankine cycle against boiler temperature. Increase in boiler temperature (the temperature at state 4 leads to an increase in efficiency as shown in the plot)
CONCLUSION
The modelling of an ideal Rankine cycle is very important in understanding vapour power systems. The thermal efficiency of the cycle is low. Hence power plants adopt different models of the Rankine cycle such as superheating the steam and reheating the steam to increase efficiency. From the second program, it is possible to increase the efficiency of the cycle by increasing the boiler temperature. The efficiency gain is very low considering the cost of specialised materials to handle the high pressure and temperature.