-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add unique key to simulation name + bugfix on benders_check
- Loading branch information
Showing
2 changed files
with
14 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,36 @@ | ||
|
||
#' Check that the ANTARES study is ready for benders decomposition | ||
#' | ||
#' | ||
#' @param benders_options | ||
#' list of benders decomposition options, as returned by | ||
#' \code{\link{read_options}}. | ||
|
||
#' @param opts | ||
#' list of simulation parameters returned by the function | ||
#' \code{antaresRead::setSimulationPath} | ||
#' | ||
#' @return boolean, indicating whether or not the test are fullfilled | ||
#' | ||
#' @importFrom antaresRead simOptions readClusterDesc | ||
#' @importFrom dplyr filter | ||
#' | ||
#' | ||
benders_check <- function(benders_options, opts = antaresRead::simOptions()) | ||
benders_check <- function(opts = antaresRead::simOptions()) | ||
{ | ||
|
||
checked <- TRUE | ||
|
||
#1. for all the clusters of the study, the market bid should be equal to the marginal cost | ||
cluster <- antaresRead::readClusterDesc(opts = opts) | ||
|
||
if (nrow(cluster[marginal.cost != market.bid.cost]) > 0) | ||
if (nrow(cluster) > 0) | ||
{ | ||
checked <- FALSE | ||
stop("for all thermal clusters, market bid must be equal to marginal cost (e.g. see cluster ", | ||
cluster[marginal.cost != market.bid.cost][1, area] , " - ", | ||
cluster[marginal.cost != market.bid.cost][1, cluster], ")") | ||
if (nrow(dplyr::filter(cluster, marginal.cost != market.bid.cost)) > 0) | ||
{ | ||
checked <- FALSE | ||
stop("for all thermal clusters, market bid must be equal to marginal cost (e.g. see cluster ", | ||
dplyr::filter(cluster, marginal.cost != market.bid.cost)[1, "area"] , " - ", | ||
dplyr::filter(cluster, marginal.cost != market.bid.cost)[1, "cluster"], ")") | ||
} | ||
} | ||
|
||
|
||
return(checked) | ||
|
||
} |