Skip to content

Conversation

@tiyash-basu-frequenz
Copy link
Contributor

@tiyash-basu-frequenz tiyash-basu-frequenz commented Aug 28, 2023

Calling microgrid.initialize() now also initializes the microgrid's grid connection point as a singleton object of a newly added type Grid. This object can be obtained by calling microgrid.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 calling microgrid.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 Fuse has been added to represent fuses. This class has a member variable max_current which 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.

@tiyash-basu-frequenz tiyash-basu-frequenz added this to the v1.0.0-rc milestone Aug 28, 2023
@tiyash-basu-frequenz tiyash-basu-frequenz self-assigned this Aug 28, 2023
@tiyash-basu-frequenz tiyash-basu-frequenz requested a review from a team as a code owner August 28, 2023 11:47
@tiyash-basu-frequenz tiyash-basu-frequenz linked an issue Aug 28, 2023 that may be closed by this pull request
2 tasks
@github-actions github-actions bot added part:docs Affects the documentation part:tests Affects the unit, integration and performance (benchmarks) tests part:microgrid Affects the interactions with the microgrid labels Aug 28, 2023
@tiyash-basu-frequenz tiyash-basu-frequenz force-pushed the grid_connection branch 3 times, most recently from 133d387 to 14a6770 Compare August 28, 2023 12:14
Copy link
Contributor

@daniel-zullo-frequenz daniel-zullo-frequenz left a 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

@tiyash-basu-frequenz tiyash-basu-frequenz force-pushed the grid_connection branch 2 times, most recently from a3a46ac to 3f390dd Compare August 28, 2023 13:18
@tiyash-basu-frequenz tiyash-basu-frequenz force-pushed the grid_connection branch 3 times, most recently from 8e39de5 to a4f1851 Compare August 29, 2023 12:48
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]>
@tiyash-basu-frequenz
Copy link
Contributor Author

Rebased on latest commit in v0.x.x.

llucax
llucax previously approved these changes Aug 30, 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.

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.

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]>
@tiyash-basu-frequenz tiyash-basu-frequenz added this pull request to the merge queue Aug 30, 2023
Merged via the queue into frequenz-floss:v0.x.x with commit 3b944e4 Aug 30, 2023
@tiyash-basu-frequenz tiyash-basu-frequenz deleted the grid_connection branch August 30, 2023 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

part:docs Affects the documentation part:microgrid Affects the interactions with the microgrid part:tests Affects the unit, integration and performance (benchmarks) tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose grid connection limits

4 participants