Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
2bf893e
add test runner
jarsarasty Sep 26, 2024
932fcd4
include scaling tests in test_multi_commodity_simulator_priorities_el
jarsarasty Sep 26, 2024
10f8a7a
expand and refactor tests\utils_test_scaling
jarsarasty Oct 2, 2024
a5b5e84
include test runner
jarsarasty Oct 2, 2024
f59fda4
include scaling test test_multi_commodity_simulator_priorities_el
jarsarasty Oct 2, 2024
33aedf4
black format
jarsarasty Oct 2, 2024
d2cf4c7
flake8 format
jarsarasty Oct 2, 2024
ac78a61
change name of scale range file
jarsarasty Oct 2, 2024
be9fa86
flake8 style fix
jarsarasty Oct 2, 2024
4dd1ecd
include check_scaling funtion and fix style
jarsarasty Oct 2, 2024
4ee6017
relocate default arguments and include scaling checks
jarsarasty Oct 3, 2024
b5e45ca
debugging
jarsarasty Oct 3, 2024
e37ea8e
fix flake8 format
jarsarasty Oct 8, 2024
b327f4e
store range_data
jarsarasty Oct 8, 2024
81e617f
store range_data
jarsarasty Oct 8, 2024
b57aed7
flake8 format
jarsarasty Oct 9, 2024
7f56b70
accept test_name_suffix in check_scaling
jarsarasty Oct 10, 2024
2c26702
read from dictionary to store the values
jarsarasty Oct 10, 2024
61f0699
relocate test files
jarsarasty Oct 10, 2024
59088f3
skip scaling test when Casadi returned min value from scaling check i…
jarsarasty Oct 11, 2024
0c4c6b3
Merge branch 'main' of remote into scaling_test
jarsarasty Oct 15, 2024
7c31ce6
Update Changelog
jarsarasty Oct 15, 2024
70fc365
handle skipped tets in test_runner
jarsarasty Oct 16, 2024
81b6dc3
flake8 style fix
jarsarasty Oct 16, 2024
d957678
change name test_runner
jarsarasty Oct 17, 2024
49b2640
exclude test for time test
jarsarasty Oct 17, 2024
38b8c91
Update Changelog
jarsarasty Oct 15, 2024
0a31543
remove csv file
jarsarasty Oct 28, 2024
4757033
flake8 and black style
jarsarasty Oct 28, 2024
e621f5e
black and flake8 format
jarsarasty Oct 28, 2024
f9ab751
style
jarsarasty Oct 28, 2024
f8ead99
style fix
jarsarasty Oct 28, 2024
238568e
format
jarsarasty Oct 28, 2024
8c2c8d9
more format
jarsarasty Oct 28, 2024
0cdc82f
black format
jarsarasty Oct 28, 2024
0b0fdbb
more black format
jarsarasty Oct 28, 2024
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
19 changes: 13 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# [Unreleased] - 2024-10-07

## Added

- Limit the available pipe classes connetced to heat/gas demand/producers
- Add demands and sources to the topology object to have easy access to the connected pipes/cables later on
- Heating and cooling example case added (2 heating demands, 1 cold demand, hot and cold producer, WKO as seasonal storage)
Expand All @@ -9,33 +10,39 @@
- Test case: Head loss validation with pandapipes.
- Example on ESDL file creation using pyESDL for the PoC Tutorial.
- Electrolyzer specific power curve valley location specified optionally specified in ESDL.
- Grow_workflow: Solver class created to allow the use of CPLEX as a solver for EndScenarioSizing classes.
- Grow_workflow: Solver class created to allow the use of CPLEX as a solver for EndScenarioSizing classes.
- tests/test_runner.py: A custom test runner that collects range_data from from the scaling checks of tests models, as well as other detailed test run information.
- tests\utils_test_scaling.py: Include functions for scaling checks.

## Changed

- Cooling demand added to adapt_hourly_year_profile_to_day_averaged_with_hourly_peak_day (peak cooling day not used yet)
- Impact on the way EndScenarioSizing problems in MESIDO are run: The calling of the different optimization problem classes has been split from the solver classes. In EndScenarioSizing classes, the HIGHS solver is the default and the calling functions also cather for other solvers by adding the keyword "solver_class" with the respective solver class.
- Bugfix: No longer required to provide a power at the heating demands when a profile has been added.
- Bugfix: Scaling fix on ATES temperature variable when temperature modelling not used.
- Bugfix: Fix on nominals in electricity cables and gas pipes. Fix on nominals for nodes with logical links.

- Tests: Include scaling checks in multiple tests listed in tests\README.txt

## Fixed

- Bug fix: machine error/rounding with updating lower bound values in the grow_workflow after stage 1
- documentation: heat physics tank storage
- bug fix in grow_workflow (heat networks), changed minimum velocity from 0 to default value
- addition to tests checking the minimum velocity setting in a workflow


# [0.1.7] - 2024-08-23

## Added

- User feedback regarding demand type to be used in heat networks
- Functionality to connect assets with logical links

## Changed

- Increased time limit for stage 1, priority 1
- Replaced Retry loop to connect all assets and apply the correct modifiers of the linked assets

## Fixed
- Error exit when stage 1, priority 1 was not successful

## Fixed

- Error exit when stage 1, priority 1 was not successful
Empty file added output.txt
Empty file.
23 changes: 22 additions & 1 deletion tests/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ General notes:

***************************************************************************************************

Exsting test cases:
Existing test cases:
- What do we want to explain in description? General scenario? Or more detail like 1 year profile
used etc?
- Where is the warming up 3/4 test cases that have been mentioned by Ryvo and Sam - KvR check with Ryvo where there cases are?
Expand Down Expand Up @@ -663,3 +663,24 @@ r"""

***************************************************************************************************


- Scaling checks

Scaling checks have been included in the following test functions:
test_absolute_heat
test_asset_is_realized
test_ates
test_airco
test_cold_demand
test_wko
test_end_scenario_sizing
test_gas_boiler
test_heat_network_head_loss_LINEARIZED_N_LINES_WEAK_INEQUALITY
test_heat_network_head_loss_LINEARIZED_N_LINES_EQUALITY
test_heat_loss
test_insulation_heatdemand
test_multi_commodity_simulator_priorities_el
test_network_simulator
test_pipe_class_var
test_1a
test_2a
12 changes: 9 additions & 3 deletions tests/models/absolute_heat/src/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
from rtctools.optimization.linearized_order_goal_programming_mixin import (
LinearizedOrderGoalProgrammingMixin,
)
from rtctools.optimization.single_pass_goal_programming_mixin import SinglePassGoalProgrammingMixin
from rtctools.optimization.single_pass_goal_programming_mixin import (
SinglePassGoalProgrammingMixin,
)
from rtctools.optimization.timeseries import Timeseries
from rtctools.util import run_optimization_problem

Expand Down Expand Up @@ -48,7 +50,9 @@ def __init__(self, state: str, target: Timeseries):
self.function_nominal = np.median(target.values)

def function(
self, optimization_problem: CollocatedIntegratedOptimizationProblem, ensemble_member: int
self,
optimization_problem: CollocatedIntegratedOptimizationProblem,
ensemble_member: int,
) -> ca.MX:
"""
This function returns the state to which will be tried to match to the target.
Expand Down Expand Up @@ -89,7 +93,9 @@ def __init__(self, source: str):
self.function_nominal = 1e6

def function(
self, optimization_problem: CollocatedIntegratedOptimizationProblem, ensemble_member: int
self,
optimization_problem: CollocatedIntegratedOptimizationProblem,
ensemble_member: int,
) -> ca.MX:
"""
This function returns the state variable to which should to be matched to the target
Expand Down
12 changes: 10 additions & 2 deletions tests/models/basic_buffer/src/model_heat.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,18 @@ def __init__(self):
)

self.add_variable(
HeatPipe, "pipe1a_cold", length=170.365, diameter=0.15, **cold_pipe_modifiers
HeatPipe,
"pipe1a_cold",
length=170.365,
diameter=0.15,
**cold_pipe_modifiers,
)
self.add_variable(
HeatPipe, "pipe1b_cold", length=309.635, diameter=0.15, **cold_pipe_modifiers
HeatPipe,
"pipe1b_cold",
length=309.635,
diameter=0.15,
**cold_pipe_modifiers,
)
self.add_variable(HeatPipe, "pipe4a_cold", length=5, diameter=0.15, **cold_pipe_modifiers)
self.add_variable(HeatPipe, "pipe4b_cold", length=15, diameter=0.15, **cold_pipe_modifiers)
Expand Down
5 changes: 4 additions & 1 deletion tests/models/basic_source_and_demand/src/model_heat.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ def __init__(self):
)

self.add_variable(
HeatDemand, "demand", HeatIn=dict(Heat=dict(max=5e5)), **supply_return_modifiers
HeatDemand,
"demand",
HeatIn=dict(Heat=dict(max=5e5)),
**supply_return_modifiers,
)

self.add_variable(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
from rtctools.optimization.csv_mixin import CSVMixin
from rtctools.optimization.goal_programming_mixin import Goal
from rtctools.optimization.homotopy_mixin import HomotopyMixin
from rtctools.optimization.single_pass_goal_programming_mixin import SinglePassGoalProgrammingMixin
from rtctools.optimization.single_pass_goal_programming_mixin import (
SinglePassGoalProgrammingMixin,
)
from rtctools.util import run_optimization_problem

if __name__ == "__main__":
Expand Down
12 changes: 9 additions & 3 deletions tests/models/electricity_cable_topology/src/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
from rtctools.optimization.linearized_order_goal_programming_mixin import (
LinearizedOrderGoalProgrammingMixin,
)
from rtctools.optimization.single_pass_goal_programming_mixin import SinglePassGoalProgrammingMixin
from rtctools.optimization.single_pass_goal_programming_mixin import (
SinglePassGoalProgrammingMixin,
)
from rtctools.optimization.timeseries import Timeseries
from rtctools.util import run_optimization_problem

Expand Down Expand Up @@ -49,7 +51,9 @@ def __init__(self, state: str, target: Timeseries):
self.function_nominal = np.median(target.values)

def function(
self, optimization_problem: CollocatedIntegratedOptimizationProblem, ensemble_member: int
self,
optimization_problem: CollocatedIntegratedOptimizationProblem,
ensemble_member: int,
) -> ca.MX:
"""
This function returns the state to which will be tried to match to the target.
Expand Down Expand Up @@ -90,7 +94,9 @@ def __init__(self, cable: str):
self.function_nominal = 1.0

def function(
self, optimization_problem: CollocatedIntegratedOptimizationProblem, ensemble_member: int
self,
optimization_problem: CollocatedIntegratedOptimizationProblem,
ensemble_member: int,
) -> ca.MX:
"""
This function returns the state variable to which should to be matched to the target
Expand Down
26 changes: 15 additions & 11 deletions tests/models/emerge/src/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
from rtctools.optimization.linearized_order_goal_programming_mixin import (
LinearizedOrderGoalProgrammingMixin,
)
from rtctools.optimization.single_pass_goal_programming_mixin import SinglePassGoalProgrammingMixin
from rtctools.optimization.single_pass_goal_programming_mixin import (
SinglePassGoalProgrammingMixin,
)


class MaxHydrogenProduction(Goal):
Expand All @@ -45,7 +47,9 @@ def __init__(self, source: str):
self.source = source

def function(
self, optimization_problem: CollocatedIntegratedOptimizationProblem, ensemble_member: int
self,
optimization_problem: CollocatedIntegratedOptimizationProblem,
ensemble_member: int,
) -> ca.MX:
"""
This function returns the state variable to be minimized.
Expand Down Expand Up @@ -83,14 +87,14 @@ def __init__(self, source: str):
self.source = source

def function(
self, optimization_problem: CollocatedIntegratedOptimizationProblem, ensemble_member: int
self,
optimization_problem: CollocatedIntegratedOptimizationProblem,
ensemble_member: int,
) -> ca.MX:

return -optimization_problem.state(f"{self.source}.Electricity_source")


class MaxRevenue(Goal):

priority = 1

order = 1
Expand All @@ -110,7 +114,9 @@ def __init__(self, asset_name: str):
self.asset_name = asset_name

def function(
self, optimization_problem: CollocatedIntegratedOptimizationProblem, ensemble_member: int
self,
optimization_problem: CollocatedIntegratedOptimizationProblem,
ensemble_member: int,
) -> ca.MX:
"""
This function returns the state variable to be minimized.
Expand All @@ -129,7 +135,6 @@ def function(


class MinCost(Goal):

priority = 1

order = 1
Expand All @@ -142,9 +147,10 @@ def __init__(self, asset_name: str):
self.asset_name = asset_name

def function(
self, optimization_problem: CollocatedIntegratedOptimizationProblem, ensemble_member: int
self,
optimization_problem: CollocatedIntegratedOptimizationProblem,
ensemble_member: int,
) -> ca.MX:

return optimization_problem.extra_variable(
f"{self.asset_name}__fixed_operational_cost", ensemble_member
) + optimization_problem.extra_variable(
Expand Down Expand Up @@ -195,7 +201,6 @@ def __init__(self, *args, **kwargs):
# return goals

def goals(self):

goals = super().goals().copy()

for asset_name in [
Expand Down Expand Up @@ -319,7 +324,6 @@ def post(self):


if __name__ == "__main__":

tic = time.time()
# for _ in range(10):
# elect = run_optimization_problem(
Expand Down
12 changes: 9 additions & 3 deletions tests/models/gas_pipe_topology/src/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
from rtctools.optimization.linearized_order_goal_programming_mixin import (
LinearizedOrderGoalProgrammingMixin,
)
from rtctools.optimization.single_pass_goal_programming_mixin import SinglePassGoalProgrammingMixin
from rtctools.optimization.single_pass_goal_programming_mixin import (
SinglePassGoalProgrammingMixin,
)
from rtctools.optimization.timeseries import Timeseries
from rtctools.util import run_optimization_problem

Expand Down Expand Up @@ -48,7 +50,9 @@ def __init__(self, state: str, target: Timeseries):
self.function_nominal = np.median(target.values)

def function(
self, optimization_problem: CollocatedIntegratedOptimizationProblem, ensemble_member: int
self,
optimization_problem: CollocatedIntegratedOptimizationProblem,
ensemble_member: int,
) -> ca.MX:
"""
This function returns the state to which will be tried to match to the target.
Expand Down Expand Up @@ -89,7 +93,9 @@ def __init__(self, pipe: str):
self.function_nominal = 1.0e3

def function(
self, optimization_problem: CollocatedIntegratedOptimizationProblem, ensemble_member: int
self,
optimization_problem: CollocatedIntegratedOptimizationProblem,
ensemble_member: int,
) -> ca.MX:
"""
This function returns the state variable to which should to be matched to the target
Expand Down
20 changes: 10 additions & 10 deletions tests/models/heat_exchange/src/run_heat_exchanger.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@
from rtctools.optimization.collocated_integrated_optimization_problem import (
CollocatedIntegratedOptimizationProblem,
)
from rtctools.optimization.goal_programming_mixin import Goal, GoalProgrammingMixin
from rtctools.optimization.goal_programming_mixin import Goal
from rtctools.optimization.linearized_order_goal_programming_mixin import (
LinearizedOrderGoalProgrammingMixin,
)
from rtctools.optimization.single_pass_goal_programming_mixin import (
CachingQPSol,
SinglePassGoalProgrammingMixin,
)
from rtctools.util import run_optimization_problem


Expand Down Expand Up @@ -49,6 +53,7 @@ def path_goals(self):
def solver_options(self):
options = super().solver_options()
options["solver"] = "highs"
self._qpsol = CachingQPSol()
return options


Expand All @@ -72,7 +77,7 @@ class HeatProblem(
_GoalsAndOptions,
PhysicsMixin,
LinearizedOrderGoalProgrammingMixin,
GoalProgrammingMixin,
SinglePassGoalProgrammingMixin,
ESDLMixin,
CollocatedIntegratedOptimizationProblem,
):
Expand All @@ -91,17 +96,12 @@ def energy_system_options(self):

return options

def solver_options(self):
options = super().solver_options()
options["solver"] = "highs"
return options


class HeatProblemTvarSecondary(
_GoalsAndOptions,
PhysicsMixin,
LinearizedOrderGoalProgrammingMixin,
GoalProgrammingMixin,
SinglePassGoalProgrammingMixin,
ESDLMixin,
CollocatedIntegratedOptimizationProblem,
):
Expand Down Expand Up @@ -158,7 +158,7 @@ class HeatProblemTvar(
_GoalsAndOptions,
PhysicsMixin,
LinearizedOrderGoalProgrammingMixin,
GoalProgrammingMixin,
SinglePassGoalProgrammingMixin,
ESDLMixin,
CollocatedIntegratedOptimizationProblem,
):
Expand Down Expand Up @@ -210,7 +210,7 @@ class HeatProblemTvarDisableHEX(
_GoalsAndOptions,
PhysicsMixin,
LinearizedOrderGoalProgrammingMixin,
GoalProgrammingMixin,
SinglePassGoalProgrammingMixin,
ESDLMixin,
CollocatedIntegratedOptimizationProblem,
):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ def __init__(self, state: str, target: Timeseries):
self.function_nominal = np.median(target.values)

def function(
self, optimization_problem: CollocatedIntegratedOptimizationProblem, ensemble_member: int
self,
optimization_problem: CollocatedIntegratedOptimizationProblem,
ensemble_member: int,
):
return optimization_problem.state(self.state)

Expand Down
Loading