grid
frequenz.sdk.timeseries.grid ¤
Grid connection point.
This module provides the Grid
type, which represents a grid connection point
in a microgrid.
Classes¤
frequenz.sdk.timeseries.grid.Grid
dataclass
¤
A grid connection point.
Note
The Grid
instance is not meant to be created directly by users.
Use the microgrid.grid
method for
creating or getting the Grid
instance.
Example
from datetime import timedelta
from frequenz.sdk import microgrid
from frequenz.sdk.timeseries import ResamplerConfig
await microgrid.initialize(
"grpc://127.0.0.1:50051",
ResamplerConfig(resampling_period=timedelta(seconds=1))
)
grid = microgrid.grid()
# Get a receiver for a builtin formula
grid_power_recv = grid.power.new_receiver()
async for grid_power_sample in grid_power_recv:
print(grid_power_sample)
Source code in frequenz/sdk/timeseries/grid.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
|
Attributes¤
current_per_phase
property
¤
current_per_phase: FormulaEngine3Phase[Current]
Fetch the per-phase grid current for the microgrid.
This formula produces values that are in the Passive Sign Convention (PSC).
If a formula engine to calculate grid current is not already running, it will be started.
A receiver from the formula engine can be created using the new_receiver
method.
RETURNS | DESCRIPTION |
---|---|
FormulaEngine3Phase[Current]
|
A FormulaEngine that will calculate and stream grid current. |
fuse
instance-attribute
¤
fuse: Fuse | None
The fuse protecting the grid connection point.
The rated current of the fuse is set to zero in case of an islanded
microgrid.
And the fuse is set to None
when the grid connection component metadata
lacks information about the fuse.
power
property
¤
power: FormulaEngine[Power]
Fetch the grid power for the microgrid.
This formula produces values that are in the Passive Sign Convention (PSC).
If a formula engine to calculate grid power is not already running, it will be started.
A receiver from the formula engine can be created using the new_receiver
method.
RETURNS | DESCRIPTION |
---|---|
FormulaEngine[Power]
|
A FormulaEngine that will calculate and stream grid power. |
reactive_power
property
¤
reactive_power: FormulaEngine[ReactivePower]
Fetch the grid reactive power for the microgrid.
This formula produces values that are in the Passive Sign Convention (PSC).
If a formula engine to calculate grid power is not already running, it will be started.
A receiver from the formula engine can be created using the new_receiver
method.
RETURNS | DESCRIPTION |
---|---|
FormulaEngine[ReactivePower]
|
A FormulaEngine that will calculate and stream grid reactive power. |
Functions¤
Functions¤
frequenz.sdk.timeseries.grid.get ¤
get() -> Grid
Get the grid connection.
Note that the rated current of the fuse is set to zero in case of an
islanded microgrid.
And the fuse is set to None
when the grid connection component metadata
lacks information about the fuse.
RETURNS | DESCRIPTION |
---|---|
Grid
|
The grid connection. |
Source code in frequenz/sdk/timeseries/grid.py
frequenz.sdk.timeseries.grid.initialize ¤
initialize(
channel_registry: ChannelRegistry,
resampler_subscription_sender: Sender[
ComponentMetricRequest
],
) -> None
Initialize the grid connection.
PARAMETER | DESCRIPTION |
---|---|
channel_registry
|
The channel registry instance shared with the resampling actor.
TYPE:
|
resampler_subscription_sender
|
The sender for sending metric requests to the resampling actor.
TYPE:
|
RAISES | DESCRIPTION |
---|---|
RuntimeError
|
If there is more than 1 grid connection point in the microgrid, or if the grid connection point is not initialized. |