-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
modified error message add variable type entry (integer)
- Loading branch information
1 parent
1221880
commit 635c75d
Showing
7 changed files
with
735 additions
and
30 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
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
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Copyright (c) 2024, RTE (https://www.rte-france.com) | ||
# | ||
# See AUTHORS.txt | ||
# | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
# | ||
# SPDX-License-Identifier: MPL-2.0 | ||
# | ||
# This file is part of the Antares project. | ||
from pathlib import Path | ||
|
||
import pytest | ||
|
||
from andromede.model.parsing import parse_yaml_library | ||
from andromede.model.resolve_library import resolve_library | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def libs_dir() -> Path: | ||
return Path(__file__).parent / "libs" | ||
|
||
@pytest.fixture(scope="session") | ||
def lib(libs_dir: Path): | ||
lib_file = libs_dir / "lib.yml" | ||
|
||
with lib_file.open() as f: | ||
input_lib = parse_yaml_library(f) | ||
|
||
lib = resolve_library(input_lib) | ||
return lib |
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 |
---|---|---|
@@ -0,0 +1,188 @@ | ||
# Copyright (c) 2024, RTE (https://www.rte-france.com) | ||
# | ||
# See AUTHORS.txt | ||
# | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
# | ||
# SPDX-License-Identifier: MPL-2.0 | ||
# | ||
# This file is part of the Antares project. | ||
library: | ||
id: basic | ||
description: Basic library | ||
|
||
port-types: | ||
- id: flow | ||
description: A port which transfers power flow | ||
fields: | ||
- name: flow | ||
|
||
models: | ||
- id: node | ||
ports: | ||
- name: balance_port | ||
type: flow | ||
binding-constraints: | ||
- name: balance | ||
expression: sum_connections(balance_port.flow) = 0 | ||
|
||
- id: demand | ||
parameters: | ||
- name: demand | ||
time-dependent: true | ||
scenario-dependent: true | ||
ports: | ||
- name: balance_port | ||
type: flow | ||
port-field-definitions: | ||
- port: balance_port | ||
field: flow | ||
definition: -demand | ||
|
||
- id: production | ||
parameters: | ||
- name: cost | ||
time-dependent: false | ||
scenario-dependent: false | ||
- name: p_max | ||
time-dependent: false | ||
scenario-dependent: false | ||
variables: | ||
- name: generation | ||
lower-bound: 0 | ||
upper-bound: p_max | ||
ports: | ||
- name: balance_port | ||
type: flow | ||
port-field-definitions: | ||
- port: balance_port | ||
field: flow | ||
definition: generation | ||
objective: expec(sum(cost * generation)) | ||
|
||
- id: production_with_min | ||
parameters: | ||
- name: cost | ||
time-dependent: false | ||
scenario-dependent: false | ||
- name: p_max | ||
time-dependent: false | ||
scenario-dependent: false | ||
- name: p_min | ||
time-dependent: false | ||
scenario-dependent: false | ||
variables: | ||
- name: generation | ||
lower-bound: p_min | ||
upper-bound: p_max | ||
ports: | ||
- name: balance_port | ||
type: flow | ||
port-field-definitions: | ||
- port: balance_port | ||
field: flow | ||
definition: generation | ||
objective: expec(sum(cost * generation)) | ||
|
||
- id: link | ||
parameters: | ||
- name: f_max | ||
time-dependent: false | ||
scenario-dependent: false | ||
variables: | ||
- name: input | ||
lower-bound: -f_max | ||
upper-bound: f_max | ||
ports: | ||
- name: out_port | ||
type: flow | ||
- name: in_port | ||
type: flow | ||
port-field-definitions: | ||
- port: out_port | ||
field: flow | ||
definition: input | ||
- port: in_port | ||
field: flow | ||
definition: -input | ||
|
||
- id: spillage | ||
parameters: | ||
- name: cost | ||
time-dependent: false | ||
scenario-dependent: false | ||
variables: | ||
- name: input | ||
lower-bound: 0 | ||
ports: | ||
- name: balance_port | ||
type: flow | ||
port-field-definitions: | ||
- port: balance_port | ||
field: flow | ||
definition: -input | ||
objective: expec(sum(cost * input)) | ||
|
||
- id: unsuplied | ||
parameters: | ||
- name: cost | ||
time-dependent: false | ||
scenario-dependent: false | ||
variables: | ||
- name: output | ||
lower-bound: 0 | ||
ports: | ||
- name: balance_port | ||
type: flow | ||
port-field-definitions: | ||
- port: balance_port | ||
field: flow | ||
definition: output | ||
objective: expec(sum(cost * output)) | ||
|
||
- id: thermal_cluster | ||
parameters: | ||
- name: p_max | ||
- name: p_min | ||
- name: cost | ||
- name: d_min_up | ||
- name: d_min_down | ||
- name: nb_units_max | ||
- name: nb_failures | ||
variables: | ||
- name: nb_units_on | ||
lower-bound: 0 | ||
upper-bound: nb_units_max | ||
variable-type: integer | ||
- name: nb_starting | ||
lower-bound: 0 | ||
upper-bound: nb_units_max | ||
variable-type: integer | ||
- name: nb_stoping | ||
lower-bound: 0 | ||
upper-bound: nb_units_max | ||
variable-type: integer | ||
- name: production | ||
lower-bound: 0 | ||
upper-bound: nb_units_max * p_max | ||
ports: | ||
- name: balance_port | ||
type: flow | ||
port-field-definitions: | ||
- port: balance_port | ||
field: flow | ||
definition: production | ||
constraints: | ||
- name: max production | ||
expression: production <= nb_units_on * p_max | ||
- name: min production | ||
expression: production >= nb_units_on * p_min | ||
- name: on units variation | ||
expression: nb_units_on = nb_units_on[-1] + nb_starting - nb_stoping | ||
- name: starting time | ||
expression: sum(nb_starting[-d_min_up + 1 .. 0]) <= nb_units_on | ||
- name: stoping time | ||
expression: sum(nb_stoping[-d_min_down + 1 .. 0]) <= nb_units_max - nb_units_on | ||
objective: expec(sum(cost * production)) |
Oops, something went wrong.