11 |
except: |
except: |
12 |
pass |
pass |
13 |
|
|
14 |
|
#--- for (T,s) plots --- |
15 |
|
|
16 |
def sat_curve(d): |
def sat_curve(d): |
17 |
Tt = d.T_t |
Tt = d.T_t |
18 |
Tc = d.T_c |
Tc = d.T_c |
49 |
out += [TSPoint(T,fprops.helmholtz_s(T,rho,D))] |
out += [TSPoint(T,fprops.helmholtz_s(T,rho,D))] |
50 |
return out |
return out |
51 |
|
|
52 |
|
|
53 |
def plot_Ts(SS,style='b-'): |
def plot_Ts(SS,style='b-'): |
54 |
xx = [] |
xx = [] |
55 |
yy = [] |
yy = [] |
58 |
xx.append(float(S.s)/1.e3) |
xx.append(float(S.s)/1.e3) |
59 |
plot(xx,yy,style) |
plot(xx,yy,style) |
60 |
|
|
61 |
def cycle_plot(self): |
#--- for (T,H) plots --- |
|
"""Plot T-s diagram for combined-cycle gas turbine""" |
|
|
import loading |
|
|
loading.load_matplotlib(throw=True) |
|
|
ioff() |
|
|
figure() |
|
|
|
|
|
D = fprops.fprops_fluid(str(self.cd_rankine.component.getSymbolValue())) |
|
62 |
|
|
63 |
# plot gas turbine cycle |
class THPoint: |
64 |
SS = [self.GC.inlet, self.GC.outlet, self.GT.inlet, self.GT.outlet, self.HE.inlet, self.HE.outlet, self.GC.inlet] |
def __init__(self,T,H): |
65 |
plot_Ts(SS) |
self.T = T |
66 |
hold(1) |
self.H = H |
|
|
|
|
sat_curve(d) |
|
67 |
|
|
68 |
boiler_curve = pconst(self.HE.inlet_cold,self.HE.outlet_cold,100) |
def pconsth(S1,S2,n): |
69 |
condenser_curve = pconst(self.CO.inlet,self.CO.outlet,100) |
"""Return a set of (T,H) points between two states, with pressure constant""" |
70 |
SS2 = [self.PU.outlet, self.HE.inlet_cold] + boiler_curve + [self.HE.outlet_cold, self.TU.inlet, self.TU.outlet, self.CO.inlet] + condenser_curve + [self.CO.outlet, self.PU.inlet, self.PU.outlet] |
D = fprops.fprops_fluid(str(S1.cd.component.getSymbolValue())) |
71 |
plot_Ts(SS2) |
out = [] |
72 |
|
hh = linspace(float(S1.h), float(S2.h), n) |
73 |
|
for h in hh: |
74 |
|
res, T, rho = fprops.fprops_solve_ph(float(S1.p), h, 0, D) |
75 |
|
if not res: |
76 |
|
out += [THPoint(T,h * float(S1.mdot))] |
77 |
|
return out |
78 |
|
|
79 |
title(unicode(r"With %s bottoming cycle" % d.name)) |
def plot_TH(SS,style='b-',Href = 0): |
80 |
ylabel(unicode(r"T / [°C]")) |
xx = [] |
81 |
xlabel("s / [kJ/kg/K]") |
yy = [] |
82 |
|
for S in SS: |
83 |
|
yy.append(float(S.T) - 273.15) |
84 |
|
xx.append((float(S.H) - Href)/1.e6) |
85 |
|
plot(xx,yy,style) |
86 |
|
|
87 |
extpy.getbrowser().reporter.reportNote("Plotting completed") |
#--- various Rankine cycle configurations --- |
|
ion() |
|
|
show() |
|
88 |
|
|
89 |
def cycle_plot_rankine(self): |
def cycle_plot_rankine(self): |
90 |
"""Plot T-s diagram for a simple Rankine cycle""" |
"""Plot T-s diagram for a simple Rankine cycle""" |
109 |
ion() |
ion() |
110 |
show() |
show() |
111 |
|
|
112 |
|
|
113 |
def cycle_plot_rankine_regen2(self): |
def cycle_plot_rankine_regen2(self): |
114 |
"""Plot T-s diagram for a regenerative Rankine cycle (bleed steam regen)""" |
"""Plot T-s diagram for a regenerative Rankine cycle (bleed steam regen)""" |
115 |
import loading |
import loading |
148 |
extpy.getbrowser().reporter.reportNote("Plotting completed") |
extpy.getbrowser().reporter.reportNote("Plotting completed") |
149 |
ion() |
ion() |
150 |
show() |
show() |
|
import os.path |
|
151 |
savefig(os.path.expanduser("~/Desktop/regen2.eps")) |
savefig(os.path.expanduser("~/Desktop/regen2.eps")) |
152 |
|
|
153 |
|
|
187 |
extpy.getbrowser().reporter.reportNote("Plotting completed") |
extpy.getbrowser().reporter.reportNote("Plotting completed") |
188 |
ion() |
ion() |
189 |
show() |
show() |
190 |
|
savefig(os.path.expanduser("~/Desktop/regen1.eps")) |
191 |
|
|
192 |
|
|
193 |
|
#--- heat exchange (T,H) plot --- |
194 |
|
|
195 |
|
def heater_closed_plot(self): |
196 |
|
"""Plot T-H diagram of heat transfer in a heater_closed model""" |
197 |
|
import loading |
198 |
|
loading.load_matplotlib(throw=True) |
199 |
|
ioff() |
200 |
|
figure() |
201 |
|
hold(1) |
202 |
|
D = fprops.fprops_fluid(str(self.cd.component.getSymbolValue())) |
203 |
|
HE = self.HE |
204 |
|
|
205 |
|
extpy.getbrowser().reporter.reportNote("Fluid is %s" % D.name) |
206 |
|
|
207 |
|
plot_TH(pconsth(HE.inlet_heat, HE.outlet_heat, 50),'r-', |
208 |
|
Href = (float(HE.outlet_heat.h)*float(HE.outlet_heat.mdot))\ |
209 |
|
) |
210 |
|
|
211 |
|
plot_TH(pconsth(HE.inlet, HE.outlet, 50),'b-', |
212 |
|
Href = (float(HE.inlet.h)*float(HE.inlet.mdot))\ |
213 |
|
) |
214 |
|
|
215 |
|
title(unicode(r"Closed feedwater heater with %s" % D.name)) |
216 |
|
ylabel(unicode(r"T / [°C]")) |
217 |
|
xlabel("H / [MW]") |
218 |
|
|
219 |
|
extpy.getbrowser().reporter.reportNote("Plotting completed") |
220 |
|
ion() |
221 |
|
show() |
222 |
|
savefig(os.path.expanduser("~/Desktop/heater_closed.eps")) |
223 |
|
|
224 |
|
#--- the big one: a combined-cycle GT --- |
225 |
|
|
226 |
|
def cycle_plot(self): |
227 |
|
"""Plot T-s diagram for combined-cycle gas turbine""" |
228 |
|
import loading |
229 |
|
loading.load_matplotlib(throw=True) |
230 |
|
ioff() |
231 |
|
figure() |
232 |
|
|
233 |
|
D = fprops.fprops_fluid(str(self.cd_rankine.component.getSymbolValue())) |
234 |
|
|
235 |
|
# plot gas turbine cycle |
236 |
|
SS = [self.GC.inlet, self.GC.outlet, self.GT.inlet, self.GT.outlet, self.HE.inlet, self.HE.outlet, self.GC.inlet] |
237 |
|
plot_Ts(SS) |
238 |
|
hold(1) |
239 |
|
|
240 |
|
sat_curve(d) |
241 |
|
|
242 |
|
boiler_curve = pconst(self.HE.inlet_cold,self.HE.outlet_cold,100) |
243 |
|
condenser_curve = pconst(self.CO.inlet,self.CO.outlet,100) |
244 |
|
SS2 = [self.PU.outlet, self.HE.inlet_cold] + boiler_curve + [self.HE.outlet_cold, self.TU.inlet, self.TU.outlet, self.CO.inlet] + condenser_curve + [self.CO.outlet, self.PU.inlet, self.PU.outlet] |
245 |
|
plot_Ts(SS2) |
246 |
|
|
247 |
|
title(unicode(r"With %s bottoming cycle" % d.name)) |
248 |
|
ylabel(unicode(r"T / [°C]")) |
249 |
|
xlabel("s / [kJ/kg/K]") |
250 |
|
|
251 |
|
extpy.getbrowser().reporter.reportNote("Plotting completed") |
252 |
|
ion() |
253 |
|
show() |
254 |
|
|
255 |
|
|
256 |
extpy.registermethod(cycle_plot_rankine) |
extpy.registermethod(cycle_plot_rankine) |
257 |
extpy.registermethod(cycle_plot_rankine_regen1) |
extpy.registermethod(cycle_plot_rankine_regen1) |
258 |
extpy.registermethod(cycle_plot_rankine_regen2) |
extpy.registermethod(cycle_plot_rankine_regen2) |
259 |
|
extpy.registermethod(heater_closed_plot) |
260 |
|
|
261 |
extpy.registermethod(cycle_plot) |
extpy.registermethod(cycle_plot) |
262 |
#the above method can be called using "EXTERNAL fourbarplot(SELF)" in ASCEND. |
#the above method can be called using "EXTERNAL fourbarplot(SELF)" in ASCEND. |