diff --git a/R/CreateInputsModel.GRiwrm.R b/R/CreateInputsModel.GRiwrm.R index 04ab3f8dab0185524b8849d5e8c4b92e8dc9f990..9f28b80e6d56a27277cbc438cec9ef4514ac15c7 100644 --- a/R/CreateInputsModel.GRiwrm.R +++ b/R/CreateInputsModel.GRiwrm.R @@ -26,6 +26,8 @@ CreateInputsModel.GRiwrm <- function(x, DatesR, Precip, PotEvap, Qobs, ...) { #' Create an empty InputsModel object for **airGRiwrm** nodes #' +#' @param griwrm a `GRiwrm` object (See [GRiwrm]) +#' #' @return \emph{GRiwrmInputsModel} empty object CreateEmptyGRiwrmInputsModel <- function(griwrm) { InputsModel <- list() diff --git a/R/RunModel.SD.R b/R/RunModel.SD.R index dfff38feefe01349a170c8c2ca367058ae2bb382..284a85a2533ee48b74ce291303bb37f9d23c9661 100644 --- a/R/RunModel.SD.R +++ b/R/RunModel.SD.R @@ -2,7 +2,7 @@ #' #' @inheritParams airGR::RunModel_Lag #' @param x `InputsModel` used as `InputsModel` parameter for [airGR::RunModel_Lag] -#' @param QSimDown a [numeric] corresponding to the runoff of the sub-basin (Typically the `Qsim` outputs of the GR model) +#' @param QsimDown a [numeric] corresponding to the runoff of the sub-basin (Typically the `Qsim` outputs of the GR model) #' @param ... further arguments passed to or from other methods #' #' @return `OutputsModel` object. See [airGR::RunModel_Lag] diff --git a/R/RunModel.Supervisor.R b/R/RunModel.Supervisor.R index 6a10e2bec83f977eca69adeb7ee868964540727b..6500f12174c2bd89764e79b1dd09bf6163a7e511 100644 --- a/R/RunModel.Supervisor.R +++ b/R/RunModel.Supervisor.R @@ -63,7 +63,7 @@ RunModel.Supervisor <- function(x, RunOptions, Param, ...) { Qsim[[id]][x$ts.index] <- x$OutputsModel[[id]]$Qsim # Routing Qsim to the downstream node if(!is.na(x$InputsModel[[id]]$down)) { - x$InputsModel[[x$InputsModel[[id]]$down]]$Qupstream[iTS, i] <- + x$InputsModel[[x$InputsModel[[id]]$down]]$Qupstream[iTS, id] <- x$OutputsModel[[id]]$Qsim } } diff --git a/R/RunModel_Lag.R b/R/RunModel_Lag.R index 398478a045c1fa0634ac6a4fcb1e2a0a046105a5..b246b1f4599f9b126fff7d82f1a808e2be0ce659 100644 --- a/R/RunModel_Lag.R +++ b/R/RunModel_Lag.R @@ -101,8 +101,8 @@ RunModel_Lag <- function(InputsModel, RunOptions, Param) { if ("StateEnd" %in% RunOptions$Outputs_Sim) { OutputsModel$StateEnd$SD <- lapply(seq(NbUpBasins), function(x) { - LengthTs <- tail(RunOptions$IndPeriod_Run,1) - InputsModel$Qupstream[(LengthTs - floor(PT[x])):LengthTs, x] + lastTS <- RunOptions$IndPeriod_Run[length(RunOptions$IndPeriod_Run)] + InputsModel$Qupstream[(lastTS - floor(PT[x])):lastTS, x] }) #message("StateEnd: ",paste(OutputsModel$StateEnd$SD, collapse = ", ")) } diff --git a/R/utils.R b/R/utils.R index 5f5650640d91b4b7127bfe621cc23427f6f607d0..7d3e0cfcf9a82346b6ebc076664375c9e7ce2741 100644 --- a/R/utils.R +++ b/R/utils.R @@ -87,6 +87,7 @@ doSupervision <- function(supervisor) { #' #' Stop the execution if an error is detected. #' +#' @param InputsModel a `GRiwrmInputsModel` object (See [CreateInputsModel.GRiwrm]) #' @param RunOptions a `GRiwrmRunOptions` object (See [CreateRunOptions.GRiwrmInputsModel]) #' @param Param a [list] of [numeric] containing model parameters of each node of the network #'