You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add module to easily create component graphs (#606)
This adds a module that allows the easy creation of component graphs.
Here is a simple example:
```python
gen = GraphGenerator()
# Pre-create a battery component to refer to it later or to use it in multiple
# places in the graph.
special_bat = gen.component(ComponentCategory.BATTERY)
graph = gen.to_graph(
(
ComponentCategory.METER, # grid side meter
[ # list of components connected to grid side meter
(
ComponentCategory.METER, # Meter in front of battery->inverter
( # A tuple, first is connected to parent, second is the child of the first
# Inverter in front of battery, type will be
# set to InverterType.BATTERY
ComponentCategory.INVERTER,
ComponentCategory.BATTERY, # Battery
),
),
(
ComponentCategory.METER,
(
# Inverter in front of battery, type will be
# set to InverterType.BATTERY
ComponentCategory.INVERTER,
special_bat, # Pre-created battery
),
),
],
)
)
```
it's not actually used yet, but I plan to do that for the n:m
battery:inverter
issue.
It also updates the MockMicrogrid to accept such graphs as parameter.
I suspect that part will receive some more udpates and fixes as I use it
more.
0 commit comments