Skip to content

289 power profiles for producers#338

Open
Jaimepatt wants to merge 11 commits intomainfrom
289-power-profiles-for-producers
Open

289 power profiles for producers#338
Jaimepatt wants to merge 11 commits intomainfrom
289-power-profiles-for-producers

Conversation

@Jaimepatt
Copy link
Contributor

@Jaimepatt Jaimepatt commented Jan 27, 2026

Added functionality for producers to be able to use production profiles. These profiles are assigned through the asset constraint attribute in esdl (as opposed to assigning the profiles to a port, like in the consumers). When creating a producer asset, the code now always checks to see if there is a profile assigned to the constraint.
These profiles are now used to regulate the maximum power a producer can generate at a given timestep. If there is no profile, or the profile is not defined at the current timestep, the controller defaults to the traditional power value, assigned through the power attribute in esdl.
These profiles are not yet compatible with the output profiles of the optimizer. This requires further work.

@Jaimepatt Jaimepatt linked an issue Jan 27, 2026 that may be closed by this pull request
@Jaimepatt Jaimepatt marked this pull request as draft January 27, 2026 09:21
@Jaimepatt
Copy link
Contributor Author

@samvanderzwan ready for review.

@Jaimepatt Jaimepatt marked this pull request as ready for review January 27, 2026 10:36
Copy link
Contributor

@samvanderzwan samvanderzwan left a comment

Choose a reason for hiding this comment

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

Some minor comments.
It looks fine. I am missing tests for the getting of the constraints, can you add these?

temperature_out=temperature_out,
power=power,
marginal_costs=marginal_costs,
profile=resampled_profile if not profile.empty else profile,
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks weird, if your profile is empty you add it otherwise you add another profile.
better in line 64 instead of assign profile assign resampled_profile. and make a comment there that you add empty dataframe when there is no profile.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed, now looking at it, it was a bit confusing. Now line 64 creates resampled_profile as an empty DataFrame if there is no profile.

temperature_out: float,
power: float,
marginal_costs: float,
profile: Optional[pd.DataFrame] = None,
Copy link
Contributor

Choose a reason for hiding this comment

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

Why make this optional? In the mapper you either assign correct profile or empty dataframe.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed, removed the Optional typing.


def get_constraint_profile(self) -> pd.DataFrame:
"""Get the profile from the asset's constraint."""
profile = self.esdl_asset.constraint[0].maximum
Copy link
Contributor

Choose a reason for hiding this comment

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

What happens if there are multiple constraints? If in future we would like to put a temperature constraint for example.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. Temperature or other constraints will need a separate function to extract them. I renamed this one to get_constraint_max_profile and made it loop through all constraint until it finds constraint.maximum (instead of checking constraint[0] like now).

)
t1 = datetime.now()
# result = run(r".\testdata\test1.esdl")
result = run(r".\testdata\test1.esdl")
Copy link
Contributor

Choose a reason for hiding this comment

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

General comment try not to update app.py. Changes here are not relevant for this PR. But leave them for now

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed. It must have slipped in through an intermediate commit.

pass


if __name__ == "__main__":
Copy link
Contributor

Choose a reason for hiding this comment

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

This should not be here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed.

@Jaimepatt
Copy link
Contributor Author

Hi @samvanderzwan I addressed all your changes. 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.

Power profiles for producers

2 participants