power-grid-model 1.11.48__py3-none-win_amd64.whl → 1.12.72__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 (60) hide show
  1. power_grid_model/__init__.py +54 -54
  2. power_grid_model/_core/__init__.py +3 -3
  3. power_grid_model/_core/buffer_handling.py +493 -487
  4. power_grid_model/_core/data_handling.py +195 -141
  5. power_grid_model/_core/data_types.py +143 -132
  6. power_grid_model/_core/dataset_definitions.py +109 -109
  7. power_grid_model/_core/enum.py +226 -226
  8. power_grid_model/_core/error_handling.py +206 -206
  9. power_grid_model/_core/errors.py +130 -130
  10. power_grid_model/_core/index_integer.py +17 -17
  11. power_grid_model/_core/options.py +71 -71
  12. power_grid_model/_core/power_grid_core.py +563 -563
  13. power_grid_model/_core/power_grid_dataset.py +535 -535
  14. power_grid_model/_core/power_grid_meta.py +257 -243
  15. power_grid_model/_core/power_grid_model.py +969 -686
  16. power_grid_model/_core/power_grid_model_c/__init__.py +3 -3
  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 -63
  19. power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/basics.h +255 -255
  20. power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/buffer.h +108 -108
  21. power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/dataset.h +316 -316
  22. power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/dataset_definitions.h +1052 -1052
  23. power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/handle.h +99 -99
  24. power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/meta_data.h +189 -189
  25. power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/model.h +125 -125
  26. power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/options.h +142 -142
  27. power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/serialization.h +118 -118
  28. power_grid_model/_core/power_grid_model_c/include/power_grid_model_c.h +36 -36
  29. power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/basics.hpp +65 -65
  30. power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/buffer.hpp +61 -61
  31. power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/dataset.hpp +220 -220
  32. power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/handle.hpp +108 -108
  33. power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/meta_data.hpp +84 -84
  34. power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/model.hpp +63 -63
  35. power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/options.hpp +52 -52
  36. power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/serialization.hpp +124 -124
  37. power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/utils.hpp +81 -81
  38. power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp.hpp +19 -19
  39. power_grid_model/_core/power_grid_model_c/lib/cmake/power_grid_model/power_grid_modelConfigVersion.cmake +3 -3
  40. power_grid_model/_core/power_grid_model_c/lib/power_grid_model_c.lib +0 -0
  41. power_grid_model/_core/serialization.py +317 -317
  42. power_grid_model/_core/typing.py +20 -20
  43. power_grid_model/_core/utils.py +798 -793
  44. power_grid_model/data_types.py +321 -321
  45. power_grid_model/enum.py +27 -27
  46. power_grid_model/errors.py +37 -37
  47. power_grid_model/typing.py +43 -43
  48. power_grid_model/utils.py +473 -469
  49. power_grid_model/validation/__init__.py +25 -25
  50. power_grid_model/validation/_rules.py +1171 -1176
  51. power_grid_model/validation/_validation.py +1172 -1172
  52. power_grid_model/validation/assertions.py +93 -93
  53. power_grid_model/validation/errors.py +602 -602
  54. power_grid_model/validation/utils.py +313 -314
  55. {power_grid_model-1.11.48.dist-info → power_grid_model-1.12.72.dist-info}/METADATA +4 -2
  56. power_grid_model-1.12.72.dist-info/RECORD +65 -0
  57. {power_grid_model-1.11.48.dist-info → power_grid_model-1.12.72.dist-info}/WHEEL +1 -1
  58. power_grid_model-1.11.48.dist-info/RECORD +0 -65
  59. {power_grid_model-1.11.48.dist-info → power_grid_model-1.12.72.dist-info}/entry_points.txt +0 -0
  60. {power_grid_model-1.11.48.dist-info → power_grid_model-1.12.72.dist-info}/licenses/LICENSE +0 -0
@@ -1,130 +1,130 @@
1
- # SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
2
- #
3
- # SPDX-License-Identifier: MPL-2.0
4
-
5
- """
6
- This file contains error classes for library-internal use.
7
- """
8
-
9
- import numpy as np
10
-
11
-
12
- class PowerGridError(RuntimeError):
13
- """Generic power grid error."""
14
-
15
-
16
- class PowerGridBatchError(PowerGridError):
17
- """Error occurs in batch calculation."""
18
-
19
- failed_scenarios: np.ndarray
20
- succeeded_scenarios: np.ndarray
21
- error_messages: list[str]
22
- errors: list[PowerGridError]
23
-
24
-
25
- class InvalidArguments(PowerGridError):
26
- """A (combination of) input arguments is not valid."""
27
-
28
-
29
- class MissingCaseForEnumError(InvalidArguments):
30
- """An enum value is not covered in a for loop.
31
-
32
- This usually happens when an invalid combination of (enum) settings is provided."""
33
-
34
-
35
- class ConflictVoltage(PowerGridError):
36
- """There is a confliciting voltage"""
37
-
38
-
39
- class InvalidBranch(PowerGridError):
40
- """A branch is invalid."""
41
-
42
-
43
- class InvalidBranch3(PowerGridError):
44
- """A branch3 is invalid."""
45
-
46
-
47
- class InvalidTransformerClock(PowerGridError):
48
- """Invalid transformer clock found."""
49
-
50
-
51
- class SparseMatrixError(PowerGridError):
52
- """Attempting to invert a non-invertible matrix."""
53
-
54
-
55
- class NotObservableError(SparseMatrixError):
56
- """Attempting to solve a non-observable system."""
57
-
58
-
59
- class IterationDiverge(PowerGridError):
60
- """Unable to iteratively converge to an optimum within the set number of iterations and precision."""
61
-
62
-
63
- class MaxIterationReached(IterationDiverge):
64
- """Maximum number of iterations reached."""
65
-
66
-
67
- class InvalidID(PowerGridError):
68
- """An ID is invalid."""
69
-
70
-
71
- class IDNotFound(InvalidID):
72
- """A reference to a non-existent ID was provided."""
73
-
74
-
75
- class InvalidMeasuredObject(InvalidID):
76
- """A provided measured object is invalid."""
77
-
78
-
79
- class InvalidRegulatedObject(InvalidID):
80
- """A provided regulated object is invalid."""
81
-
82
-
83
- class IDWrongType(InvalidID):
84
- """A referenced ID points to a component that cannot be referenced here."""
85
-
86
-
87
- class ConflictID(InvalidID):
88
- """Conflicting IDs found."""
89
-
90
-
91
- class InvalidCalculationMethod(PowerGridError):
92
- """Invalid calculation method provided."""
93
-
94
-
95
- class AutomaticTapCalculationError(PowerGridError):
96
- """Automatic tap changer with tap at LV side is unsupported for automatic tap changing calculation."""
97
-
98
-
99
- class AutomaticTapInputError(PowerGridError):
100
- """Automatic tap changer has invalid configuration."""
101
-
102
-
103
- class ConflictingAngleMeasurementType(PowerGridError):
104
- """Conflicting angle measurement types found."""
105
-
106
-
107
- class InvalidShortCircuitPhaseOrType(PowerGridError):
108
- """Invalid (combination of) short circuit types and phase(s) provided."""
109
-
110
-
111
- class TapSearchStrategyIncompatibleError(InvalidArguments):
112
- """Search method is incompatible with optimization strategy."""
113
-
114
-
115
- class PowerGridSerializationError(PowerGridError):
116
- """Error occurs during (de-)serialization."""
117
-
118
-
119
- class PowerGridDatasetError(PowerGridError):
120
- """Error occurs during dataset handling."""
121
-
122
-
123
- class PowerGridNotImplementedError(PowerGridError):
124
- """The functionality is either not supported or not yet implemented."""
125
-
126
-
127
- class PowerGridUnreachableHitError(PowerGridError):
128
- """Supposedly unreachable code was hit.
129
-
130
- 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
+ This file contains error classes for library-internal use.
7
+ """
8
+
9
+ import numpy as np
10
+
11
+
12
+ class PowerGridError(RuntimeError):
13
+ """Generic power grid error."""
14
+
15
+
16
+ class PowerGridBatchError(PowerGridError):
17
+ """Error occurs in batch calculation."""
18
+
19
+ failed_scenarios: np.ndarray
20
+ succeeded_scenarios: np.ndarray
21
+ error_messages: list[str]
22
+ errors: list[PowerGridError]
23
+
24
+
25
+ class InvalidArguments(PowerGridError):
26
+ """A (combination of) input arguments is not valid."""
27
+
28
+
29
+ class MissingCaseForEnumError(InvalidArguments):
30
+ """An enum value is not covered in a for loop.
31
+
32
+ This usually happens when an invalid combination of (enum) settings is provided."""
33
+
34
+
35
+ class ConflictVoltage(PowerGridError):
36
+ """There is a confliciting voltage"""
37
+
38
+
39
+ class InvalidBranch(PowerGridError):
40
+ """A branch is invalid."""
41
+
42
+
43
+ class InvalidBranch3(PowerGridError):
44
+ """A branch3 is invalid."""
45
+
46
+
47
+ class InvalidTransformerClock(PowerGridError):
48
+ """Invalid transformer clock found."""
49
+
50
+
51
+ class SparseMatrixError(PowerGridError):
52
+ """Attempting to invert a non-invertible matrix."""
53
+
54
+
55
+ class NotObservableError(SparseMatrixError):
56
+ """Attempting to solve a non-observable system."""
57
+
58
+
59
+ class IterationDiverge(PowerGridError):
60
+ """Unable to iteratively converge to an optimum within the set number of iterations and precision."""
61
+
62
+
63
+ class MaxIterationReached(IterationDiverge):
64
+ """Maximum number of iterations reached."""
65
+
66
+
67
+ class InvalidID(PowerGridError):
68
+ """An ID is invalid."""
69
+
70
+
71
+ class IDNotFound(InvalidID):
72
+ """A reference to a non-existent ID was provided."""
73
+
74
+
75
+ class InvalidMeasuredObject(InvalidID):
76
+ """A provided measured object is invalid."""
77
+
78
+
79
+ class InvalidRegulatedObject(InvalidID):
80
+ """A provided regulated object is invalid."""
81
+
82
+
83
+ class IDWrongType(InvalidID):
84
+ """A referenced ID points to a component that cannot be referenced here."""
85
+
86
+
87
+ class ConflictID(InvalidID):
88
+ """Conflicting IDs found."""
89
+
90
+
91
+ class InvalidCalculationMethod(PowerGridError):
92
+ """Invalid calculation method provided."""
93
+
94
+
95
+ class AutomaticTapCalculationError(PowerGridError):
96
+ """Automatic tap changer with tap at LV side is unsupported for automatic tap changing calculation."""
97
+
98
+
99
+ class AutomaticTapInputError(PowerGridError):
100
+ """Automatic tap changer has invalid configuration."""
101
+
102
+
103
+ class ConflictingAngleMeasurementType(PowerGridError):
104
+ """Conflicting angle measurement types found."""
105
+
106
+
107
+ class InvalidShortCircuitPhaseOrType(PowerGridError):
108
+ """Invalid (combination of) short circuit types and phase(s) provided."""
109
+
110
+
111
+ class TapSearchStrategyIncompatibleError(InvalidArguments):
112
+ """Search method is incompatible with optimization strategy."""
113
+
114
+
115
+ class PowerGridSerializationError(PowerGridError):
116
+ """Error occurs during (de-)serialization."""
117
+
118
+
119
+ class PowerGridDatasetError(PowerGridError):
120
+ """Error occurs during dataset handling."""
121
+
122
+
123
+ class PowerGridNotImplementedError(PowerGridError):
124
+ """The functionality is either not supported or not yet implemented."""
125
+
126
+
127
+ class PowerGridUnreachableHitError(PowerGridError):
128
+ """Supposedly unreachable code was hit.
129
+
130
+ This usually means a failed assumption and may be caused by a bug in the PGM library."""
@@ -1,17 +1,17 @@
1
- # SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
2
- #
3
- # SPDX-License-Identifier: MPL-2.0
4
-
5
- """
6
- Definition of integers used by the calculation core
7
- """
8
-
9
- # define internal index integer
10
- from ctypes import c_int32, c_int64
11
-
12
- import numpy as np
13
-
14
- IdxC = c_int64
15
- IdxNp = np.int64
16
- IdC = c_int32
17
- IdNp = np.int32
1
+ # SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
2
+ #
3
+ # SPDX-License-Identifier: MPL-2.0
4
+
5
+ """
6
+ Definition of integers used by the calculation core
7
+ """
8
+
9
+ # define internal index integer
10
+ from ctypes import c_int32, c_int64
11
+
12
+ import numpy as np
13
+
14
+ IdxC = c_int64
15
+ IdxNp = np.int64
16
+ IdC = c_int32
17
+ IdNp = np.int32
@@ -1,71 +1,71 @@
1
- # SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
2
- #
3
- # SPDX-License-Identifier: MPL-2.0
4
-
5
- """
6
- Option class
7
- """
8
-
9
- from collections.abc import Callable
10
- from typing import Any
11
-
12
- from power_grid_model._core.power_grid_core import OptionsPtr, power_grid_core as pgc
13
-
14
-
15
- class OptionSetter:
16
- """
17
- setter for options
18
- """
19
-
20
- _setter: Callable
21
-
22
- def __init__(self, setter):
23
- self._setter = setter
24
-
25
- def __set__(self, instance: "Options", value: Any):
26
- self._setter(instance.opt, value)
27
-
28
- def __get__(self, instance, owner):
29
- raise NotImplementedError("Cannot get option value!")
30
-
31
-
32
- class Options:
33
- """
34
- Option class
35
- """
36
-
37
- _opt: OptionsPtr
38
- # option setter
39
- calculation_type = OptionSetter(pgc.set_calculation_type)
40
- calculation_method = OptionSetter(pgc.set_calculation_method)
41
- symmetric = OptionSetter(pgc.set_symmetric)
42
- error_tolerance = OptionSetter(pgc.set_err_tol)
43
- max_iterations = OptionSetter(pgc.set_max_iter)
44
- threading = OptionSetter(pgc.set_threading)
45
- tap_changing_strategy = OptionSetter(pgc.set_tap_changing_strategy)
46
- short_circuit_voltage_scaling = OptionSetter(pgc.set_short_circuit_voltage_scaling)
47
- experimental_features = OptionSetter(pgc.set_experimental_features)
48
-
49
- @property
50
- def opt(self) -> OptionsPtr:
51
- """
52
-
53
- Returns: Pointer to the option object
54
-
55
- """
56
- return self._opt
57
-
58
- def __new__(cls, *args, **kwargs):
59
- instance = super().__new__(cls, *args, **kwargs)
60
- instance._opt = pgc.create_options()
61
- return instance
62
-
63
- def __del__(self):
64
- pgc.destroy_options(self._opt)
65
-
66
- # not copyable
67
- def __copy__(self):
68
- raise NotImplementedError("Class not copyable")
69
-
70
- def __deepcopy__(self, memodict):
71
- raise NotImplementedError("class not copyable")
1
+ # SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
2
+ #
3
+ # SPDX-License-Identifier: MPL-2.0
4
+
5
+ """
6
+ Option class
7
+ """
8
+
9
+ from collections.abc import Callable
10
+ from typing import Any
11
+
12
+ from power_grid_model._core.power_grid_core import OptionsPtr, power_grid_core as pgc
13
+
14
+
15
+ class OptionSetter:
16
+ """
17
+ setter for options
18
+ """
19
+
20
+ _setter: Callable
21
+
22
+ def __init__(self, setter):
23
+ self._setter = setter
24
+
25
+ def __set__(self, instance: "Options", value: Any):
26
+ self._setter(instance.opt, value)
27
+
28
+ def __get__(self, instance, owner):
29
+ raise NotImplementedError("Cannot get option value!")
30
+
31
+
32
+ class Options:
33
+ """
34
+ Option class
35
+ """
36
+
37
+ _opt: OptionsPtr
38
+ # option setter
39
+ calculation_type = OptionSetter(pgc.set_calculation_type)
40
+ calculation_method = OptionSetter(pgc.set_calculation_method)
41
+ symmetric = OptionSetter(pgc.set_symmetric)
42
+ error_tolerance = OptionSetter(pgc.set_err_tol)
43
+ max_iterations = OptionSetter(pgc.set_max_iter)
44
+ threading = OptionSetter(pgc.set_threading)
45
+ tap_changing_strategy = OptionSetter(pgc.set_tap_changing_strategy)
46
+ short_circuit_voltage_scaling = OptionSetter(pgc.set_short_circuit_voltage_scaling)
47
+ experimental_features = OptionSetter(pgc.set_experimental_features)
48
+
49
+ @property
50
+ def opt(self) -> OptionsPtr:
51
+ """
52
+
53
+ Returns: Pointer to the option object
54
+
55
+ """
56
+ return self._opt
57
+
58
+ def __new__(cls, *args, **kwargs):
59
+ instance = super().__new__(cls, *args, **kwargs)
60
+ instance._opt = pgc.create_options()
61
+ return instance
62
+
63
+ def __del__(self):
64
+ pgc.destroy_options(self._opt)
65
+
66
+ # not copyable
67
+ def __copy__(self):
68
+ raise NotImplementedError("Class not copyable")
69
+
70
+ def __deepcopy__(self, memodict):
71
+ raise NotImplementedError("class not copyable")