Esempio n. 1
0
def test_include_branches():
    net = nw.gas_versatility()

    mg = top.create_nxgraph(net,
                            include_pipes=False,
                            include_valves=False,
                            include_pumps=False)
    assert len(mg.nodes()) == len(net.junction)
    assert len(mg.edges()) == 0

    mg = top.create_nxgraph(net,
                            include_pipes=True,
                            include_valves=False,
                            include_pumps=False)
    assert len(mg.nodes()) == len(net.junction)
    assert len(mg.edges()) == len(net.pipe)

    mg = top.create_nxgraph(net,
                            include_pipes=True,
                            include_valves=True,
                            include_pumps=False)
    assert len(mg.nodes()) == len(net.junction)
    assert len(mg.edges()) == len(net.pipe) + len(net.valve)

    mg = top.create_nxgraph(net,
                            include_pipes=True,
                            include_valves=True,
                            include_pumps=True)
    assert len(mg.nodes()) == len(net.junction)
    assert len(mg.edges()) == len(net.pipe) + len(net.valve) + len(net.pump)
Esempio n. 2
0
def test_time_series_default_ow():
    """

    :return:
    :rtype:
    """
    net = nw.gas_versatility()
    net = _preparte_grid(net)
    time_steps = range(25)
    ow = get_default_output_writer_ppipe(net, time_steps)
    run_timeseries_ppipe(net, time_steps, output_writer=ow)
    _compare_results(ow)
Esempio n. 3
0
def test_time_series():
    """

    :return:
    :rtype:
    """
    net = nw.gas_versatility()
    net = _preparte_grid(net)
    time_steps = range(25)
    ow = _output_writer(net, time_steps)  # , path=os.path.join(ppipe.pp_dir, 'results'))
    run_timeseries_ppipe(net, time_steps, output_writer=ow)
    _compare_results(ow)
Esempio n. 4
0
def test_time_series_default_ow():
    """

    :return:
    :rtype:
    """
    net = nw.gas_versatility()
    _prepare_grid(net)
    time_steps = range(25)
    init_default_outputwriter(net, time_steps)
    run_timeseries(net, time_steps)
    ow = net.output_writer.iat[0, 0]
    _compare_results(ow)
Esempio n. 5
0
def test_time_series():
    """

    :return:
    :rtype:
    """
    net = nw.gas_versatility()
    _prepare_grid(net)
    time_steps = range(25)
    # _output_writer(net, time_steps)  # , path=os.path.join(ppipe.pp_dir, 'results'))
    _output_writer(net, time_steps, ow_path=tempfile.gettempdir())
    run_timeseries(net, time_steps)
    ow = net.output_writer.iat[0, 0]
    _compare_results(ow)