Skip to content

Asset sizing mixin generalization#469

Open
FJanssen-TNO wants to merge 6 commits into
mainfrom
asset_sizing_mixin_generalization
Open

Asset sizing mixin generalization#469
FJanssen-TNO wants to merge 6 commits into
mainfrom
asset_sizing_mixin_generalization

Conversation

@FJanssen-TNO

@FJanssen-TNO FJanssen-TNO commented May 4, 2026

Copy link
Copy Markdown
Collaborator

ToDo:

  • better naming for map_variables_asset
  • adding docstrings for new functions

Comment thread src/mesido/asset_sizing_mixin.py Outdated
_make_max_size_var(name=asset_name, lb=lb, ub=ub, nominal=ub / 2.0)


map_variables_asset = {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Still think about a better name for this map

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

map_asset_type_to_bound_vars ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I like it, updated:)

@FJanssen-TNO FJanssen-TNO marked this pull request as ready for review May 15, 2026 13:04
Comment thread src/mesido/asset_sizing_mixin.py Outdated
"electricity_storage": {"upper_bound_suffix": "Stored_electricity"},
}

# Making the __aggregation_count variable for each asset

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Update or delete this outdated code comment:

"# Making the __aggregation_count variable for each asset"

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

updated

Comment thread src/mesido/asset_sizing_mixin.py Outdated
if asset_type in map_variables_asset:
_make_asset_max_size_vars(asset_type, **map_variables_asset[asset_type])
elif asset_type not in ["heat_pipe", "gas_pipe", "cable"]:
logger.warning(f"Assets of type {asset_type} is not supported for sizing, ")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Remove the ", space" at the end of the warning message. Else it seems that a part of the info is missing or not printed after the ",". See below an example:

"
No fixed OPEX cost information specified for asset HeatingDemand_d121
Assets of type node is not supported for sizing,
2026-05-20 13:39:46,374 INFO Starting goal programming
...
"

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

updated

ub = _scalar_upper_bound(ub_raw)
if profile_constraint:
ub = _get_ub_profile_constraint(asset_name, profile_constraint, ub)
lb = 0.0 if parameters[f"{asset_name}.state"] == AssetStateEnum.OPTIONAL else ub

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Previously the lb for a heat_demand the "np.isinf(bounds[f"{asset_name}.Heat_demand"][1])" check was used instead of state. Will this not have an impact now? Same holds for some of the other asset types

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I believe it should work right now. Only in case that that an infinity for the upperbound occurs it might be an issue, but that cannot occur.

Comment thread src/mesido/asset_sizing_mixin.py Outdated
_make_max_size_var(name=asset_name, lb=lb, ub=ub, nominal=ub / 2.0)


map_variables_asset = {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

map_asset_type_to_bound_vars ?

Comment thread src/mesido/asset_sizing_mixin.py Outdated
for asset_name in self.energy_system_components.get("heat_source", []):
ub = bounds[f"{asset_name}.Heat_source"][1]

def _get_ub_profile_constraint(asset_name, profile_name, ub):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

why the word "get" in the name if it is doing something similar to the function "_demand_ub(..)" which does not have the word "get" in it? Should the other new function not also get the word "get"?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I used "get" because we are extracting it from ESDL constraints. whiles "_demand_ub" is just picking the upperbound from the bounds.

Comment thread src/mesido/asset_sizing_mixin.py Outdated
nominal=self.variable_nominal(f"{asset_name}.Secondary_heat"),
return ub

def _scalar_upper_bound(bound_ub):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested name instead, then it is clear that an action is performed (if applicable of course): _scalarise_upper_bound

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good one, updated.

@KobusVanRooyen

Copy link
Copy Markdown
Collaborator

@FJanssen-TNO review completed

@FJanssen-TNO

Copy link
Copy Markdown
Collaborator Author

@KobusVanRooyen ready for review again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants