Example #1
0
    def Ph_plot_tests():
        from CoolProp.Plots import Ph
        Ph(fluid_ref, show=True)

        from matplotlib import pyplot
        fig = pyplot.figure(2)
        ax = fig.gca()
        Ph(fluid_ref, show=True, axis=ax)

        Ph(fluid_ref, show=True, Tmin=200, Tmax=300)
Example #2
0
Ncols = 10
Nrows = 10
for parameter in ['D', 'T', 'S', 'C']:
    fig = plt.figure(figsize=(40, 40))
    for Index, fluid in enumerate(sorted(CoolProp.__fluids__)):
        print(fluid)
        ax = fig.add_subplot(Ncols, Nrows, Index + 1)
        ax.set_title(fluid)
        values = check(fluid=fluid, param=parameter)
        if len(values) == 0:
            continue
        h, p, values_withTTSE, values_noTTSE = zip(*values)
        ax = fig.add_subplot(Ncols, Nrows, Index + 1)
        CP.disable_TTSE_LUT(fluid)
        Ph(fluid)
        CP.enable_TTSE_LUT(fluid)
        error = (np.array(values_withTTSE) / np.array(values_noTTSE) - 1) * 100
        plt.scatter(h,
                    p,
                    s=8,
                    c=np.abs(error),
                    norm=LogNorm(),
                    edgecolor='none',
                    vmin=1e-16,
                    vmax=10)
        plt.gca().set_yscale('log')
        plt.colorbar()

    plt.savefig(parameter + '_TTSE.png', dpi=200)
    plt.tight_layout()
Example #3
0
File: tests.py Project: ibell/achp
    Qmax = B.DetermineQmax()

    ph = [B.State_h_inlet.p() / 1000 for i in range(len(B.EnthalpyList_h))]
    pc = [B.State_c_inlet.p() / 1000 for i in range(len(B.EnthalpyList_h))]
    hh = np.array([h / 1000 for h in B.EnthalpyList_h])
    hc = np.array([h / 1000 for h in B.EnthalpyList_c])
    hhnorm = B.mdot_h * (np.array(hh) - hh[0]) / Qmax * 1000
    hcnorm = B.mdot_c * (np.array(hc) - hc[0]) / Qmax * 1000
    Th = [T for T in B.TemperatureList_h]
    Tc = [T for T in B.TemperatureList_c]

    ax1 = fig.add_subplot(121)
    ax2 = fig.add_subplot(122)
    ax1.set_yscale('log')

    Ph('Propane', axis=ax1)
    ax1.plot(hh, ph, 'ro-')
    ax1.plot(hc, pc, 'bo-')
    ax1.set_title('')
    ax1.set_ylim(ymin=100)

    ax2.plot(hcnorm, Tc, 'bo-')
    ax2.plot(hhnorm, Th, 'ro-')
    ax2.set_xlabel('Norm. length')
    ax2.set_ylabel('Temperature[K]')
    ax2.set_xlim(0, 1)

    plt.suptitle('$\dot m_h/\dot m_c = $ {m:0.3}'.format(m=mdot_ratio_h_c))

    plt.tight_layout()
    plt.savefig('frame_{s:08d}'.format(s=int(mdot_ratio_h_c * 1000)) + '.png')
Example #4
0
    print('x9',x9,)
    print('Qcond',(mdot+mdot_inj)*(h[4]-h[5]),'T4',T[4]-273.15)
    print(mdot,mdot+mdot_inj)
    f=3500/60.
    eta_v=0.7
    print('Vdisp1: ',mdot/(rho[1]*f*eta_v)*1e6,'cm^3')
    print('Vdisp2: ',(mdot+mdot_inj)/(rho[1]*f*eta_v)*1e6,'cm^3')
    return COP

if __name__=='__main__':
    from CoolProp.Plots import Ph,Ts

    Ref='R290'
    fig=matplotlib.pyplot.figure(figsize=(4,3))
    ax=fig.add_axes((0.15,0.15,0.8,0.8))
    Ph(Ref,Tmin=273.15-30,hbounds=[0,600],axis=ax)
    COP=TwoStage('Propane',10000,273.15-5,273.15+43.3,5,7,0.7,0.3,15+273.15,3,prints = True)
    matplotlib.pyplot.show()

    Ref='R290'
    fig=matplotlib.pyplot.figure(figsize=(4,3))
    ax=fig.add_axes((0.15,0.15,0.8,0.8))
    Ph(Ref,Tmin=273.15-30,hbounds=[0,600],axis=ax)
    COP=SimpleCycle(Ref,273.15-5,273.15+45,5,7,0.7,Ts_Ph='Ph')
    matplotlib.pyplot.show()

    Ref='R410A'
    fig=matplotlib.pyplot.figure(figsize=(4,3))
    ax=fig.add_axes((0.15,0.15,0.8,0.8))
    Ts(Ref,Tmin=273.15-100,sbounds=[0,600],axis=ax)
    COP=SimpleCycle(Ref,273.15-5,273.15+45,5,7,0.7,Ts_Ph='Ts')
Example #5
0
import matplotlib.pyplot as plt
from CoolProp.Plots import Ph
from CoolProp.Plots.SimpleCycles import SimpleCycle

fig = plt.figure(figsize=(6, 1))
ax = fig.add_axes((0, 0, 1, 1))
ax.set_xlim(0, 6)
ax.set_ylim(0, 2)
plt.text(3, 1, 'CoolProp', size=50, name='Times', ha='center', va='center')
ax.axis('off')

ax2 = fig.add_axes((0, 0, 0.3, 1))
Ph('R410A', lw=2, color='white')
SimpleCycle(Ref='R410A', Te=280, Tc=310, DTsh=5, DTsc=5, eta_a=0.7, Ts_Ph='Ph', axis=ax2, lw=2, color='b')
ax2.set_xlim(-6, 600)
ax2.set_ylim(-1000, 6000)
ax2.axis('off')
plt.draw()
plt.savefig('_static/header.png', transparent=True)
plt.show()