Esempio n. 1
0
def run_simple_heat_pump_model():
    nw = Network(['NH3'], T_unit='C', p_unit='bar', h_unit='kJ / kg')
    nw.set_attr(iterinfo=False)
    cp = Compressor('compressor')
    cc = CycleCloser('cycle_closer')
    cd = HeatExchangerSimple('condenser')
    va = Valve('expansion valve')
    ev = HeatExchangerSimple('evaporator')

    cc_cd = Connection(cc, 'out1', cd, 'in1')
    cd_va = Connection(cd, 'out1', va, 'in1')
    va_ev = Connection(va, 'out1', ev, 'in1')
    ev_cp = Connection(ev, 'out1', cp, 'in1')
    cp_cc = Connection(cp, 'out1', cc, 'in1')

    nw.add_conns(cc_cd, cd_va, va_ev, ev_cp, cp_cc)

    cd.set_attr(pr=0.95, Q=-1e6)
    ev.set_attr(pr=0.9)
    cp.set_attr(eta_s=0.9)

    cc_cd.set_attr(fluid={'NH3': 1})
    cd_va.set_attr(Td_bp=-5, T=85)
    ev_cp.set_attr(Td_bp=5, T=15)
    nw.solve('design')

    result_dict = {}
    result_dict.update({
        cp.label: cp.get_plotting_data()[1]
        for cp in nw.comps.index if cp.get_plotting_data() is not None
    })

    return result_dict
Esempio n. 2
0
# %% design calculation

path = 'R410A'
nw.solve('design')
# alternatively use:
# nw.solve('design', init_path=path)
print("\n##### DESIGN CALCULATION #####\n")
nw.print_results()
nw.save(path)

# %% plot h_log(p) diagram

# generate plotting data
result_dict = {}
result_dict.update({ev.label: ev.get_plotting_data()[2]})
result_dict.update({cp.label: cp.get_plotting_data()[1]})
result_dict.update({cd.label: cd.get_plotting_data()[1]})
result_dict.update({va.label: va.get_plotting_data()[1]})

# create plot
diagram = FluidPropertyDiagram('R410A')
diagram.set_unit_system(T='°C', p='bar', h='kJ/kg')

for key, data in result_dict.items():
    result_dict[key]['datapoints'] = diagram.calc_individual_isoline(**data)

diagram.set_limits(x_min=200, x_max=500, y_min=0.8e1, y_max=0.8e2)
diagram.calc_isolines()
diagram.draw_isolines('logph')

for key in result_dict.keys():