States handling on Lag model
Analysis of the existing situation
In the lag model, upstream flows are added to the downstream flow with a delay. At the beginning of the simulation during this delay time, zero are currently added downstream because upstream flow before the beginning of the simulation are not known. This period can be regarded as a warming period with initial zero flow upstream which lasts few days (Few time steps for a daily time step model).
The package airGRiwrm will need to run the model time step by time step without warming period (See in-wop/airGRiwrm#19 (closed)). So we need to be able to handle states of the Lag model both as initial states and states at the end of the simulation.
IniStatesobject embedded in
RunOptionsshould store a list of vector, each vector containing the flows during the delay time of the upstream flow.
OutputsModelobject should contains this same list in the
Lag model would not be the only hydraulic propagation model, so the implementation needs to be generic for other hydraulic propagation models.
Proposition of realisation
SD item in both
IniStates object and
StateEnd item of
OutputsModel. Its contents will be model dependant. For the lag model it consists in a list ordered by the upstream connections and each item of the list will store the flow for the time steps during the delay time of each upstream flow.
createIniStateswith a new parameter
NULLand copy this parameter in the
CreateRunOptionsfor handling the new
RunModelLagto use the hydraulic initial states provided by
RunOptionsinstead of zeros
RunModelLagto add hydraulic states at the end of the simulation in