Conversation
|
@samvanderzwan ready for review. |
samvanderzwan
left a comment
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
Why make this optional? In the mapper you either assign correct profile or empty dataframe.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
What happens if there are multiple constraints? If in future we would like to put a temperature constraint for example.
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
General comment try not to update app.py. Changes here are not relevant for this PR. But leave them for now
There was a problem hiding this comment.
Removed. It must have slipped in through an intermediate commit.
| pass | ||
|
|
||
|
|
||
| if __name__ == "__main__": |
There was a problem hiding this comment.
This should not be here
|
Hi @samvanderzwan I addressed all your changes. Ready for review again. |
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.