power-grid-model 1.11.33__py3-none-win_amd64.whl → 1.12.70__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.
Files changed (67) 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 -478
  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 -108
  7. power_grid_model/_core/enum.py +226 -226
  8. power_grid_model/_core/error_handling.py +206 -205
  9. power_grid_model/_core/errors.py +130 -126
  10. power_grid_model/_core/index_integer.py +17 -17
  11. power_grid_model/_core/options.py +71 -70
  12. power_grid_model/_core/power_grid_core.py +563 -581
  13. power_grid_model/_core/power_grid_dataset.py +535 -534
  14. power_grid_model/_core/power_grid_meta.py +257 -243
  15. power_grid_model/_core/power_grid_model.py +969 -687
  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 +255 -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 +316 -0
  22. power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/dataset_definitions.h +1052 -0
  23. power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/handle.h +99 -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 +125 -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 +220 -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 +317 -317
  47. power_grid_model/_core/typing.py +20 -20
  48. power_grid_model/_core/utils.py +798 -789
  49. power_grid_model/data_types.py +321 -321
  50. power_grid_model/enum.py +27 -27
  51. power_grid_model/errors.py +37 -37
  52. power_grid_model/typing.py +43 -43
  53. power_grid_model/utils.py +473 -469
  54. power_grid_model/validation/__init__.py +25 -25
  55. power_grid_model/validation/_rules.py +1171 -1174
  56. power_grid_model/validation/_validation.py +1172 -1173
  57. power_grid_model/validation/assertions.py +93 -93
  58. power_grid_model/validation/errors.py +602 -589
  59. power_grid_model/validation/utils.py +313 -312
  60. {power_grid_model-1.11.33.dist-info → power_grid_model-1.12.70.dist-info}/METADATA +178 -180
  61. power_grid_model-1.12.70.dist-info/RECORD +65 -0
  62. {power_grid_model-1.11.33.dist-info → power_grid_model-1.12.70.dist-info}/WHEEL +1 -1
  63. power_grid_model-1.12.70.dist-info/entry_points.txt +3 -0
  64. power_grid_model/_core/_power_grid_core.dll +0 -0
  65. power_grid_model-1.11.33.dist-info/RECORD +0 -36
  66. power_grid_model-1.11.33.dist-info/top_level.txt +0 -1
  67. {power_grid_model-1.11.33.dist-info → power_grid_model-1.12.70.dist-info}/licenses/LICENSE +0 -0
@@ -1,126 +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 PowerGridSerializationError(PowerGridError):
112
- """Error occurs during (de-)serialization."""
113
-
114
-
115
- class PowerGridDatasetError(PowerGridError):
116
- """Error occurs during dataset handling."""
117
-
118
-
119
- class PowerGridNotImplementedError(PowerGridError):
120
- """The functionality is either not supported or not yet implemented."""
121
-
122
-
123
- class PowerGridUnreachableHitError(PowerGridError):
124
- """Supposedly unreachable code was hit.
125
-
126
- 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,70 +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 typing import Any, Callable
10
-
11
- from power_grid_model._core.power_grid_core import OptionsPtr, power_grid_core as pgc
12
-
13
-
14
- class OptionSetter:
15
- """
16
- setter for options
17
- """
18
-
19
- _setter: Callable
20
-
21
- def __init__(self, setter):
22
- self._setter = setter
23
-
24
- def __set__(self, instance: "Options", value: Any):
25
- self._setter(instance.opt, value)
26
-
27
- def __get__(self, instance, owner):
28
- raise NotImplementedError("Cannot get option value!")
29
-
30
-
31
- class Options:
32
- """
33
- Option class
34
- """
35
-
36
- _opt: OptionsPtr
37
- # option setter
38
- calculation_type = OptionSetter(pgc.set_calculation_type)
39
- calculation_method = OptionSetter(pgc.set_calculation_method)
40
- symmetric = OptionSetter(pgc.set_symmetric)
41
- error_tolerance = OptionSetter(pgc.set_err_tol)
42
- max_iterations = OptionSetter(pgc.set_max_iter)
43
- threading = OptionSetter(pgc.set_threading)
44
- tap_changing_strategy = OptionSetter(pgc.set_tap_changing_strategy)
45
- short_circuit_voltage_scaling = OptionSetter(pgc.set_short_circuit_voltage_scaling)
46
- experimental_features = OptionSetter(pgc.set_experimental_features)
47
-
48
- @property
49
- def opt(self) -> OptionsPtr:
50
- """
51
-
52
- Returns: Pointer to the option object
53
-
54
- """
55
- return self._opt
56
-
57
- def __new__(cls, *args, **kwargs):
58
- instance = super().__new__(cls, *args, **kwargs)
59
- instance._opt = pgc.create_options()
60
- return instance
61
-
62
- def __del__(self):
63
- pgc.destroy_options(self._opt)
64
-
65
- # not copyable
66
- def __copy__(self):
67
- raise NotImplementedError("Class not copyable")
68
-
69
- def __deepcopy__(self, memodict):
70
- 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")