Skip to content

Config file for complex modeling artifacts conversion #98

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 16, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
119 changes: 119 additions & 0 deletions src/andromede/input_converter/src/cc_configuration/batteries.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
#
# 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.

# Configuration file to convert a complex modelling artefact in an Antares study into an Andromede model.

loop:

iteration_key: zone #Key on which we iterate (for a given list of zone, we want to execute a loop : for zone in list_zone)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
iteration_key: zone #Key on which we iterate (for a given list of zone, we want to execute a loop : for zone in list_zone)
iteration_key: area #Key on which we iterate (for a given list of zone, we want to execute a loop : for zone in list_zone)

#In the following, the notation $zone$ means the value of the string variable "zone"
andromede-model: antares-historic.short-term-storage #we want to create components of such a model, with id being indexed by the iteration_key
andromede-component-id : battery_$zone$
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
andromede-component-id : battery_$zone$
andromede-component-id : battery_$area$



andromede-model-parameters-to-set-a-priori:
#TODO : we still have to see if the following parameters can be set a priori or have to be read in the Antares study,during the conversion.
#- id: lower_rule_curve
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the current modelling of batteries with the binding constraints define lower/upper rule curves (maybe implicitly ?) ? Otherwise set lower_rule_curve to 0 and upper-rule-curve to 1

#- id: lower_rule_curve
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#- id: lower_rule_curve
#- id: upper_rule_curve

#- id: p_max_injection_modulation # Read in p_max_injection
Copy link
Collaborator

@tbittar tbittar May 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be read from the availability series of thermal clusters in z_batteries ? Or the link profile between the physical area and z_batteries ?

#- id: p_max_withdrawal_modulation # Read in p_max_withdrawal


- id: initial_level
time-dependent: false
scenario-dependent: false
value: -1.0 #TODO : The initial stock level constraint must be disabled or deleted in the Andromede ST storage model
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it is better to write a specialized short term storage models for batteries or we can keep the current one ? And usually the initial_level is at 0.5 ? Otherwise it may be optimized, in this case, we definitely need a different model


- id: inflows #No inflows in a battery model!
time-dependent: false
scenario-dependent: false
value: 0.0



antares-coupling-constraints-to-visit:

- id : batteries_$zone$
name: batteries_$zone$
to-delete: True #This flag means that the constraint should be deleted from the Antares Study, if hybrid mode is targetted
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean by hybrid mode here ?

parameters-to-store:
- id-target-andromede-model-parameter: efficiency_injection #target parameter in the andromede-model
location-in-legacy-study: $zone$%z_batteries #where to read the parameter in the Antares coupling constraint
multiplication-factor: -1 # The parameter we read in Antares coupling constraint should be multiplied by -1 to create target param
- id-target-andromede-model-parameter: efficiency_withdrawal #there are different naming conventions between Antares CC model for batteries and the short-term storage model
#=> therefore there is an intervertion between injection and withdrawal (this is no mistake)
location-in-legacy-study: $zone$.$zone$_batteries_inj
multiplication-factor: 1
Copy link
Collaborator

@tbittar tbittar May 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of giving the Antares components to iterate through, we could specify directly the location of the Andromede model parameters :

Suggested change
antares-coupling-constraints-to-visit:
- id : batteries_$zone$
name: batteries_$zone$
to-delete: True #This flag means that the constraint should be deleted from the Antares Study, if hybrid mode is targetted
parameters-to-store:
- id-target-andromede-model-parameter: efficiency_injection #target parameter in the andromede-model
location-in-legacy-study: $zone$%z_batteries #where to read the parameter in the Antares coupling constraint
multiplication-factor: -1 # The parameter we read in Antares coupling constraint should be multiplied by -1 to create target param
- id-target-andromede-model-parameter: efficiency_withdrawal #there are different naming conventions between Antares CC model for batteries and the short-term storage model
#=> therefore there is an intervertion between injection and withdrawal (this is no mistake)
location-in-legacy-study: $zone$.$zone$_batteries_inj
multiplication-factor: 1
- id: efficicency_injection
time-dependent: false
scenario-dependent: false
value: batteries_$zone$::$zone$%z_batteries
multiplication_factor: -1
- id: efficicency_withdrawal
time-dependent: false
scenario-dependent: false
value: batteries_$zone$::$zone$.$zone$_batteries_inj

And add a field a the end to list the legacy components to delete



- id : battery_level_$zone$
name : Battery_level_$zone$
to-delete: True
parameters-to-store: /


antares-links-to-visit:
- id : $zone$%z_batteries
name : $zone$%z_batteries
to-delete: True
parameters-to-store:
- id-target-andromede-model-parameter : injection_nominal_capacity
location-in-legacy-study: link_capacity #TODO : find the right id to describe link capacity? @tbittar
Copy link
Collaborator

@tbittar tbittar May 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
location-in-legacy-study: link_capacity #TODO : find the right id to describe link capacity? @tbittar
location-in-legacy-study: input/links/$zone$/capacities/$zone$_direct.txt

multiplication-factor: 1


antares-nodes-to-visit: /

antares-clusters-to-visit:
- node.cluster_id: $zone$.$zone$_batteries_inj #node.cluster
to-delete: True
parameters-to-store:
- id-target-andromede-model-parameter : withdrawal_nominal_capacity
location-in-legacy-study: p_max_cluster #TODO : find the right id to describe cluster pmax? @tbittar
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
location-in-legacy-study: p_max_cluster #TODO : find the right id to describe cluster pmax? @tbittar
location-in-legacy-study: input/thermal/series/$zone$/$zone$_batteries_inj/series.txt

multiplication-factor: 1
- node.cluster_id : z_batteries.z_batteries_batteries_$zone$_1 #node.cluster in Antares study
to-delete: True
parameters-to-store:
- id-target-andromede-model-parameter : reservoir_capacity
location-in-legacy-study: p_max_cluster #TODO : find the right id to describe cluster pmax? @tbittar
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
location-in-legacy-study: p_max_cluster #TODO : find the right id to describe cluster pmax? @tbittar
location-in-legacy-study: input/thermal/series/z_batteries/z_batteries_batteries_$zone$_1/series.txt

multiplication-factor: 1
- node.cluster_id : z_batteries.z_batteries_batteries_$zone$_2 #node.cluster in Antares study
to-delete: True
parameters-to-store: /

antares-load-to-visit: /

andromede-connection-to-create: /

area-connections-to-create: #Hybrid connection to create
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why "hybrid" ?

- component: battery_$zone$
port: injection
area: $zone$




#We also have to delete the fictive node "z_batteries"

loop:
iteration_key: / #No loop, just 1 iteration.
andromede-model : /
andromede-component-id : /
antares-nodes-to-visit:
- id : z_batteries
name: z_batteries #TBC
to-delete: True
parameters-to-store: /
antares-nodes-to-visit: /
antares-clusters-to-visit:
antares-load-to-visit: /
andromede-connection-to-create: /
hybrid-connection-to-create: /
114 changes: 114 additions & 0 deletions src/andromede/input_converter/src/cc_configuration/batteries_v2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
#
# 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.

# Configuration file to convert a complex modelling artefact in an Antares study into an Andromede model.

#TODOs :
#*idem pour battery_pcomp

loop:

iteration-key: area #Key on which we iterate (for a given list of area, we want to execute a loop : for area in list_area)

andromede-component-id: battery_$area$

andromede-model: andromede-v1-models.battery

parameters:

- id: reservoir_capacity
time-dependent: false
scenario-dependent: false
value:
- cluster: z_batteries_batteries_$area$_1
- field: nominalcapacity #field in the file "list.ini"
- multiplication_factor: 1
- id: injection_nominal_capacity
time-dependent: false
scenario-dependent: false
value:
- path: input/links/$area$/capacities/z_batteries_direct.txt
- column: 0 #To be read in first column
- operator: max
- id: withdrawal_nominal_capacity
time-dependent: false
scenario-dependent: false
value:
- cluster: $area$_batteries_inj
- field: nominalcapacity
- multiplication_factor: 1 #field in the file "list.ini"
- id: efficiency_injection
time-dependent: false
scenario-dependent: false
value:
- binding_constraint: batteries_$area$
- field : $area$%z_batteries #field in the file corresponding to the binding constraint
- multiplication_factor: -1
- id: efficiency_withdrawal
time-dependent: false
scenario-dependent: false
value:
- binding_constraint: batteries_$area$
- field : $area$.$area$_batteries_inj
- multiplication_factor: 1
- id: lower_rule_curve
time-dependent: false
scenario-dependent: false
value: 0
- id: upper_rule_curve
time-dependent: true
scenario-dependent: false
value:
- path: input/thermal/series/z_batteries/z_batteries_batteries_$area$_1/series.txt
- column: 0 #To be read in first column
- multiplication_factor: 1.0 /reservoir_capacity #Reference to a constant parameter already defined above.
- id: p_max_injection_modulation
time-dependent: true
scenario-dependent: false
value:
- path: input/links/$area$/capacities/z_batteries_direct.txt
- column: 0 #To be read in first column
- multiplication_factor: 1.0 / injection_nominal_capacity #Reference to a constant parameter already defined above.
- id: p_max_withdrawal_modulation
time-dependent: true
scenario-dependent: false
value:
- path: input/thermal/series/$area$/$area$_batteries_inj/series.txt
- column: 0 #To be read in first column
- multiplication_factor: 1.0 / withdrawal_nominal_capacity #Reference to a constant parameter already defined above.
- id: marginal_cost
time-dependent: true
scenario-dependent: false
value:
- path: input/links/$area$/capacities/z_batteries_parameters
- column: 0 #To be read in first column (direct hurdle costs)
- multiplication_factor: 1.0


area-connections: #Syntax for hybrid connections: https://antares-simulator.readthedocs.io/en/latest/user-guide/solver/08-hybrid-studies/
#To handle the case of hybrid studies, where we replace complex modeling artifacts for batteries by a model.
#TODO : handle the case of pure Andromede studies
- component: battery_$area$
port: injection_port
area: $area$

legacy-objects-to-delete:
- binding_constraints:
- id : batteries_$area$
- id : battery_level_$area$
- links:
- id : $area$%z_batteries
- nodes:
- id : z_batteries #Warning: does not depend on area
- thermal_clusters:
- id : $area$.$area$_batteries_inj
- id : z_batteries.z_batteries_batteries_$area$_1
- id : z_batteries.z_batteries_batteries_$area$_2
56 changes: 56 additions & 0 deletions src/andromede/libs/reference_models/andromede_v1_models.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,59 @@ library:
- port: hydrogen_port
field: flow
definition: efficiency * power

- id: battery_BP23
parameters:
- id: reservoir_capacity
time-dependent: false
scenario-dependent: false
- id: injection_nominal_capacity
time-dependent: false
scenario-dependent: false
- id: withdrawal_nominal_capacity
time-dependent: false
scenario-dependent: false
- id: efficiency_injection
time-dependent: false
scenario-dependent: false
- id: efficiency_withdrawal
time-dependent: false
scenario-dependent: false
- id: lower_rule_curve
time-dependent: true
scenario-dependent: true
- id: upper_rule_curve
time-dependent: true
scenario-dependent: true
- id: p_max_injection_modulation # Read in p_max_injection
time-dependent: true
scenario-dependent: true
- id: p_max_withdrawal_modulation # Read in p_max_withdrawal
time-dependent: true
scenario-dependent: true
- id: marginal_cost
time-dependent: true
scenario-dependent: false


variables:
- id: p_injection
lower-bound: 0
upper-bound: p_max_injection_modulation * injection_nominal_capacity # p_max_injection_modulation is a timeseries with adimensional values between 0 and 1
- id: p_withdrawal
lower-bound: 0
upper-bound: p_max_withdrawal_modulation * withdrawal_nominal_capacity # p_max_withdrawal_modulation is a timeseries with adimensional values between 0 and 1
- id: level
lower-bound: lower_rule_curve * reservoir_capacity
upper-bound: upper_rule_curve * reservoir_capacity
ports:
- id: injection_port
type: flow
port-field-definitions:
- port: injection_port
field: flow
definition: p_withdrawal - p_injection
constraints:
- id: level_equation
expression: level[t+1] = level + efficiency_injection * p_injection - efficiency_withdrawal * p_withdrawal
objective: expec(sum(marginal_cost * p_injection))
5 changes: 5 additions & 0 deletions tests/e2e/models/andromede-v1/test_andromede_v1_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@ def test_model_behaviour(
)
status = problem.solver.Solve()
assert status == problem.solver.OPTIMAL
assert math.isclose(
problem.solver.Objective().Value(),
problem.solver.Objective().BestBound(),
rel_tol=relative_accuracy,
)
assert math.isclose(
reference_values[k, 0],
problem.solver.Objective().Value(),
Expand Down
Loading