Exemple #1
0
def test_nodes_5():
    sim = Simulation(MODEL_WEIR_SETTING_PATH)
    print("\n\n\nNODES\n")
    J5 = Nodes(sim)["J5"]

    for ind, step in enumerate(sim):
        if ind == 7:
            J5.generated_inflow(544.0)
        if ind > 8:
            assert (J5.lateral_inflow >= 543.9)
            print(J5.lateral_inflow)
    sim.close()
def test_nodes_5():
    sim = Simulation(MODEL_WEIR_SETTING_PATH)
    print("\n\n\nNODES\n")
    J5 = Nodes(sim)["J5"]

    for ind, step in enumerate(sim):
        if ind == 7:
            J5.generated_inflow(544.0)
        if ind > 8:
            assert (J5.lateral_inflow == approx(543.9, rel=UT_PRECISION))
            if ind % 1000 == 0:
                print(J5.lateral_inflow)
    sim.close()
def test_nodes_10():
    with Simulation(MODEL_NODE_INFLOWS_PATH) as sim:
        J1 = Nodes(sim)["J1"]
        outfall = Nodes(sim)["J3"]

        J1.generated_inflow(4)
        #Below Invert test
        outfall.outfall_stage(0)
        for ind, step in enumerate(sim):
            if ind == 1000:
                assert outfall.head >= outfall.invert_elevation
            if ind == 5000:
                outfall.outfall_stage(7)
            if ind == 5001:
                assert outfall.head <= 7.00001
                assert outfall.head >= 6.99999

            if ind == 50000:
                outfall.outfall_stage(13.5)

            if ind == 50001:
                assert outfall.head <= 13.50001
                assert outfall.head >= 13.49999
Exemple #4
0
    psudo_pipe_area = 7.011
    pipe15 = Links(sim)["L2373"]
    pipe16 = Links(sim)["L6497"]
    pipe17 = Links(sim)["L2390"]
    pipe18 = Links(sim)["L2354"]
    tank2 = Nodes(sim)["B2323069"]
    tank2_area = 29.9432
    pump2 = Links(sim)["P2"]
    tank_offset = 1.1

    # Init sim
    count = 1
    on_time = 0
    total_count = 0
    pump_reference_flow = 1  # [m^3/s]
    tank1.generated_inflow(2)
    for idx, step in enumerate(sim):
        # Make sure the system is always supplied with water

        # System identification setup:
        #

        # Outflow pump simple control in operating range:

        if tank2.depth > tank_offset + 1.5:
            pump2.target_setting = 1 * pump_reference_flow
        elif tank2.depth > tank_offset + 1.8:
            pump2.target_setting = 1.3 * pump_reference_flow
        elif tank2.depth < tank_offset + 0.2:
            pump2.target_setting = 0
    node3 = Nodes(sim)["N3"]
    pipe3 = Links(sim)["P3"]
    pipe4 = Links(sim)["P4"]
    tank2 = Nodes(sim)["T2"]

    # Init sim
    tank_area = 200
    count = 1
    on_time = 0
    total_count = 0
    pump_reference_flow = 1 / 5
    lateral_inflow = 1 / 15
    for idx, step in enumerate(sim):
        # Make sure the system is always supplied with water
        pump3.target_setting = 5
        node3.generated_inflow(lateral_inflow)
        # System identification setup:

        if tank2.depth > 0.7:
            pump2.target_setting = 1 * pump_reference_flow
        elif tank2.depth > 0.9:
            pump2.target_setting = 1.3 * pump_reference_flow
        elif tank2.depth < 0.1:
            pump2.target_setting = 0

        # Create simple random controller
        if count > on_time:
            count = 0
            on_time = random.randint(5, 15)
            pump1.target_setting = random.uniform(0, 1) * pump_reference_flow
        # if tank2.depth > 0.9: