-
Notifications
You must be signed in to change notification settings - Fork 20
Initialize a Grid object with a given Fuse limit
#610
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initialize a Grid object with a given Fuse limit
#610
Conversation
133d387 to
14a6770
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a few minor suggestions to check for and LGTM otherwise
a3a46ac to
3f390dd
Compare
8e39de5 to
a4f1851
Compare
Objects of the `Component` type are used in `ComponentGraph` in sets. The implicit hash method works there for now, but adding new members to the `Component` class may make it unhashable in the future, if the added members themselves are unhashable. Implementing an explicit hash method here removes this burden from from future member types. Component IDs are supposed to be unique in a microgrid, therefore hashing a `Component` object just based on its component ID is enough. Signed-off-by: Tiyash Basu <[email protected]>
This commit refactors the declarations of types in format `Optional[X]` to `X | None`. Signed-off-by: Tiyash Basu <[email protected]>
This commit introduces metadata to Components by incorporating GridMetadata, which now includes the maximum grid current, specified in Amperes. Signed-off-by: Tiyash Basu <[email protected]>
This commit allows tests to specify the `rated_fuse_current` member in the metadata objects of grid connection points. The test data supplied using this mechanism can be used in downstream validations. Signed-off-by: Tiyash Basu <[email protected]>
a4f1851 to
8f3fb2e
Compare
|
Rebased on latest commit in v0.x.x. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few more optional (no pun intended) comments. Maybe @shsms should have a quick look too as he is probably the most familiar with the microgrid API code.
9fa91bd to
f7c54a3
Compare
Grid connection points are nodes in the component graph that abstract grids in a microgrid. Such nodes have their own metadata, which include their rated fuse limits. Microgrids with zero or one grid connection points are accepted. Note that a microgrid may have zero grid connection points, if it is configured as an island. This commit adds a module exposing a representation of such grid connection points. The module is named `frequenz.sdk.microgrid.grid`. The `grid` module exposes a singleton object that represents the grid connection point. It gets initialized when `microgrid.initialize()` is called. It can be obtained by calling `microgrid.grid_connection.get()`. Signed-off-by: Tiyash Basu <[email protected]>
This commit introduces a class to represent fuses. Fuses have just one property representing their rated max current. If the current flowing through a fuse is greater than this limit, then the fuse will break the circuit. This commit also introduces using a Fuse object to represent the allowed max current at a grid connection point. Signed-off-by: Tiyash Basu <[email protected]>
This commit uses a Fuse object to represent the max current limit in component metadata in the internal layer that parses component objects obtained directly from the Microgrid API. This makes the abstraction of fuses one level deeper, increasing the chances of the `grid_connection.py` file being more stable in the future if/when further changes are introduced in the Microgrid API. Signed-off-by: Tiyash Basu <[email protected]>
f7c54a3 to
d2de571
Compare
Calling
microgrid.initialize()now also initializes the microgrid's grid connection point as a singleton object of a newly added typeGrid. This object can be obtained by callingmicrogrid.grid.get(). This object exposes the max current that can course through the grid connection point, which is useful for the power distribution algorithm. The max current is provided by the Microgrid API, and can be obtained by callingmicrogrid.grid.get().fuse.max_current.Note that a microgrid is allowed to have zero or one grid connection point. Microgrids configured as islands will have zero grid connection points, and microgrids configured as grid-connected will have one grid connection point.
A new class
Fusehas been added to represent fuses. This class has a member variablemax_currentwhich represents the maximum current that can course through the fuse. If the current flowing through a fuse is greater than this limit, then the fuse will break the circuit.