Project 2 - Rankine cycle Simulator
AIM:-To create a Rankine Cycle simulator by using MATLAB.
MATLAB CODE:-
clear all
close all
clc
fprintf('%75s \n\n Desktop','RANKINNE CYCLE SIMULATOR')
fprintf('1-2 is Isentropic Expression in Turbine \n')
fprintf('2-3 is Isentropic Expression in Turbine \n')
fprintf('3-4 is Isentropic Expression in Turbine \n')
fprintf('4-1 is Isentropic Expression in Turbine \n')
% Computing Results
P1 =input('inlet pressure')
T1 =input('inlet pressure')
P2 =input('inlet pressure')
fprintf('\n %65s','RESULTS')
% Calculating Required Values at all points
% At State Point 1
S1 = XSteam ('s_pT',P1,T1);
H1 = XSteam ('h_pT',P1,T1);
% At State Point 2
S2 = S1;
sf2 = XSteam ('sL_p',P2);
sg2 = XSteam ('sV_p',P2);
hf2 = XSteam ('hL_p',P2);
hg2 = XSteam ('hL_p',P2);
T2 = XSteam ('Tsat_p',P2);
x2 = ((S2-sf2)/(sg2-sf2));
H2 = hf2+(x2*(hg2-hf2));
% At State Point 3
P3 = P2;
T3 = XSteam ('Tsat_p',P3);
S3 = XSteam ('sL_p',P3);
H3 = XSteam ('hL_p',P3);
% To Calculate Gamma
cp = XSteam ('cpL_p',P3);
cv = XSteam ('cvL_p',P3);
gamma = (cp/cv);
% At State Point 4
P4 = P1;
S4 = S3;
H4 = XSteam ('h_ps',P4,S4);
T4 = T3*((P4/P3)^((gamma-1)/gamma))
% calculating work done
wt = H1-H2;
Wp = H4-H3;
W_net = Wt-Wp;
q_in = H1-H4;
Q_out = H2-H3;
n = W_net/q_in;
n_percent = n*100;
SSC = 3600/W_net;
BWR = q_in/q_out;
% At State Points 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);
% Plotting The Required Graphs
% T-S Graph
figure(1)
T_Zone1 = linspace(T5,T1,500);
for i = 1:length(T_Zone1)
S(i) = XSteam ('s_pt',P1,T_Zone1(i));
end
hold on
plot([S1 S2 S3 S4 S5 S6 S],[T1 T2 T3 T4 T5 T6 T_Zone1],'LineWidth',3,'Color','K')
axis([0 10 0 430])
text(S1,T1,'1','FontSize',15)
text(S2,T2,'2','FontSize',15)
text(S3,T3,'3','FontSize',15,'verticalalignment','top')
text(S4,T4,'4','FontSize',15,'verticalalignment','bottom','Horizontalalignment','right')
text(S5,T5,'5','FontSize',15,'verticalalignment','top')
text(S6,T6,'6','FontSize',15,'verticalalignment','top','Horizontalalignment','right')
T_Zone2 = linspace(0, T1, 500);
for j = 1:length(T_Zone2)
sl(j) = XSteam('sL_T',T_Zone2(J));
sv(j) = XSteam('sV_T',T_Zone2(J));
sl(j) = XSteam('hL_T',T_Zone2(J));
sv(j) = XSteam('hV_T',T_Zone2(J));
end
plot(sl,T_Zone2,'LineWidth',1.5,'Color','r')
plot(sv,T_Zone2,'LineWidth',1.5,'Color','r')
xlabel('Entropy')
ylabel('Temperature')
title('Entropy vs Temperature')
% H-S Graph
figure(2)
hold on
plot([S1 S2 S3 S4 S1],[H1 H2 H3 H4 H1],'LineWidth',3,'Color','K')
axis([0 10 -100 3500])
text(S1,H1,'1','FontSize',15)
text(S2,H2,'2','FontSize',15)
text(S3,H3,'3','FontSize',15,'Verticalalignment','top','Horizontalalignment','left')
text(S4,H4,'4','FontSize',15,'Verticalalignment','bottom','Horizontalalignment','right')
plot(sv,hv,'LineWidth',1.5,'Color','r')
plot(sl,hl,'LineWidth',1.5,'Color','r')
xlabel('Entropy')
ylabel('Enthalpy')
% Displaying The Results
fprintf('\n At State point 1 : \n')
fprintf('P1 is : %f Bar \n',P1)
fprintf('T1 is : %f Deg Celcious \n',T1)
fprintf('H1 is : %f KJ/Kg \n',H1)
fprintf('S1 is : %f KJ/KgK \n',S1)
fprintf('\n At State point 2 : \n')
fprintf('P2 is : %f Bar \n',P2)
fprintf('T2 is : %f Deg Celcious \n',T2)
fprintf('H2 is : %f KJ/kg \n',H2)
fprintf('S2 is : %f KJ/kgK \n',S2)
fprintf('X2 is : %f Bar \n',X2)
fprintf('\n At State point 3 : \n')
fprintf('P3 is : %f Bar \n',P3)
fprintf('T3 is : %f Deg Celcious \n',T3)
fprintf('H3 is : %f KJ/kg \n',H3)
fprintf('S3 is : %f KJ/kgK \n',S3)
fprintf('\n At State point 4 : \n')
fprintf('P4 is : %f Bar \n',P4)
fprintf('T4 is : %f Deg Celcious \n',T4)
fprintf('H4 is : %f KJ/kg \n',H4)
fprintf('S4 is : %f KJ/kgK \n',S4)
fprintf('Wt : %f KJ/kg \n',Wt)
fprintf('Wp : %f KJ/kg \n',Wp)
fprintf('W_net : %f KJ/kg \n',W_net)
fprintf('Ntherm : %f percent \n',n_percent)
fprintf('SSC : %f kg/kWh \n',SSC)
fprintf('BWR : %f \n',BWR)
EXAPLAINATION:-
-Xsteam data is used to extract the steam and water properties of enthalpy,entropy at specific pressure and temperatures for saturated liquid,saturated vapour conditions etc.
-Defining the input of pressure at state point 1 and temperature at condensor inlet.
-As we extract the data, we use thermodaynamic relation to further find state point and extract their data from Xsteam and also to determine the net work.
-The program calculates all the 4 state points of the rankine cycle form the Xsteam data
-The plotting of s,h, saturation curve for saturated liquid and saturated gas,Establishes 2Graphs one will be Temperature vs Entropy and another will be Enthalpy vs Entropy.
-Once the required inputs are given in the command window,the results will be printed in the command windows
RESULTS:-
-The objective to create a Rankine cycle simulator using MATLAB,has been completed and output is verified
Rankine Cycle
1-2 is Isentropic expansion in the turbine
2-3 is constant pressure heat rejection in the condensor.
3-4 is Isentropic compression in the pump.
4-1 is constant pressure heat addition in the boiler.
Enter temperature at turbine inlet, T1(in Deg.C)=400
Enter pressure at turbine inlet, P1(in Bar)=30
Enter pressure at condensor inlet, P2(in Bar)=0.05
RESULTS
At state point 1
p1:30.000bar t1:400.000c h1:3231.571
kj/kgk s1:6.923kj/kgk
At state point 2
p2:0.050bar t2:32.875c h2:2110.708
kj/kg s2:6.923kj/kgk x2:0.814
At state point 3
p3:0.050bar t3:32.875c h3:137.765
kj/kg s3:0.476kj/kgk
At state point 4
p4:30.000bar t4:36.935 c h4:140.776
kj/kg s4:0.476kj/kgk
ssc:3.220kj/kwh