Skip to content

Conversation

@Marenz
Copy link
Contributor

@Marenz Marenz commented Nov 27, 2023

This is a WIP and the current work is 90% done by ChatGPT.
I am currently busy with a few other things, so anyone can take over this PR and finish it.
Otherwise I'll get back to it when my important stuff is done.

@github-actions github-actions bot added part:data-pipeline Affects the data pipeline part:actor Affects an actor ot the actors utilities (decorator, etc.) part:microgrid Affects the interactions with the microgrid labels Nov 27, 2023
Copy link
Contributor

@llucax llucax left a comment

Choose a reason for hiding this comment

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

I would really avoid using NewType in this case, also I'm not sure if we should update all component_id to component as how the component is specified now is encoded in the type system, and could open the door to pass a component as an object for example (or even think more on a case-by-case basis if another name is more suitable). But I guess that part is out of scope for this PR.

from ...timeseries import Fuse


ComponentId = NewType("ComponentId", int)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why NewType and not dataclass?

NewType allows this for example: ComponentId(1) + 2 and microgrid.battery_pool(priority=ComponentId(1)) which is just weird.

Also the str and repr looks just like a bare int, which might be good or not (I personally would like to at least have repr use ComponentId(1) instead of just 1.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Honestly, no specific reason, I selected NewType after a quick research, I am not set on using it :)

Copy link
Contributor

Choose a reason for hiding this comment

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

In that case I would use a dataclass, I see no benefits in using NewType and a few drawbacks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

just a data class with one member you mean?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yup.

@llucax llucax modified the milestones: v1.0.0-rc5, v1.0.0-rc6 Jan 29, 2024
@llucax llucax modified the milestones: v1.0.0-rc6, v1.0.0-rc7 Mar 26, 2024
@llucax
Copy link
Contributor

llucax commented Jul 1, 2024

I'll try this in the new microgrid API client.

@llucax llucax closed this Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

part:actor Affects an actor ot the actors utilities (decorator, etc.) part:data-pipeline Affects the data pipeline part:microgrid Affects the interactions with the microgrid

Projects

Development

Successfully merging this pull request may close these issues.

2 participants