distgridforge 0.3.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. distgridforge-0.3.0.dist-info/METADATA +266 -0
  2. distgridforge-0.3.0.dist-info/RECORD +38 -0
  3. distgridforge-0.3.0.dist-info/WHEEL +5 -0
  4. distgridforge-0.3.0.dist-info/licenses/LICENCE.txt +21 -0
  5. distgridforge-0.3.0.dist-info/top_level.txt +1 -0
  6. gridforge/__init__.py +32 -0
  7. gridforge/case_study/config.py +158 -0
  8. gridforge/case_study/dickert_lv_network_script.py +109 -0
  9. gridforge/case_study/mv_lv_feeder.py +314 -0
  10. gridforge/case_study/simbench_network_test_case.py +168 -0
  11. gridforge/core/__init__.py +0 -0
  12. gridforge/core/constraints.py +421 -0
  13. gridforge/core/cost_model.py +363 -0
  14. gridforge/core/grid_enhancement.py +1932 -0
  15. gridforge/core/power_flow.py +1146 -0
  16. gridforge/core/strategy.py +297 -0
  17. gridforge/engines/__init__.py +0 -0
  18. gridforge/engines/gridlabd_engine.py +527 -0
  19. gridforge/engines/opendss_engine.py +885 -0
  20. gridforge/engines/pandapower_engine.py +3766 -0
  21. gridforge/engines/roseau_engine.py +1234 -0
  22. gridforge/examples/__init__.py +0 -0
  23. gridforge/examples/quick_start.py +85 -0
  24. gridforge/main.py +0 -0
  25. gridforge/strategies/__init__.py +0 -0
  26. gridforge/strategies/flexibility.py +1476 -0
  27. gridforge/strategies/line_upgrade.py +1846 -0
  28. gridforge/strategies/path_to_source.py +596 -0
  29. gridforge/strategies/sizing.py +210 -0
  30. gridforge/strategies/step_check.py +183 -0
  31. gridforge/strategies/tap_change.py +267 -0
  32. gridforge/strategies/transformer_upgrade.py +622 -0
  33. gridforge/utils/__init__.py +0 -0
  34. gridforge/utils/config.py +55 -0
  35. gridforge/utils/interactive_plot.py +700 -0
  36. gridforge/utils/logging.py +86 -0
  37. gridforge/utils/plot.py +1078 -0
  38. gridforge/utils/reporting.py +0 -0
File without changes
@@ -0,0 +1,85 @@
1
+ import pandapower as pp
2
+
3
+ from gridforge import CostModel, PandaPowerEngine
4
+ from gridforge.core.grid_enhancement import (
5
+ EnhancementStrategyRegistry,
6
+ GridEnhancementAlgorithm,
7
+ )
8
+ from gridforge.strategies.line_upgrade import LineUpgradeStrategy
9
+ from gridforge.strategies.tap_change import TapChangeStrategy
10
+ from gridforge.strategies.transformer_upgrade import TransformerUpgradeStrategy
11
+
12
+ # A small LV feeder: a 250 kVA substation and a 250 m cable feeding 120 kW
13
+ net = pp.create_empty_network()
14
+ mv_bus = pp.create_bus(net, vn_kv=20.0, name="MV bus")
15
+ lv_bus = pp.create_bus(net, vn_kv=0.4, name="LV busbar")
16
+ end_bus = pp.create_bus(net, vn_kv=0.4, name="Feeder end")
17
+ pp.create_ext_grid(net, bus=mv_bus, vm_pu=1.0, name="Grid")
18
+ pp.create_transformer(
19
+ net, hv_bus=mv_bus, lv_bus=lv_bus, std_type="0.25 MVA 20/0.4 kV", name="Substation"
20
+ )
21
+ pp.create_line(
22
+ net,
23
+ from_bus=lv_bus,
24
+ to_bus=end_bus,
25
+ length_km=0.25,
26
+ std_type="NAYY 4x50 SE",
27
+ name="Cable",
28
+ )
29
+ pp.create_load(net, bus=end_bus, p_mw=0.12, q_mvar=0.04, name="Load")
30
+
31
+ engine = PandaPowerEngine()
32
+ engine.network = net
33
+
34
+ # The cable is overloaded and the feeder end is under-voltage
35
+ engine.run_power_flow()
36
+ for violation in engine.check_violations():
37
+ print(f"Before: {violation.constraint_type.value} at {violation.element_id}")
38
+
39
+ # The strategies try the cheapest fixes first: tap changes, then line and
40
+ # transformer upgrades: a larger type, or one more conductor or unit of the type
41
+ # in place, whichever is cheaper at the prices below.
42
+ registry = EnhancementStrategyRegistry()
43
+ registry.register_strategy(TapChangeStrategy())
44
+ registry.register_strategy(
45
+ LineUpgradeStrategy(
46
+ line_types={
47
+ "lv": {
48
+ "overhead": [],
49
+ "underground": ["NAYY 4x50 SE", "NAYY 4x120 SE", "NAYY 4x150 SE"],
50
+ }
51
+ }
52
+ )
53
+ )
54
+ registry.register_strategy(
55
+ TransformerUpgradeStrategy(["0.25 MVA 20/0.4 kV", "0.4 MVA 20/0.4 kV"])
56
+ )
57
+
58
+ # Every type of these ladders needs a price: a missing one raises
59
+ # MissingUnitCostError before the run (see "Unit Costs" in the usage docs).
60
+ cost_model = CostModel(
61
+ {
62
+ "line_upgrade": { # €/km
63
+ "NAYY 4x50 SE": 50.0e3,
64
+ "NAYY 4x120 SE": 70.0e3,
65
+ "NAYY 4x150 SE": 80.0e3,
66
+ },
67
+ "transformer_upgrade": { # € per unit
68
+ "0.25 MVA 20/0.4 kV": 5000.0,
69
+ "0.4 MVA 20/0.4 kV": 8000.0,
70
+ },
71
+ "tap_change": 10.0, # € per tap step
72
+ }
73
+ )
74
+
75
+ algorithm = GridEnhancementAlgorithm(
76
+ power_flow_engine=engine,
77
+ strategy_registry=registry,
78
+ cost_model=cost_model,
79
+ )
80
+ success, results = algorithm.run()
81
+
82
+ print(f"Resolved: {success}, total cost: {results['total_cost']:.0f} €")
83
+ for action in results["actions_applied"]:
84
+ print(f"- {action['type']}")
85
+ print(f"Remaining violations: {len(results['remaining_violations'])}")
gridforge/main.py ADDED
File without changes
File without changes