create-binding-constraint: Create a binding constraint

create-binding-constraintR Documentation

Create a binding constraint

Description

Antares API OK

Create a new binding constraint in an Antares study. createBindingConstraintBulk() allow to create multiple constraints at once.

Usage

createBindingConstraint(
  name,
  id = tolower(name),
  values = NULL,
  enabled = TRUE,
  timeStep = c("hourly", "daily", "weekly"),
  operator = c("both", "equal", "greater", "less"),
  filter_year_by_year = "hourly, daily, weekly, monthly, annual",
  filter_synthesis = "hourly, daily, weekly, monthly, annual",
  coefficients = NULL,
  overwrite = FALSE,
  opts = antaresRead::simOptions()
)

createBindingConstraintBulk(constraints, opts = antaresRead::simOptions())

Arguments

name

The name for the binding constraint.

id

An id, default is to use the name.

values

Values used by the constraint. It contains one line per time step and three columns "less", "greater" and "equal".

enabled

Logical, is the constraint enabled ?

timeStep

Time step the constraint applies to : hourly, daily or weekly.

operator

Type of constraint: equality, inequality on one side or both sides.

filter_year_by_year

Marginal price granularity for year by year

filter_synthesis

Marginal price granularity for synthesis

coefficients

A named vector containing the coefficients used by the constraint.

overwrite

If the constraint already exist, overwrite the previous value.

opts

List of simulation parameters returned by the function antaresRead::setSimulationPath()

constraints

A list of several named list containing data to create binding constraints. Warning all arguments for creating a binding constraints must be provided, see examples.

Value

An updated list containing various information about the simulation.

See Also

editBindingConstraint() to edit existing binding constraints, removeBindingConstraint() to remove binding constraints.

Examples

## Not run: 
createBindingConstraint(
  name = "myconstraint", 
  values = matrix(data = rep(0, 8760 * 3), ncol = 3), 
  enabled = FALSE, 
  timeStep = "hourly",
  operator = "both",
  coefficients = c("fr%myarea" = 1)
)

# Create multiple constraints

# Prepare data for constraints 
bindings_constraints <- lapply(
  X = seq_len(100),
  FUN = function(i) {
    # use arguments of createBindingConstraint()
    # all arguments must be provided !
    list(
      name = paste0("constraints", i), 
      id = paste0("constraints", i), 
      values = matrix(data = rep(0, 8760 * 3), ncol = 3), 
      enabled = FALSE, 
      timeStep = "hourly",
      operator = "both",
      coefficients = c("area1%area2" = 1),
      overwrite = TRUE
    )
  }
)
# create all constraints
createBindingConstraintBulk(bindings_constraints)

## End(Not run)

antaresEditObject documentation built on Oct. 4, 2023, 1:06 a.m.