psr-factory 5.0.0b69__py3-none-manylinux_2_28_x86_64.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 psr-factory might be problematic. Click here for more details.

@@ -0,0 +1,410 @@
1
+ # PSR Factory. Copyright (C) PSR, Inc - All Rights Reserved
2
+ # Unauthorized copying of this file, via any medium is strictly prohibited
3
+ # Proprietary and confidential
4
+
5
+ import ctypes
6
+ import os
7
+ import sys
8
+
9
+ import psr.psrfcommon
10
+
11
+
12
+ lib = None
13
+
14
+ if sys.platform == "win32":
15
+ def get_lib_path() -> str:
16
+ return os.path.join(os.path.dirname(__file__), "factory.dll")
17
+ def load_lib():
18
+ return ctypes.cdll.LoadLibrary(get_lib_path())
19
+ else:
20
+ def get_lib_path() -> str:
21
+ return os.path.join(os.path.dirname(__file__), "libfactory.so")
22
+ def load_lib():
23
+ with psr.psrfcommon.change_cwd(os.path.dirname(__file__)):
24
+ lib_path = "./libfactory.so"
25
+ return ctypes.cdll.LoadLibrary(lib_path)
26
+
27
+
28
+ def initialize():
29
+ global lib
30
+ lib = load_lib()
31
+
32
+ lib.psrd_check_license.restype = ctypes.c_int
33
+ lib.psrd_check_license.argtypes = [ctypes.c_void_p]
34
+ lib.psrd_initialize_basic_data.restype = ctypes.c_int
35
+ lib.psrd_initialize_basic_data.argtypes = [ctypes.c_void_p]
36
+ lib.psrd_initialize_study_data.restype = ctypes.c_int
37
+ lib.psrd_initialize_study_data.argtypes = [ctypes.c_char_p, ctypes.c_long, ctypes.c_void_p]
38
+ lib.psrd_unload.restype = ctypes.c_int
39
+ lib.psrd_unload.argtypes = [ctypes.c_void_p]
40
+ lib.psrd_get_constant.restype = ctypes.c_int
41
+ lib.psrd_get_constant.argtypes = [ctypes.c_char_p, ctypes.c_long, ctypes.c_void_p, ctypes.c_void_p]
42
+ lib.psrd_set_global_setting.restype = ctypes.c_int
43
+ lib.psrd_set_global_setting.argtypes = [ctypes.c_char_p, ctypes.c_long, ctypes.c_void_p, ctypes.c_void_p]
44
+ lib.psrd_get_global_setting.restype = ctypes.c_int
45
+ lib.psrd_get_global_setting.argtypes = [ctypes.c_char_p, ctypes.c_long, ctypes.c_void_p, ctypes.c_void_p]
46
+ lib.psrd_set_binding_property.restype = ctypes.c_int
47
+ lib.psrd_set_binding_property.argtypes = [ctypes.c_char_p, ctypes.c_long, ctypes.c_void_p, ctypes.c_void_p]
48
+ lib.psrd_version_short.restype = ctypes.c_int
49
+ lib.psrd_version_short.argtypes = [ctypes.c_char_p, ctypes.c_long]
50
+ lib.psrd_version_long.restype = ctypes.c_int
51
+ lib.psrd_version_long.argtypes = [ctypes.c_char_p, ctypes.c_long]
52
+ lib.psrd_help.restype = ctypes.c_int
53
+ lib.psrd_help.argtypes = [ctypes.c_char_p, ctypes.c_long, ctypes.c_char_p, ctypes.c_long, ctypes.c_void_p]
54
+ lib.psrd_set_log_level.restype = ctypes.c_int
55
+ lib.psrd_set_log_level.argtypes = [ctypes.c_long]
56
+ lib.psrd_get_log_level.restype = ctypes.c_int
57
+ lib.psrd_get_log_level.argtypes = [ctypes.POINTER(ctypes.c_long)]
58
+ lib.psrd_get_log_file_path.restype = ctypes.c_int
59
+ lib.psrd_get_log_file_path.argtypes = [ctypes.c_char_p, ctypes.c_long, ctypes.c_void_p]
60
+ lib.psrd_set_diagnostics_mode.restype = ctypes.c_int
61
+ lib.psrd_set_diagnostics_mode.argtypes = [ctypes.c_long]
62
+ lib.psrd_diagnostics.restype = ctypes.c_int
63
+ lib.psrd_diagnostics.argtypes = [ctypes.c_char_p, ctypes.c_long, ctypes.c_char_p, ctypes.c_long, ctypes.c_void_p]
64
+ lib.psrd_get_default_context.restype = ctypes.c_void_p
65
+ lib.psrd_get_default_context.argtypes = [ctypes.c_void_p]
66
+ lib.psrd_new_error.restype = ctypes.c_void_p
67
+ lib.psrd_new_error.argtypes = []
68
+ lib.psrd_error_code.restype = ctypes.c_int
69
+ lib.psrd_error_code.argtypes = [ctypes.c_void_p]
70
+ lib.psrd_error_message.restype = ctypes.c_int
71
+ lib.psrd_error_message.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_long]
72
+ lib.psrd_free_error.restype = ctypes.c_int
73
+ lib.psrd_free_error.argtypes = [ctypes.c_void_p]
74
+ lib.psrd_study_load.restype = ctypes.c_void_p
75
+ lib.psrd_study_load.argtypes = [ctypes.c_char_p, ctypes.c_long, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
76
+ lib.psrd_study_save.restype = ctypes.c_int
77
+ lib.psrd_study_save.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_long, ctypes.c_void_p, ctypes.c_void_p]
78
+ lib.psrd_study_load_settings.restype = ctypes.c_void_p
79
+ lib.psrd_study_load_settings.argtypes = [ctypes.c_char_p, ctypes.c_long, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
80
+ lib.psrd_study_save_settings.restype = ctypes.c_int
81
+ lib.psrd_study_save_settings.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_long, ctypes.c_void_p, ctypes.c_void_p]
82
+ lib.psrd_study_create.restype = ctypes.c_void_p
83
+ lib.psrd_study_create.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
84
+ lib.psrd_study_is_equals_to.restype = ctypes.c_int
85
+ lib.psrd_study_is_equals_to.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.POINTER(ctypes.c_bool), ctypes.c_void_p]
86
+ lib.psrd_study_get_handler.restype = ctypes.c_longlong
87
+ lib.psrd_study_get_handler.argtypes = [ctypes.c_void_p]
88
+ lib.psrd_study_clone.restype = ctypes.c_void_p
89
+ lib.psrd_study_clone.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
90
+ lib.psrd_study_context.restype = ctypes.c_void_p
91
+ lib.psrd_study_context.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
92
+ lib.psrd_free_study.restype = ctypes.c_int
93
+ lib.psrd_free_study.argtypes = [ctypes.c_void_p]
94
+ lib.psrd_study_property_description_count.restype = ctypes.c_int
95
+ lib.psrd_study_property_description_count.argtypes = [ctypes.c_void_p, ctypes.POINTER(ctypes.c_long), ctypes.c_void_p]
96
+ lib.psrd_study_get_property_description.restype = ctypes.c_void_p
97
+ lib.psrd_study_get_property_description.argtypes = [ctypes.c_void_p, ctypes.c_long, ctypes.c_void_p]
98
+ lib.psrd_study_get_property_description_by_name.restype = ctypes.c_void_p
99
+ lib.psrd_study_get_property_description_by_name.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_long, ctypes.c_void_p]
100
+ lib.psrd_study_set_value.restype = ctypes.c_int
101
+ lib.psrd_study_set_value.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_long, ctypes.c_void_p, ctypes.c_void_p]
102
+ lib.psrd_study_set_value_at.restype = ctypes.c_int
103
+ lib.psrd_study_set_value_at.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_long, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
104
+ lib.psrd_study_set_from_dict.restype = ctypes.c_int
105
+ lib.psrd_study_set_from_dict.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
106
+ lib.psrd_study_get_value.restype = ctypes.c_int
107
+ lib.psrd_study_get_value.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_void_p, ctypes.c_void_p]
108
+ lib.psrd_study_get_value_at.restype = ctypes.c_int
109
+ lib.psrd_study_get_value_at.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
110
+ lib.psrd_study_has_property.restype = ctypes.c_int
111
+ lib.psrd_study_has_property.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_long, ctypes.POINTER(ctypes.c_bool), ctypes.c_void_p]
112
+ lib.psrd_study_get_as_dict.restype = ctypes.c_void_p
113
+ lib.psrd_study_get_as_dict.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
114
+ lib.psrd_study_get_table.restype = ctypes.c_int
115
+ lib.psrd_study_get_table.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_char_p, ctypes.c_long, ctypes.c_void_p]
116
+ lib.psrd_study_set_table.restype = ctypes.c_int
117
+ lib.psrd_study_set_table.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
118
+ lib.psrd_study_clear_values.restype = ctypes.c_int
119
+ lib.psrd_study_clear_values.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_long, ctypes.c_void_p]
120
+ lib.psrd_study_get_objects_values.restype = ctypes.c_int
121
+ lib.psrd_study_get_objects_values.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_char_p, ctypes.c_void_p, ctypes.c_void_p]
122
+ lib.psrd_study_get_objects_values_at.restype = ctypes.c_int
123
+ lib.psrd_study_get_objects_values_at.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_char_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
124
+ lib.psrd_study_get_date_iterator_from_start.restype = ctypes.c_int
125
+ lib.psrd_study_get_date_iterator_from_start.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
126
+ lib.psrd_create.restype = ctypes.c_void_p
127
+ lib.psrd_create.argtypes = [ctypes.c_char_p, ctypes.c_void_p, ctypes.c_void_p]
128
+ lib.psrd_study_add.restype = ctypes.c_int
129
+ lib.psrd_study_add.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
130
+ lib.psrd_study_remove.restype = ctypes.c_int
131
+ lib.psrd_study_remove.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
132
+ lib.psrd_study_get_all_objects.restype = ctypes.c_void_p
133
+ lib.psrd_study_get_all_objects.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
134
+ lib.psrd_study_get_key_object_map.restype = ctypes.c_void_p
135
+ lib.psrd_study_get_key_object_map.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
136
+ lib.psrd_study_find.restype = ctypes.c_void_p
137
+ lib.psrd_study_find.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_void_p]
138
+ lib.psrd_study_find_by_id.restype = ctypes.c_void_p
139
+ lib.psrd_study_find_by_id.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_void_p]
140
+ lib.psrd_study_find_by_code.restype = ctypes.c_void_p
141
+ lib.psrd_study_find_by_code.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_int, ctypes.c_void_p]
142
+ lib.psrd_free_object.restype = ctypes.c_int
143
+ lib.psrd_free_object.argtypes = [ctypes.c_void_p]
144
+ lib.psrd_object_is_equals_to.restype = ctypes.c_int
145
+ lib.psrd_object_is_equals_to.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.POINTER(ctypes.c_bool), ctypes.c_void_p]
146
+ lib.psrd_object_get_handler.restype = ctypes.c_longlong
147
+ lib.psrd_object_get_handler.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
148
+ lib.psrd_object_clone.restype = ctypes.c_void_p
149
+ lib.psrd_object_clone.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
150
+ lib.psrd_object_context.restype = ctypes.c_void_p
151
+ lib.psrd_object_context.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
152
+ lib.psrd_object_get_parent.restype = ctypes.c_void_p
153
+ lib.psrd_object_get_parent.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
154
+ lib.psrd_object_get_type.restype = ctypes.c_int
155
+ lib.psrd_object_get_type.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_long, ctypes.c_void_p]
156
+ lib.psrd_object_get_key.restype = ctypes.c_int
157
+ lib.psrd_object_get_key.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_long, ctypes.c_void_p]
158
+ lib.psrd_object_set_key.restype = ctypes.c_int
159
+ lib.psrd_object_set_key.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_long, ctypes.c_void_p]
160
+ lib.psrd_object_has_code.restype = ctypes.c_int
161
+ lib.psrd_object_has_code.argtypes = [ctypes.c_void_p, ctypes.POINTER(ctypes.c_bool), ctypes.c_void_p]
162
+ lib.psrd_object_get_code.restype = ctypes.c_int
163
+ lib.psrd_object_get_code.argtypes = [ctypes.c_void_p, ctypes.POINTER(ctypes.c_int), ctypes.c_void_p]
164
+ lib.psrd_object_set_code.restype = ctypes.c_int
165
+ lib.psrd_object_set_code.argtypes = [ctypes.c_void_p, ctypes.c_int, ctypes.c_void_p]
166
+ lib.psrd_object_has_name.restype = ctypes.c_int
167
+ lib.psrd_object_has_name.argtypes = [ctypes.c_void_p, ctypes.POINTER(ctypes.c_bool), ctypes.c_void_p]
168
+ lib.psrd_object_get_name.restype = ctypes.c_int
169
+ lib.psrd_object_get_name.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_long, ctypes.c_void_p]
170
+ lib.psrd_object_set_name.restype = ctypes.c_int
171
+ lib.psrd_object_set_name.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_long, ctypes.c_void_p]
172
+ lib.psrd_object_has_id.restype = ctypes.c_int
173
+ lib.psrd_object_has_id.argtypes = [ctypes.c_void_p, ctypes.POINTER(ctypes.c_bool), ctypes.c_void_p]
174
+ lib.psrd_object_get_id.restype = ctypes.c_int
175
+ lib.psrd_object_get_id.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_long, ctypes.c_void_p]
176
+ lib.psrd_object_set_id.restype = ctypes.c_int
177
+ lib.psrd_object_set_id.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_long, ctypes.c_void_p]
178
+ lib.psrd_object_property_description_count.restype = ctypes.c_int
179
+ lib.psrd_object_property_description_count.argtypes = [ctypes.c_void_p, ctypes.POINTER(ctypes.c_long), ctypes.c_void_p]
180
+ lib.psrd_object_get_property_description.restype = ctypes.c_void_p
181
+ lib.psrd_object_get_property_description.argtypes = [ctypes.c_void_p, ctypes.c_long, ctypes.c_void_p]
182
+ lib.psrd_object_get_property_description_by_name.restype = ctypes.c_void_p
183
+ lib.psrd_object_get_property_description_by_name.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_long, ctypes.c_void_p]
184
+ lib.psrd_object_set_value.restype = ctypes.c_int
185
+ lib.psrd_object_set_value.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_long, ctypes.c_void_p, ctypes.c_void_p]
186
+ lib.psrd_object_set_value_at.restype = ctypes.c_int
187
+ lib.psrd_object_set_value_at.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_long, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
188
+ lib.psrd_object_set_from_dict.restype = ctypes.c_int
189
+ lib.psrd_object_set_from_dict.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
190
+ lib.psrd_object_get_value.restype = ctypes.c_int
191
+ lib.psrd_object_get_value.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_void_p, ctypes.c_void_p]
192
+ lib.psrd_object_get_value_at.restype = ctypes.c_int
193
+ lib.psrd_object_get_value_at.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
194
+ lib.psrd_object_has_property.restype = ctypes.c_int
195
+ lib.psrd_object_has_property.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_long, ctypes.POINTER(ctypes.c_bool), ctypes.c_void_p]
196
+ lib.psrd_object_get_as_dict.restype = ctypes.c_void_p
197
+ lib.psrd_object_get_as_dict.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
198
+ lib.psrd_object_get_table.restype = ctypes.c_int
199
+ lib.psrd_object_get_table.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_char_p, ctypes.c_long, ctypes.c_void_p]
200
+ lib.psrd_object_set_table.restype = ctypes.c_int
201
+ lib.psrd_object_set_table.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
202
+ lib.psrd_object_clear_values.restype = ctypes.c_int
203
+ lib.psrd_object_clear_values.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_long, ctypes.c_void_p]
204
+ lib.psrd_object_referenced_by.restype = ctypes.c_void_p
205
+ lib.psrd_object_referenced_by.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
206
+ lib.psrd_new_value.restype = ctypes.c_void_p
207
+ lib.psrd_new_value.argtypes = []
208
+ lib.psrd_free_value.restype = ctypes.c_int
209
+ lib.psrd_free_value.argtypes = [ctypes.c_void_p]
210
+ lib.psrd_value_get_type.restype = ctypes.c_int
211
+ lib.psrd_value_get_type.argtypes = [ctypes.c_void_p, ctypes.POINTER(ctypes.c_long), ctypes.c_void_p]
212
+ lib.psrd_value_get_int32.restype = ctypes.c_int
213
+ lib.psrd_value_get_int32.argtypes = [ctypes.c_void_p, ctypes.POINTER(ctypes.c_int), ctypes.c_void_p]
214
+ lib.psrd_value_set_int32.restype = ctypes.c_int
215
+ lib.psrd_value_set_int32.argtypes = [ctypes.c_void_p, ctypes.c_int, ctypes.c_void_p]
216
+ lib.psrd_value_get_int64.restype = ctypes.c_int
217
+ lib.psrd_value_get_int64.argtypes = [ctypes.c_void_p, ctypes.POINTER(ctypes.c_longlong), ctypes.c_void_p]
218
+ lib.psrd_value_set_int64.restype = ctypes.c_int
219
+ lib.psrd_value_set_int64.argtypes = [ctypes.c_void_p, ctypes.c_longlong, ctypes.c_void_p]
220
+ lib.psrd_value_get_bool.restype = ctypes.c_int
221
+ lib.psrd_value_get_bool.argtypes = [ctypes.c_void_p, ctypes.POINTER(ctypes.c_bool), ctypes.c_void_p]
222
+ lib.psrd_value_set_bool.restype = ctypes.c_int
223
+ lib.psrd_value_set_bool.argtypes = [ctypes.c_void_p, ctypes.c_short, ctypes.c_void_p]
224
+ lib.psrd_value_get_date.restype = ctypes.c_int
225
+ lib.psrd_value_get_date.argtypes = [ctypes.c_void_p, ctypes.POINTER(ctypes.c_longlong), ctypes.c_void_p]
226
+ lib.psrd_value_set_date.restype = ctypes.c_int
227
+ lib.psrd_value_set_date.argtypes = [ctypes.c_void_p, ctypes.c_longlong, ctypes.c_void_p]
228
+ lib.psrd_value_get_float32.restype = ctypes.c_int
229
+ lib.psrd_value_get_float32.argtypes = [ctypes.c_void_p, ctypes.POINTER(ctypes.c_float), ctypes.c_void_p]
230
+ lib.psrd_value_set_float32.restype = ctypes.c_int
231
+ lib.psrd_value_set_float32.argtypes = [ctypes.c_void_p, ctypes.c_float, ctypes.c_void_p]
232
+ lib.psrd_value_get_float64.restype = ctypes.c_int
233
+ lib.psrd_value_get_float64.argtypes = [ctypes.c_void_p, ctypes.POINTER(ctypes.c_double), ctypes.c_void_p]
234
+ lib.psrd_value_set_float64.restype = ctypes.c_int
235
+ lib.psrd_value_set_float64.argtypes = [ctypes.c_void_p, ctypes.c_double, ctypes.c_void_p]
236
+ lib.psrd_value_get_string.restype = ctypes.c_int
237
+ lib.psrd_value_get_string.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_long, ctypes.c_void_p]
238
+ lib.psrd_value_set_string.restype = ctypes.c_int
239
+ lib.psrd_value_set_string.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_long, ctypes.c_void_p]
240
+ lib.psrd_value_get_object.restype = ctypes.c_void_p
241
+ lib.psrd_value_get_object.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
242
+ lib.psrd_value_set_object.restype = ctypes.c_int
243
+ lib.psrd_value_set_object.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
244
+ lib.psrd_value_get_list.restype = ctypes.c_void_p
245
+ lib.psrd_value_get_list.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
246
+ lib.psrd_value_set_list.restype = ctypes.c_int
247
+ lib.psrd_value_set_list.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
248
+ lib.psrd_value_get_dict.restype = ctypes.c_void_p
249
+ lib.psrd_value_get_dict.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
250
+ lib.psrd_value_set_dict.restype = ctypes.c_int
251
+ lib.psrd_value_set_dict.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
252
+ lib.psrd_value_set_null.restype = ctypes.c_int
253
+ lib.psrd_value_set_null.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
254
+ lib.psrd_value_is_null.restype = ctypes.c_int
255
+ lib.psrd_value_is_null.argtypes = [ctypes.c_void_p, ctypes.POINTER(ctypes.c_bool), ctypes.c_void_p]
256
+ lib.psrd_new_list.restype = ctypes.c_void_p
257
+ lib.psrd_new_list.argtypes = []
258
+ lib.psrd_free_list.restype = ctypes.c_int
259
+ lib.psrd_free_list.argtypes = [ctypes.c_void_p]
260
+ lib.psrd_list_count.restype = ctypes.c_int
261
+ lib.psrd_list_count.argtypes = [ctypes.c_void_p, ctypes.POINTER(ctypes.c_long), ctypes.c_void_p]
262
+ lib.psrd_list_clear.restype = ctypes.c_int
263
+ lib.psrd_list_clear.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
264
+ lib.psrd_list_get.restype = ctypes.c_int
265
+ lib.psrd_list_get.argtypes = [ctypes.c_void_p, ctypes.c_long, ctypes.c_void_p, ctypes.c_void_p]
266
+ lib.psrd_list_set.restype = ctypes.c_int
267
+ lib.psrd_list_set.argtypes = [ctypes.c_void_p, ctypes.c_long, ctypes.c_void_p, ctypes.c_void_p]
268
+ lib.psrd_list_append.restype = ctypes.c_int
269
+ lib.psrd_list_append.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
270
+ lib.psrd_new_dict.restype = ctypes.c_void_p
271
+ lib.psrd_new_dict.argtypes = []
272
+ lib.psrd_free_dict.restype = ctypes.c_int
273
+ lib.psrd_free_dict.argtypes = [ctypes.c_void_p]
274
+ lib.psrd_dict_count.restype = ctypes.c_int
275
+ lib.psrd_dict_count.argtypes = [ctypes.c_void_p, ctypes.POINTER(ctypes.c_long), ctypes.c_void_p]
276
+ lib.psrd_dict_clear.restype = ctypes.c_int
277
+ lib.psrd_dict_clear.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
278
+ lib.psrd_dict_get_by_key.restype = ctypes.c_int
279
+ lib.psrd_dict_get_by_key.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
280
+ lib.psrd_dict_get_by_index.restype = ctypes.c_int
281
+ lib.psrd_dict_get_by_index.argtypes = [ctypes.c_void_p, ctypes.c_long, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
282
+ lib.psrd_dict_get_key_by_index.restype = ctypes.c_int
283
+ lib.psrd_dict_get_key_by_index.argtypes = [ctypes.c_void_p, ctypes.c_long, ctypes.c_void_p, ctypes.c_void_p]
284
+ lib.psrd_dict_get_value_by_index.restype = ctypes.c_int
285
+ lib.psrd_dict_get_value_by_index.argtypes = [ctypes.c_void_p, ctypes.c_long, ctypes.c_void_p, ctypes.c_void_p]
286
+ lib.psrd_dict_set.restype = ctypes.c_int
287
+ lib.psrd_dict_set.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
288
+ lib.psrd_free_property_description.restype = ctypes.c_int
289
+ lib.psrd_free_property_description.argtypes = [ctypes.c_void_p]
290
+ lib.psrd_property_description_get_name.restype = ctypes.c_int
291
+ lib.psrd_property_description_get_name.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_long, ctypes.c_void_p]
292
+ lib.psrd_property_description_get_alternative_name.restype = ctypes.c_int
293
+ lib.psrd_property_description_get_alternative_name.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_long, ctypes.c_void_p]
294
+ lib.psrd_property_description_dimensions_count.restype = ctypes.c_int
295
+ lib.psrd_property_description_dimensions_count.argtypes = [ctypes.c_void_p, ctypes.POINTER(ctypes.c_long), ctypes.c_void_p]
296
+ lib.psrd_property_description_get_type.restype = ctypes.c_int
297
+ lib.psrd_property_description_get_type.argtypes = [ctypes.c_void_p, ctypes.POINTER(ctypes.c_long), ctypes.c_void_p]
298
+ lib.psrd_property_description_get_dimension_size.restype = ctypes.c_int
299
+ lib.psrd_property_description_get_dimension_size.argtypes = [ctypes.c_void_p, ctypes.c_long, ctypes.POINTER(ctypes.c_long), ctypes.c_void_p]
300
+ lib.psrd_property_description_get_dimension_name.restype = ctypes.c_int
301
+ lib.psrd_property_description_get_dimension_name.argtypes = [ctypes.c_void_p, ctypes.c_long, ctypes.c_char_p, ctypes.c_long, ctypes.c_void_p]
302
+ lib.psrd_property_description_is_reference.restype = ctypes.c_int
303
+ lib.psrd_property_description_is_reference.argtypes = [ctypes.c_void_p, ctypes.POINTER(ctypes.c_bool), ctypes.c_void_p]
304
+ lib.psrd_property_description_is_required.restype = ctypes.c_int
305
+ lib.psrd_property_description_is_required.argtypes = [ctypes.c_void_p, ctypes.POINTER(ctypes.c_bool), ctypes.c_void_p]
306
+ lib.psrd_property_description_is_dynamic.restype = ctypes.c_int
307
+ lib.psrd_property_description_is_dynamic.argtypes = [ctypes.c_void_p, ctypes.POINTER(ctypes.c_bool), ctypes.c_void_p]
308
+ lib.psrd_property_description_is_indexed.restype = ctypes.c_int
309
+ lib.psrd_property_description_is_indexed.argtypes = [ctypes.c_void_p, ctypes.POINTER(ctypes.c_bool), ctypes.c_void_p]
310
+ lib.psrd_property_description_is_grouped.restype = ctypes.c_int
311
+ lib.psrd_property_description_is_grouped.argtypes = [ctypes.c_void_p, ctypes.POINTER(ctypes.c_bool), ctypes.c_void_p]
312
+ lib.psrd_property_description_grouped_with.restype = ctypes.c_void_p
313
+ lib.psrd_property_description_grouped_with.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
314
+ lib.psrd_new_table.restype = ctypes.c_void_p
315
+ lib.psrd_new_table.argtypes = []
316
+ lib.psrd_free_table.restype = ctypes.c_int
317
+ lib.psrd_free_table.argtypes = [ctypes.c_void_p]
318
+ lib.psrd_table_load.restype = ctypes.c_int
319
+ lib.psrd_table_load.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_long, ctypes.c_void_p, ctypes.c_void_p]
320
+ lib.psrd_table_save.restype = ctypes.c_int
321
+ lib.psrd_table_save.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_long, ctypes.c_void_p, ctypes.c_void_p]
322
+ lib.psrd_table_set_property.restype = ctypes.c_int
323
+ lib.psrd_table_set_property.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_long, ctypes.c_void_p, ctypes.c_void_p]
324
+ lib.psrd_table_get_property.restype = ctypes.c_int
325
+ lib.psrd_table_get_property.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_void_p, ctypes.c_void_p]
326
+ lib.psrd_table_is_indexed.restype = ctypes.c_int
327
+ lib.psrd_table_is_indexed.argtypes = [ctypes.c_void_p, ctypes.POINTER(ctypes.c_bool), ctypes.c_void_p]
328
+ lib.psrd_table_resize.restype = ctypes.c_int
329
+ lib.psrd_table_resize.argtypes = [ctypes.c_void_p, ctypes.c_long, ctypes.c_void_p]
330
+ lib.psrd_table_get_as_dict.restype = ctypes.c_void_p
331
+ lib.psrd_table_get_as_dict.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
332
+ lib.psrd_table_set_from_dict.restype = ctypes.c_int
333
+ lib.psrd_table_set_from_dict.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
334
+ lib.psrd_table_configure_index.restype = ctypes.c_int
335
+ lib.psrd_table_configure_index.argtypes = [ctypes.c_void_p, ctypes.c_long, ctypes.c_long, ctypes.c_void_p]
336
+ lib.psrd_table_configure_column.restype = ctypes.c_int
337
+ lib.psrd_table_configure_column.argtypes = [ctypes.c_void_p, ctypes.c_long, ctypes.c_long, ctypes.c_void_p]
338
+ lib.psrd_table_columns_count.restype = ctypes.c_int
339
+ lib.psrd_table_columns_count.argtypes = [ctypes.c_void_p, ctypes.POINTER(ctypes.c_long), ctypes.c_void_p]
340
+ lib.psrd_table_column_get_name.restype = ctypes.c_int
341
+ lib.psrd_table_column_get_name.argtypes = [ctypes.c_void_p, ctypes.c_long, ctypes.c_char_p, ctypes.c_long, ctypes.c_void_p]
342
+ lib.psrd_table_column_set_name.restype = ctypes.c_int
343
+ lib.psrd_table_column_set_name.argtypes = [ctypes.c_void_p, ctypes.c_long, ctypes.c_char_p, ctypes.c_long, ctypes.c_void_p]
344
+ lib.psrd_table_column_values_count.restype = ctypes.c_int
345
+ lib.psrd_table_column_values_count.argtypes = [ctypes.c_void_p, ctypes.c_long, ctypes.POINTER(ctypes.c_long), ctypes.c_void_p]
346
+ lib.psrd_table_column_get_value.restype = ctypes.c_int
347
+ lib.psrd_table_column_get_value.argtypes = [ctypes.c_void_p, ctypes.c_long, ctypes.c_long, ctypes.c_void_p, ctypes.c_void_p]
348
+ lib.psrd_table_column_set_value.restype = ctypes.c_int
349
+ lib.psrd_table_column_set_value.argtypes = [ctypes.c_void_p, ctypes.c_long, ctypes.c_long, ctypes.c_void_p, ctypes.c_void_p]
350
+ lib.psrd_table_rows_count.restype = ctypes.c_int
351
+ lib.psrd_table_rows_count.argtypes = [ctypes.c_void_p, ctypes.POINTER(ctypes.c_long), ctypes.c_void_p]
352
+ lib.psrd_table_index_count.restype = ctypes.c_int
353
+ lib.psrd_table_index_count.argtypes = [ctypes.c_void_p, ctypes.POINTER(ctypes.c_long), ctypes.c_void_p]
354
+ lib.psrd_table_index_get_name.restype = ctypes.c_int
355
+ lib.psrd_table_index_get_name.argtypes = [ctypes.c_void_p, ctypes.c_long, ctypes.c_char_p, ctypes.c_long, ctypes.c_void_p]
356
+ lib.psrd_table_index_set_name.restype = ctypes.c_int
357
+ lib.psrd_table_index_set_name.argtypes = [ctypes.c_void_p, ctypes.c_long, ctypes.c_char_p, ctypes.c_long, ctypes.c_void_p]
358
+ lib.psrd_table_index_get_value.restype = ctypes.c_int
359
+ lib.psrd_table_index_get_value.argtypes = [ctypes.c_void_p, ctypes.c_long, ctypes.c_long, ctypes.c_void_p, ctypes.c_void_p]
360
+ lib.psrd_table_index_set_value.restype = ctypes.c_int
361
+ lib.psrd_table_index_set_value.argtypes = [ctypes.c_void_p, ctypes.c_long, ctypes.c_long, ctypes.c_void_p, ctypes.c_void_p]
362
+ lib.psrd_table_column_set_float32_values.restype = ctypes.c_int
363
+ lib.psrd_table_column_set_float32_values.argtypes = [ctypes.c_void_p, ctypes.c_long, ctypes.POINTER(ctypes.c_float), ctypes.c_void_p]
364
+ lib.psrd_table_column_set_float64_values.restype = ctypes.c_int
365
+ lib.psrd_table_column_set_float64_values.argtypes = [ctypes.c_void_p, ctypes.c_long, ctypes.POINTER(ctypes.c_double), ctypes.c_void_p]
366
+ lib.psrd_table_column_set_int32_values.restype = ctypes.c_int
367
+ lib.psrd_table_column_set_int32_values.argtypes = [ctypes.c_void_p, ctypes.c_long, ctypes.POINTER(ctypes.c_int), ctypes.c_void_p]
368
+ lib.psrd_table_column_set_date_values.restype = ctypes.c_int
369
+ lib.psrd_table_column_set_date_values.argtypes = [ctypes.c_void_p, ctypes.c_long, ctypes.POINTER(ctypes.c_longlong), ctypes.c_void_p]
370
+ lib.psrd_table_column_set_null_values.restype = ctypes.c_int
371
+ lib.psrd_table_column_set_null_values.argtypes = [ctypes.c_void_p, ctypes.c_long, ctypes.c_void_p]
372
+ lib.psrd_table_index_set_int32_values.restype = ctypes.c_int
373
+ lib.psrd_table_index_set_int32_values.argtypes = [ctypes.c_void_p, ctypes.c_long, ctypes.POINTER(ctypes.c_int), ctypes.c_void_p]
374
+ lib.psrd_table_index_set_int64_values.restype = ctypes.c_int
375
+ lib.psrd_table_index_set_int64_values.argtypes = [ctypes.c_void_p, ctypes.c_long, ctypes.POINTER(ctypes.c_longlong), ctypes.c_void_p]
376
+ lib.psrd_table_index_set_float32_values.restype = ctypes.c_int
377
+ lib.psrd_table_index_set_float32_values.argtypes = [ctypes.c_void_p, ctypes.c_long, ctypes.POINTER(ctypes.c_float), ctypes.c_void_p]
378
+ lib.psrd_table_index_set_float64_values.restype = ctypes.c_int
379
+ lib.psrd_table_index_set_float64_values.argtypes = [ctypes.c_void_p, ctypes.c_long, ctypes.POINTER(ctypes.c_double), ctypes.c_void_p]
380
+ lib.psrd_table_index_set_date_values.restype = ctypes.c_int
381
+ lib.psrd_table_index_set_date_values.argtypes = [ctypes.c_void_p, ctypes.c_long, ctypes.POINTER(ctypes.c_longlong), ctypes.c_void_p]
382
+ lib.psrd_table_column_get_float32_values.restype = ctypes.c_int
383
+ lib.psrd_table_column_get_float32_values.argtypes = [ctypes.c_void_p, ctypes.c_long, ctypes.POINTER(ctypes.c_float), ctypes.c_void_p]
384
+ lib.psrd_table_column_get_float64_values.restype = ctypes.c_int
385
+ lib.psrd_table_column_get_float64_values.argtypes = [ctypes.c_void_p, ctypes.c_long, ctypes.POINTER(ctypes.c_double), ctypes.c_void_p]
386
+ lib.psrd_table_column_get_int32_values.restype = ctypes.c_int
387
+ lib.psrd_table_column_get_int32_values.argtypes = [ctypes.c_void_p, ctypes.c_long, ctypes.POINTER(ctypes.c_int), ctypes.c_void_p]
388
+ lib.psrd_table_column_get_int64_values.restype = ctypes.c_int
389
+ lib.psrd_table_column_get_int64_values.argtypes = [ctypes.c_void_p, ctypes.c_long, ctypes.POINTER(ctypes.c_longlong), ctypes.c_void_p]
390
+ lib.psrd_table_column_get_date_values.restype = ctypes.c_int
391
+ lib.psrd_table_column_get_date_values.argtypes = [ctypes.c_void_p, ctypes.c_long, ctypes.POINTER(ctypes.c_longlong), ctypes.c_void_p]
392
+ lib.psrd_table_index_get_int32_values.restype = ctypes.c_int
393
+ lib.psrd_table_index_get_int32_values.argtypes = [ctypes.c_void_p, ctypes.c_long, ctypes.POINTER(ctypes.c_int), ctypes.c_void_p]
394
+ lib.psrd_table_index_get_int64_values.restype = ctypes.c_int
395
+ lib.psrd_table_index_get_int64_values.argtypes = [ctypes.c_void_p, ctypes.c_long, ctypes.POINTER(ctypes.c_longlong), ctypes.c_void_p]
396
+ lib.psrd_table_index_get_date_values.restype = ctypes.c_int
397
+ lib.psrd_table_index_get_date_values.argtypes = [ctypes.c_void_p, ctypes.c_long, ctypes.POINTER(ctypes.c_longlong), ctypes.c_void_p]
398
+ lib.psrd_new_date_iterator.restype = ctypes.c_void_p
399
+ lib.psrd_new_date_iterator.argtypes = []
400
+ lib.psrd_free_date_iterator.restype = ctypes.c_int
401
+ lib.psrd_free_date_iterator.argtypes = [ctypes.c_void_p]
402
+ lib.psrd_date_iterator_at_start.restype = ctypes.c_int
403
+ lib.psrd_date_iterator_at_start.argtypes = [ctypes.c_void_p, ctypes.POINTER(ctypes.c_bool), ctypes.c_void_p]
404
+ lib.psrd_date_iterator_at_end.restype = ctypes.c_int
405
+ lib.psrd_date_iterator_at_end.argtypes = [ctypes.c_void_p, ctypes.POINTER(ctypes.c_bool), ctypes.c_void_p]
406
+ lib.psrd_date_iterator_get_value.restype = ctypes.c_int
407
+ lib.psrd_date_iterator_get_value.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_long, ctypes.c_void_p]
408
+ lib.psrd_convert_output.restype = ctypes.c_int
409
+ lib.psrd_convert_output.argtypes = [ctypes.c_char_p, ctypes.c_long, ctypes.c_char_p, ctypes.c_long, ctypes.c_void_p, ctypes.c_void_p]
410
+
Binary file
psr/factory/py.typed ADDED
File without changes
@@ -0,0 +1,2 @@
1
+ from .sddp_case01 import create_case01
2
+ from .sddp_case21 import create_case21
@@ -0,0 +1,166 @@
1
+ """Creates SDDP 1 stage Case01 example."""
2
+ import copy
3
+ import os
4
+
5
+ import psr.factory
6
+
7
+
8
+ def _get_case_path() -> str:
9
+ return os.path.join(os.path.splitext(os.path.basename(__file__))[0], "")
10
+
11
+
12
+ def create_case01(legacy: bool = False) -> psr.factory.Study:
13
+ blocks = 1
14
+ model = "SDDP" if not legacy else "SDDP17"
15
+ # Create a study object and define its basic settings.
16
+ study = psr.factory.create_study({
17
+ "Models": [model, ], # Default model: SDDP
18
+ "Blocks": blocks, # Default number of blocks: 1
19
+ "StageType": 2, # Weekly: 1 (default), Monthly: 2
20
+ })
21
+ study.from_dict({
22
+ "Description": "Caso ejemplo - DT - 1 etapa - 1 bloque",
23
+ "InitialYear": 2013,
24
+ "InitialStage": 1,
25
+ "NumberOfStages": 1,
26
+ "NumberOfSeries": 1,
27
+ })
28
+
29
+ # Study options
30
+ study.from_dict({
31
+ "PARModel": 2,
32
+ "InitialYearOfHydrology": 1996,
33
+ "NumberOfSystems": 1,
34
+ "AggregateInTheOperationPolicy": 0,
35
+ "UMON": "$",
36
+ "LoadSheddingInBuses": 0,
37
+ "MonitoringOfCircuitLimits": 0,
38
+ "HourlyRepresentation": 0,
39
+ "MaximumNumberOfIterations": 10,
40
+ "MinimumOutflowPenaltyHm3": 5000.0,
41
+ "DeficitSegment": [100.0, 0.0, 0.0, 0.0],
42
+ "DeficitCost": [500.0, 0.0, 0.0, 0.0],
43
+ "FutureCostStage": 4,
44
+ "FutureCostYear": 1998,
45
+ })
46
+
47
+ # Study duration
48
+ study.set("FixedDurationOfBlocks(1)", 100.0)
49
+
50
+ # By default, a study comes with one system.
51
+ system = study.get("System")[0]
52
+ system.code = 1
53
+ system.id = "s1"
54
+ system.name = "System 1"
55
+ # System's currency
56
+ system.set("SystemCurrency", "$")
57
+ # It's not required to add an existing object to the study.
58
+
59
+ # Set study to run with this unique system
60
+ study.set("CodesOfPowerSystems", [1, ])
61
+
62
+ # Create a demand segment - it's required to add at least
63
+ # an inelastic segment to a demand object.
64
+ segment = psr.factory.create("DemandSegment", study.context)
65
+ segment.code = 1
66
+ # Set demand and cost data.
67
+ segment.set_at("EnergyPerBlock(:)", "01/2013", 8.928)
68
+ # Add segment to the study.
69
+ study.add(segment)
70
+
71
+ # Create a system demand.
72
+ demand = psr.factory.create("Demand", study.context)
73
+ demand.code = 1
74
+ demand.name = "System 1"
75
+ # Associate it with the only system in the case.
76
+ demand.set("RefSystem", system)
77
+ # Associate the demand with its segments.
78
+ demand.set("RefSegments", [segment, ])
79
+ # Add demand to the study.
80
+ study.add(demand)
81
+
82
+ # Create all fuels - Thermal plants requires then.
83
+ fuel1 = psr.factory.create("Fuel", study.context)
84
+ fuel1.code = 1
85
+ fuel1.name = "Fuel 1"
86
+ fuel1.from_dict({
87
+ "Unit": "UC",
88
+ "UE": "MWh",
89
+ "Price": 0.8,
90
+ "EmissionFactor": 0.0,
91
+ "RefSystem": system,
92
+ })
93
+ study.add(fuel1)
94
+
95
+ fuel2 = psr.factory.create("Fuel", study.context)
96
+ fuel2.code = 2
97
+ fuel2.name = "Fuel 2"
98
+ fuel2.from_dict({
99
+ "Unit": "UC",
100
+ "UE": "MWh",
101
+ "Price": 1.2,
102
+ "EmissionFactor": 0.0,
103
+ "RefSystem": system,
104
+ })
105
+ study.add(fuel2)
106
+
107
+ # Create all thermal plants.
108
+ plant1 = study.create("ThermalPlant")
109
+ plant1.code = 1
110
+ plant1.name = "Thermal 1"
111
+ # Set plant's properties
112
+ t_params = {
113
+ "MaximumGenerationCapacity": 10.0,
114
+ "InstalledCapacity": 10.0,
115
+ "ThermalType": 0,
116
+ "Type": 0,
117
+ "NumberOfUnits": 1,
118
+ "NumberOfAlternativeFuels": 0,
119
+ "CodeOfAlternativeFuels(:)": 0,
120
+ "O&MCost": 0.0,
121
+ "FuelTransportationCost": 0.0,
122
+ "SpecificConsumptionSegment(1)": 100.0,
123
+ "SpecificConsumptionSegment(2:3)": 0.0,
124
+ "SpecificConsumption(1:3,1)": 10.0,
125
+ "RefFuels": [fuel1, ],
126
+ "RefSystem": system,
127
+ }
128
+ plant1.from_dict(t_params)
129
+ study.add(plant1)
130
+
131
+ # Use Python copy's module copy function to create
132
+ # a copy of an object.
133
+ plant2 = copy.copy(plant1)
134
+ plant2.code = 2
135
+ plant2.name = "Thermal 2"
136
+ plant2.set("MaximumGenerationCapacity", 5.0)
137
+ plant2.set("InstalledCapacity", 5.0)
138
+ plant2.set("SpecificConsumption(1:3,1)", 15.0)
139
+ plant2.set("RefFuels", [fuel1, ])
140
+ plant2.set("RefSystem", system)
141
+ study.add(plant2)
142
+
143
+ plant3 = plant2.clone()
144
+ plant3.code = 3
145
+ plant3.name = "Thermal 3"
146
+ plant3.from_dict({
147
+ "MaximumGenerationCapacity": 20.0,
148
+ "InstalledCapacity": 20.0,
149
+ "SpecificConsumption(1:3,1)": 12.5,
150
+ "RefFuels": [fuel2, ],
151
+ "RefSystem": system,
152
+ })
153
+ study.add(plant3)
154
+
155
+ return study
156
+
157
+
158
+ if __name__ == "__main__":
159
+ case_path = _get_case_path()
160
+ os.makedirs(case_path, exist_ok=True)
161
+ print("Creating example case... ", end="")
162
+ study = create_case01(False)
163
+ print(" OK.")
164
+ print("Saving example case in \"{}\"... ".format(case_path), end="")
165
+ study.save(case_path)
166
+ print(" OK.")