Skip to content

Commit

Permalink
Merge pull request #229 from rte-antares-rpackage/feature/scenarized_bc
Browse files Browse the repository at this point in the history
Feature/scenarized bc
  • Loading branch information
berthetclement authored Jan 17, 2024
2 parents 3443fdc + d0980ad commit 38b1673
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 19 deletions.
52 changes: 42 additions & 10 deletions R/readBindingConstraints.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
#' Read binding constraints
#'
#' @description
#' `r antaresRead:::badge_api_ok()`
#' `r lifecycle::badge("experimental")`
#'
#' This function reads the binding constraints of an Antares project.
#'
#' Be aware that binding constraints are read in the input files of a study. So
Expand All @@ -11,15 +14,28 @@
#' @inheritParams readAntares
#'
#' @return
#' \code{readBindingConstraints} returns an object of class \code{bindingConstraints}.
#' It is a named list with one element per read constraint. Each element is itself
#' a list with the following elements:
#' \item{enabled}{is the constraint enabled ?}
#' \item{timeStep}{time step the constraint applies to}
#' \item{operator}{type of constraint: equality, inequality on one side or both sides}
#' \item{coefficients}{elements containing the coefficients used by the constraint}
#' \item{values}{values used by the constraint. It contains one line per time step
#' and three columns "less", "greater" and "equal"}
#' An object of class \code{bindingConstraints}. This object is also a named
#' list with 3 sections per read constraint.
#'
#' @section Warning:
#' Since `release 2.7.0` the structure of the returned object has evolved for
#' all versions of study Antares:
#' - .ini parameters are in section `properties`
#' - Coeffcients links or thermal are in section `coefs`
#' - Values are already in section `values`
#'
#' @note
#' For an study Antares **version >=8.7.0**. Now contains `data.frame` with
#' one line per time step and \eqn{p} colums according to "scenarized RHS".
#'
#' For "both" case, you will find in section `values` two `data.frame` :
#' - One `data.frame` for `less`
#' - One `data.frame` for `greater`
#'
#' For an study Antares **version <8.7.0**.
#'
#' Section \code{values} contains one line
#' per time step and three columns "less", "greater" and "equal"
#'
#'
#'
Expand All @@ -28,6 +44,20 @@
#' setSimulationPath()
#'
#' constraints <- readBindingConstraints()
#'
#' # read properties
#' constraints$properties
#'
#' # read coefs
#' constraints$coefs
#'
#' # read values
#' constraints$values
#' # both case ( study Antares >=8.7.0)
#' constraints$values$less
#' constraints$values$greater
#'
#' # display equation (only for study Antares <8.7.0)
#' summary(constraints)
#'
#' }
Expand Down Expand Up @@ -287,8 +317,10 @@ readBindingConstraints <- function(opts = simOptions()) {
return(core_list)
}

#' `r lifecycle::badge("deprecated")`
#' @title Display equation of binding constraint
#' @description
#' `r lifecycle::badge("deprecated")`
#' This function cannot be used for a study `>= 8.7.0`
#' @param object Object returned by readBindingConstraints
#' @param ... Unused
#'
Expand Down
54 changes: 45 additions & 9 deletions man/readBindingConstraints.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/summary.bindingConstraints.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 38b1673

Please sign in to comment.