Commit 7f8ece8d authored by Dorchies David's avatar Dorchies David
Browse files

fix(RunModel_Lag): bugs on StateEnd

- Add commentaries with debug messages

Fix #103, #104
parent 42f5d51c
......@@ -75,6 +75,7 @@ RunModel_Lag <- function(InputsModel, RunOptions, Param) {
rep(0, floor(PT[x] + 1))
})
}
#message("Initstates: ",paste(IniStates, collapse = ", "))
for (upstream_basin in seq_len(NbUpBasins)) {
Qupstream <- c(IniStates[[upstream_basin]],
......@@ -96,11 +97,14 @@ RunModel_Lag <- function(InputsModel, RunOptions, Param) {
}
# Convert back Qsim to mm
OutputsModel$Qsim <- OutputsModel$Qsim / sum(InputsModel$BasinAreas, na.rm = TRUE) / 1e3
#message("Qsim: ",paste(OutputsModel$Qsim, collapse = ", "))
if ("StateEnd" %in% RunOptions$Outputs_Sim) {
OutputsModel$StateEnd$SD <- lapply(seq(NbUpBasins), function(x) {
Qupstream[(LengthTs - floor(PT[x])):LengthTs]
lastTS <- RunOptions$IndPeriod_Run[length(RunOptions$IndPeriod_Run)]
InputsModel$Qupstream[(lastTS - floor(PT[x])):lastTS, x]
})
#message("StateEnd: ",paste(OutputsModel$StateEnd$SD, collapse = ", "))
}
return(OutputsModel)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment