Challenge

Project 2 - Rankine cycle Simulator

AIM:
To create a Rankine cycle simulator by using MATLAB.
OBJECTIVE:
•	Calculate each state points of the Rankine cycle ( any type of your choice ) based on user inputs.
•	Plot the corresponding T-S and h-s plots for the given set of inputs.
•	Calculate the efficiency.
THEORY:
The Rankine cycle is an idealized thermodynamic cycle of a heat engine that converts heat into mechanical work while undergoing a 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.

Four Components of the Rankine Cycle:
1.	pump
2.	Boiler
3.	Turbine
4.	Condenser

•	Four processes of the Rankine Cycle:
1-2:Isentropic Expansion
   Turbine (1-2): Superheated steam enters into the turbine and expands isentropically resulting in the production of work . The shaft of the turbine is connected to the generator . This results in the production of electricity i.e Mechanical energy gets converted into electric energy . Work produced by the turbine,
    WT = m(h1-h2)K

2-3: Constant Pressure Heat heat Rejection:
Condenser (2-3): The expanded vapour is then passed through a condenser .  where it gets condensed and converts into liquid again. This liquid is again pumped to the boiler.
QT = m(h2-h3)K

3-4 Isentropic Compression by the Pump 
Pump(3-4) : The water enters into the pump in a saturated state . Then the liquid is compressed isentropically until it meets the boiler pressure . Word done by the pump is 
Wp = m(h1-h4)
4-1 Constant pressure Heat addition:
Boiler(4-1) : The water enters into the boiler as compressed and leaves as superheated from the boiler . Thus the phase changes from liquid to vapour . 
Qb = m(h1-h4)K
•	The efficiency of the Steam cycle is given by

     Efficiency = Wn/Q1 = Wt-Wp/Q1
•	Applying the steady flow energy Equation ( SFEE) to all the process , neglecting the friction losses and changes  potential 
                    Q1 = h1-h4@Boiler
                   Wt = h1-h2@Turbine
                   Q2 = h2-h3 @Condensor
                   Wp =  h4-h3@pump
•	The capacity of the steam plant is often expressed interms of Steam Rate (SR) or(SSC)

EXPLANATION OF CODE:
•	The program begins with clear all ,close all , clc to erase the workspace amd plots.
•	Input variables p1,T1,p2 are given by input command whose values are entered in command window while executing the program
•	@state-1 , Values for Enthalpy & Entropy are extracted as a function of Pressure & Temperature .
•	H_pT,s_pT,hL_p,sV_P etc … are the default variables whose value is stored in XSteam file.
•	Similarly ,all the variables for all states are extracted using a suitable format .
•	Pressure, Temperature , Enthalpy , Entropy for all the state variables are extracted as a function of the dependent  variable from the XSteam file.
•	@State – 2:is a condenser inlet where the high -pressure steam is converted into low-pressure water and hence Dryness fraction , Enthalpy & Entropy for saturated vapour & saturated water are considered to calculate the specific Enthalpy.
•	@State -3: The water is condensed back to its saturation temperature and fed to the pump , This temperature of water at the exit of the condenser and entry of pump is the same.
•	@State-4: This is constant pressure Heat Addition ,  hence pressure is equal to p1, but the temperature increases on heating at constant pressure & constant volume as our Entropy remains same and hence Cp/Cv = gamma is considered to find temperature T4.
•	Fprintf command is used to display the results of a rankine cycle in command window.




MAIN CODE FOR RANKINE CYCLE SIMULATION:
clear all
close all
clc

% Print Process Description
fprintf('1-2 Isentropic compression in the turbine\n')
fprintf('2-3 Constant heat rejection by the condenser \n')
fprintf('3-4 Isentropic compression in the pump\n')
fprintf('4-1 Constant pressure heat addition by the boiler\n')

% step 1:Enter inputs
p1 = input('Enter the pressure at the turbine inlet(in bar):');
T1 = input('Enter the Temperature at the Turbineinlet(in degree celsius):');
p2 = input('Enter the pressure at the condensor(in bar):');

%step 2: Calculate each state point values
%state point 1
h1 = XSteam('h_pt',p1,T1);
s1 = XSteam('s_pt',p1,T1);

%step 3: 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);

%step 4:State point 3
T3 = T2;
p3 = p2;
s3 = XSteam('sl_T',T3);
h3 = XSteam('hl_T',T3);
v3 = XSteam('vL_p',p2);

%step 5: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;

%step6: Calculate other output values
Wt = h1-h2;
Wp = v3*(p1-p2)*100;
h4 = Wp + h3;
W_net = Wt - Wp;
Qs = h1 - h4;
N_per = (W_net/Qs)*100;
steam_rate = 3600/(Wt-Wp);

%step 7:state point 5 and 6 which help in plotting
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);

%step 8: print all state point values to show
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:\nP2 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:\nP3 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:\nP4 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\nWp is : %4.2f kJ/kg\nWnet is : %4.2f kJ/kg\nWnet is : %4.2f kJ/kg\nNtherm is :  %4.2f percent\nS.S.C is :%4.2f kg/kWh',Wt,Wp,W_net,N_per,steam_rate);

%step 9:plot T-S Diagram
subplot(2,1,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('hV_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);
xlabel('Entropy in kJ/kgk');
ylabel('Temperature in degree celcius');
hold off

%step 10:plot H-S diagram
subplot(2,1,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');
xlabel('Entropy in kJ/kgk');
ylabel('Enthalpy in kJ/kgk');
hold off
 

CONCLUSION:
The simulation of the Rankine cycle is calculated by using MATLAB.
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.