Skip to content

Commit

Permalink
Factorize condition for check mingen
Browse files Browse the repository at this point in the history
  • Loading branch information
kemihak committed Sep 4, 2023
1 parent 8a1f7db commit 260daa5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions R/writeInputTS.R
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
#'
#' }
writeInputTS <- function(data,
type = c("load", "hydroROR", "hydroSTOR", "wind", "solar", "tsLink", "mingen"),
type = c("load", "hydroROR", "hydroSTOR", "mingen", "wind", "solar", "tsLink"),
area = NULL,
link = NULL,
overwrite = TRUE,
Expand Down Expand Up @@ -246,8 +246,9 @@ writeInputTS <- function(data,
call. = FALSE
)

should_check_mingen_data <- opts$antaresVersion >= 860 & type %in% c("mingen", "hydroSTOR")
# v860 - save the original data
if (opts$antaresVersion >= 860 & type %in% c("mingen", "hydroSTOR")) {
if (should_check_mingen_data) {
filename <- switch(type,
"mingen" = "mingen.txt",
"hydroSTOR" = "mod.txt"
Expand All @@ -272,7 +273,7 @@ writeInputTS <- function(data,
)

# v860 - rollback to original data if necessary
if (opts$antaresVersion >= 860 & type %in% c("mingen", "hydroSTOR")) {
if (should_check_mingen_data) {
comp_mingen_vs_hydro_storage <- list("check" = TRUE, "msg" = "")
comp_mingen_vs_maxpower <- list("check" = TRUE, "msg" = "")
if (type == "mingen") {
Expand Down

0 comments on commit 260daa5

Please sign in to comment.