Esempio n. 1
0
                    id='consolidated')

unconsolidated = Unit(layers=[
    [upper_splitter],
    [snow, upper_transparent],
    [upper_junction],
    [unsaturated],
    [lower_splitter],
    [slow, lag_fun],
    [lower_transparent, fast],
    [lower_junction],
],
                      id='unconsolidated')

andelfingen = Node(units=[consolidated, unconsolidated],
                   weights=[0.24, 0.76],
                   area=403.3,
                   id='andelfingen')

appenzell = Node(units=[consolidated, unconsolidated],
                 weights=[0.92, 0.08],
                 area=74.4,
                 id='appenzell')

frauenfeld = Node(units=[consolidated, unconsolidated],
                  weights=[0.49, 0.51],
                  area=134.4,
                  id='frauenfeld')

halden = Node(units=[consolidated, unconsolidated],
              weights=[0.34, 0.66],
              area=314.3,
Esempio n. 2
0
#%% Run Node

# Reset states of Unit1
unit_1.reset_states()
unit_1.set_states({'unit-1_lag-fun_lag': None})  # Remove after new build

# Create second unit
unit_2 = Unit(
    layers=[[reservoir]],
    id='unit-2'
)

# Put units together in a node
node_1 = Node(
    units=[unit_1, unit_2],
    weights=[0.7, 0.3],
    area=10.0,
    id='node-1'
)

node_1.set_timestep(1.0)
node_1.set_input([precipitation])

# Solve the node
output = node_1.get_output()[0]

output_unit_1 = node_1.call_internal(id='unit-1', method='get_output', solve=False)[0]
output_unit_2 = node_1.call_internal(id='unit-2', method='get_output', solve=False)[0]

# Plotting
fig, ax = plt.subplots(3, 1, sharex=True, figsize=(10, 9))
Esempio n. 3
0
    def _init_model(self, solver):

        if solver == 'numba':
            solver = PegasusNumba()
            num_app = ImplicitEulerNumba(root_finder=solver)
        elif solver == 'python':
            solver = PegasusPython()
            num_app = ImplicitEulerPython(root_finder=solver)

        # Define HRU 1 (40%)
        fr = PowerReservoir(parameters={
            'k': 0.01,
            'alpha': 2.5
        },
                            states={'S0': 0.0},
                            approximation=num_app,
                            id='FR')

        h1 = Unit(layers=[[fr]], id='H1')

        # Define HRU 2 (60%)
        fr = PowerReservoir(parameters={
            'k': 0.01,
            'alpha': 2.5
        },
                            states={'S0': 0.0},
                            approximation=num_app,
                            id='FR')

        sr = PowerReservoir(parameters={
            'k': 1e-4,
            'alpha': 1.0
        },
                            states={'S0': 0.0},
                            approximation=num_app,
                            id='SR')

        ur = UnsaturatedReservoir(parameters={
            'Smax': 50.0,
            'Ce': 1.5,
            'm': 0.01,
            'beta': 1.5,
        },
                                  states={
                                      'S0': 0.2 * 50.0,
                                      'PET': None
                                  },
                                  approximation=num_app,
                                  id='UR')

        s = Splitter(weight=[[0.3], [0.7]], direction=[[0], [0]], id='S')

        j = Junction(direction=[[0, 0]], id='J')

        h2 = Unit(layers=[[ur], [s], [fr, sr], [j]], id='H2')

        # Define the catchment
        cat = Node(units=[h1, h2], weights=[0.4, 0.6], area=1.0, id='Cat')

        cat.set_timestep(1.0)
        self._model = cat