gdm-flow 0.1.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.
- gdm_flow/__init__.py +102 -0
- gdm_flow/_utils.py +20 -0
- gdm_flow/ac_opf.py +994 -0
- gdm_flow/ac_pf.py +414 -0
- gdm_flow/cli.py +1895 -0
- gdm_flow/dashboard.py +1916 -0
- gdm_flow/dc_opf.py +532 -0
- gdm_flow/export_cli.py +241 -0
- gdm_flow/lindistflow.py +540 -0
- gdm_flow/mcp/__init__.py +9 -0
- gdm_flow/mcp/server.py +844 -0
- gdm_flow/multiperiod.py +1017 -0
- gdm_flow/sqlite_export.py +1065 -0
- gdm_flow/time_series.py +1033 -0
- gdm_flow/ybus.py +432 -0
- gdm_flow-0.1.0.dist-info/METADATA +389 -0
- gdm_flow-0.1.0.dist-info/RECORD +20 -0
- gdm_flow-0.1.0.dist-info/WHEEL +5 -0
- gdm_flow-0.1.0.dist-info/entry_points.txt +4 -0
- gdm_flow-0.1.0.dist-info/top_level.txt +1 -0
gdm_flow/__init__.py
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"""GDM Flow utilities."""
|
|
2
|
+
|
|
3
|
+
from .dc_opf import (
|
|
4
|
+
DCGenerator,
|
|
5
|
+
DCOPFResult,
|
|
6
|
+
build_dc_generators_from_components,
|
|
7
|
+
build_dc_load_profile_from_components,
|
|
8
|
+
solve_dc_opf,
|
|
9
|
+
solve_dc_opf_from_components,
|
|
10
|
+
)
|
|
11
|
+
from .lindistflow import (
|
|
12
|
+
LinDistFlowResult,
|
|
13
|
+
build_lindistflow_net_injections_from_components,
|
|
14
|
+
solve_lindistflow,
|
|
15
|
+
)
|
|
16
|
+
from .sqlite_export import (
|
|
17
|
+
export_ac_opf_result_to_sqlite,
|
|
18
|
+
export_all_results_to_sqlite,
|
|
19
|
+
export_dc_opf_result_to_sqlite,
|
|
20
|
+
export_lindistflow_result_to_sqlite,
|
|
21
|
+
)
|
|
22
|
+
from .ac_opf import (
|
|
23
|
+
PowerFlowOptimizationResult,
|
|
24
|
+
build_regulator_voltage_limits_from_components,
|
|
25
|
+
build_nodal_power_specs_from_components,
|
|
26
|
+
build_regulator_voltage_targets_from_components,
|
|
27
|
+
optimize_ac_power_flow,
|
|
28
|
+
optimize_ac_power_flow_from_components,
|
|
29
|
+
)
|
|
30
|
+
from .ybus import YBusResult, calculate_ybus
|
|
31
|
+
from .ac_pf import (
|
|
32
|
+
ACPowerFlowResult,
|
|
33
|
+
solve_ac_power_flow,
|
|
34
|
+
solve_ac_power_flow_from_components,
|
|
35
|
+
)
|
|
36
|
+
from .time_series import (
|
|
37
|
+
BatterySOCTracker,
|
|
38
|
+
QSTSSummary,
|
|
39
|
+
TimeSeriesInfo,
|
|
40
|
+
build_dc_load_profile_at_timestep,
|
|
41
|
+
build_lindistflow_injections_at_timestep,
|
|
42
|
+
build_nodal_power_specs_at_timestep,
|
|
43
|
+
get_time_series_length,
|
|
44
|
+
get_time_series_resolution,
|
|
45
|
+
get_time_series_timestamps,
|
|
46
|
+
has_time_series_data,
|
|
47
|
+
list_component_time_series,
|
|
48
|
+
run_qsts,
|
|
49
|
+
)
|
|
50
|
+
from .multiperiod import (
|
|
51
|
+
BatterySpec,
|
|
52
|
+
MultiPeriodResult,
|
|
53
|
+
build_battery_specs_from_components,
|
|
54
|
+
solve_multiperiod_dc_opf,
|
|
55
|
+
solve_multiperiod_lindistflow,
|
|
56
|
+
)
|
|
57
|
+
from .dashboard import generate_ts_dashboard
|
|
58
|
+
|
|
59
|
+
__all__ = [
|
|
60
|
+
"YBusResult",
|
|
61
|
+
"calculate_ybus",
|
|
62
|
+
"DCGenerator",
|
|
63
|
+
"DCOPFResult",
|
|
64
|
+
"build_dc_load_profile_from_components",
|
|
65
|
+
"build_dc_generators_from_components",
|
|
66
|
+
"solve_dc_opf",
|
|
67
|
+
"solve_dc_opf_from_components",
|
|
68
|
+
"LinDistFlowResult",
|
|
69
|
+
"build_lindistflow_net_injections_from_components",
|
|
70
|
+
"solve_lindistflow",
|
|
71
|
+
"export_ac_opf_result_to_sqlite",
|
|
72
|
+
"export_dc_opf_result_to_sqlite",
|
|
73
|
+
"export_lindistflow_result_to_sqlite",
|
|
74
|
+
"export_all_results_to_sqlite",
|
|
75
|
+
"PowerFlowOptimizationResult",
|
|
76
|
+
"build_nodal_power_specs_from_components",
|
|
77
|
+
"build_regulator_voltage_limits_from_components",
|
|
78
|
+
"build_regulator_voltage_targets_from_components",
|
|
79
|
+
"optimize_ac_power_flow",
|
|
80
|
+
"optimize_ac_power_flow_from_components",
|
|
81
|
+
"ACPowerFlowResult",
|
|
82
|
+
"solve_ac_power_flow",
|
|
83
|
+
"solve_ac_power_flow_from_components",
|
|
84
|
+
"TimeSeriesInfo",
|
|
85
|
+
"BatterySOCTracker",
|
|
86
|
+
"QSTSSummary",
|
|
87
|
+
"list_component_time_series",
|
|
88
|
+
"has_time_series_data",
|
|
89
|
+
"get_time_series_length",
|
|
90
|
+
"get_time_series_resolution",
|
|
91
|
+
"get_time_series_timestamps",
|
|
92
|
+
"build_nodal_power_specs_at_timestep",
|
|
93
|
+
"build_dc_load_profile_at_timestep",
|
|
94
|
+
"build_lindistflow_injections_at_timestep",
|
|
95
|
+
"run_qsts",
|
|
96
|
+
"BatterySpec",
|
|
97
|
+
"MultiPeriodResult",
|
|
98
|
+
"build_battery_specs_from_components",
|
|
99
|
+
"solve_multiperiod_dc_opf",
|
|
100
|
+
"solve_multiperiod_lindistflow",
|
|
101
|
+
"generate_ts_dashboard",
|
|
102
|
+
]
|
gdm_flow/_utils.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"""Internal shared helper utilities for solver modules."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import math
|
|
6
|
+
|
|
7
|
+
from gdm.distribution.enums import Phase, VoltageTypes
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def _phase_name(phase: Phase | str) -> str:
|
|
11
|
+
"""Normalize phase enum/string values to string labels."""
|
|
12
|
+
return phase.value if isinstance(phase, Phase) else str(phase)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _phase_voltage(voltage, voltage_type: VoltageTypes) -> float:
|
|
16
|
+
"""Return phase voltage magnitude in volts."""
|
|
17
|
+
v_ll_or_lg = float(voltage.to("volt").magnitude)
|
|
18
|
+
if voltage_type == VoltageTypes.LINE_TO_LINE:
|
|
19
|
+
return v_ll_or_lg / math.sqrt(3)
|
|
20
|
+
return v_ll_or_lg
|