power-grid-model 1.10.74__py3-none-win_amd64.whl → 1.12.119__py3-none-win_amd64.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.

Potentially problematic release.


This version of power-grid-model might be problematic. Click here for more details.

Files changed (67) hide show
  1. power_grid_model/__init__.py +54 -29
  2. power_grid_model/_core/__init__.py +3 -3
  3. power_grid_model/_core/buffer_handling.py +507 -478
  4. power_grid_model/_core/data_handling.py +195 -141
  5. power_grid_model/_core/data_types.py +142 -0
  6. power_grid_model/_core/dataset_definitions.py +109 -109
  7. power_grid_model/_core/enum.py +226 -0
  8. power_grid_model/_core/error_handling.py +215 -202
  9. power_grid_model/_core/errors.py +134 -0
  10. power_grid_model/_core/index_integer.py +17 -17
  11. power_grid_model/_core/options.py +71 -69
  12. power_grid_model/_core/power_grid_core.py +577 -597
  13. power_grid_model/_core/power_grid_dataset.py +545 -528
  14. power_grid_model/_core/power_grid_meta.py +262 -244
  15. power_grid_model/_core/power_grid_model.py +1025 -692
  16. power_grid_model/_core/power_grid_model_c/__init__.py +3 -0
  17. power_grid_model/_core/power_grid_model_c/bin/power_grid_model_c.dll +0 -0
  18. power_grid_model/_core/power_grid_model_c/get_pgm_dll_path.py +63 -0
  19. power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/basics.h +251 -0
  20. power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/buffer.h +108 -0
  21. power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/dataset.h +332 -0
  22. power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/dataset_definitions.h +1060 -0
  23. power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/handle.h +111 -0
  24. power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/meta_data.h +189 -0
  25. power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/model.h +130 -0
  26. power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/options.h +142 -0
  27. power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/serialization.h +118 -0
  28. power_grid_model/_core/power_grid_model_c/include/power_grid_model_c.h +36 -0
  29. power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/basics.hpp +65 -0
  30. power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/buffer.hpp +61 -0
  31. power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/dataset.hpp +224 -0
  32. power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/handle.hpp +108 -0
  33. power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/meta_data.hpp +84 -0
  34. power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/model.hpp +63 -0
  35. power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/options.hpp +52 -0
  36. power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/serialization.hpp +124 -0
  37. power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/utils.hpp +81 -0
  38. power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp.hpp +19 -0
  39. power_grid_model/_core/power_grid_model_c/lib/cmake/power_grid_model/power_grid_modelConfig.cmake +37 -0
  40. power_grid_model/_core/power_grid_model_c/lib/cmake/power_grid_model/power_grid_modelConfigVersion.cmake +65 -0
  41. power_grid_model/_core/power_grid_model_c/lib/cmake/power_grid_model/power_grid_modelTargets-release.cmake +19 -0
  42. power_grid_model/_core/power_grid_model_c/lib/cmake/power_grid_model/power_grid_modelTargets.cmake +144 -0
  43. power_grid_model/_core/power_grid_model_c/lib/power_grid_model_c.lib +0 -0
  44. power_grid_model/_core/power_grid_model_c/share/LICENSE +292 -0
  45. power_grid_model/_core/power_grid_model_c/share/README.md +15 -0
  46. power_grid_model/_core/serialization.py +319 -317
  47. power_grid_model/_core/typing.py +20 -0
  48. power_grid_model/{_utils.py → _core/utils.py} +798 -783
  49. power_grid_model/data_types.py +321 -319
  50. power_grid_model/enum.py +27 -214
  51. power_grid_model/errors.py +37 -123
  52. power_grid_model/typing.py +43 -48
  53. power_grid_model/utils.py +529 -400
  54. power_grid_model/validation/__init__.py +25 -14
  55. power_grid_model/validation/_rules.py +1167 -904
  56. power_grid_model/validation/_validation.py +1172 -980
  57. power_grid_model/validation/assertions.py +93 -92
  58. power_grid_model/validation/errors.py +602 -520
  59. power_grid_model/validation/utils.py +313 -318
  60. {power_grid_model-1.10.74.dist-info → power_grid_model-1.12.119.dist-info}/METADATA +162 -171
  61. power_grid_model-1.12.119.dist-info/RECORD +65 -0
  62. {power_grid_model-1.10.74.dist-info → power_grid_model-1.12.119.dist-info}/WHEEL +1 -1
  63. power_grid_model-1.12.119.dist-info/entry_points.txt +3 -0
  64. power_grid_model/_core/_power_grid_core.dll +0 -0
  65. power_grid_model-1.10.74.dist-info/RECORD +0 -32
  66. power_grid_model-1.10.74.dist-info/top_level.txt +0 -1
  67. {power_grid_model-1.10.74.dist-info → power_grid_model-1.12.119.dist-info}/licenses/LICENSE +0 -0
power_grid_model/enum.py CHANGED
@@ -1,214 +1,27 @@
1
- # SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
2
- #
3
- # SPDX-License-Identifier: MPL-2.0
4
-
5
- """
6
- Common enumerations used by the power-grid-model library.
7
-
8
- Note: these enumeration match the C++ arithmetic core, so don't change the values unless you change them in C++ as well
9
-
10
- """
11
-
12
- from enum import IntEnum
13
-
14
- # Value names are defined in lower case instead of upper case
15
- # pylint: disable=invalid-name
16
-
17
-
18
- class LoadGenType(IntEnum):
19
- """Load and Generator Types"""
20
-
21
- const_power = 0
22
- const_impedance = 1
23
- const_current = 2
24
-
25
-
26
- class WindingType(IntEnum):
27
- """Transformer Winding Types"""
28
-
29
- wye = 0
30
- wye_n = 1
31
- delta = 2
32
- zigzag = 3
33
- zigzag_n = 4
34
-
35
-
36
- class BranchSide(IntEnum):
37
- """Branch Sides"""
38
-
39
- from_side = 0
40
- to_side = 1
41
-
42
-
43
- class Branch3Side(IntEnum):
44
- """Branch3 Sides"""
45
-
46
- side_1 = 0
47
- side_2 = 1
48
- side_3 = 2
49
-
50
-
51
- class CalculationType(IntEnum):
52
- """Calculation Types"""
53
-
54
- power_flow = 0
55
- state_estimation = 1
56
- short_circuit = 2
57
-
58
-
59
- class CalculationMethod(IntEnum):
60
- """Calculation Methods"""
61
-
62
- linear = 0
63
- newton_raphson = 1
64
- iterative_linear = 2
65
- iterative_current = 3
66
- linear_current = 4
67
- iec60909 = 5
68
-
69
-
70
- class TapChangingStrategy(IntEnum):
71
- """Tap Changing Strategies"""
72
-
73
- disabled = 0
74
- """
75
- Disable automatic tap adjustment
76
- """
77
- any_valid_tap = 1
78
- """
79
- Adjust tap position automatically; optimize for any value in the voltage band
80
- """
81
- min_voltage_tap = 2
82
- """
83
- Adjust tap position automatically; optimize for the lower end of the voltage band
84
- """
85
- max_voltage_tap = 3
86
- """
87
- Adjust tap position automatically; optimize for the higher end of the voltage band
88
- """
89
- fast_any_tap = 4
90
- """
91
- Adjust tap position automatically; optimize for any value in the voltage band; binary search
92
- """
93
-
94
-
95
- class MeasuredTerminalType(IntEnum):
96
- """The type of asset measured by a (power) sensor"""
97
-
98
- branch_from = 0
99
- """
100
- Measuring the from-terminal between a branch (except link) and a node
101
- """
102
- branch_to = 1
103
- """
104
- Measuring the to-terminal between a branch (except link) and a node
105
- """
106
- source = 2
107
- """
108
- Measuring the terminal between a source and a node
109
- """
110
- shunt = 3
111
- """
112
- Measuring the terminal between a shunt and a node
113
- """
114
- load = 4
115
- """
116
- Measuring the terminal between a load and a node
117
- """
118
- generator = 5
119
- """
120
- Measuring the terminal between a generator and a node
121
- """
122
- branch3_1 = 6
123
- """
124
- Measuring the terminal-1 between a branch3 and a node
125
- """
126
- branch3_2 = 7
127
- """
128
- Measuring the terminal-2 between a branch3 and a node
129
- """
130
- branch3_3 = 8
131
- """
132
- Measuring the terminal-3 between a branch3 and a node
133
- """
134
- node = 9
135
- """
136
- Measuring the total power injection into a node
137
- """
138
-
139
-
140
- class FaultType(IntEnum):
141
- """The type of fault represented by a fault component"""
142
-
143
- three_phase = 0
144
- single_phase_to_ground = 1
145
- two_phase = 2
146
- two_phase_to_ground = 3
147
- nan = -128
148
- """
149
- Unspecified fault type. Needs to be overloaded at the latest in the update_data
150
- """
151
-
152
-
153
- class FaultPhase(IntEnum):
154
- """The faulty phase(s) affected by the provided fault type"""
155
-
156
- abc = 0
157
- """
158
- All phases are faulty in a three-phase fault
159
- """
160
- a = 1
161
- """
162
- The first phase is faulty in a single-phase-to-ground fault
163
- """
164
- b = 2
165
- """
166
- The second phase is faulty in a single-phase-to-ground fault
167
- """
168
- c = 3
169
- """
170
- The third phase is faulty in a single-phase-to-ground fault
171
- """
172
- ab = 4
173
- """
174
- The first and second phase are faulty in a two-phase or two-phase-to-ground fault
175
- """
176
- ac = 5
177
- """
178
- The first and third phase are faulty in a two-phase or two-phase-to-ground fault
179
- """
180
- bc = 6
181
- """
182
- The second and third phase are faulty in a two-phase or two-phase-to-ground fault
183
- """
184
- default_value = -1
185
- """
186
- Use the default fault phase. Depends on the fault_type.
187
- """
188
- nan = -128
189
- """
190
- Unspecified fault phase. Needs to be overloaded at the latest in the update_data
191
- """
192
-
193
-
194
- class ShortCircuitVoltageScaling(IntEnum):
195
- """Voltage scaling for short circuit calculations"""
196
-
197
- minimum = 0
198
- maximum = 1
199
-
200
-
201
- class _ExperimentalFeatures(IntEnum):
202
- """Experimental features"""
203
-
204
- disabled = 0
205
- enabled = 1
206
-
207
-
208
- class ComponentAttributeFilterOptions(IntEnum):
209
- """Filter option component or attribute"""
210
-
211
- everything = 0
212
- """Filter all components/attributes"""
213
- relevant = 1
214
- """Filter only non-empty components/attributes that contain non-NaN values"""
1
+ # SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
2
+ #
3
+ # SPDX-License-Identifier: MPL-2.0
4
+
5
+ """
6
+ Common enumerations used by the power-grid-model library.
7
+
8
+ Note: these enumeration match the C++ arithmetic core, so don't change the values unless you change them in C++ as well
9
+
10
+ """
11
+
12
+ from power_grid_model._core.enum import ( # noqa: F401
13
+ AngleMeasurementType,
14
+ Branch3Side,
15
+ BranchSide,
16
+ CalculationMethod,
17
+ CalculationType,
18
+ ComponentAttributeFilterOptions,
19
+ FaultPhase,
20
+ FaultType,
21
+ LoadGenType,
22
+ MeasuredTerminalType,
23
+ ShortCircuitVoltageScaling,
24
+ TapChangingStrategy,
25
+ WindingType,
26
+ _ExperimentalFeatures,
27
+ )
@@ -1,123 +1,37 @@
1
- # SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
2
- #
3
- # SPDX-License-Identifier: MPL-2.0
4
-
5
- """
6
- Error classes used by the power-grid-model library.
7
- """
8
-
9
-
10
- import numpy as np
11
-
12
-
13
- class PowerGridError(RuntimeError):
14
- """Generic power grid error."""
15
-
16
-
17
- class PowerGridBatchError(PowerGridError):
18
- """Error occurs in batch calculation."""
19
-
20
- failed_scenarios: np.ndarray
21
- succeeded_scenarios: np.ndarray
22
- error_messages: list[str]
23
- errors: list[PowerGridError]
24
-
25
-
26
- class InvalidArguments(PowerGridError):
27
- """A (combination of) input arguments is not valid."""
28
-
29
-
30
- class MissingCaseForEnumError(InvalidArguments):
31
- """An enum value is not covered in a for loop.
32
-
33
- This usually happens when an invalid combination of (enum) settings is provided."""
34
-
35
-
36
- class ConflictVoltage(PowerGridError):
37
- """There is a confliciting voltage"""
38
-
39
-
40
- class InvalidBranch(PowerGridError):
41
- """A branch is invalid."""
42
-
43
-
44
- class InvalidBranch3(PowerGridError):
45
- """A branch3 is invalid."""
46
-
47
-
48
- class InvalidTransformerClock(PowerGridError):
49
- """Invalid transformer clock found."""
50
-
51
-
52
- class SparseMatrixError(PowerGridError):
53
- """Attempting to invert a non-invertible matrix."""
54
-
55
-
56
- class NotObservableError(SparseMatrixError):
57
- """Attempting to solve a non-observable system."""
58
-
59
-
60
- class IterationDiverge(PowerGridError):
61
- """Unable to iteratively converge to an optimum within the set number of iterations and precision."""
62
-
63
-
64
- class MaxIterationReached(IterationDiverge):
65
- """Maximum number of iterations reached."""
66
-
67
-
68
- class InvalidID(PowerGridError):
69
- """An ID is invalid."""
70
-
71
-
72
- class ConflictID(InvalidID):
73
- """Conflicting IDs found."""
74
-
75
-
76
- class IDNotFound(InvalidID):
77
- """A reference to a non-existent ID was provided."""
78
-
79
-
80
- class InvalidMeasuredObject(InvalidID):
81
- """A provided measured object is invalid."""
82
-
83
-
84
- class InvalidRegulatedObject(InvalidID):
85
- """A provided regulated object is invalid."""
86
-
87
-
88
- class IDWrongType(InvalidID):
89
- """A referenced ID points to a component that cannot be referenced here."""
90
-
91
-
92
- class InvalidCalculationMethod(PowerGridError):
93
- """Invalid calculation method provided."""
94
-
95
-
96
- class AutomaticTapCalculationError(PowerGridError):
97
- """Automatic tap changer with tap at LV side is unsupported for automatic tap changing calculation."""
98
-
99
-
100
- class AutomaticTapInputError(PowerGridError):
101
- """Automatic tap changer has invalid configuration."""
102
-
103
-
104
- class InvalidShortCircuitPhaseOrType(PowerGridError):
105
- """Invalid (combination of) short circuit types and phase(s) provided."""
106
-
107
-
108
- class PowerGridSerializationError(PowerGridError):
109
- """Error occurs during (de-)serialization."""
110
-
111
-
112
- class PowerGridDatasetError(PowerGridError):
113
- """Error occurs during dataset handling."""
114
-
115
-
116
- class PowerGridNotImplementedError(PowerGridError):
117
- """The functionality is either not supported or not yet implemented."""
118
-
119
-
120
- class PowerGridUnreachableHitError(PowerGridError):
121
- """Supposedly unreachable code was hit.
122
-
123
- This usually means a failed assumption and may be caused by a bug in the PGM library."""
1
+ # SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
2
+ #
3
+ # SPDX-License-Identifier: MPL-2.0
4
+
5
+ """
6
+ Error classes used by the power-grid-model library.
7
+ """
8
+
9
+ from power_grid_model._core.errors import ( # noqa: F401
10
+ AutomaticTapCalculationError,
11
+ AutomaticTapInputError,
12
+ ConflictID,
13
+ ConflictingAngleMeasurementType,
14
+ ConflictVoltage,
15
+ IDNotFound,
16
+ IDWrongType,
17
+ InvalidArguments,
18
+ InvalidBranch,
19
+ InvalidBranch3,
20
+ InvalidCalculationMethod,
21
+ InvalidID,
22
+ InvalidMeasuredObject,
23
+ InvalidRegulatedObject,
24
+ InvalidShortCircuitPhaseOrType,
25
+ InvalidTransformerClock,
26
+ IterationDiverge,
27
+ MaxIterationReached,
28
+ MissingCaseForEnumError,
29
+ NotObservableError,
30
+ PowerGridBatchError,
31
+ PowerGridDatasetError,
32
+ PowerGridError,
33
+ PowerGridNotImplementedError,
34
+ PowerGridSerializationError,
35
+ PowerGridUnreachableHitError,
36
+ SparseMatrixError,
37
+ )
@@ -1,48 +1,43 @@
1
- # SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
2
- #
3
- # SPDX-License-Identifier: MPL-2.0
4
-
5
- """
6
- Type hints for the power-grid-model library.
7
-
8
- This includes all miscellaneous type hints not under dataset or categories.
9
- """
10
-
11
- from power_grid_model._core.dataset_definitions import ( # pylint: disable=unused-import
12
- ComponentType,
13
- ComponentTypeVar,
14
- DatasetType,
15
- DatasetTypeVar,
16
- )
17
- from power_grid_model._core.power_grid_meta import ( # pylint: disable=unused-import
18
- ComponentMetaData,
19
- DatasetMetaData,
20
- PowerGridMetaData,
21
- )
22
- from power_grid_model.enum import ComponentAttributeFilterOptions
23
-
24
- _ComponentAttributeMappingDict = dict[ComponentType, set[str] | list[str] | None | ComponentAttributeFilterOptions]
25
-
26
- ComponentAttributeMapping = (
27
- set[ComponentTypeVar]
28
- | list[ComponentTypeVar]
29
- | ComponentAttributeFilterOptions
30
- | None
31
- | _ComponentAttributeMappingDict
32
- )
33
- """
34
- Type hint for mapping component attributes.
35
-
36
- `ComponentAttributeMapping` can be one of the following:
37
-
38
- - A set of :class:`ComponentType` or `str`
39
-
40
- - A list of :class:`ComponentType` or `str`
41
-
42
- - A :class:`ComponentAttributeFilterOptions <power_grid_model.enum.ComponentAttributeFilterOptions>` value
43
-
44
- - `None`
45
-
46
- - A dictionary mapping :class:`ComponentType` to a set, list, `None` or
47
- :class:`ComponentAttributeFilterOptions <power_grid_model.enum.ComponentAttributeFilterOptions>`
48
- """
1
+ # SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
2
+ #
3
+ # SPDX-License-Identifier: MPL-2.0
4
+
5
+ """
6
+ Type hints for the power-grid-model library.
7
+
8
+ This includes all miscellaneous type hints not under dataset or categories.
9
+ """
10
+
11
+ from power_grid_model._core.dataset_definitions import ( # noqa: F401
12
+ ComponentType,
13
+ ComponentTypeVar,
14
+ DatasetType,
15
+ DatasetTypeVar,
16
+ )
17
+ from power_grid_model._core.power_grid_meta import ( # noqa: F401
18
+ ComponentMetaData,
19
+ DatasetMetaData,
20
+ PowerGridMetaData,
21
+ )
22
+ from power_grid_model._core.typing import (
23
+ ComponentAttributeMapping as _ComponentAttributeMapping,
24
+ )
25
+ from power_grid_model.enum import ComponentAttributeFilterOptions # noqa: F401
26
+
27
+ ComponentAttributeMapping = _ComponentAttributeMapping
28
+ """
29
+ Type hint for mapping component attributes.
30
+
31
+ `ComponentAttributeMapping` can be one of the following:
32
+
33
+ - A set of :class:`ComponentType` or `str`
34
+
35
+ - A list of :class:`ComponentType` or `str`
36
+
37
+ - A :class:`ComponentAttributeFilterOptions <power_grid_model.enum.ComponentAttributeFilterOptions>` value
38
+
39
+ - `None`
40
+
41
+ - A dictionary mapping :class:`ComponentType` to a set, list, `None` or
42
+ :class:`ComponentAttributeFilterOptions <power_grid_model.enum.ComponentAttributeFilterOptions>`
43
+ """