power-grid-model 1.12.58__py3-none-win_amd64.whl → 1.12.59__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.
- power_grid_model/__init__.py +54 -54
- power_grid_model/_core/__init__.py +3 -3
- power_grid_model/_core/buffer_handling.py +493 -493
- power_grid_model/_core/data_handling.py +141 -141
- power_grid_model/_core/data_types.py +132 -132
- power_grid_model/_core/dataset_definitions.py +109 -109
- power_grid_model/_core/enum.py +226 -226
- power_grid_model/_core/error_handling.py +206 -206
- power_grid_model/_core/errors.py +130 -130
- power_grid_model/_core/index_integer.py +17 -17
- power_grid_model/_core/options.py +71 -71
- power_grid_model/_core/power_grid_core.py +563 -563
- power_grid_model/_core/power_grid_dataset.py +535 -535
- power_grid_model/_core/power_grid_meta.py +243 -243
- power_grid_model/_core/power_grid_model.py +686 -686
- power_grid_model/_core/power_grid_model_c/__init__.py +3 -3
- power_grid_model/_core/power_grid_model_c/bin/power_grid_model_c.dll +0 -0
- power_grid_model/_core/power_grid_model_c/get_pgm_dll_path.py +63 -63
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/basics.h +255 -255
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/buffer.h +108 -108
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/dataset.h +316 -316
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/dataset_definitions.h +1052 -1052
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/handle.h +99 -99
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/meta_data.h +189 -189
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/model.h +125 -125
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/options.h +142 -142
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/serialization.h +118 -118
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_c.h +36 -36
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/basics.hpp +65 -65
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/buffer.hpp +61 -61
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/dataset.hpp +220 -220
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/handle.hpp +108 -108
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/meta_data.hpp +84 -84
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/model.hpp +63 -63
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/options.hpp +52 -52
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/serialization.hpp +124 -124
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/utils.hpp +81 -81
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp.hpp +19 -19
- power_grid_model/_core/power_grid_model_c/lib/cmake/power_grid_model/power_grid_modelConfigVersion.cmake +3 -3
- power_grid_model/_core/serialization.py +317 -317
- power_grid_model/_core/typing.py +20 -20
- power_grid_model/_core/utils.py +798 -798
- power_grid_model/data_types.py +321 -321
- power_grid_model/enum.py +27 -27
- power_grid_model/errors.py +37 -37
- power_grid_model/typing.py +43 -43
- power_grid_model/utils.py +473 -473
- power_grid_model/validation/__init__.py +25 -25
- power_grid_model/validation/_rules.py +1171 -1171
- power_grid_model/validation/_validation.py +1172 -1172
- power_grid_model/validation/assertions.py +93 -93
- power_grid_model/validation/errors.py +602 -602
- power_grid_model/validation/utils.py +313 -313
- {power_grid_model-1.12.58.dist-info → power_grid_model-1.12.59.dist-info}/METADATA +1 -1
- power_grid_model-1.12.59.dist-info/RECORD +65 -0
- power_grid_model-1.12.58.dist-info/RECORD +0 -65
- {power_grid_model-1.12.58.dist-info → power_grid_model-1.12.59.dist-info}/WHEEL +0 -0
- {power_grid_model-1.12.58.dist-info → power_grid_model-1.12.59.dist-info}/entry_points.txt +0 -0
- {power_grid_model-1.12.58.dist-info → power_grid_model-1.12.59.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,125 +1,125 @@
|
|
|
1
|
-
// SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
|
|
2
|
-
//
|
|
3
|
-
// SPDX-License-Identifier: MPL-2.0
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @brief header file which includes model functions
|
|
7
|
-
*
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
#pragma once
|
|
11
|
-
#ifndef POWER_GRID_MODEL_C_MODEL_H
|
|
12
|
-
#define POWER_GRID_MODEL_C_MODEL_H
|
|
13
|
-
|
|
14
|
-
#include "basics.h"
|
|
15
|
-
|
|
16
|
-
#ifdef __cplusplus
|
|
17
|
-
extern "C" {
|
|
18
|
-
#endif
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* @brief Create a new instance of Power Grid Model.
|
|
22
|
-
*
|
|
23
|
-
* This is the main function to create a new model.
|
|
24
|
-
* You need to prepare the buffer data for input.
|
|
25
|
-
* The returned model need to be freed by PGM_destroy_model()
|
|
26
|
-
*
|
|
27
|
-
* @param handle
|
|
28
|
-
* @param system_frequency The frequency of the system, usually 50 or 60 Hz
|
|
29
|
-
* @param input_dataset Pointer to an instance of PGM_ConstDataset. It should have data type "input".
|
|
30
|
-
* @return The opaque pointer to the created model.
|
|
31
|
-
* If there are errors during the creation, a NULL is returned.
|
|
32
|
-
* Use PGM_error_code() and PGM_error_message() to check the error.
|
|
33
|
-
*/
|
|
34
|
-
PGM_API PGM_PowerGridModel* PGM_create_model(PGM_Handle* handle, double system_frequency,
|
|
35
|
-
PGM_ConstDataset const* input_dataset);
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* @brief Update the model by changing mutable attributes of some elements.
|
|
39
|
-
*
|
|
40
|
-
* Use PGM_error_code() and PGM_error_message() to check if there are errors in the update.
|
|
41
|
-
* NOTE: The model will be in an undefined state after errors occured during the update and should be destroyed.
|
|
42
|
-
*
|
|
43
|
-
* @param handle
|
|
44
|
-
* @param model A pointer to an existing model.
|
|
45
|
-
* @param update_dataset Pointer to an instance of PGM_ConstDataset. It should have data type "update".
|
|
46
|
-
* @return
|
|
47
|
-
*/
|
|
48
|
-
PGM_API void PGM_update_model(PGM_Handle* handle, PGM_PowerGridModel* model, PGM_ConstDataset const* update_dataset);
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* @brief Make a copy of an existing model.
|
|
52
|
-
*
|
|
53
|
-
* The returned model need to be freed by PGM_destroy_model()
|
|
54
|
-
*
|
|
55
|
-
* @param handle
|
|
56
|
-
* @param model A pointer to an existing model
|
|
57
|
-
* @return A opaque pointer to the new copy.
|
|
58
|
-
* If there are errors during the creation, a NULL is returned.
|
|
59
|
-
* Use PGM_error_code() and PGM_error_message() to check the error.
|
|
60
|
-
*/
|
|
61
|
-
PGM_API PGM_PowerGridModel* PGM_copy_model(PGM_Handle* handle, PGM_PowerGridModel const* model);
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* @brief Get the sequence numbers based on list of ids in a given component.
|
|
65
|
-
*
|
|
66
|
-
* For example, if there are 5 nodes in the model with id [10, 2, 5, 15, 30].
|
|
67
|
-
* We have a node ID list of [2, 5, 15, 5, 10, 10, 30].
|
|
68
|
-
* We would like to know the sequence number of each element in the model.
|
|
69
|
-
* Calling this function should result in a sequence array of [1, 2, 3, 2, 0, 0, 4].
|
|
70
|
-
*
|
|
71
|
-
* If you supply a non-existing ID in the ID array, an error will be raised.
|
|
72
|
-
* Use PGM_error_code() and PGM_error_message() to check the error.
|
|
73
|
-
*
|
|
74
|
-
* @param handle
|
|
75
|
-
* @param model A pointer to an existing model.
|
|
76
|
-
* @param component A char const* string as component name.
|
|
77
|
-
* @param size The size of the ID array.
|
|
78
|
-
* @param ids A pointer to a #PGM_ID array buffer, this should be at least length of size.
|
|
79
|
-
* @param indexer A pointer to a #PGM_Idx array buffer. The results will be written to this array.
|
|
80
|
-
* The array should be pre-allocated with at least length of size.
|
|
81
|
-
*/
|
|
82
|
-
PGM_API void PGM_get_indexer(PGM_Handle* handle, PGM_PowerGridModel const* model, char const* component, PGM_Idx size,
|
|
83
|
-
PGM_ID const* ids, PGM_Idx* indexer);
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* @brief Execute a one-time or batch calculation.
|
|
87
|
-
*
|
|
88
|
-
* This is the main function to execute calculation.
|
|
89
|
-
* You can choose to execute one-time calculation or batch calculation,
|
|
90
|
-
* by controlling the batch_dataset argument.
|
|
91
|
-
* If batch_dataset == NULL, it is a one-time calculation.
|
|
92
|
-
* If batch_dataset != NULL, it is a batch calculation with batch update in the batch_dataset.
|
|
93
|
-
*
|
|
94
|
-
* You need to pre-allocate all output buffer.
|
|
95
|
-
*
|
|
96
|
-
* Use PGM_error_code() and PGM_error_message() to check the error.
|
|
97
|
-
*
|
|
98
|
-
* @param handle
|
|
99
|
-
* @param model A pointer to an existing model.
|
|
100
|
-
* @param opt A pointer to options, you need to pre-set all the calculation options you want.
|
|
101
|
-
* @param output_dataset A pointer to an instance of PGM_MutableDataset.
|
|
102
|
-
* The dataset should have type "*_output", depending on the type of dataset.
|
|
103
|
-
* You need to pre-allocate all output memory buffers.
|
|
104
|
-
* You do not need to output all the component types as in the input.
|
|
105
|
-
* For example, you can choose only create output buffers for node, not for line.
|
|
106
|
-
* @param batch_dataset A pointer to an instance of PGM_ConstDataset for batch calculation.
|
|
107
|
-
* Or NULL for single calculation.
|
|
108
|
-
* The dataset should have is_batch == true. The type of the dataset should be "update".
|
|
109
|
-
* @return
|
|
110
|
-
*/
|
|
111
|
-
PGM_API void PGM_calculate(PGM_Handle* handle, PGM_PowerGridModel* model, PGM_Options const* opt,
|
|
112
|
-
PGM_MutableDataset const* output_dataset, PGM_ConstDataset const* batch_dataset);
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* @brief Destroy the model returned by PGM_create_model() or PGM_copy_model().
|
|
116
|
-
*
|
|
117
|
-
* @param model The pointer to the model.
|
|
118
|
-
*/
|
|
119
|
-
PGM_API void PGM_destroy_model(PGM_PowerGridModel* model);
|
|
120
|
-
|
|
121
|
-
#ifdef __cplusplus
|
|
122
|
-
}
|
|
123
|
-
#endif
|
|
124
|
-
|
|
125
|
-
#endif
|
|
1
|
+
// SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
|
|
2
|
+
//
|
|
3
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @brief header file which includes model functions
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#pragma once
|
|
11
|
+
#ifndef POWER_GRID_MODEL_C_MODEL_H
|
|
12
|
+
#define POWER_GRID_MODEL_C_MODEL_H
|
|
13
|
+
|
|
14
|
+
#include "basics.h"
|
|
15
|
+
|
|
16
|
+
#ifdef __cplusplus
|
|
17
|
+
extern "C" {
|
|
18
|
+
#endif
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @brief Create a new instance of Power Grid Model.
|
|
22
|
+
*
|
|
23
|
+
* This is the main function to create a new model.
|
|
24
|
+
* You need to prepare the buffer data for input.
|
|
25
|
+
* The returned model need to be freed by PGM_destroy_model()
|
|
26
|
+
*
|
|
27
|
+
* @param handle
|
|
28
|
+
* @param system_frequency The frequency of the system, usually 50 or 60 Hz
|
|
29
|
+
* @param input_dataset Pointer to an instance of PGM_ConstDataset. It should have data type "input".
|
|
30
|
+
* @return The opaque pointer to the created model.
|
|
31
|
+
* If there are errors during the creation, a NULL is returned.
|
|
32
|
+
* Use PGM_error_code() and PGM_error_message() to check the error.
|
|
33
|
+
*/
|
|
34
|
+
PGM_API PGM_PowerGridModel* PGM_create_model(PGM_Handle* handle, double system_frequency,
|
|
35
|
+
PGM_ConstDataset const* input_dataset);
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @brief Update the model by changing mutable attributes of some elements.
|
|
39
|
+
*
|
|
40
|
+
* Use PGM_error_code() and PGM_error_message() to check if there are errors in the update.
|
|
41
|
+
* NOTE: The model will be in an undefined state after errors occured during the update and should be destroyed.
|
|
42
|
+
*
|
|
43
|
+
* @param handle
|
|
44
|
+
* @param model A pointer to an existing model.
|
|
45
|
+
* @param update_dataset Pointer to an instance of PGM_ConstDataset. It should have data type "update".
|
|
46
|
+
* @return
|
|
47
|
+
*/
|
|
48
|
+
PGM_API void PGM_update_model(PGM_Handle* handle, PGM_PowerGridModel* model, PGM_ConstDataset const* update_dataset);
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @brief Make a copy of an existing model.
|
|
52
|
+
*
|
|
53
|
+
* The returned model need to be freed by PGM_destroy_model()
|
|
54
|
+
*
|
|
55
|
+
* @param handle
|
|
56
|
+
* @param model A pointer to an existing model
|
|
57
|
+
* @return A opaque pointer to the new copy.
|
|
58
|
+
* If there are errors during the creation, a NULL is returned.
|
|
59
|
+
* Use PGM_error_code() and PGM_error_message() to check the error.
|
|
60
|
+
*/
|
|
61
|
+
PGM_API PGM_PowerGridModel* PGM_copy_model(PGM_Handle* handle, PGM_PowerGridModel const* model);
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* @brief Get the sequence numbers based on list of ids in a given component.
|
|
65
|
+
*
|
|
66
|
+
* For example, if there are 5 nodes in the model with id [10, 2, 5, 15, 30].
|
|
67
|
+
* We have a node ID list of [2, 5, 15, 5, 10, 10, 30].
|
|
68
|
+
* We would like to know the sequence number of each element in the model.
|
|
69
|
+
* Calling this function should result in a sequence array of [1, 2, 3, 2, 0, 0, 4].
|
|
70
|
+
*
|
|
71
|
+
* If you supply a non-existing ID in the ID array, an error will be raised.
|
|
72
|
+
* Use PGM_error_code() and PGM_error_message() to check the error.
|
|
73
|
+
*
|
|
74
|
+
* @param handle
|
|
75
|
+
* @param model A pointer to an existing model.
|
|
76
|
+
* @param component A char const* string as component name.
|
|
77
|
+
* @param size The size of the ID array.
|
|
78
|
+
* @param ids A pointer to a #PGM_ID array buffer, this should be at least length of size.
|
|
79
|
+
* @param indexer A pointer to a #PGM_Idx array buffer. The results will be written to this array.
|
|
80
|
+
* The array should be pre-allocated with at least length of size.
|
|
81
|
+
*/
|
|
82
|
+
PGM_API void PGM_get_indexer(PGM_Handle* handle, PGM_PowerGridModel const* model, char const* component, PGM_Idx size,
|
|
83
|
+
PGM_ID const* ids, PGM_Idx* indexer);
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* @brief Execute a one-time or batch calculation.
|
|
87
|
+
*
|
|
88
|
+
* This is the main function to execute calculation.
|
|
89
|
+
* You can choose to execute one-time calculation or batch calculation,
|
|
90
|
+
* by controlling the batch_dataset argument.
|
|
91
|
+
* If batch_dataset == NULL, it is a one-time calculation.
|
|
92
|
+
* If batch_dataset != NULL, it is a batch calculation with batch update in the batch_dataset.
|
|
93
|
+
*
|
|
94
|
+
* You need to pre-allocate all output buffer.
|
|
95
|
+
*
|
|
96
|
+
* Use PGM_error_code() and PGM_error_message() to check the error.
|
|
97
|
+
*
|
|
98
|
+
* @param handle
|
|
99
|
+
* @param model A pointer to an existing model.
|
|
100
|
+
* @param opt A pointer to options, you need to pre-set all the calculation options you want.
|
|
101
|
+
* @param output_dataset A pointer to an instance of PGM_MutableDataset.
|
|
102
|
+
* The dataset should have type "*_output", depending on the type of dataset.
|
|
103
|
+
* You need to pre-allocate all output memory buffers.
|
|
104
|
+
* You do not need to output all the component types as in the input.
|
|
105
|
+
* For example, you can choose only create output buffers for node, not for line.
|
|
106
|
+
* @param batch_dataset A pointer to an instance of PGM_ConstDataset for batch calculation.
|
|
107
|
+
* Or NULL for single calculation.
|
|
108
|
+
* The dataset should have is_batch == true. The type of the dataset should be "update".
|
|
109
|
+
* @return
|
|
110
|
+
*/
|
|
111
|
+
PGM_API void PGM_calculate(PGM_Handle* handle, PGM_PowerGridModel* model, PGM_Options const* opt,
|
|
112
|
+
PGM_MutableDataset const* output_dataset, PGM_ConstDataset const* batch_dataset);
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* @brief Destroy the model returned by PGM_create_model() or PGM_copy_model().
|
|
116
|
+
*
|
|
117
|
+
* @param model The pointer to the model.
|
|
118
|
+
*/
|
|
119
|
+
PGM_API void PGM_destroy_model(PGM_PowerGridModel* model);
|
|
120
|
+
|
|
121
|
+
#ifdef __cplusplus
|
|
122
|
+
}
|
|
123
|
+
#endif
|
|
124
|
+
|
|
125
|
+
#endif
|
|
@@ -1,142 +1,142 @@
|
|
|
1
|
-
// SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
|
|
2
|
-
//
|
|
3
|
-
// SPDX-License-Identifier: MPL-2.0
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @brief header file which includes options functions
|
|
7
|
-
*
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
#pragma once
|
|
11
|
-
#ifndef POWER_GRID_MODEL_C_OPTIONS_H
|
|
12
|
-
#define POWER_GRID_MODEL_C_OPTIONS_H
|
|
13
|
-
|
|
14
|
-
#include "basics.h"
|
|
15
|
-
|
|
16
|
-
#ifdef __cplusplus
|
|
17
|
-
extern "C" {
|
|
18
|
-
#endif
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* @brief Create an option instance.
|
|
22
|
-
*
|
|
23
|
-
* The option is needed to run calculations.
|
|
24
|
-
* This function create a new option instance with the following default values:
|
|
25
|
-
* - calculation_type: PGM_power_flow
|
|
26
|
-
* - calculation_method: PGM_default_method
|
|
27
|
-
* - symmetric: 1
|
|
28
|
-
* - err_tol: 1e-8
|
|
29
|
-
* - max_iter: 20
|
|
30
|
-
* - threading: -1
|
|
31
|
-
* - short_circuit_voltage_scaling: PGM_short_circuit_voltage_scaling_maximum
|
|
32
|
-
* - experimental_features: PGM_experimental_features_disabled
|
|
33
|
-
*
|
|
34
|
-
* @param handle
|
|
35
|
-
* @return The pointer to the option instance. Should be freed by PGM_destroy_options().
|
|
36
|
-
*/
|
|
37
|
-
PGM_API PGM_Options* PGM_create_options(PGM_Handle* handle);
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* @brief Free an option instance.
|
|
41
|
-
*
|
|
42
|
-
* @param opt The pointer to the option instance created by PGM_create_options().
|
|
43
|
-
*/
|
|
44
|
-
PGM_API void PGM_destroy_options(PGM_Options* opt);
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* @brief Specify type of calculation.
|
|
48
|
-
*
|
|
49
|
-
* @param handle
|
|
50
|
-
* @param opt The pointer to the option instance.
|
|
51
|
-
* @param type See #PGM_CalculationType .
|
|
52
|
-
*/
|
|
53
|
-
PGM_API void PGM_set_calculation_type(PGM_Handle* handle, PGM_Options* opt, PGM_Idx type);
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* @brief Specify method of calculation.
|
|
57
|
-
*
|
|
58
|
-
* @param handle
|
|
59
|
-
* @param opt The pointer to the option instance.
|
|
60
|
-
* @param method See #PGM_CalculationMethod .
|
|
61
|
-
*/
|
|
62
|
-
PGM_API void PGM_set_calculation_method(PGM_Handle* handle, PGM_Options* opt, PGM_Idx method);
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* @brief Specify if we are calculating symmetrically or asymmetrically.
|
|
66
|
-
*
|
|
67
|
-
* @param handle
|
|
68
|
-
* @param opt The pointer to the option instance.
|
|
69
|
-
* @param sym See #PGM_CalculationSymmetry . 1 for symmetric calculation; 0 for asymmetric calculation.
|
|
70
|
-
*/
|
|
71
|
-
PGM_API void PGM_set_symmetric(PGM_Handle* handle, PGM_Options* opt, PGM_Idx sym);
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* @brief Specify the error tolerance to stop iterations. Only applicable if using iterative method.
|
|
75
|
-
*
|
|
76
|
-
* It is in terms of voltage deviation per iteration in p.u.
|
|
77
|
-
*
|
|
78
|
-
* @param handle
|
|
79
|
-
* @param opt The pointer to the option instance.
|
|
80
|
-
* @param err_tol The relative votlage deviation tolerance.
|
|
81
|
-
*/
|
|
82
|
-
PGM_API void PGM_set_err_tol(PGM_Handle* handle, PGM_Options* opt, double err_tol);
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* @brief Specify maximum number of iterations. Only applicable if using iterative method.
|
|
86
|
-
*
|
|
87
|
-
* @param handle
|
|
88
|
-
* @param opt The pointer to the option instance.
|
|
89
|
-
* @param max_iter The maximum number of iterations.
|
|
90
|
-
*/
|
|
91
|
-
PGM_API void PGM_set_max_iter(PGM_Handle* handle, PGM_Options* opt, PGM_Idx max_iter);
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* @brief Specify the multi-threading strategy. Only applicable for batch calculation.
|
|
95
|
-
*
|
|
96
|
-
* @param handle
|
|
97
|
-
* @param opt The pointer to the option instance.
|
|
98
|
-
* @param threading The value of the threading setting. See below:
|
|
99
|
-
* - -1: No multi-threading, calculate sequentially.
|
|
100
|
-
* - 0: use number of machine available threads.
|
|
101
|
-
* - >0: specify number of threads you want to calculate in parallel.
|
|
102
|
-
*/
|
|
103
|
-
PGM_API void PGM_set_threading(PGM_Handle* handle, PGM_Options* opt, PGM_Idx threading);
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* @brief Specify the voltage scaling min/max for short circuit calculations
|
|
107
|
-
*
|
|
108
|
-
* @param handle
|
|
109
|
-
* @param opt pointer to option instance
|
|
110
|
-
* @param short_circuit_voltage_scaling See #PGM_ShortCircuitVoltageScaling
|
|
111
|
-
*/
|
|
112
|
-
PGM_API void PGM_set_short_circuit_voltage_scaling(PGM_Handle* handle, PGM_Options* opt,
|
|
113
|
-
PGM_Idx short_circuit_voltage_scaling);
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* @brief Specify the tap changing strategy for power flow calculations
|
|
117
|
-
*
|
|
118
|
-
* @param handle
|
|
119
|
-
* @param opt pointer to option instance
|
|
120
|
-
* @param tap_changing_strategy See #PGM_TapChangingStrategy
|
|
121
|
-
*/
|
|
122
|
-
PGM_API void PGM_set_tap_changing_strategy(PGM_Handle* handle, PGM_Options* opt, PGM_Idx tap_changing_strategy);
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* @brief Enable/disable experimental features.
|
|
126
|
-
*
|
|
127
|
-
* [Danger mode]
|
|
128
|
-
*
|
|
129
|
-
* The behavior of experimental features may not be final and no stability guarantees are made to the users.
|
|
130
|
-
* Features marked as 'experimental' as well as the behavior of experimental functionality itself may change over time.
|
|
131
|
-
*
|
|
132
|
-
* @param handle
|
|
133
|
-
* @param opt pointer to option instance
|
|
134
|
-
* @param experimental_features See #PGM_ExperimentalFeatures
|
|
135
|
-
*/
|
|
136
|
-
PGM_API void PGM_set_experimental_features(PGM_Handle* handle, PGM_Options* opt, PGM_Idx experimental_features);
|
|
137
|
-
|
|
138
|
-
#ifdef __cplusplus
|
|
139
|
-
}
|
|
140
|
-
#endif
|
|
141
|
-
|
|
142
|
-
#endif
|
|
1
|
+
// SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
|
|
2
|
+
//
|
|
3
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @brief header file which includes options functions
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#pragma once
|
|
11
|
+
#ifndef POWER_GRID_MODEL_C_OPTIONS_H
|
|
12
|
+
#define POWER_GRID_MODEL_C_OPTIONS_H
|
|
13
|
+
|
|
14
|
+
#include "basics.h"
|
|
15
|
+
|
|
16
|
+
#ifdef __cplusplus
|
|
17
|
+
extern "C" {
|
|
18
|
+
#endif
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @brief Create an option instance.
|
|
22
|
+
*
|
|
23
|
+
* The option is needed to run calculations.
|
|
24
|
+
* This function create a new option instance with the following default values:
|
|
25
|
+
* - calculation_type: PGM_power_flow
|
|
26
|
+
* - calculation_method: PGM_default_method
|
|
27
|
+
* - symmetric: 1
|
|
28
|
+
* - err_tol: 1e-8
|
|
29
|
+
* - max_iter: 20
|
|
30
|
+
* - threading: -1
|
|
31
|
+
* - short_circuit_voltage_scaling: PGM_short_circuit_voltage_scaling_maximum
|
|
32
|
+
* - experimental_features: PGM_experimental_features_disabled
|
|
33
|
+
*
|
|
34
|
+
* @param handle
|
|
35
|
+
* @return The pointer to the option instance. Should be freed by PGM_destroy_options().
|
|
36
|
+
*/
|
|
37
|
+
PGM_API PGM_Options* PGM_create_options(PGM_Handle* handle);
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @brief Free an option instance.
|
|
41
|
+
*
|
|
42
|
+
* @param opt The pointer to the option instance created by PGM_create_options().
|
|
43
|
+
*/
|
|
44
|
+
PGM_API void PGM_destroy_options(PGM_Options* opt);
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @brief Specify type of calculation.
|
|
48
|
+
*
|
|
49
|
+
* @param handle
|
|
50
|
+
* @param opt The pointer to the option instance.
|
|
51
|
+
* @param type See #PGM_CalculationType .
|
|
52
|
+
*/
|
|
53
|
+
PGM_API void PGM_set_calculation_type(PGM_Handle* handle, PGM_Options* opt, PGM_Idx type);
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* @brief Specify method of calculation.
|
|
57
|
+
*
|
|
58
|
+
* @param handle
|
|
59
|
+
* @param opt The pointer to the option instance.
|
|
60
|
+
* @param method See #PGM_CalculationMethod .
|
|
61
|
+
*/
|
|
62
|
+
PGM_API void PGM_set_calculation_method(PGM_Handle* handle, PGM_Options* opt, PGM_Idx method);
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* @brief Specify if we are calculating symmetrically or asymmetrically.
|
|
66
|
+
*
|
|
67
|
+
* @param handle
|
|
68
|
+
* @param opt The pointer to the option instance.
|
|
69
|
+
* @param sym See #PGM_CalculationSymmetry . 1 for symmetric calculation; 0 for asymmetric calculation.
|
|
70
|
+
*/
|
|
71
|
+
PGM_API void PGM_set_symmetric(PGM_Handle* handle, PGM_Options* opt, PGM_Idx sym);
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* @brief Specify the error tolerance to stop iterations. Only applicable if using iterative method.
|
|
75
|
+
*
|
|
76
|
+
* It is in terms of voltage deviation per iteration in p.u.
|
|
77
|
+
*
|
|
78
|
+
* @param handle
|
|
79
|
+
* @param opt The pointer to the option instance.
|
|
80
|
+
* @param err_tol The relative votlage deviation tolerance.
|
|
81
|
+
*/
|
|
82
|
+
PGM_API void PGM_set_err_tol(PGM_Handle* handle, PGM_Options* opt, double err_tol);
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* @brief Specify maximum number of iterations. Only applicable if using iterative method.
|
|
86
|
+
*
|
|
87
|
+
* @param handle
|
|
88
|
+
* @param opt The pointer to the option instance.
|
|
89
|
+
* @param max_iter The maximum number of iterations.
|
|
90
|
+
*/
|
|
91
|
+
PGM_API void PGM_set_max_iter(PGM_Handle* handle, PGM_Options* opt, PGM_Idx max_iter);
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* @brief Specify the multi-threading strategy. Only applicable for batch calculation.
|
|
95
|
+
*
|
|
96
|
+
* @param handle
|
|
97
|
+
* @param opt The pointer to the option instance.
|
|
98
|
+
* @param threading The value of the threading setting. See below:
|
|
99
|
+
* - -1: No multi-threading, calculate sequentially.
|
|
100
|
+
* - 0: use number of machine available threads.
|
|
101
|
+
* - >0: specify number of threads you want to calculate in parallel.
|
|
102
|
+
*/
|
|
103
|
+
PGM_API void PGM_set_threading(PGM_Handle* handle, PGM_Options* opt, PGM_Idx threading);
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* @brief Specify the voltage scaling min/max for short circuit calculations
|
|
107
|
+
*
|
|
108
|
+
* @param handle
|
|
109
|
+
* @param opt pointer to option instance
|
|
110
|
+
* @param short_circuit_voltage_scaling See #PGM_ShortCircuitVoltageScaling
|
|
111
|
+
*/
|
|
112
|
+
PGM_API void PGM_set_short_circuit_voltage_scaling(PGM_Handle* handle, PGM_Options* opt,
|
|
113
|
+
PGM_Idx short_circuit_voltage_scaling);
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* @brief Specify the tap changing strategy for power flow calculations
|
|
117
|
+
*
|
|
118
|
+
* @param handle
|
|
119
|
+
* @param opt pointer to option instance
|
|
120
|
+
* @param tap_changing_strategy See #PGM_TapChangingStrategy
|
|
121
|
+
*/
|
|
122
|
+
PGM_API void PGM_set_tap_changing_strategy(PGM_Handle* handle, PGM_Options* opt, PGM_Idx tap_changing_strategy);
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* @brief Enable/disable experimental features.
|
|
126
|
+
*
|
|
127
|
+
* [Danger mode]
|
|
128
|
+
*
|
|
129
|
+
* The behavior of experimental features may not be final and no stability guarantees are made to the users.
|
|
130
|
+
* Features marked as 'experimental' as well as the behavior of experimental functionality itself may change over time.
|
|
131
|
+
*
|
|
132
|
+
* @param handle
|
|
133
|
+
* @param opt pointer to option instance
|
|
134
|
+
* @param experimental_features See #PGM_ExperimentalFeatures
|
|
135
|
+
*/
|
|
136
|
+
PGM_API void PGM_set_experimental_features(PGM_Handle* handle, PGM_Options* opt, PGM_Idx experimental_features);
|
|
137
|
+
|
|
138
|
+
#ifdef __cplusplus
|
|
139
|
+
}
|
|
140
|
+
#endif
|
|
141
|
+
|
|
142
|
+
#endif
|