## Feature: Local Rule

The issue #19 (closed) addresses central regulation on the system with a so-called supervisor and controllers. A controller can pick measured flows anywhere in the system and coordinate flow influences anywhere. While Supervisor and Controllers can simulate whatever artificial influence that can be imagine, this method has several pitfalls:

- the measured flows used for calculating controller actions are the one calculated at the previous time step. If the delay between the measured points and the action points is less than one simulation time step, this can lead to inaccurate regulation.
- it is impossible to calibrate the model with a supervision as the whole network is run time step by time step and a calibration requires to be run sub-basin by sub-basin from upstream to downstream on the entire run period.
- The time step by time step run can lead to very long computation time.

In contrast, if we imagine that a node can be a model running local rules. This local rules model would be able to pick simulated flow time series from other nodes and calculate a flow time series for the node where it is implemented.

If the simulated flow time series is picked from an upper node, then the data is available and the process looks like an open-loop regulation.

Otherwise, if the simulated flow time series is picked from a lower node, then the data is not available because this flow is simulated after the current node. To cope with this issue, we can make iterations over all the node's loop. At first iteration, the local rule is calculated with a default flow time series at the lower node, and then the lower node is simulated. At the next iterations, the lower node simulate a flow taking into account the upper node with the local rule. We then stop the iterations when the lower flow time series converge to stabilised values.

Here below a scheme comparing the two paradigms of regulation: central supervision and local rules:

With the local rules concept, it is now possible to calibrate a model containing nodes with local rules (calibration with dynamically influenced flows) because each node is run for a entire run period which allows to do calibration node by node from upstream to downstream. And moreover, we can imagine that a local rule depends on free parameters that can also be calibrated in the whole process (needs more conceptual investigations).