binding_constraint
Classes:
-
BindingConstraint–Define generic constraints (binding constraints) between transmission flows
-
BindingConstraintFrequency–An enumeration representing the possible frequencies for binding constraints.
-
BindingConstraintOperator–An enumeration representing the possible operators for binding constraints.
-
BindingConstraintProperties–Binding constraint properties
-
BindingConstraintPropertiesUpdate–Update binding constraint properties
-
ClusterData–Data Transfer Object (DTO) for a constraint term on a cluster in an area.
-
ConstraintTerm–Constraint terms
-
ConstraintTermData–Constraint term in the left hand side of a binding constraint.
-
LinkData–Data Transfer Object (DTO) for a constraint term on a link between two areas.
BindingConstraint
BindingConstraint(
bc_id: str,
name: str,
binding_constraint_service: BaseBindingConstraintService,
properties: Optional[BindingConstraintProperties] = None,
terms: Optional[list[ConstraintTerm]] = None,
)
Define generic constraints (binding constraints) between transmission flows and/or power generated from thermal clusters.
Methods:
-
get_equal_term_matrix–Get the "equal" (==) term matrix
-
get_greater_term_matrix–Get the "greater than" (>) term matrix
-
get_less_term_matrix–Get the "less than" (<) term matrix
-
get_terms–Get the terms of this binding constraint.
-
set_equal_term–Set the "equal" (==) term matrix
-
set_greater_term–Set the "greater than" (>) term matrix
-
set_less_term–Set the "less than" (<) term matrix
-
set_terms–Replace all terms of this binding constraint.
-
update_properties–Update properties of the binding constraint.
Attributes:
-
id(str) –ID of the constraint.
-
name(str) –Name of the constraint.
-
properties(BindingConstraintProperties) –Binding constraints properties
Source code in src/antares/craft/model/binding_constraint.py
get_equal_term_matrix
get_greater_term_matrix
Get the "greater than" (>) term matrix
get_less_term_matrix
get_terms
get_terms() -> dict[str, ConstraintTerm]
Get the terms of this binding constraint.
Returns:
-
dict[str, ConstraintTerm]–The constraint terms, as a mapping of term ID to term.
set_equal_term
set_equal_term(matrix: DataFrame) -> None
Set the "equal" (==) term matrix
Parameters:
-
(matrixDataFrame) –the matrix to upload.
Source code in src/antares/craft/model/binding_constraint.py
set_greater_term
set_greater_term(matrix: DataFrame) -> None
Set the "greater than" (>) term matrix
Parameters:
-
(matrixDataFrame) –the matrix to upload.
Source code in src/antares/craft/model/binding_constraint.py
set_less_term
set_less_term(matrix: DataFrame) -> None
Set the "less than" (<) term matrix
Parameters:
-
(matrixDataFrame) –the matrix to upload.
Source code in src/antares/craft/model/binding_constraint.py
set_terms
set_terms(terms: list[ConstraintTerm]) -> None
Replace all terms of this binding constraint.
Parameters:
-
(termslist[ConstraintTerm]) –The new list of constraint terms to set.
Source code in src/antares/craft/model/binding_constraint.py
update_properties
update_properties(
properties: BindingConstraintPropertiesUpdate,
) -> BindingConstraintProperties
Update properties of the binding constraint.
Source code in src/antares/craft/model/binding_constraint.py
BindingConstraintFrequency
An enumeration representing the possible frequencies for binding constraints.
The values are case-insensitive, so "HOURLY", "hourly", or "Hourly" are all valid.
Attributes:
-
HOURLY–Constraints are applied every hour.
-
DAILY–Constraints are applied every day.
-
WEEKLY–Constraints are applied every week.
BindingConstraintOperator
An enumeration representing the possible operators for binding constraints.
The values are case-insensitive, so "LESS", "less", or "Less" are all valid.
Attributes:
-
LESS–Represents a "less than" (<) constraint.
-
GREATER–Represents a "greater than" (>) constraint.
-
BOTH–Represents a "both less than and greater than" constraint.
-
EQUAL–Represents an "equal to" (==) constraint.
BindingConstraintProperties
dataclass
BindingConstraintProperties(
enabled: bool = True,
time_step: BindingConstraintFrequency = HOURLY,
operator: BindingConstraintOperator = LESS,
comments: str = "",
filter_year_by_year: set[FilterOption] = (lambda: FILTER_VALUES)(),
filter_synthesis: set[FilterOption] = (lambda: FILTER_VALUES)(),
group: str = "default",
)
Binding constraint properties
Attributes:
-
enabled(bool) –Whether or not the binding constraint is enabled for the simulation.
-
time_step(BindingConstraintFrequency) –Frequency at which the binding constraint is applied.
-
operator(BindingConstraintOperator) –Bound of the bounding constraint (<, >, == or < and >).
-
comments(str) –User comments on the constraint.
-
filter_year_by_year(set[FilterOption]) –Set of filter options for output (hourly, daily, weekly, monthly, annual).
-
filter_synthesis(set[FilterOption]) –Set of filter options for synthesis (hourly, daily, weekly, monthly, annual).
-
group(str) –User defined group to organize binding constraints
BindingConstraintPropertiesUpdate
dataclass
BindingConstraintPropertiesUpdate(
enabled: Optional[bool] = None,
time_step: Optional[BindingConstraintFrequency] = None,
operator: Optional[BindingConstraintOperator] = None,
comments: Optional[str] = None,
filter_year_by_year: Optional[set[FilterOption]] = None,
filter_synthesis: Optional[set[FilterOption]] = None,
group: Optional[str] = None,
)
Update binding constraint properties
Attributes:
-
enabled(Optional[bool]) –Whether or not the binding constraint is enabled for the simulation.
-
time_step(Optional[BindingConstraintFrequency]) –Frequency at which the binding constraint is applied.
-
operator(Optional[BindingConstraintOperator]) –Bound of the bounding constraint (<, >, == or < and >).
-
comments(Optional[str]) –User comments on the constraint.
-
filter_year_by_year(Optional[set[FilterOption]]) –Set of filter options for output (hourly, daily, weekly, monthly, annual).
-
filter_synthesis(Optional[set[FilterOption]]) –Set of filter options for synthesis (hourly, daily, weekly, monthly, annual).
-
group(Optional[str]) –User defined group to organize binding constraints
ClusterData
dataclass
ConstraintTerm
dataclass
ConstraintTerm(data: LinkData | ClusterData, weight: float = 1, offset: int = 0)
Constraint terms
Attributes:
-
weigth–The coefficient multiplying the link or cluster
-
offset(int) –The time offset of flow on the given link or output of the cluster. For example, it allows to make a constraint on a previous time-step.
Methods:
-
from_dict–Create a
LinkDataorClusterDataobject from a dictionary. -
from_ini–Creates a
LinkDataorClusterDataobject from a string. -
weight_offset–Format the weight and offset values into a string representation.
id
property
id: str
Generate a unique string identifier for the constraint term - For a link term type: "area1%area2" (sorted alphabetically and lowercase) - For a cluster term type: "area.cluster" (lowercase)
from_dict
staticmethod
Create a LinkData or ClusterData object from a dictionary.
Parameters:
-
(inputdict[str, str]) –A dictionary containing either "area1" and "area2" keys (for
LinkData) or "area" and "cluster" keys (forClusterData).
Returns:
-
LinkData | ClusterData–LinkData | ClusterData: An instance of
LinkDataorClusterDatabased on the input.
Raises:
-
ValueError–If the dictionary does not contain the required keys.
Source code in src/antares/craft/model/binding_constraint.py
from_ini
staticmethod
from_ini(input: str) -> LinkData | ClusterData
Creates a LinkData or ClusterData object from a string.
Parameters:
-
(inputstr) –A string formatted as "area1%area2" (for
LinkData) or "area.cluster" (forClusterData).
Returns:
-
LinkData | ClusterData–An instance of
LinkDataorClusterDatabased on the input.
Raises:
-
ValueError–If the string does not match the expected format.
Source code in src/antares/craft/model/binding_constraint.py
weight_offset
weight_offset() -> str
Format the weight and offset values into a string representation.
ConstraintTermData
dataclass
ConstraintTermData(data: LinkData | ClusterData)
Constraint term in the left hand side of a binding constraint.
Attributes:
-
data(LinkData | ClusterData) –The underlying data, which can be either a
LinkDataorClusterDataobject.
Methods:
-
from_dict–Create a
LinkDataorClusterDataobject from a dictionary. -
from_ini–Creates a
LinkDataorClusterDataobject from a string.
id
property
id: str
Generate a unique string identifier for the constraint term - For a link term type: "area1%area2" (sorted alphabetically and lowercase) - For a cluster term type: "area.cluster" (lowercase)
from_dict
staticmethod
Create a LinkData or ClusterData object from a dictionary.
Parameters:
-
(inputdict[str, str]) –A dictionary containing either "area1" and "area2" keys (for
LinkData) or "area" and "cluster" keys (forClusterData).
Returns:
-
LinkData | ClusterData–LinkData | ClusterData: An instance of
LinkDataorClusterDatabased on the input.
Raises:
-
ValueError–If the dictionary does not contain the required keys.
Source code in src/antares/craft/model/binding_constraint.py
from_ini
staticmethod
from_ini(input: str) -> LinkData | ClusterData
Creates a LinkData or ClusterData object from a string.
Parameters:
-
(inputstr) –A string formatted as "area1%area2" (for
LinkData) or "area.cluster" (forClusterData).
Returns:
-
LinkData | ClusterData–An instance of
LinkDataorClusterDatabased on the input.
Raises:
-
ValueError–If the string does not match the expected format.