Creation of a Supervisor for handling regulation in a model

CreateSupervisor(InputsModel, TimeStep = 1L)



[object of type GRiwrmInputsModel] inputs of the model


numeric number of time steps between each supervision


A Supervisor object which is an environment containing all the necessary variables to run a supervised simulation, such as:

  • DatesR POSIXct: vector of date from InputsModel

  • InputsModel: a copy of InputsModel provided by CreateInputsModel.GRiwrm

  • griwrm: a copy of griwrm provided by CreateGRiwrm

  • Controllers list: list of the controllers used in the supervised simulation (See CreateController)

  • some internal state variables updated during simulation (ts.index, ts.previous,, ts.index0,


nodes <- Severn$BasinsInfo[, c("gauge_id", "downstream_id", "distance_downstream", "area")]
nodes$model <- "RunModel_GR4J"
griwrm <- CreateGRiwrm(nodes,
                 list(id = "gauge_id",
                      down = "downstream_id",
                      length = "distance_downstream"))
BasinsObs <- Severn$BasinsObs
DatesR <- BasinsObs[[1]]$DatesR
PrecipTot <- cbind(sapply(BasinsObs, function(x) {x$precipitation}))
PotEvapTot <- cbind(sapply(BasinsObs, function(x) {x$peti}))
Qobs <- cbind(sapply(BasinsObs, function(x) {x$discharge_spec}))
Precip <- ConvertMeteoSD(griwrm, PrecipTot)
PotEvap <- ConvertMeteoSD(griwrm, PotEvapTot)
InputsModel <- CreateInputsModel(griwrm, DatesR, Precip, PotEvap, Qobs)
#> CreateInputsModel.GRiwrm: Treating sub-basin 54095...
#> CreateInputsModel.GRiwrm: Treating sub-basin 54002...
#> CreateInputsModel.GRiwrm: Treating sub-basin 54029...
#> CreateInputsModel.GRiwrm: Treating sub-basin 54001...
#> CreateInputsModel.GRiwrm: Treating sub-basin 54032...
#> CreateInputsModel.GRiwrm: Treating sub-basin 54057...
#> Warning: 'Qupstream' contains NA values: model outputs will contain NAs
sv <- CreateSupervisor(InputsModel)