EES CODE of TCRC

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

File:Initial Coding.

EES 07/06/2024 9:43:08 pm Page 1


EES Ver. 10.561: #3905: DownLoadLy.iR, https://downloadly.ir?¬???«™?—?™???????””‘—–??™›“??‹???™•

1: {$UnitSystem SI K MPa Mass radians}


2:
3: "----------------------------Definging Procedures-------------------"
4: "Turbine"
5: Procedure turbine (T_in,P_in,h_in,eta_t,P_out,Fluid$:T_out,s_out,h_out)
6: s_in=entropy(Fluid$,T=T_in,P=P_in) "Inlet entropy"
7: s_s_out=s_in "For isentropic assumption"
8: h_s_out=enthalpy(Fluid$,s=s_s_out,P=P_out) "This will give h_s_out"
9: W_t_s=h_in-h_s_out
10: W_t=W_t_s*eta_t "By the definitions of turbine efficiency"
11: h_out=h_in-W_t "This will give h_out"
12: T_out=temperature(Fluid$,h=h_out,P=P_out) "This will give T_out"
13: s_out=entropy(Fluid$,h=h_out,P=P_out) "outlet entropy"
14: End "Ending Procedure turbine"
15:
16:
17: "Pump"
18: Procedure pump(P_in,x_in,P_out,F$,eta_pump:T_in,h_in,s_in,T_out,s_out,h_out)
19: v=volume(F$,P=P_in,x=x_in) "inlet specific volume"
20: h_in=enthalpy(F$,P=P_in,x=x_in)
21: T_in=temperature(F$,P=P_in,x=x_in)
22: s_in=entropy(F$,P=P_in,x=x_in)
23: s_s_out=s_in "Assuming isentropic pump"
24: w_s_pump=v*(P_out-P_in) "Pump work definition"
25: h_s_out=h_in+w_s_pump "pump work can also be defined as"
26: h_out=h_in+((h_s_out-h_in)/eta_pump)
27: T_out=temperature(F$,P=P_out,h=h_out)
28: s_out=entropy(F$,P=P_out,h=h_out)
29:
30: End "Ending Procedure pump"
31:
32:
33: "Compressor"
34: Procedure compressor (T_in,P_in,eta_compressor,P_out,Fluid$,h_in:T_out,s_out,h_out)
35: s_in=entropy(Fluid$,T=T_in,h=h_in) "Inlet entropy"
36: s_s_out=s_in "For isentropic assumption"
37: h_s_out=enthalpy(Fluid$,s=s_s_out,P=P_out) "This will give h_s_out"
38: W_c_s=h_in-h_s_out
39: W_c=W_c_s*eta_compressor
40: h_out=h_in-W_c "This will give h_out"
41: T_out=temperature(Fluid$,h=h_out,P=P_out) "This will give T_out"
42: s_out=entropy(Fluid$,T=T_out,P=P_out) "outlet entropy"
43: End "Ending Procedure compressor"
44:
45:
46: "Separator"
47: Procedure separator(in:out)
48:
49: End "Ending Procedure separator"
50: {
51: "Ejector"
52: 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_out,s_out,h_out)
53:
54:
55:
56: End "Ending Procedure ejector"
57:
File:Initial Coding.EES 07/06/2024 9:43:09 pm Page 2
EES Ver. 10.561: #3905: DownLoadLy.iR, https://downloadly.ir?¬???«™?—?™???????””‘—–??™›“??‹???™•

58: "Energy and Momentum equations of Ejector"


59:
60: "Nozzel Section"
61: eta_n=(h_pf_n1-h_pf_n2)/(h_pf_n1-h_pf_n2_s)
62: h_pf_n2=h_pf_n1+((u_pf_n1)^2/2)-((u_pf_n2)^2/2)
63: u_pf_n2=sqrt(2*eta_n*(h_pf_n1-h_pf_n2_s))
64:
65: "Mixing Chamber Section"
66: eta_m=((u_mf_m)^2)/(u_mf_m_id)
67: M_dot_pf*u_pf_n2+M_dot_sf*u_sf_n2=(M_dot_pf+M_dot_sf)*u_mf_m_id
68: M_dot_pf*(h_pf_n2+((u_pf_n2)^2/2))+M_dot_sf*(h_sf_n2+((u_sf_n2)^2/2))=M_dot_pf+M_dot_sf*(h_mf_n2+((u_mf_n2)^2/2))
69: u_mf_m=(u_pf_n2*sqrt(eta_m))/(1+ER)
70: h_mf_m=(h_pf_n1+micro*h_sf)/(1+ER)-((u_mf_m)^2)/(2)
71:
72: "Diffuser Section"
73:
74: eta_d=(h_mf_d_s-h_mf_m)/(h_mf_d-h_mf_m)
75: h_mf_d-h_mf_m=((u_mf_m)^2-(u_mf_d)^2)/(2)
76: }
77:
78: "------------------------------Given Data------------------------------"
79: F$='CarbonDioxide' "Working Fluid"
80: P_amb=0.1013[MPa]
81: T_amb=converttemp(C,K,25[C])
82: T_h=converttemp(C,K,230[C]) "Hot air temperature"
83: m_dot_h=20[kg/s] "Hot air mass flow rate"
84: T_turb_in=converttemp(C,K,220[C]) "Turbine inlet temperature"
85: P_turb_in=18[MPa] "Turbine inlet pressure"
86: DELTAT_pinch_re=6[C] "Pinch point temperature difference of recuperator"
87: T[7]=converttemp(C,K,35[C]) "Cooling temperature at cooler outlet"
88: P[7]=8.6[MPa] "Cooling pressure at cooler output"
89: P[8]=7[MPa] "Back pressure of HP ejector"
90: P[12]=6.5[MPa] "Back pressure of LP ejector"
91: P[13]=6[MPa] "Expansion pressure of throttle valve"
92: DELTAT_diff_gh=10[C] "Terminal temperature difference of gas heater"
93: eta_turb=85/100 "Isentropic efficiency of turbine"
94: eta_comp=85/100 "Isentropic efficiency of compressor"
95: eta_pump1=80/100 "Isentropic efficiency of pump1"
96: eta_pump2=80/100 "Isentropic efficiency of pump2"
97: eta_n1=90/100 "Nozzle efficiency of HP ejector"
98: eta_m1=90/100 "Mixing efficiency of HP ejector"
99: eta_d1=80/100 "Diffuser efficiency of HP ejector"
100: eta_n2=90/100 "Nozzle efficiency of LP ejector"
101: eta_m2=90/100 "Mixing efficiency of LP ejector"
102: eta_d2=80/100 "Diffuser efficiency of LP ejector"
103:
104:
105: "-------------------------------Point States-------------------------------"
106:
107: "State Point 1"
108: "State Point 2"
109: T[2]=T[4]-DELTAT_pinch_re "Using pinch point temperature"
110: T_C[2]=converttemp(K,C,T[2])
111: "State Point 3"
112: T[3]=T_turb_in
113: P[3]=P_turb_in
File:Initial Coding.EES 07/06/2024 9:43:09 pm Page 3
EES Ver. 10.561: #3905: DownLoadLy.iR, https://downloadly.ir?¬???«™?—?™???????””‘—–??™›“??‹???™•

114: eta_t=eta_turb
115: h[3]=enthalpy(F$,T=T[3],P=P[3])
116: T_C[3]=converttemp(K,C,T[3])
117: "State Point 4"
118: P[4]=P[7] "Assuming no pressure loss"
119: Call turbine(T[3],P[3],h[3],eta_t,P[4],F$:T[4],s[4],h[4])
120: T_C[4]=converttemp(K,C,T[4])
121: "State Point 5"
122: "State Point 6"
123: "State Point 7"
124: h[7]=enthalpy(F$,T=T[7],P=P[7])
125: s[7]=entropy(F$,P=P[7],T=T[7])
126: T_C[7]=converttemp(K,C,T[7])
127: "State Point 8"
128: "State Point 9"
129: P[9]=P[8]
130: x[9]=0
131: T_C[9]=converttemp(K,C,T[9])
132: "State Point 10"
133: P[10]=P[3]
134: Call pump(P[9],x[9],P[10],F$,eta_pump1:T[9],s[9],h[9],T[10],s[10],h[10])
135: T_C[10]=converttemp(K,C,T[10])
136: "State Point 11"
137: P[11]=P[9]
138: x[11]=1
139: h[11]=enthalpy(F$,x=x[11],P=P[11])
140: s[11]=entropy(F$,x=x[11],P=P[11])
141: T[11]=temperature(F$,x=x[11],P=P[11])
142: T_C[11]=converttemp(K,C,T[11])
143: "State Point 12"
144: "State Point 13"
145: "State Point 14"
146: P[14]=P[13]
147: x[14]=0
148: T_C[14]=converttemp(K,C,T[14])
149: "State Point 15"
150: P[15]=P[10]
151: Call pump(P[14],x[14],P[15],F$,eta_pump2:T[14],s[14],h[14],T[15],s[15],h[15])
152: T_C[15]=converttemp(K,C,T[15])
153: "State Point 16"
154: P[16]=P[13]
155: x[16]=1
156: h[16]=enthalpy(F$,x=x[16],P=P[16])
157: s[16]=entropy(F$,x=x[16],P=P[16])
158: T[16]=temperature(F$,x=x[16],P=P[16])
159: T_C[16]=converttemp(K,C,T[16])
160: "State Point 17"
161: P[17]=P[13]
162: x[17]=1
163: h[17]=enthalpy(F$,x=x[17],P=P[17])
164: s[17]=entropy(F$,x=x[17],P=P[17])
165: T[17]=temperature(F$,x=x[17],P=P[17])
166: T_C[17]=converttemp(K,C,T[17])
167: "State Point 18"
168: P[18]=P[13]
169: x[18]=1
File:Initial Coding.EES 07/06/2024 9:43:10 pm Page 4
EES Ver. 10.561: #3905: DownLoadLy.iR, https://downloadly.ir?¬???«™?—?™???????””‘—–??™›“??‹???™•

170: h[18]=enthalpy(F$,x=x[18],P=P[18])
171: s[18]=entropy(F$,x=x[18],P=P[18])
172: T[18]=temperature(F$,x=x[18],P=P[18])
173: T_C[18]=converttemp(K,C,T[18])
174: "State Point 19"
175: P[19]=P[13]
176: x[19]=1
177: h[19]=enthalpy(F$,x=x[19],P=P[19])
178: s[19]=entropy(F$,x=x[19],P=P[19])
179: T[19]=temperature(F$,x=x[19],P=P[19])
180: T_C[19]=converttemp(K,C,T[19])
181: "State Point 20"
182: P[20]=P[13]
183: x[20]=1
184: h[20]=enthalpy(F$,x=x[20],P=P[20])
185: s[20]=entropy(F$,x=x[20],P=P[20])
186: T[20]=temperature(F$,x=x[20],P=P[20])
187: T_C[20]=converttemp(K,C,T[20])
188: "State Point 21"
189: P[21]=P[7]
190: Call compressor (T[20],P[20],eta_comp,P[21],F$,h[20]:T[21],s[21],h[21])
191: T_C[21]=converttemp(K,C,T[21])
192:
193: "--------------------------------Finding mass flow fractions---------------------------------------"
194: {"Energy balance on Separator 1"
195: f_8*h[8]=f_9*h[9]+f_11*h[11]
196: "Energy balance on LP Ejector "
197: f_11*h[11]+f_19*h[19]=f_12*h[12]
198: "Energy balance on Separator 2"
199: f_13*h[13]=f_14*h[14]+f_16*h[16]
200: "Energy balance on HP Ejector "
201: f_17*h[17]+f_7*h[7]=f_8*h[8]
202:
203: "Here"
204: f_8=1[kg/s]
205: f_11=1-f_9
206: f_13=(1-f_9)+f_19
207: f_16=((1-f_9)+f_19)-f_14
208: f_17=(((1-f_9)+f_19)-f_14)-f_18
209: {f_18=f_16-f_17}
210: f_19=f_18-f_20
211: {f_20=f_18-f_19}
212: f_5=f_9+f_14
213: f_7=f_20+(f_9+f_14)
214: f_8=f_7+f_17}

SOLUTION
Unit Settings: SI K MPa kJ mass rad
DTdiff,gh = 10 [C] DTpinch,re = 6 [C] hcomp = 0.85
hd1 = 0.8 hd2 = 0.8 hm1 = 0.9
hm2 = 0.9 hn1 = 0.9 hn2 = 0.9
hpump1 = 0.8 hpump2 = 0.8 ht = 0.85
hturb = 0.85 F$ = 'Carbondioxide' mh = 20 [kg/s]
Pamb = 0.1013 [MPa] Pturb,in = 18 [MPa] Tamb = 298.2 [K]
Th = 503.2 [K] Tturb,in = 493.2 [K]
File:Initial Coding.EES 07/06/2024 9:43:10 pm Page 5
EES Ver. 10.561: #3905: DownLoadLy.iR, https://downloadly.ir?¬???«™?—?™???????””‘—–??™›“??‹???™•

63 potential unit problems were detected.

Arrays Table: Main


Pi Ti TC,i hi si xi
[MPa] [K]

2 420.7 147.5
3 18 493.2 220 124
4 8.6 426.7 153.5 76.38 -0.5867
5
6
7 8.6 308.2 35 -200.6 -1.398
8 7
9 7 301.8 28.68 -1.43 -212.9 0
10 18 319 45.87 -212.9 -1.478
11 7 301.8 28.68 -129.9 -1.155 1
12 6.5
13 6
14 6 295.1 21.98 -1.529 -243.9 0
15 18 305.9 32.75 -243.9 -1.578
16 6 295.1 21.98 -103.5 -1.053 1
17 6 295.1 21.98 -103.5 -1.053 1
18 6 295.1 21.98 -103.5 -1.053 1
19 6 295.1 21.98 -103.5 -1.053 1
20 6 295.1 21.98 -103.5 -1.053 1
21 8.6 319.9 46.77 -94.33 -1.058

You might also like