Пример #1
0
def cycle_plot_brayton_split_regen(self):
	"""Plot T-s diagran for regenerative gas turbine"""
	import loading
	loading.load_matplotlib(throw=True)
	ioff()
	figure()		
	hold(1)
	D = fprops.fprops_fluid(str(self.cd.component.getSymbolValue()))
	sat_curve(D)
	
	# plot gas turbine cycle
	boiler_curve = pconst(self.BO.inlet, self.BO.outlet,100)
	condenser_curve = pconst(self.CO.inlet,self.CO.outlet,100)
	SS = [self.PU2.inlet, self.PU2.outlet, self.HEL.inlet, self.HEL.outlet, self.HEH.inlet, self.HEH.outlet] + boiler_curve + [self.TU.inlet, self.TU.outlet,self.HEH.inlet_hot, self.HEH.outlet_hot, self.HEL.inlet_hot, self.HEL.outlet_hot, self.CO.inlet, self.CO.outlet, self.PU2.inlet]
	plot_Ts(SS)
	hold(1)

	title(unicode(r"Split Regenerative Brayton cycle"))
	ylabel(unicode(r"T / [°C]"))
	xlabel("s / [kJ/kg/K]")

	extpy.getbrowser().reporter.reportNote("Plotting completed")
	ion()
	show()
	savefig(os.path.expanduser("~/Desktop/brayton__split_regen.eps"))
Пример #2
0
def cycle_plot_brayton_reheat(self):
	"""Plot T-s diagram for reheat gas turbine"""
	import loading
	loading.load_matplotlib(throw=True)
	ioff()
	figure()		
	hold(1)
	D = fprops.fprops_fluid(str(self.cd.component.getSymbolValue()))
	sat_curve(D)
	
	# plot gas turbine cycle
	boiler1_curve = pconst(self.BO1.inlet, self.BO1.outlet,100)
	boiler2_curve = pconst(self.BO2.inlet, self.BO2.outlet,100)
	condenser_curve = pconst(self.CO.inlet,self.CO.outlet,1000)
	SS = [self.PU.inlet, self.PU.outlet] + boiler1_curve + [self.TU1.inlet, self.TU1.outlet] + boiler2_curve + [self.TU2.inlet, self.TU2.outlet, self.CO.inlet] + condenser_curve + [self.CO.outlet,self.PU.inlet]
	plot_Ts(SS)
	hold(1)

	title("Reheat Brayton cycle")
	ylabel(unicode(r"T / [°C]"))
	xlabel("s / [kJ/kg/K]")

	extpy.getbrowser().reporter.reportNote("Plotting completed")
	ion()
	show()
Пример #3
0
def heater_closed_plot(self):
	"""Plot T-H diagram of heat transfer in a heater_closed model"""
	import loading
	loading.load_matplotlib(throw=True)
	ioff()
	figure()
	hold(1)
	D = fprops.fprops_fluid(str(self.cd.component.getSymbolValue()))
	HE = self.HE

	extpy.getbrowser().reporter.reportNote("Fluid is %s" % D.name)	

	plot_TH(pconsth(HE.inlet_heat, HE.outlet_heat, 50),'r-',
		Href = (float(HE.outlet_heat.h)*float(HE.outlet_heat.mdot))\
	)

	plot_TH(pconsth(HE.inlet, HE.outlet, 50),'b-',
		Href = (float(HE.inlet.h)*float(HE.inlet.mdot))\
	)

	title(unicode(r"Closed feedwater heater with %s" % D.name))
	ylabel(unicode(r"T / [°C]"))
	xlabel("H / [MW]")

	extpy.getbrowser().reporter.reportNote("Plotting completed")
	ion()
	show()
	savefig(os.path.expanduser("~/Desktop/heater_closed.eps"))
Пример #4
0
def cycle_plot_brayton_split_rachel(self):
    """Plot T-s diagram for a split Brayton cycle"""
    import loading
    loading.load_matplotlib(throw=True)
    ioff()
    figure()
    hold(1)
    D = fprops.fprops_fluid(str(self.cd.component.getSymbolValue()))
    sat_curve(D)

    boiler_curve = pconst(self.BO.inlet, self.BO.outlet, 100)
    condenser_curve = pconst(self.CO.inlet, self.CO.outlet, 100)
    heh_hot_curve = pconst(self.HEH.inlet_hot, self.HEH.outlet_hot, 100)
    hel_hot_curve = pconst(self.HEL.inlet_hot, self.HEL.outlet_hot, 100)
    hel_curve = pconst(self.HEL.inlet, self.HEL.outlet, 100)
    heh_curve = pconst(self.HEH.inlet, self, HEH.outlet, 100)
    SS = boiler_curve + [
        self.TU.inlet, self.TU.outlet
    ] + heh_hot_curve + hel_hot_curve + condenser_curve + [
        self.PU2.inlet, self.PU2.outlet
    ] + hel_curve + heh_curve
    plot_Ts(SS)

    title(unicode(r"Brayton cycle with %s" % D.name))
    ylabel(unicode(r"T / [°C]"))
    aa = axis()
    axis([aa[0], aa[1], -100, 600])
    xlabel("s / [kJ/kg/K]")

    extpy.getbrowser().reporter.reportNote("Plotting completed")
    ion()
    show()
    savefig(os.path.expanduser("~/Desktop/brayton.eps"))
Пример #5
0
def cycle_plot_brayton_split_rachel(self):
	"""Plot T-s diagram for a split Brayton cycle"""
	import loading
	loading.load_matplotlib(throw=True)
	ioff()
	figure()
	hold(1)
	D = fprops.fprops_fluid(str(self.cd.component.getSymbolValue()))
	sat_curve(D)

	boiler_curve = pconst(self.BO.inlet, self.BO.outlet,100)
	condenser_curve = pconst(self.CO.inlet,self.CO.outlet,100)
	heh_hot_curve = pconst (self.HEH.inlet_hot, self.HEH.outlet_hot,100)
	hel_hot_curve = pconst (self.HEL.inlet_hot, self.HEL.outlet_hot,100)
	hel_curve = pconst(self.HEL.inlet, self.HEL.outlet,100)
	heh_curve = pconst(self.HEH.inlet, self,HEH.outlet,100)
	SS = boiler_curve + [self.TU.inlet, self.TU.outlet] + heh_hot_curve + hel_hot_curve + condenser_curve + [self.PU2.inlet, self.PU2.outlet]+ hel_curve + heh_curve
	plot_Ts(SS)

	title(unicode(r"Brayton cycle with %s" % D.name))
	ylabel(unicode(r"T / [°C]"))
	aa = axis(); axis([aa[0],aa[1],-100,600])
	xlabel("s / [kJ/kg/K]")

	extpy.getbrowser().reporter.reportNote("Plotting completed")
	ion()
	show()
	savefig(os.path.expanduser("~/Desktop/brayton.eps"))
Пример #6
0
def regenerator_plot_fprops(self):
    """Plot T-H diagram of regenerator"""
    import loading
    loading.load_matplotlib(throw=True)
    ioff()
    figure()
    hold(1)
    D = fprops.fprops_fluid(str(self.cd.component.getSymbolValue()))
    extpy.getbrowser().reporter.reportNote("Fluid is %s" % D.name)

    plot_TH(pconsth(self.inlet_hot, self.outlet_hot, 50),'r-',
     Href = (float(self.outlet_hot.h)*float(self.outlet_hot.mdot))\
    )

    plot_TH(pconsth(self.inlet, self.outlet, 50),'b-',
     Href = (float(self.inlet.h)*float(self.inlet.mdot))\
    )

    title(unicode(r"%s heat exchanger" % D.name))
    ylabel(unicode(r"T / [°C]"))
    xlabel("H / [MW]")

    extpy.getbrowser().reporter.reportNote("Plotting completed")
    ion()
    show()
Пример #7
0
def cycle_plot_brayton_reheat(self):
    """Plot T-s diagram for reheat gas turbine"""
    import loading
    loading.load_matplotlib(throw=True)
    ioff()
    figure()
    hold(1)
    D = fprops.fprops_fluid(str(self.cd.component.getSymbolValue()))
    sat_curve(D)

    # plot gas turbine cycle
    boiler1_curve = pconst(self.BO1.inlet, self.BO1.outlet, 100)
    boiler2_curve = pconst(self.BO2.inlet, self.BO2.outlet, 100)
    condenser_curve = pconst(self.CO.inlet, self.CO.outlet, 1000)
    SS = [self.PU.inlet, self.PU.outlet] + boiler1_curve + [
        self.TU1.inlet, self.TU1.outlet
    ] + boiler2_curve + [self.TU2.inlet, self.TU2.outlet, self.CO.inlet
                         ] + condenser_curve + [self.CO.outlet, self.PU.inlet]
    plot_Ts(SS)
    hold(1)

    title("Reheat Brayton cycle")
    ylabel(unicode(r"T / [°C]"))
    xlabel("s / [kJ/kg/K]")

    extpy.getbrowser().reporter.reportNote("Plotting completed")
    ion()
    show()
Пример #8
0
def air_stream_heat_exchanger_plot(self):
    """Plot T-H diagram of heat transfer in a heater_closed model"""
    import loading
    loading.load_matplotlib(throw=True)
    ioff()
    figure()
    hold(1)
    D = fprops.fprops_fluid(str(self.cd_cold.component.getSymbolValue()))

    n = self.n.getIntValue()
    extpy.getbrowser().reporter.reportNote("Fluid is %s" % D.name)

    # hot side is the air, calculated in the model
    plot_TH( [self.H[i] for i in range(1+int(n))],'r-',\
     Href = (float(self.outlet.h)*float(self.outlet.mdot))\
    )

    plot_TH(pconsth(self.inlet_cold, self.outlet_cold, 50),'b-',
     Href = (float(self.inlet_cold.h)*float(self.inlet_cold.mdot))\
    )

    title(unicode(r"Combined-cycle air-%s heat exchanger" % D.name))
    ylabel(unicode(r"T / [°C]"))
    xlabel("H / [MW]")

    extpy.getbrowser().reporter.reportNote("Plotting completed")
    ion()
    show()
Пример #9
0
def heater_closed_plot(self):
    """Plot T-H diagram of heat transfer in a heater_closed model"""
    import loading
    loading.load_matplotlib(throw=True)
    ioff()
    figure()
    hold(1)
    D = fprops.fprops_fluid(str(self.cd.component.getSymbolValue()))
    HE = self.HE

    extpy.getbrowser().reporter.reportNote("Fluid is %s" % D.name)

    plot_TH(pconsth(HE.inlet_heat, HE.outlet_heat, 50),'r-',
     Href = (float(HE.outlet_heat.h)*float(HE.outlet_heat.mdot))\
    )

    plot_TH(pconsth(HE.inlet, HE.outlet, 50),'b-',
     Href = (float(HE.inlet.h)*float(HE.inlet.mdot))\
    )

    title(unicode(r"Closed feedwater heater with %s" % D.name))
    ylabel(unicode(r"T / [°C]"))
    xlabel("H / [MW]")

    extpy.getbrowser().reporter.reportNote("Plotting completed")
    ion()
    show()
    savefig(os.path.expanduser("~/Desktop/heater_closed.eps"))
Пример #10
0
def cycle_plot_brayton_split_regen(self):
    """Plot T-s diagran for regenerative gas turbine"""
    import loading
    loading.load_matplotlib(throw=True)
    ioff()
    figure()
    hold(1)
    D = fprops.fprops_fluid(str(self.cd.component.getSymbolValue()))
    sat_curve(D)

    # plot gas turbine cycle
    boiler_curve = pconst(self.BO.inlet, self.BO.outlet, 100)
    condenser_curve = pconst(self.CO.inlet, self.CO.outlet, 100)
    SS = [
        self.PU2.inlet, self.PU2.outlet, self.HEL.inlet, self.HEL.outlet,
        self.HEH.inlet, self.HEH.outlet
    ] + boiler_curve + [
        self.TU.inlet, self.TU.outlet, self.HEH.inlet_hot, self.HEH.outlet_hot,
        self.HEL.inlet_hot, self.HEL.outlet_hot, self.CO.inlet, self.CO.outlet,
        self.PU2.inlet
    ]
    plot_Ts(SS)
    hold(1)

    title(unicode(r"Split Regenerative Brayton cycle"))
    ylabel(unicode(r"T / [°C]"))
    xlabel("s / [kJ/kg/K]")

    extpy.getbrowser().reporter.reportNote("Plotting completed")
    ion()
    show()
    savefig(os.path.expanduser("~/Desktop/brayton__split_regen.eps"))
Пример #11
0
def air_stream_heat_exchanger_plot(self):
	"""Plot T-H diagram of heat transfer in a heater_closed model"""
	import loading
	loading.load_matplotlib(throw=True)
	ioff()
	figure()
	hold(1)
	D = fprops.fprops_fluid(str(self.cd_cold.component.getSymbolValue()))

	n = self.n.getIntValue()
	extpy.getbrowser().reporter.reportNote("Fluid is %s" % D.name)	

	# hot side is the air, calculated in the model
	plot_TH( [self.H[i] for i in range(1+int(n))],'r-',\
		Href = (float(self.outlet.h)*float(self.outlet.mdot))\
	)

	plot_TH(pconsth(self.inlet_cold, self.outlet_cold, 50),'b-',
		Href = (float(self.inlet_cold.h)*float(self.inlet_cold.mdot))\
	)

	title(unicode(r"Combined-cycle air-%s heat exchanger" % D.name))
	ylabel(unicode(r"T / [°C]"))
	xlabel("H / [MW]")

	extpy.getbrowser().reporter.reportNote("Plotting completed")
	ion()
	show()
Пример #12
0
def cycle_plot_brayton_reheat_regen_intercool(self):
    """Plot T-s diagram for reheat-regenerative gas turbine"""
    import loading
    loading.load_matplotlib(throw=True)
    ioff()
    figure()
    hold(1)
    D = fprops.fprops_fluid(str(self.cd.component.getSymbolValue()))
    sat_curve(D)

    # add some dots for the points in the cycle
    seq = "CO1.inlet DI2.inlet CO2.inlet RE.inlet BU1.inlet TU1.inlet BU2.inlet TU2.inlet RE.inlet_hot DI1.inlet".split(
        " ")
    lalign = "TU2.inlet RE.inlet_hot BU2.inlet DI1.inlet DI2.inlet CO1.inlet".split(
        " ")
    SS1 = []
    SS1a = []
    for s in seq:
        print "looking at '%s'" % s
        p = reduce(getattr, s.split("."), self)
        SS1.append(p)
        SS1a.append((p, s))
    plot_Ts(SS1, 'bo')

    print "ANNOTATIONS"
    for s in SS1a:
        align = "right"
        if s[1] in lalign:
            align = "left"
        annotate(s[1] + "  ",
                 xy=(float(s[0].s) / 1.e3, float(s[0].T) - 273.15),
                 horizontalalignment=align)

    # plot the cycle with smooth curves
    BU1_curve = pconst(self.BU1.inlet, self.BU1.outlet, 30)
    BU2_curve = pconst(self.BU2.inlet, self.BU2.outlet, 20)
    DI1_curve = pconst(self.DI1.inlet, self.DI1.outlet, 20)
    DI2_curve = pconst(self.DI2.inlet, self.DI2.outlet, 20)
    REH_curve = pconst(self.RE.inlet_hot, self.RE.outlet_hot, 50)
    REL_curve = pconst(self.RE.inlet, self.RE.outlet, 50)

    SS2 = [self.CO1.inlet, self.CO1.outlet] + DI2_curve + [
        self.CO2.inlet, self.CO2.outlet
    ] + REL_curve + BU1_curve + [self.TU1.inlet, self.TU1.outlet
                                 ] + BU2_curve + [
                                     self.TU2.inlet, self.TU2.outlet
                                 ] + REH_curve + DI1_curve + [self.CO1.inlet]
    plot_Ts(SS2)

    title(unicode(r"Reheat Regenerative Brayton cycle with Intercooling"))
    ylabel(unicode(r"T / [°C]"))
    xlabel("s / [kJ/kg/K]")

    extpy.getbrowser().reporter.reportNote("Plotting completed")
    ion()
    show()
Пример #13
0
def pconst(S1, S2, n):
    """Return a set of (T,s) points between two states, with pressure held constant."""
    D = fprops.fprops_fluid(str(S1.cd.component.getSymbolValue()))
    out = []
    hh = linspace(float(S1.h), float(S2.h), n)
    for h in hh:
        res, T, rho = fprops.fprops_solve_ph(float(S1.p), h, 0, D)
        if not res:
            out += [TSPoint(T, fprops.helmholtz_s(T, rho, D))]
    return out
Пример #14
0
def pconst(S1,S2,n):
	"""Return a set of (T,s) points between two states, with pressure held constant."""
	D = fprops.fprops_fluid(str(S1.cd.component.getSymbolValue()))	
	out = []
	hh = linspace(float(S1.h), float(S2.h), n)
	for h in hh:
		res, T, rho = fprops.fprops_solve_ph(float(S1.p), h, 0, D)
		if not res:
			out += [TSPoint(T,fprops.helmholtz_s(T,rho,D))]
	return out
Пример #15
0
def pconsth(S1, S2, n):
    """Return a set of (T,H) points between two states, with pressure constant"""
    D = fprops.fprops_fluid(str(S1.cd.component.getSymbolValue()))
    out = []
    hh = linspace(float(S1.h), float(S2.h), n)
    mdot = float(S1.mdot)
    for h in hh:
        res, T, rho = fprops.fprops_solve_ph(float(S1.p), h, 0, D)
        if not res:
            out += [THPoint(T, h * mdot)]
    return out
Пример #16
0
def pconsth(S1,S2,n):
	"""Return a set of (T,H) points between two states, with pressure constant"""
	D = fprops.fprops_fluid(str(S1.cd.component.getSymbolValue()))	
	out = []
	hh = linspace(float(S1.h), float(S2.h), n)
	mdot = float(S1.mdot)
	for h in hh:
		res, T, rho = fprops.fprops_solve_ph(float(S1.p), h, 0, D)
		if not res:
			out += [THPoint(T,h * mdot)]
	return out
Пример #17
0
def cycle_plot_brayton_reheat_regen_intercool(self):
	"""Plot T-s diagram for reheat-regenerative gas turbine"""
	import loading
	loading.load_matplotlib(throw=True)
	ioff()
	figure()		
	hold(1)
	D = fprops.fprops_fluid(str(self.cd.component.getSymbolValue()))
	sat_curve(D)
	
	# add some dots for the points in the cycle
	seq = "CO1.inlet DI2.inlet CO2.inlet RE.inlet BU1.inlet TU1.inlet BU2.inlet TU2.inlet RE.inlet_hot DI1.inlet".split(" ")
	lalign = "TU2.inlet RE.inlet_hot BU2.inlet DI1.inlet DI2.inlet CO1.inlet".split(" ")
	SS1 = []; SS1a = []
	for s in seq:
		print "looking at '%s'"%s
		p = reduce(getattr,s.split("."),self)
		SS1.append(p)
		SS1a.append((p,s))
	plot_Ts(SS1,'bo')

	print "ANNOTATIONS"
	for s in SS1a:
		align = "right"
		if s[1] in lalign:
			align = "left"
		annotate(s[1]+"  ", xy =(float(s[0].s)/1.e3,float(s[0].T) - 273.15)
			,horizontalalignment=align
		)

	# plot the cycle with smooth curves
	BU1_curve = pconst(self.BU1.inlet, self.BU1.outlet,30)
	BU2_curve = pconst(self.BU2.inlet, self.BU2.outlet,20)
	DI1_curve = pconst(self.DI1.inlet,self.DI1.outlet,20)
	DI2_curve = pconst(self.DI2.inlet,self.DI2.outlet,20)
	REH_curve = pconst(self.RE.inlet_hot,self.RE.outlet_hot,50)
	REL_curve = pconst(self.RE.inlet,self.RE.outlet,50)

	SS2 = [self.CO1.inlet, self.CO1.outlet] + DI2_curve + [self.CO2.inlet, self.CO2.outlet] + REL_curve + BU1_curve + [self.TU1.inlet, self.TU1.outlet] + BU2_curve + [self.TU2.inlet, self.TU2.outlet] + REH_curve + DI1_curve + [self.CO1.inlet]
	plot_Ts(SS2)

	title(unicode(r"Reheat Regenerative Brayton cycle with Intercooling"))
	ylabel(unicode(r"T / [°C]"))
	xlabel("s / [kJ/kg/K]")

	extpy.getbrowser().reporter.reportNote("Plotting completed")
	ion()
	show()
Пример #18
0
def cycle_plot_rankine_regen2(self):
    """Plot T-s diagram for a regenerative Rankine cycle (bleed steam regen)"""
    import loading
    loading.load_matplotlib(throw=True)
    ioff()
    figure()
    hold(1)
    D = fprops.fprops_fluid(str(self.cd.component.getSymbolValue()))
    sat_curve(D)

    boiler_curve = pconst(self.BO.inlet, self.BO.outlet, 100)
    condenser_curve = pconst(self.CO.inlet, self.CO.outlet, 100)

    SS = [self.PU1.inlet, self.PU1.outlet] + \
      pconst(self.HE.inlet, self.HE.outlet, 100) + \
      [self.PU2.inlet, self.PU2.outlet] + \
      boiler_curve + \
      [self.TU1.inlet, self.TU1.outlet, self.TU2.outlet] + \
      condenser_curve + [self.PU1.inlet]

    plot_Ts(SS)
    plot_Ts([
        self.PU1.inlet, self.PU1.outlet, self.HE.inlet, self.HE.outlet,
        self.PU2.inlet, self.PU2.outlet, self.TU1.inlet, self.TU1.outlet,
        self.TU2.outlet, self.PU1.inlet
    ], 'bo')

    # line for the heat exchanger
    plot_Ts(pconst(self.HE.inlet_heat, self.HE.outlet, 100), 'b-')

    title(unicode(r"Regenerative Rankine cycle with %s" % D.name))
    ylabel(unicode(r"T / [°C]"))
    aa = axis()
    axis([aa[0], aa[1], -100, 600])
    xlabel("s / [kJ/kg/K]")

    extpy.getbrowser().reporter.reportNote("Plotting completed")
    ion()
    show()
    savefig(os.path.expanduser("~/Desktop/regen2.eps"))
Пример #19
0
def cycle_plot_rankine_regen2(self):
	"""Plot T-s diagram for a regenerative Rankine cycle (bleed steam regen)"""
	import loading
	loading.load_matplotlib(throw=True)
	ioff()
	figure()
	hold(1)
	D = fprops.fprops_fluid(str(self.cd.component.getSymbolValue()))
	sat_curve(D)

	boiler_curve = pconst(self.BO.inlet, self.BO.outlet,100)
	condenser_curve = pconst(self.CO.inlet,self.CO.outlet,100)

	SS = [self.PU1.inlet, self.PU1.outlet] + \
			pconst(self.HE.inlet, self.HE.outlet, 100) + \
			[self.PU2.inlet, self.PU2.outlet] + \
			boiler_curve + \
			[self.TU1.inlet, self.TU1.outlet, self.TU2.outlet] + \
			condenser_curve + [self.PU1.inlet]

	plot_Ts(SS)
	plot_Ts(
		[self.PU1.inlet, self.PU1.outlet, self.HE.inlet, self.HE.outlet, 
			self.PU2.inlet, self.PU2.outlet, self.TU1.inlet, self.TU1.outlet, 
			self.TU2.outlet, self.PU1.inlet]
		,'bo'
	)

	# line for the heat exchanger
	plot_Ts(pconst(self.HE.inlet_heat, self.HE.outlet,100),'b-')

	title(unicode(r"Regenerative Rankine cycle with %s" % D.name))
	ylabel(unicode(r"T / [°C]"))
	aa = axis(); axis([aa[0],aa[1],-100,600])
	xlabel("s / [kJ/kg/K]")

	extpy.getbrowser().reporter.reportNote("Plotting completed")
	ion()
	show()
	savefig(os.path.expanduser("~/Desktop/regen2.eps"))
Пример #20
0
def regenerator_plot_fprops(self):
	"""Plot T-H diagram of regenerator"""
	import loading; loading.load_matplotlib(throw=True)
	ioff();	figure(); hold(1)
	D = fprops.fprops_fluid(str(self.cd.component.getSymbolValue()))
	extpy.getbrowser().reporter.reportNote("Fluid is %s" % D.name)	

	plot_TH(pconsth(self.inlet_hot, self.outlet_hot, 50),'r-',
		Href = (float(self.outlet_hot.h)*float(self.outlet_hot.mdot))\
	)

	plot_TH(pconsth(self.inlet, self.outlet, 50),'b-',
		Href = (float(self.inlet.h)*float(self.inlet.mdot))\
	)

	title(unicode(r"%s heat exchanger" % D.name))
	ylabel(unicode(r"T / [°C]"))
	xlabel("H / [MW]")

	extpy.getbrowser().reporter.reportNote("Plotting completed")
	ion()
	show()