Skip to content

Commit

Permalink
Add possibility to enable/disable candidates in candidates.ini
Browse files Browse the repository at this point in the history
  • Loading branch information
baptsegu committed Sep 28, 2017
1 parent 3a9158f commit c7a9079
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions R/read_candidates.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ read_candidates <- function(file, opts = antaresRead::simOptions())
candidate <- list()
candidate$id <- candidate_id[pr]
candidate$name <- NA
candidate$enable <- TRUE
candidate$candidate_type <- "investment"
candidate$investment_type <- "generation"
candidate$link <- NA
Expand Down Expand Up @@ -78,6 +79,11 @@ read_candidates <- function(file, opts = antaresRead::simOptions())
option_value <- sub(pattern = " ", replacement = "_", option_value)
candidate$name <- option_value
}
else if (option_name == "enable")
{
assertthat::assert_that(option_value %in% c("true", "false"))
candidate$enable <- as.logical(option_value)
}
else if (option_name == "candidate-type")
{
assertthat::assert_that(option_value %in% c("investment", "decommissioning"))
Expand Down Expand Up @@ -158,9 +164,12 @@ read_candidates <- function(file, opts = antaresRead::simOptions())
assertthat::assert_that(!is.na(candidate$link))
assertthat::assert_that(candidate$link %in% opts$linkList)

# update candidate list
inv[[i]] <- candidate
i <- i + 1
# update candidate list if the candidate is enabled
if(candidate$enable)
{
inv[[i]] <- candidate
i <- i + 1
}
}

# check that candidates names are unique
Expand Down

0 comments on commit c7a9079

Please sign in to comment.