Creation of a Rankine Cycle Simulator using MATLAB programming
Aim:- To create a Rankine cycle simulator by MATLAB programming
Governing equations:- Equations those play main role:
W_T=m(h1-h2)K
Q_r=m(h2-h3)K
W_p=m(h3-h4)K
Q_b=m(h1-h4)K
where W=Work produced
Q=Heat required
m=mass flow rate
The efficiency of the steam cycle, eta=W-n/Q1=(W_T-W_p)/Q1
Specific steam consumption (S.S.C)=3600/W_n kg/kwh
Objectives:- The main objective of this project is to calculate each and every state point of the Rankine cycle based on user input requirement and plot graph and calculate efficiency.
Brief theory:-
Rankine cycle:- Basically Rankine cycle is nothing but a thermodynamic cycle that converts heat into mechanical energy. It is a model that predicts steam turbine system performance. It is an ideal cycle.
Turbine:- It's a machine that provides continuous power in the power plants industry and for example, it allows to run the diary machine also.
Condenser:- It's a device that condenses gaseous substance into the liquid state.
Boiler:- It is a vessel closed in which fluid heats steam is produced in it used for various purposes like drawing humidification etc.
Processes of Rankine cycle:
1- 2 isentropic expansion
2-3 constant pressure heat reaction
3-4 isentropic compression by the pump
4-1 constant pressure and heat addition
Workflow:-
(i) Four process names are printed.
(ii) Four state points at followed and necessary formulas are written.
(iii) Output values are calculated.
(iv) All state point values are printed.
(v) Necessary plots are printed.
Brief content of this project:-
This project has been done by MATLAB programming. The code for the program is attached below.
%creation of Rankine cycle simulator by MATLAB programming
clear all
close all
clc
% Printing all Process names
fprintf('1-2 Isobaric heat Transfer\n')
fprintf('2-3 Isentropic Expansion\n')
fprintf('3-4 Isobaric heat Rejection\n')
fprintf('4-1 Isentropic Compression\n')
%entering inputs
p1 = input('Enter the Pressure at the Turbine Inlet (in bar):');
T1 = input('Enter the Temperature at the Turbineinlet (in Degree Celcius):');
p2 = input('Enter the Pressure at the Condensor (in bar):');
%Calculating state point values
% taking state point 1
h1 = XSteam('h_pt',p1,T1);
s1 = XSteam('s_pt',p1,T1);
%takingstate point 2
s2=s1;
sf2 = XSteam('sL_p',p2);
sg2 = XSteam('sV_p',p2);
hf2 = XSteam('hL_p',p2);
hg2 = XSteam('hV_p',p2); %x2 = (s2-sf2)/(sg2-sf2);
s2 = sg2;
h2 = hg2; %hf2 +(x2*(hg2-hf2));
T2=XSteam('T_hs',h2,s2);
%taking state point 3
T3=T2;
p3= p2;
s3=XSteam('sL_T',T3);
h3=XSteam('hL_T',T3);
v3 = XSteam('vL_p',p2);
%taking 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;
%Calculating outputs
% Turbine Work
Wt = h1-h2;
% Pump Work
Wp = v3*(p1-p2)*100;
h4 = Wp + h3;
% Net Work unit ( kj/kg)
W_net = Wt-Wp;
%heat supplied
Qs = h1 - h4;
%efficiency
N_per = (W_net/Qs)*100;
steam_rate = 3600/(Wt - Wp);
%taking state point 5 and 6
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);
% printing all state point values
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\nNtherm is : %4.2f percent\nS.S.C is : %4.2f kg/kWh',Wt,Wp,W_net,N_per,steam_rate)
%plotting the T-S Diagram
subplot(1,2,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');
%plotting H-S diagram
subplot(1,2,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')
%taking axis
xlabel('Entropy in kJ/KgK')
ylabel('Enthalpy in kJ/kg')
Algorithm of the program:-
Firstly the screen is cleared
(i) Using input comment input variables are put (ii)At State 1 extraction of values of enthalpy and entropy are completed as a function of pressure and temperature. (iii) Using X Stream command values of different variables are stored.
(iv) At state 2 and 3 and 4 similarly, the extreme command is used.
(v) The calculation for turbine pump work, efficiency using governing formulas are done.
(vi) Similar steps are followed at State 5,6.
(vii) Using fprint command outputs are printed.
(viii) Plotting of H-S, T-S diagram is done.
(ix) When plotting for loop is used X label Y label command is used to print x axis y axis purpose using font size, color command colors and font size are fixed as per requirement.
Results:-
Plots:-
Conclusion:- Through this whole project we have learned about the Rankine cycle and how to compute it to run automatically, calculating efficiency. This project is very helpful for various industrial work like power plants etc.