gridconnect 0.2.0__tar.gz
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.
- gridconnect-0.2.0/LICENSE +25 -0
- gridconnect-0.2.0/PKG-INFO +163 -0
- gridconnect-0.2.0/README.md +135 -0
- gridconnect-0.2.0/gridconnect/analysis/__init__.py +6 -0
- gridconnect-0.2.0/gridconnect/analysis/load_shifting.py +1170 -0
- gridconnect-0.2.0/gridconnect/analysis/power_flow.py +639 -0
- gridconnect-0.2.0/gridconnect/analysis/power_proxy.py +768 -0
- gridconnect-0.2.0/gridconnect/analysis/reconfiguration.py +773 -0
- gridconnect-0.2.0/gridconnect/analysis/reinforcement.py +795 -0
- gridconnect-0.2.0/gridconnect/api/__init__.py +5 -0
- gridconnect-0.2.0/gridconnect/api/building_bus_matcher.py +279 -0
- gridconnect-0.2.0/gridconnect/api/manager.py +694 -0
- gridconnect-0.2.0/gridconnect/io/__init__.py +5 -0
- gridconnect-0.2.0/gridconnect/io/conversion.py +52 -0
- gridconnect-0.2.0/gridconnect/matching/__init__.py +6 -0
- gridconnect-0.2.0/gridconnect/matching/area.py +198 -0
- gridconnect-0.2.0/gridconnect/matching/buses.py +347 -0
- gridconnect-0.2.0/gridconnect/matching/config.py +174 -0
- gridconnect-0.2.0/gridconnect/matching/data.py +446 -0
- gridconnect-0.2.0/gridconnect/matching/network.py +187 -0
- gridconnect-0.2.0/gridconnect/matching/splitting.py +489 -0
- gridconnect-0.2.0/gridconnect/network/__init__.py +5 -0
- gridconnect-0.2.0/gridconnect/network/loads.py +545 -0
- gridconnect-0.2.0/gridconnect/network/snapshots.py +282 -0
- gridconnect-0.2.0/gridconnect/network/state.py +977 -0
- gridconnect-0.2.0/gridconnect/network/topology.py +574 -0
- gridconnect-0.2.0/gridconnect/plotting/__init__.py +5 -0
- gridconnect-0.2.0/gridconnect/plotting/building_bus_match.py +419 -0
- gridconnect-0.2.0/gridconnect/plotting/network.py +385 -0
- gridconnect-0.2.0/gridconnect/results/__init__.py +5 -0
- gridconnect-0.2.0/gridconnect/results/constraints.py +170 -0
- gridconnect-0.2.0/gridconnect/results/loads.py +151 -0
- gridconnect-0.2.0/gridconnect/results/reinforcement.py +113 -0
- gridconnect-0.2.0/gridconnect/results/snapshots.py +137 -0
- gridconnect-0.2.0/gridconnect/utils/logger.py +119 -0
- gridconnect-0.2.0/gridconnect.egg-info/PKG-INFO +163 -0
- gridconnect-0.2.0/gridconnect.egg-info/SOURCES.txt +40 -0
- gridconnect-0.2.0/gridconnect.egg-info/dependency_links.txt +1 -0
- gridconnect-0.2.0/gridconnect.egg-info/requires.txt +19 -0
- gridconnect-0.2.0/gridconnect.egg-info/top_level.txt +1 -0
- gridconnect-0.2.0/pyproject.toml +64 -0
- gridconnect-0.2.0/setup.cfg +4 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
=====================
|
|
3
|
+
|
|
4
|
+
- Copyright © `2026` `Yoann CHICHE`
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person
|
|
7
|
+
obtaining a copy of this software and associated documentation
|
|
8
|
+
files (the “Software”), to deal in the Software without
|
|
9
|
+
restriction, including without limitation the rights to use,
|
|
10
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
copies of the Software, and to permit persons to whom the
|
|
12
|
+
Software is furnished to do so, subject to the following
|
|
13
|
+
conditions:
|
|
14
|
+
|
|
15
|
+
The above copyright notice and this permission notice shall be
|
|
16
|
+
included in all copies or substantial portions of the Software.
|
|
17
|
+
|
|
18
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
|
|
19
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
20
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
21
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
22
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
23
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
24
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
25
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: gridconnect
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: A package for connecting building-scale load profiles to distribution networks and preparing simulation-ready network models.
|
|
5
|
+
Author-email: Yoann Chiche <yoann.chiche@minesparis.psl.eu>
|
|
6
|
+
Requires-Python: >=3.12
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Dist: networkx
|
|
10
|
+
Requires-Dist: polars
|
|
11
|
+
Requires-Dist: pandas==2.3.3
|
|
12
|
+
Requires-Dist: geopandas
|
|
13
|
+
Requires-Dist: pandapower==3.2.1
|
|
14
|
+
Requires-Dist: numba
|
|
15
|
+
Requires-Dist: colorlog
|
|
16
|
+
Requires-Dist: numpy
|
|
17
|
+
Requires-Dist: matplotlib
|
|
18
|
+
Requires-Dist: folium
|
|
19
|
+
Requires-Dist: seaborn
|
|
20
|
+
Requires-Dist: scipy
|
|
21
|
+
Requires-Dist: jupyter
|
|
22
|
+
Requires-Dist: fastparquet
|
|
23
|
+
Requires-Dist: pyarrow
|
|
24
|
+
Requires-Dist: duckdb
|
|
25
|
+
Provides-Extra: maps
|
|
26
|
+
Requires-Dist: contextily; extra == "maps"
|
|
27
|
+
Dynamic: license-file
|
|
28
|
+
|
|
29
|
+
# GridConnect
|
|
30
|
+
|
|
31
|
+
[](https://www.python.org/)
|
|
32
|
+
[](https://docs.astral.sh/uv/)
|
|
33
|
+
[](tests/)
|
|
34
|
+
|
|
35
|
+
GridConnect connects simulated building electricity demand to representative
|
|
36
|
+
distribution networks and prepares `pandapower` networks for electrical studies.
|
|
37
|
+
|
|
38
|
+
Full reference documentation: **[https://pages.persee.minesparis.psl.eu/planeterr/gridconnect/](https://pages.persee.minesparis.psl.eu/planeterr/gridconnect/)**.
|
|
39
|
+
|
|
40
|
+
## Main APIs
|
|
41
|
+
|
|
42
|
+
### `BuildingBusMatcher`
|
|
43
|
+
|
|
44
|
+
`BuildingBusMatcher` assigns simulated buildings to the low- or medium-voltage
|
|
45
|
+
buses of a named `pandapower` feeder. It uses building, demand-profile, district,
|
|
46
|
+
and ORE line-geometry datasets, and returns a feeder-specific connection table.
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
from gridconnect.api.building_bus_matcher import BuildingBusMatcher
|
|
50
|
+
from gridconnect.matching.config import BuildingBusMatchConfig
|
|
51
|
+
|
|
52
|
+
matcher = BuildingBusMatcher(network, BuildingBusMatchConfig(...))
|
|
53
|
+
connections = matcher.run()
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
`connections` is a pandas/GeoPandas DataFrame with this stable schema:
|
|
57
|
+
|
|
58
|
+
| Field | Description |
|
|
59
|
+
| --- | --- |
|
|
60
|
+
| `cleabs`, `building_id`, `main_usage`, `floor_area` | Building identifiers and characteristics. |
|
|
61
|
+
| `annual_energy_mwh`, `peak_active_power_mw`, `peak_reactive_power_mvar`, `peak_apparent_power_mva` | Building demand. |
|
|
62
|
+
| `district`, `mv_feeder` | Source district and target feeder. |
|
|
63
|
+
| `bus`, `voltage_level`, `grid_distance` | Selected bus, LV/MV assignment, and connection distance in metres. |
|
|
64
|
+
|
|
65
|
+
### `NetworkManager`
|
|
66
|
+
|
|
67
|
+
`NetworkManager` is the stateful API for populating a `pandapower` network with
|
|
68
|
+
loads, evaluating constraints, and applying corrective actions. Load creation,
|
|
69
|
+
load shifting, reinforcement, and reconfiguration modify the managed network.
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
from gridconnect.api.manager import NetworkManager
|
|
73
|
+
|
|
74
|
+
manager = NetworkManager.from_network(network)
|
|
75
|
+
load_profiles = manager.create_loads(
|
|
76
|
+
connections=connections,
|
|
77
|
+
profiles=profiles,
|
|
78
|
+
)
|
|
79
|
+
constraints = manager.run_power_flow()
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Key operations:
|
|
83
|
+
|
|
84
|
+
- `create_loads(...)` imports one network load per valid building connection.
|
|
85
|
+
- `run_power_flow(...)` runs AC power flow and returns constraint results. If
|
|
86
|
+
some steps fail, valid results are retained for converged steps, `converged` is
|
|
87
|
+
`False`, and `failed_time_steps` identifies the unavailable profile rows.
|
|
88
|
+
- `run_power_proxy(...)` screens constraints using the power-proxy method.
|
|
89
|
+
- `run_load_shift(process)` applies a selected `mv`, `trafo`, `line`, `bus`, or
|
|
90
|
+
`voltage_risk` load-shifting process.
|
|
91
|
+
- `run_reinforcement(...)` reinforces constrained lines and/or transformers.
|
|
92
|
+
- `run_reconfiguration(...)` screens all profile rows with the power proxy and validates
|
|
93
|
+
selected rows with AC power flow before iterating load shifting and reinforcement.
|
|
94
|
+
After every network change, it re-screens all active profiles, selects fresh critical
|
|
95
|
+
rows (or highest-power fallback rows), and validates them with AC power flow. If AC
|
|
96
|
+
validation fails, it retains the fresh full-profile proxy constraints. It returns
|
|
97
|
+
constraints before and after the process plus accumulated changes.
|
|
98
|
+
|
|
99
|
+
## Input data
|
|
100
|
+
|
|
101
|
+
GridConnect expects a named `pandapower` distribution network plus the following
|
|
102
|
+
data. Default paths are configurable through `BuildingBusMatchConfig` and
|
|
103
|
+
`NetworkManager`.
|
|
104
|
+
|
|
105
|
+
| Input | Format | Required content |
|
|
106
|
+
| --- | --- | --- |
|
|
107
|
+
| Building data | District Parquet files | Building identifiers, geometry, usage, and floor area. |
|
|
108
|
+
| Load profiles | `energy_model_<district>.parquet` | `datetime`, `building_id`, `name`, `main_usage`, `district`, and `electricity_need` (kW). |
|
|
109
|
+
| Building-to-bus connections | Parquet or DataFrame | The connection schema returned by `BuildingBusMatcher`. |
|
|
110
|
+
| District areas | Parquet | District geometry used to resolve the feeder study area. |
|
|
111
|
+
| ORE network geometries | Parquet | Low- and medium-voltage overhead and underground line geometries. |
|
|
112
|
+
|
|
113
|
+
For in-memory load creation, pass both DataFrames together:
|
|
114
|
+
|
|
115
|
+
```python
|
|
116
|
+
manager.create_loads(connections=connections, profiles=profiles)
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
For file-based loading, provide a connection Parquet file and a directory of
|
|
120
|
+
district profile files:
|
|
121
|
+
|
|
122
|
+
```python
|
|
123
|
+
manager.create_loads(
|
|
124
|
+
building_bus_file="path/to/building_bus_match.parquet",
|
|
125
|
+
load_profiles_dir="path/to/load_profiles",
|
|
126
|
+
)
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Output data
|
|
130
|
+
|
|
131
|
+
The matching workflow produces a building-to-bus connection table. The network
|
|
132
|
+
workflow adds loads to the supplied `pandapower` network and returns typed result
|
|
133
|
+
containers containing:
|
|
134
|
+
|
|
135
|
+
- Time-indexed load profiles and maximum load powers.
|
|
136
|
+
- Line-current, transformer-power, and bus-voltage constraint results.
|
|
137
|
+
- Load-shift events and line/transformer reinforcement records.
|
|
138
|
+
- Network snapshots and before/after reconfiguration comparisons.
|
|
139
|
+
|
|
140
|
+
Power values are represented in MW, Mvar, or MVA as named; line current is in kA,
|
|
141
|
+
voltage is per unit, and matching distance is in metres.
|
|
142
|
+
|
|
143
|
+
## Build the full documentation
|
|
144
|
+
|
|
145
|
+
Install the documentation dependencies from the repository root:
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
uv sync --extra docs
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Preview the documentation locally:
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
uv run mkdocs serve
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Build the deployable static site with strict validation:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
uv run mkdocs build --strict
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
The generated site is written to `site/`.
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# GridConnect
|
|
2
|
+
|
|
3
|
+
[](https://www.python.org/)
|
|
4
|
+
[](https://docs.astral.sh/uv/)
|
|
5
|
+
[](tests/)
|
|
6
|
+
|
|
7
|
+
GridConnect connects simulated building electricity demand to representative
|
|
8
|
+
distribution networks and prepares `pandapower` networks for electrical studies.
|
|
9
|
+
|
|
10
|
+
Full reference documentation: **[https://pages.persee.minesparis.psl.eu/planeterr/gridconnect/](https://pages.persee.minesparis.psl.eu/planeterr/gridconnect/)**.
|
|
11
|
+
|
|
12
|
+
## Main APIs
|
|
13
|
+
|
|
14
|
+
### `BuildingBusMatcher`
|
|
15
|
+
|
|
16
|
+
`BuildingBusMatcher` assigns simulated buildings to the low- or medium-voltage
|
|
17
|
+
buses of a named `pandapower` feeder. It uses building, demand-profile, district,
|
|
18
|
+
and ORE line-geometry datasets, and returns a feeder-specific connection table.
|
|
19
|
+
|
|
20
|
+
```python
|
|
21
|
+
from gridconnect.api.building_bus_matcher import BuildingBusMatcher
|
|
22
|
+
from gridconnect.matching.config import BuildingBusMatchConfig
|
|
23
|
+
|
|
24
|
+
matcher = BuildingBusMatcher(network, BuildingBusMatchConfig(...))
|
|
25
|
+
connections = matcher.run()
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
`connections` is a pandas/GeoPandas DataFrame with this stable schema:
|
|
29
|
+
|
|
30
|
+
| Field | Description |
|
|
31
|
+
| --- | --- |
|
|
32
|
+
| `cleabs`, `building_id`, `main_usage`, `floor_area` | Building identifiers and characteristics. |
|
|
33
|
+
| `annual_energy_mwh`, `peak_active_power_mw`, `peak_reactive_power_mvar`, `peak_apparent_power_mva` | Building demand. |
|
|
34
|
+
| `district`, `mv_feeder` | Source district and target feeder. |
|
|
35
|
+
| `bus`, `voltage_level`, `grid_distance` | Selected bus, LV/MV assignment, and connection distance in metres. |
|
|
36
|
+
|
|
37
|
+
### `NetworkManager`
|
|
38
|
+
|
|
39
|
+
`NetworkManager` is the stateful API for populating a `pandapower` network with
|
|
40
|
+
loads, evaluating constraints, and applying corrective actions. Load creation,
|
|
41
|
+
load shifting, reinforcement, and reconfiguration modify the managed network.
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
from gridconnect.api.manager import NetworkManager
|
|
45
|
+
|
|
46
|
+
manager = NetworkManager.from_network(network)
|
|
47
|
+
load_profiles = manager.create_loads(
|
|
48
|
+
connections=connections,
|
|
49
|
+
profiles=profiles,
|
|
50
|
+
)
|
|
51
|
+
constraints = manager.run_power_flow()
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Key operations:
|
|
55
|
+
|
|
56
|
+
- `create_loads(...)` imports one network load per valid building connection.
|
|
57
|
+
- `run_power_flow(...)` runs AC power flow and returns constraint results. If
|
|
58
|
+
some steps fail, valid results are retained for converged steps, `converged` is
|
|
59
|
+
`False`, and `failed_time_steps` identifies the unavailable profile rows.
|
|
60
|
+
- `run_power_proxy(...)` screens constraints using the power-proxy method.
|
|
61
|
+
- `run_load_shift(process)` applies a selected `mv`, `trafo`, `line`, `bus`, or
|
|
62
|
+
`voltage_risk` load-shifting process.
|
|
63
|
+
- `run_reinforcement(...)` reinforces constrained lines and/or transformers.
|
|
64
|
+
- `run_reconfiguration(...)` screens all profile rows with the power proxy and validates
|
|
65
|
+
selected rows with AC power flow before iterating load shifting and reinforcement.
|
|
66
|
+
After every network change, it re-screens all active profiles, selects fresh critical
|
|
67
|
+
rows (or highest-power fallback rows), and validates them with AC power flow. If AC
|
|
68
|
+
validation fails, it retains the fresh full-profile proxy constraints. It returns
|
|
69
|
+
constraints before and after the process plus accumulated changes.
|
|
70
|
+
|
|
71
|
+
## Input data
|
|
72
|
+
|
|
73
|
+
GridConnect expects a named `pandapower` distribution network plus the following
|
|
74
|
+
data. Default paths are configurable through `BuildingBusMatchConfig` and
|
|
75
|
+
`NetworkManager`.
|
|
76
|
+
|
|
77
|
+
| Input | Format | Required content |
|
|
78
|
+
| --- | --- | --- |
|
|
79
|
+
| Building data | District Parquet files | Building identifiers, geometry, usage, and floor area. |
|
|
80
|
+
| Load profiles | `energy_model_<district>.parquet` | `datetime`, `building_id`, `name`, `main_usage`, `district`, and `electricity_need` (kW). |
|
|
81
|
+
| Building-to-bus connections | Parquet or DataFrame | The connection schema returned by `BuildingBusMatcher`. |
|
|
82
|
+
| District areas | Parquet | District geometry used to resolve the feeder study area. |
|
|
83
|
+
| ORE network geometries | Parquet | Low- and medium-voltage overhead and underground line geometries. |
|
|
84
|
+
|
|
85
|
+
For in-memory load creation, pass both DataFrames together:
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
manager.create_loads(connections=connections, profiles=profiles)
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
For file-based loading, provide a connection Parquet file and a directory of
|
|
92
|
+
district profile files:
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
manager.create_loads(
|
|
96
|
+
building_bus_file="path/to/building_bus_match.parquet",
|
|
97
|
+
load_profiles_dir="path/to/load_profiles",
|
|
98
|
+
)
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Output data
|
|
102
|
+
|
|
103
|
+
The matching workflow produces a building-to-bus connection table. The network
|
|
104
|
+
workflow adds loads to the supplied `pandapower` network and returns typed result
|
|
105
|
+
containers containing:
|
|
106
|
+
|
|
107
|
+
- Time-indexed load profiles and maximum load powers.
|
|
108
|
+
- Line-current, transformer-power, and bus-voltage constraint results.
|
|
109
|
+
- Load-shift events and line/transformer reinforcement records.
|
|
110
|
+
- Network snapshots and before/after reconfiguration comparisons.
|
|
111
|
+
|
|
112
|
+
Power values are represented in MW, Mvar, or MVA as named; line current is in kA,
|
|
113
|
+
voltage is per unit, and matching distance is in metres.
|
|
114
|
+
|
|
115
|
+
## Build the full documentation
|
|
116
|
+
|
|
117
|
+
Install the documentation dependencies from the repository root:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
uv sync --extra docs
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Preview the documentation locally:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
uv run mkdocs serve
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Build the deployable static site with strict validation:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
uv run mkdocs build --strict
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
The generated site is written to `site/`.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"""Analysis processes for evaluating and relieving network constraints.
|
|
2
|
+
|
|
3
|
+
This package exposes AC power-flow, approximate power-proxy, reinforcement,
|
|
4
|
+
load-shifting, and reconfiguration workflows. They operate on pandapower
|
|
5
|
+
networks; powers use MW, Mvar, and MVA as named by their fields.
|
|
6
|
+
"""
|