Example #1
0
def demo_generate_ph_Diagramm(path=None, precision=1.0):
    '''Generate a p(h) Diagramm showing the Saturation Line'''
    steamTable = XSteam(XSteam.UNIT_SYSTEM_MKS)
    p_krit = steamTable.criticalPressure(
    ) - 0.0001  # minus 0.0001 or else hL_V returns NaN
    h_krit = steamTable.hL_p(p_krit)

    p = np.arange(0.0, 1000, precision)
    p2 = np.arange(0.5, p_krit, precision)
    vaporFrac = np.arange(0.1, 1.0, 0.1)
    h = np.arange(200.0, 4500.0, 100.0)
    rho = np.arange(1, 15.0, precision * 2)

    nph_px = np.frompyfunc(steamTable.h_px, 2, 1)
    nph_pt = np.frompyfunc(steamTable.h_pt, 2, 1)
    nphL_p = np.frompyfunc(steamTable.hL_p, 1, 1)
    nphV_p = np.frompyfunc(steamTable.hV_p, 1, 1)
    npp_hrho = np.frompyfunc(steamTable.p_hrho, 2, 1)

    # Siede und Taulinie
    hL = nphL_p(p)
    hV = nphV_p(p)

    # Dampfgehalt
    for vf in vaporFrac:
        h_px = nph_px(p2, vf)
        line, = pyplot.plot(h_px, p2)
        pyplot.setp(line, linewidth=1, color='g')

    # Temperatur
    for temp in range(0, 900, 30):
        h_pt = nph_pt(p, temp)
        line, = pyplot.plot(h_pt, p)
        pyplot.setp(line, linewidth=1, color='r')

    # Dichte
    for r in rho:
        p_hrho = npp_hrho(h, r)
        line, = pyplot.plot(h, p_hrho)
        pyplot.setp(line, linewidth=1, color='y')

    # Kritischer Punkt
    pyplot.plot([h_krit], [p_krit], marker='s', mfc='k', ms=8)

    line1, = pyplot.plot(hL, p)
    line2, = pyplot.plot(hV, p)
    pyplot.xlabel("h in [kJ/kg]")
    pyplot.ylabel("p in [bar]")
    pyplot.setp(line1, linewidth=2, color='b')
    pyplot.setp(line2, linewidth=2, color='r')
    pyplot.yscale('log')
    pyplot.grid()

    if path == None:
        pyplot.show()
    else:
        pyplot.savefig(path, bbox_inches='tight')
Example #2
0
def demo_generate_ph_diagramm(path=None, precision=1.0):
    """Generate a p(h) Diagram showing the Saturation Line"""
    steam_table = XSteam(XSteam.UNIT_SYSTEM_MKS)
    p_krit = (steam_table.criticalPressure() - 0.0001
              )  # minus 0.0001 or else hL_V returns NaN
    h_krit = steam_table.hL_p(p_krit)
    p = np.arange(0.0, 1000, precision)
    p2 = np.arange(0.5, p_krit, precision)
    vapor_fraction = np.arange(0.1, 1.0, 0.1)
    h = np.arange(200.0, 4500.0, 100.0)
    rho = np.arange(1, 15.0, precision * 2)
    nph_px = np.frompyfunc(steam_table.h_px, 2, 1)
    nph_pt = np.frompyfunc(steam_table.h_pt, 2, 1)
    nphL_p = np.frompyfunc(steam_table.hL_p, 1, 1)
    nphV_p = np.frompyfunc(steam_table.hV_p, 1, 1)
    npp_hrho = np.frompyfunc(steam_table.p_hrho, 2, 1)

    # boiling and dew lines
    hL = nphL_p(p)
    hV = nphV_p(p)

    # vapor fraction
    for vf in vapor_fraction:
        h_px = nph_px(p2, vf)
        pyplot.plot(h_px, p2, linewidth=1, color="g")

    # temperature
    for temp in range(0, 900, 30):
        h_pt = nph_pt(p, temp)
        pyplot.plot(h_pt, p, linewidth=1, color="r")

    # density
    for r in rho:
        p_hrho = npp_hrho(h, r)
        pyplot.plot(h, p_hrho, linewidth=1, color="y")

    # critical point
    pyplot.plot([h_krit], [p_krit], marker="s", mfc="k", ms=8)
    (line1, ) = pyplot.plot(hL, p, linewidth=2, color="b")
    (line2, ) = pyplot.plot(hV, p, linewidth=2, color="r")

    pyplot.xlabel("h in [kJ/kg]")
    pyplot.ylabel("p in [bar]")
    pyplot.yscale("log")
    pyplot.grid()
    if path is None:
        pyplot.show()
    else:
        pyplot.savefig(path, bbox_inches="tight")
Example #3
0
def demo_generate_ph_Diagramm(path=None, precision=1.0):
    '''Generate a p(h) Diagramm showing the Saturation Line'''
    steamTable = XSteam(XSteam.UNIT_SYSTEM_MKS)
    p_krit = steamTable.criticalPressure() - 0.0001  # minus 0.0001 or else hL_V returns NaN
    h_krit = steamTable.hL_p(p_krit)
    p = np.arange(0.0, 1000, precision)
    p2 = np.arange(0.5, p_krit, precision)
    vaporFrac = np.arange(0.1, 1.0, 0.1)
    h = np.arange(200.0, 4500.0, 100.0)
    rho = np.arange(1, 15.0, precision * 2)
    nph_px = np.frompyfunc(steamTable.h_px, 2, 1)
    nph_pt = np.frompyfunc(steamTable.h_pt, 2, 1)
    nphL_p = np.frompyfunc(steamTable.hL_p, 1, 1)
    nphV_p = np.frompyfunc(steamTable.hV_p, 1, 1)
    npp_hrho = np.frompyfunc(steamTable.p_hrho, 2, 1)
    # Siede und Taulinie
    hL = nphL_p(p)
    hV = nphV_p(p)
    # Dampfgehalt
    for vf in vaporFrac:
        h_px = nph_px(p2, vf)
        line, = pyplot.plot(h_px, p2)
        pyplot.setp(line, linewidth=1, color='g')
    # Temperatur
    for temp in range(0, 900, 30):
        h_pt = nph_pt(p, temp)
        line, = pyplot.plot(h_pt, p)
        pyplot.setp(line, linewidth=1, color='r')
    # Dichte
    for r in rho:
        p_hrho = npp_hrho(h, r)
        line, = pyplot.plot(h, p_hrho)
        pyplot.setp(line, linewidth=1, color='y')
    # Kritischer Punkt
    pyplot.plot([h_krit], [p_krit], marker='s', mfc='k', ms=8)
    line1, = pyplot.plot(hL, p)
    line2, = pyplot.plot(hV, p)
    pyplot.xlabel("h in [kJ/kg]")
    pyplot.ylabel("p in [bar]")
    pyplot.setp(line1, linewidth=2, color='b')
    pyplot.setp(line2, linewidth=2, color='r')
    pyplot.yscale('log')
    pyplot.grid()
    if path is None:
        pyplot.show()
    else:
        pyplot.savefig(path, bbox_inches='tight')