config
frequenz.lib.notebooks.config ¤
Configuration for microgrids.
Attributes¤
frequenz.lib.notebooks.config.ComponentCategory
module-attribute
¤
ComponentCategory = Literal[
"meter", "inverter", "component"
]
Valid component categories.
frequenz.lib.notebooks.config.ComponentType
module-attribute
¤
ComponentType = Literal[
"grid", "pv", "battery", "consumption", "chp"
]
Valid component types.
Classes¤
frequenz.lib.notebooks.config.AssetsConfig
dataclass
¤
Configuration of the assets in a microgrid.
Source code in frequenz/lib/notebooks/config.py
Attributes¤
battery
class-attribute
instance-attribute
¤
battery: dict[str, BatteryConfig] | None = None
Configuration of the batteries.
pv
class-attribute
instance-attribute
¤
Configuration of the PV system.
wind
class-attribute
instance-attribute
¤
wind: dict[str, WindConfig] | None = None
Configuration of the wind turbines.
frequenz.lib.notebooks.config.BatteryConfig
dataclass
¤
Configuration of a battery in a microgrid.
Source code in frequenz/lib/notebooks/config.py
frequenz.lib.notebooks.config.ComponentTypeConfig
dataclass
¤
Configuration of a microgrid component type.
Source code in frequenz/lib/notebooks/config.py
Attributes¤
component
class-attribute
instance-attribute
¤
List of component IDs for this component.
formula
class-attribute
instance-attribute
¤
Formula to calculate the power of this component.
inverter
class-attribute
instance-attribute
¤
List of inverter IDs for this component.
meter
class-attribute
instance-attribute
¤
List of meter IDs for this component.
Functions¤
__post_init__ ¤
Set the default formula if none is provided.
Source code in frequenz/lib/notebooks/config.py
_default_cids ¤
Get the default component IDs for this component.
If available, the meter IDs are returned, otherwise the inverter IDs. For components without meters or inverters, the component IDs are returned.
RETURNS | DESCRIPTION |
---|---|
list[int]
|
List of component IDs for this component. |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If no IDs are available. |
Source code in frequenz/lib/notebooks/config.py
cids ¤
Get component IDs for this component.
By default, the meter IDs are returned if available, otherwise the inverter IDs. For components without meters or inverters, the component IDs are returned.
If a metric is provided, the component IDs are extracted from the formula.
PARAMETER | DESCRIPTION |
---|---|
metric
|
Metric name of the formula.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
list[int]
|
List of component IDs for this component. |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If the metric is not supported or improperly set. |
Source code in frequenz/lib/notebooks/config.py
is_valid_type
classmethod
¤
frequenz.lib.notebooks.config.Metadata
dataclass
¤
Metadata for a microgrid.
Source code in frequenz/lib/notebooks/config.py
Attributes¤
altitude
class-attribute
instance-attribute
¤
altitude: float | None = None
Geographic altitude of the microgrid.
delivery_area
class-attribute
instance-attribute
¤
delivery_area: str | None = None
Delivery area of the microgrid.
latitude
class-attribute
instance-attribute
¤
latitude: float | None = None
Geographic latitude of the microgrid.
frequenz.lib.notebooks.config.MicrogridConfig
dataclass
¤
Configuration of a microgrid.
Source code in frequenz/lib/notebooks/config.py
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 |
|
Attributes¤
_assets_cfg
instance-attribute
¤
_assets_cfg: AssetsConfig = AssetsConfig(
pv=get("pv") or {},
wind=get("wind") or {},
battery=get("battery") or {},
)
Configuration of the assets in the microgrid.
_component_types_cfg
instance-attribute
¤
_component_types_cfg: dict[str, ComponentTypeConfig] = {
ctype: ComponentTypeConfig(
component_type=cast(ComponentType, ctype), **cfg
)
for (ctype, cfg) in items()
if is_valid_type(ctype)
}
Mapping of component category types to ac power component config.
_metadata
instance-attribute
¤
Metadata of the microgrid.
Functions¤
__init__ ¤
Initialize the microgrid configuration.
PARAMETER | DESCRIPTION |
---|---|
config_dict
|
Dictionary with component type as key and config as value. |
Source code in frequenz/lib/notebooks/config.py
component_type_ids ¤
component_type_ids(
component_type: str,
component_category: str | None = None,
metric: str = "",
) -> list[int]
Get a list of all component IDs for a component type.
PARAMETER | DESCRIPTION |
---|---|
component_type
|
Component type to be aggregated.
TYPE:
|
component_category
|
Specific category of component IDs to retrieve (e.g., "meter", "inverter", or "component"). If not provided, the default logic is used.
TYPE:
|
metric
|
Metric name of the formula if CIDs should be extracted from the formula.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
list[int]
|
List of component IDs for this component type. |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If the component type is unknown. |
KeyError
|
If |
Source code in frequenz/lib/notebooks/config.py
component_types ¤
formula ¤
Get the formula for a component type.
PARAMETER | DESCRIPTION |
---|---|
component_type
|
Component type to be aggregated.
TYPE:
|
metric
|
Metric to be aggregated.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
str
|
Formula to be used for this aggregated component as string. |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If the component type is unknown or formula is missing. |
Source code in frequenz/lib/notebooks/config.py
load_configs
staticmethod
¤
load_configs(*paths: str) -> dict[str, MicrogridConfig]
Load multiple microgrid configurations from a file.
Configs for a single microgrid are expected to be in a single file. Later files with the same microgrid ID will overwrite the previous configs.
PARAMETER | DESCRIPTION |
---|---|
*paths
|
Path(es) to the config file(s).
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
dict[str, MicrogridConfig]
|
Dictionary of single microgrid formula configs with microgrid IDs as keys. |
Source code in frequenz/lib/notebooks/config.py
frequenz.lib.notebooks.config.PVConfig
dataclass
¤
Configuration of a PV system in a microgrid.
Source code in frequenz/lib/notebooks/config.py
frequenz.lib.notebooks.config.WindConfig
dataclass
¤
Configuration of a wind turbine in a microgrid.