Expose grid connection limits #322
Replies: 9 comments 62 replies
-
not that I can think of @tiyash-basu-frequenz |
Beta Was this translation helpful? Give feedback.
-
Whenever someone entered a wrong value or did not yet provide a value or the grid connection has been extended. However, any change has to be picked up and exposed.
of course. |
Beta Was this translation helpful? Give feedback.
-
most likely the PowerManager will be the main consumer of that limitation but other actors might need it too. So it "feels" more like a channel tbh. |
Beta Was this translation helpful? Give feedback.
-
I updated the discussion text with the results of the current comments. @sahas-subramanian-frequenz it would be good to know your opinion here too, specially in terms of the channel-based interface. |
Beta Was this translation helpful? Give feedback.
-
Right, and the same value will apply to all the three phases individually. |
Beta Was this translation helpful? Give feedback.
-
To summarize the latest events and the merging of the changes in the microgrid API, this is what I propose to add to the SDK: from frequenz.sdk import microgrid
max_current = microgrogrid.grid_connection.fuse_rate_current Where We could also add some utility methods for checking a current value is within the accepted limits. We could accept if not microgrid.grid_connection.is_current_within_bounds(10):
scream()
if not microgrid.grid_connection.is_current_within_bounds(sample):
scream()
# With 3 phases
if not microgrid.grid_connection.is_current_within_bounds(10, 23, 12):
scream()
tuple_3_phase = (10, 23, 12)
if not microgrid.grid_connection.is_current_within_bounds(*tuple_3_phase):
scream()
if not microgrid.grid_connection.is_current_within_bounds(sample_3_phase):
scream() So the user doesn't have to think in low level terms, if the fuse rate applies to one phase or all of them... Does this look good? @tiyash-basu-frequenz, @thomas-nicolai-frequenz , @sahas-subramanian-frequenz |
Beta Was this translation helpful? Give feedback.
-
OK, I created an issue based on this discussion. Closing. |
Beta Was this translation helpful? Give feedback.
-
Reopening because of #322 (reply in thread) |
Beta Was this translation helpful? Give feedback.
-
We need to add a way to allow users to know the grid connection limits.
The base concept comes from the fact that a grid connection has a fuse, and we should avoid blowing that fuse.
The microgrid API already defines a
COMPONENT_CATEGORY_GRID
, so we probably should define afrequenz.sdk.microgrid.component.Grid
class.We should probably provide an abstraction at the level of the logical meter and *pools, so
frequenz.sdk.microgrid.grid_connection
maybe, and that should probably have afuse
attribute, which should have amax_current
attribute for now.So the end-user interface should be something like:
Questions:
TheGrid
class should probably have amax_current
attribute.The
Grid
class should be the one-to-one representation of what comes from the microgrid API. It shouldn't be normally exposed to the user unless they want to interact with the microgrid API directly.Are there any other limits we need to expose? (max_power
or anything else)Maybe in the future, but as long as we have the interface right it should be easy to add in the future.
Does it have only one phase or should we expose this for multiple phases?Only one value for now, as it is the fuse max current (it is an absolute value).
There should probably only be only one instance of aGrid
object. It sounds like this should be initialized by the SDK and exposed like withlogical_meter
orbattery_pool
, so...Should we have a singleton instance accessible throughfrequenz.sdk.microgrid.grid
?YES, so it won't be an instance of the
Grid
object but another, higher-level, abstraction.How often do these limits change?Only when the fuse is replaced, so it is a very low frequency change.
Do we need a task to keep this instance updated?No, the
Grid
object will be dumb and just a representation of what comes from the API. We will offer a channel-based interface like we do with the logical meter.Should this instance provide a direct interface or a channel based interface? (this is probably tied to how often it changes and if users are expected to subscribe to changes or if they will just query the current value when they need it.See above.
Sogrid.max_current
is afloat
with the value? (for this we could just expose thefrequenz.sdk.microgrid.component.Grid
instance infrequenz.sdk.microgrid.grid
, providing that we have an extra task that keeps it up to date)Or should it provide a channel interface likelogical_meter
andbattery pool
, so users should get the value usinggrid.max_current.new_receiver()
? (for this we would need a class that just usesfrequenz.sdk.microgrid.component.Grid
as mean to communicate to the microgrid API). In this case it might be better to call itfrequenz.sdk.microgrid.grid_connection
?Coming from:
Beta Was this translation helpful? Give feedback.
All reactions