Skip to content

Commit

Permalink
Copy GitLab branch and solve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
tbittar committed Feb 20, 2024
1 parent add3654 commit 0043477
Show file tree
Hide file tree
Showing 12 changed files with 904 additions and 150 deletions.
18 changes: 16 additions & 2 deletions src/andromede/model/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
A model allows to define the behaviour for components, by
defining parameters, variables, and equations.
"""
from enum import Enum
import itertools
from dataclasses import dataclass, field
from typing import Dict, Iterable, Optional
Expand Down Expand Up @@ -133,6 +134,19 @@ def port_field_def(
return PortFieldDefinition(PortFieldId(port_name, field_name), definition)


class BlockBoundariesDynamics(Enum):
"""
Defines the management of the dynamics at the boundaries of a block for a model :
- IGNORE_BOUNDARIES : Terms in constraints that corespond to out of frame variables are ignored
- CYCLE : The dynamics is bounding the end of a time block with its beginning in a cyclic way. This is the actual functioning of Antares for thermal clusters.
- INTERBLOCK_DYNAMICS : The necessary state information is passed between time blocks to ensure the satisfaction of the dynamics between blocks.
"""

IGNORE_BOUNDARIES = "IGNORE"
CYCLE = "CYCLE"
INTERBLOCK_DYNAMICS = "INTERBLOCK"


@dataclass(frozen=True)
class Model:
"""
Expand All @@ -143,7 +157,7 @@ class Model:
id: str
constraints: Dict[str, Constraint] = field(default_factory=dict)
binding_constraints: Dict[str, Constraint] = field(default_factory=dict)
inter_block_dyn: bool = False
inter_block_dyn: BlockBoundariesDynamics = BlockBoundariesDynamics.CYCLE
parameters: Dict[str, Parameter] = field(default_factory=dict)
variables: Dict[str, Variable] = field(default_factory=dict)
objective_operational_contribution: Optional[ExpressionNode] = None
Expand Down Expand Up @@ -192,7 +206,7 @@ def model(
variables: Optional[Iterable[Variable]] = None,
objective_operational_contribution: Optional[ExpressionNode] = None,
objective_investment_contribution: Optional[ExpressionNode] = None,
inter_block_dyn: bool = False,
inter_block_dyn: BlockBoundariesDynamics = BlockBoundariesDynamics.CYCLE,
ports: Optional[Iterable[ModelPort]] = None,
port_fields_definitions: Optional[Iterable[PortFieldDefinition]] = None,
) -> Model:
Expand Down
2 changes: 1 addition & 1 deletion src/andromede/simulation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# This file is part of the Antares project.

from .optimization import BlockBorderManagement, OptimizationProblem, build_problem
from .optimization import OptimizationProblem, build_problem
from .output_values import OutputValues
from .time_block import TimeBlock
from .xpansion import XpansionProblem, build_xpansion_problem
Loading

0 comments on commit 0043477

Please sign in to comment.