0% found this document useful (0 votes)
4 views

code without ejectors

Uploaded by

engr.mdrizwan
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

code without ejectors

Uploaded by

engr.mdrizwan
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 5

$UnitSystem SI Mass J K Pa

"----------------------------Definging Procedures-------------------"
"Turbine"
Procedure turbine (T_in,P_in,h_in,eta_t,P_out,Fluid$:T_out,s_out,h_out)
s_in=entropy(Fluid$,T=T_in,P=P_in) "Inlet entropy"
s_s_out=s_in "For isentropic assumption"
h_s_out=enthalpy(Fluid$,s=s_s_out,P=P_out) "This will give h_s_out"
W_t_s=h_in-h_s_out
W_t=W_t_s*eta_t "By the definitions of turbine efficiency"
h_out=h_in-W_t "This will give h_out"
T_out=temperature(Fluid$,h=h_out,P=P_out) "This will give T_out"
s_out=entropy(Fluid$,h=h_out,P=P_out) "outlet entropy"
End "Ending Procedure turbine"

"Pump"
Procedure pump(P_in,x_in,P_out,F$,eta_pump:T_in,h_in,s_in,T_out,s_out,h_out)
v=volume(F$,P=P_in,x=x_in) "inlet specific volume"
h_in=enthalpy(F$,P=P_in,x=x_in)
T_in=temperature(F$,P=P_in,x=x_in)
s_in=entropy(F$,P=P_in,x=x_in)
s_s_out=s_in "Assuming isentropic pump"
w_s_pump=v*(P_out-P_in) "Pump work definition"
h_s_out=h_in+w_s_pump "pump work can also be defined as"
h_out=h_in+((h_s_out-h_in)/eta_pump)
T_out=temperature(F$,P=P_out,h=h_out)
s_out=entropy(F$,P=P_out,h=h_out)

End "Ending Procedure pump"

"Compressor"
Procedure compressor (T_in,P_in,eta_compressor,P_out,Fluid$,h_in:T_out,s_out,h_out)
s_in=entropy(Fluid$,T=T_in,h=h_in) "Inlet entropy"
s_s_out=s_in "For isentropic assumption"
h_s_out=enthalpy(Fluid$,s=s_s_out,P=P_out) "This will give h_s_out"
W_c_s=h_in-h_s_out
W_c=W_c_s*eta_compressor
h_out=h_in-W_c "This will give h_out"
T_out=temperature(Fluid$,h=h_out,P=P_out) "This will give T_out"
s_out=entropy(Fluid$,T=T_out,P=P_out) "outlet entropy"
End "Ending Procedure compressor"

"Separator"
Procedure separator(in:out)

End "Ending Procedure separator"


{
{"Ejector"
Procedure
ejector(P_prim,P_ent,P_out,x_ent,x_prim:T_prim,s_prim,h_prim,T_ent,s_ent,h_ent,T_ou
t,s_out,h_out)

End "Ending Procedure ejector"}

"Energy and Momentum equations of Ejector"


"Nozzel Section"
h_pf_n1=h[7] "h_7"
eta_n1=(h_pf_n1-h_pf_n2)/(h_pf_n1-h_pf_n2_s)
h_pf_n2=h_pf_n1+((u_pf_n1)^2/2)-((u_pf_n2)^2/2)
u_pf_n1=0 "assuming negligible velocity at entrance"
u_pf_n2=sqrt(2*eta_n1*(h_pf_n1-h_pf_n2_s))

"Mixing Chamber Section"


h_sf=h[17] "h_17"
eta_m1=((u_mf_m)^2)/(u_mf_m_id)
M_dot_pf*u_pf_n2+M_dot_sf*u_sf=(M_dot_pf+M_dot_sf)*u_mf_m_id "law of impulse and
mass conservation applies in ejector’s mixing process"
u_sf=0 "Ignoring velocity at inlet of ejector"
M_dot_pf*(h_pf_n2+((u_pf_n2)^2/2))+M_dot_sf*(h_sf+
((u_sf)^2/2))=(M_dot_pf+M_dot_sf)*(h_mf_m+((u_mf_m)^2/2))
u_mf_m=(u_pf_n2*sqrt(eta_m1))/(1+ER)
h_mf_m=(h_pf_n1+((1*10^(-6))*h_sf))/(1+ER)-((u_mf_m)^2)/(2)

"Diffuser Section"
u_mf_d=0 "Negligible velocity at exit"
eta_d1=(h_mf_d_s-h_mf_m)/(h_mf_d-h_mf_m)
h_mf_d-h_mf_m=((u_mf_m)^2-(u_mf_d)^2)/(2)

ER=M_dot_sf/M_dot_pf
ER_new=sqrt((eta_n1*eta_m1*eta_d1*(h_pf_n1-h_pf_n2_s))/(h_mf_d_s-h_mf_m))-1
}

"------------------------------Given Data------------------------------"
F$='CarbonDioxide' "Working Fluid"
P_amb=0.1013[MPa]*convert(MPa,Pa)
T_amb=converttemp(C,K,25[C])
T_h_in=converttemp(C,K,230[C]) "Hot air input temperature"
m_dot_h=20[kg/s] "Hot air mass flow rate"
T_turb_in=converttemp(C,K,220[C]) "Turbine inlet temperature"
P_turb_in=18*convert(MPa,Pa) "Turbine inlet pressure"
DT_pinch_re=6[C] "Pinch point temperature difference of recuperator"
T[7]=converttemp(C,K,35[C]) "Cooling temperature at cooler outlet"
P[7]=8.6*convert(MPa,Pa) "Cooling pressure at cooler output"
P[8]=7*convert(MPa,Pa) "Back pressure of HP ejector"
P[12]=6.5*convert(MPa,Pa) "Back pressure of LP ejector"
P[13]=6*convert(MPa,Pa) "Expansion pressure of throttle valve"
DT_diff_gh=10[C] "Terminal temperature difference of gas heater"
eta_turb=85/100[-] "Isentropic efficiency of turbine"
eta_comp=85/100[-] "Isentropic efficiency of compressor"
eta_pump1=80/100[-] "Isentropic efficiency of pump1"
eta_pump2=80/100[-] "Isentropic efficiency of pump2"
eta_n1=90/100[-] "Nozzle efficiency of HP ejector"
eta_m1=90/100[-] "Mixing efficiency of HP ejector"
eta_d1=80/100[-] "Diffuser efficiency of HP ejector"
eta_n2=90/100[-] "Nozzle efficiency of LP ejector"
eta_m2=90/100[-] "Mixing efficiency of LP ejector"
eta_d2=80/100[-] "Diffuser efficiency of LP ejector"

"-------------------------------Point States-------------------------------"

"State Point 1"


"P[1]=P[15]"
"Apply energy balance at mixing point of state 15,10 and 1 for state point 1"
"State Point 2"
T[2]=T[4]-DT_pinch_re "Using pinch point temperature"
T_C[2]=converttemp(K,C,T[2])
"P[2]=P[1]"
"State Point 3"
T[3]=T_turb_in
P[3]=P_turb_in
eta_t=eta_turb
h[3]=enthalpy(F$,T=T[3],P=P[3])
s[3]=entropy(F$,T=T[3],P=P[3])
T_C[3]=converttemp(K,C,T[3])
"State Point 4"
P[4]=P[7] "Assuming no pressure loss"
Call turbine(T[3],P[3],h[3],eta_t,P[4],F$:T[4],s[4],h[4])
T_C[4]=converttemp(K,C,T[4])
"State Point 5"
"To solve this analyze the recuperator"
"State Point 6"
"To get state point 6 apply energy balnce on mixing point of state 5,21 and 6"
"State Point 7"
h[7]=enthalpy(F$,T=T[7],P=P[7])
s[7]=entropy(F$,P=P[7],T=T[7])
T_C[7]=converttemp(K,C,T[7])
"State Point 8"
"Call ejector function for state point 8"
"State Point 9"
P[9]=P[8]
x[9]=0
T_C[9]=converttemp(K,C,T[9])
"State Point 10"
P[10]=P[3]
Call pump(P[9],x[9],P[10],F$,eta_pump1:T[9],s[9],h[9],T[10],s[10],h[10])
T_C[10]=converttemp(K,C,T[10])
"State Point 11"
P[11]=P[9]
x[11]=1
h[11]=enthalpy(F$,x=x[11],P=P[11])
s[11]=entropy(F$,x=x[11],P=P[11])
T[11]=temperature(F$,x=x[11],P=P[11])
T_C[11]=converttemp(K,C,T[11])
"State Point 12"
"Call ejector function for state point 12"
"State Point 13"
{h[13]=h[12] "Iso enthalpic process in throttle valve"
s[13]=entropy(F$,h=h[13],P=P[13])
T[13]=temperature(F$,h=h[13],P=P[13])
T_C[13]=converttemp(K,C,T[13])}
"State Point 14"
P[14]=P[13]
x[14]=0
T_C[14]=converttemp(K,C,T[14])
"State Point 15"
P[15]=P[10]
Call pump(P[14],x[14],P[15],F$,eta_pump2:T[14],s[14],h[14],T[15],s[15],h[15])
T_C[15]=converttemp(K,C,T[15])
"State Point 16"
P[16]=P[13]
x[16]=1
h[16]=enthalpy(F$,x=x[16],P=P[16])
s[16]=entropy(F$,x=x[16],P=P[16])
T[16]=temperature(F$,x=x[16],P=P[16])
T_C[16]=converttemp(K,C,T[16])
"State Point 17"
P[17]=P[13]
x[17]=1
h[17]=enthalpy(F$,x=x[17],P=P[17])
s[17]=entropy(F$,x=x[17],P=P[17])
T[17]=temperature(F$,x=x[17],P=P[17])
T_C[17]=converttemp(K,C,T[17])
"State Point 18"
P[18]=P[13]
x[18]=1
h[18]=enthalpy(F$,x=x[18],P=P[18])
s[18]=entropy(F$,x=x[18],P=P[18])
T[18]=temperature(F$,x=x[18],P=P[18])
T_C[18]=converttemp(K,C,T[18])
"State Point 19"
P[19]=P[13]
x[19]=1
h[19]=enthalpy(F$,x=x[19],P=P[19])
s[19]=entropy(F$,x=x[19],P=P[19])
T[19]=temperature(F$,x=x[19],P=P[19])
T_C[19]=converttemp(K,C,T[19])
"State Point 20"
P[20]=P[13]
x[20]=1
h[20]=enthalpy(F$,x=x[20],P=P[20])
s[20]=entropy(F$,x=x[20],P=P[20])
T[20]=temperature(F$,x=x[20],P=P[20])
T_C[20]=converttemp(K,C,T[20])
"State Point 21"
P[21]=P[7]
Call compressor (T[20],P[20],eta_comp,P[21],F$,h[20]:T[21],s[21],h[21])
T_C[21]=converttemp(K,C,T[21])

"--------------------------------Finding mass flow


fractions---------------------------------------"
{"Energy balance on Separator 1"
f_8*h[8]=f_9*h[9]+f_11*h[11]
"Energy balance on LP Ejector "
f_11*h[11]+f_19*h[19]=f_12*h[12]
"Energy balance on Separator 2"
f_13*h[13]=f_14*h[14]+f_16*h[16]
"Energy balance on HP Ejector "
f_17*h[17]+f_7*h[7]=f_8*h[8]

"Here"
f_8=1[kg/s]
f_11=1-f_9
f_13=(1-f_9)+f_19
f_16=((1-f_9)+f_19)-f_14
f_17=(((1-f_9)+f_19)-f_14)-f_18
{f_18=f_16-f_17}
f_19=f_18-f_20
{f_20=f_18-f_19}
f_5=f_9+f_14
f_7=f_20+(f_9+f_14)
f_8=f_7+f_17}

You might also like