Skip to content

Commit 5ca2199

Browse files
committed
Bump frequenz-microgrid-component-graph version to 0.4
Signed-off-by: Sahas Subramanian <[email protected]>
1 parent d463ca3 commit 5ca2199

File tree

5 files changed

+56
-5
lines changed

5 files changed

+56
-5
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ crate-type = ["cdylib"]
1010

1111
[dependencies]
1212
pyo3 = "0.27.1"
13-
frequenz-microgrid-component-graph = "0.3.0"
13+
frequenz-microgrid-component-graph = "0.4"

python/frequenz/microgrid_component_graph/__init__.pyi

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ class ComponentGraphConfig:
2323
allow_unconnected_components: bool = False,
2424
allow_unspecified_inverters: bool = False,
2525
disable_fallback_components: bool = False,
26+
include_phantom_loads_in_consumer_formula: bool = False,
27+
prefer_inverters_in_battery_formula: bool = False,
28+
prefer_inverters_in_pv_formula: bool = False,
29+
prefer_chp_in_chp_formula: bool = False,
30+
prefer_ev_chargers_in_ev_formula: bool = False,
31+
prefer_wind_turbines_in_wind_formula: bool = False,
2632
) -> None:
2733
"""Initialize this instance.
2834
@@ -38,6 +44,33 @@ class ComponentGraphConfig:
3844
disable_fallback_components: Whether to disable fallback components in
3945
generated formulas. When this is `True`, the formulas will not include
4046
fallback components.
47+
include_phantom_loads_in_consumer_formula: Whether to consider phantom loads
48+
in the consumer formula. Meters with successors can still have loads
49+
not represented in the component graph. These are called phantom loads.
50+
When this is `true`, phantom loads are included in formulas by excluding
51+
the measurements of successor meters from the measurements of their
52+
predecessor meters. When `false`, consumer formula is generated by
53+
excluding production and battery components from the grid measurements.
54+
prefer_inverters_in_battery_formula: Whether to prefer battery inverters
55+
when generating Battery formulas. When this is `true`, battery inverters
56+
will be the primary source and battery meters will be secondary. When
57+
`false`, battery meters will be the primary source.
58+
prefer_inverters_in_pv_formula: Whether to prefer PV inverters when
59+
generating PV formulas. When this is `true`, PV inverters will be the
60+
primary source and PV meters will be secondary. When `false`, PV meters
61+
will be the primary source.
62+
prefer_chp_in_chp_formula: Whether to prefer CHP when generating CHP
63+
formulas. When this is `true`, CHPs will be the primary source and CHP
64+
meters will be secondary. When `false`, CHP meters will be the primary
65+
source.
66+
prefer_ev_chargers_in_ev_formula: Whether to prefer EV chargers when
67+
generating EV charger formulas. When this is `true`, EV chargers will be
68+
the primary source and EV meters will be secondary. When `false`, EV
69+
meters will be the primary source.
70+
prefer_wind_turbines_in_wind_formula: Whether to prefer wind turbines when
71+
generating wind turbine formulas. When this is `true`, wind turbines
72+
will be the primary source and wind meters will be secondary. When
73+
`false`, wind meters will be the primary source.
4174
"""
4275

4376
class ComponentIdProtocol(Protocol):

src/graph.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,38 @@ impl ComponentGraphConfig {
3030
allow_component_validation_failures = false,
3131
allow_unconnected_components = false,
3232
allow_unspecified_inverters = false,
33-
disable_fallback_components = false
33+
disable_fallback_components = false,
34+
include_phantom_loads_in_consumer_formula = false,
35+
prefer_inverters_in_battery_formula = false,
36+
prefer_inverters_in_pv_formula = false,
37+
prefer_chp_in_chp_formula = false,
38+
prefer_ev_chargers_in_ev_formula = false,
39+
prefer_wind_turbines_in_wind_formula = false,
3440
))]
3541
fn new(
3642
allow_component_validation_failures: bool,
3743
allow_unconnected_components: bool,
3844
allow_unspecified_inverters: bool,
3945
disable_fallback_components: bool,
46+
include_phantom_loads_in_consumer_formula: bool,
47+
prefer_inverters_in_battery_formula: bool,
48+
prefer_inverters_in_pv_formula: bool,
49+
prefer_chp_in_chp_formula: bool,
50+
prefer_ev_chargers_in_ev_formula: bool,
51+
prefer_wind_turbines_in_wind_formula: bool,
4052
) -> Self {
4153
ComponentGraphConfig {
4254
config: cg::ComponentGraphConfig {
4355
allow_component_validation_failures,
4456
allow_unconnected_components,
4557
allow_unspecified_inverters,
4658
disable_fallback_components,
59+
include_phantom_loads_in_consumer_formula,
60+
prefer_inverters_in_battery_formula,
61+
prefer_inverters_in_pv_formula,
62+
prefer_chp_in_chp_formula,
63+
prefer_ev_chargers_in_ev_formula,
64+
prefer_wind_turbines_in_wind_formula,
4765
},
4866
}
4967
}

tests/test_microgrid_component_graph.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def test_wind_turbine_graph() -> None:
116116
# References the Meter (ID 2) measuring the Turbine (ID 3).
117117
assert (
118118
graph.wind_turbine_formula(wind_turbine_ids={ComponentId(3)})
119-
== "COALESCE(#3, #2, 0.0)"
119+
== "COALESCE(#2, #3, 0.0)"
120120
)
121121

122122
# 4. Test Topology (Successors/Predecessors)

0 commit comments

Comments
 (0)