# Feature request: feedback control

Human influenced systems are subject to 2 kind of controls: open-loop and closed-loop ones (See https://en.wikipedia.org/wiki/Control_theory#Open-loop_and_closed-loop_(feedback)_control).

Here in our model controls, there will be time series of releases or withdrawals of water in some locations in the system. Let's call these releases or this withdrawals "control variables".

Open-loop issue has been already addressed in #5 (closed). Indeed, in this case, control variables can be represented has a predefined time series directly applied as an upstream flow in the lag model. The model can then be run by proceeding each part from upstream to downstream for the entire time series.

For the closed loop so called "feedback control", a control variable at one location in the model depends on data calculated at previous time steps. See the small example below:

If these requested data are upstream then they are available and we can continue to pre-processing the control variable and run the simulation from upstream to downstream for the entire time series. If however, the control variable depends on data calculated downstream in previous time steps, we need to run the entire model time step by time step in order to proceed this feedback.

Running the model time step by time step would lead to a unsustainable computation burden.

One interesting thing is that the hydrological part of the model is not subject to this feedback (There is no feedback on rainfall and evapotranspiration). So we can continue to run the GR models on the entire time series and only the hydraulic part will be subject to the feedback. If we want to refine again the process, we can apply this feedback only on the parts downstream the control variables.

The implementation of such feedback in the model is still to invent. The SIC software (https://sic.g-eau.fr) implements such feedback with paradigms coming from the control theories. If think we should be inspired by these paradigms in order to be able to implement a very generic implementation of feedbacks in the model.