power-grid-model 1.10.74__py3-none-win_amd64.whl → 1.12.119__py3-none-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of power-grid-model might be problematic. Click here for more details.
- power_grid_model/__init__.py +54 -29
- power_grid_model/_core/__init__.py +3 -3
- power_grid_model/_core/buffer_handling.py +507 -478
- power_grid_model/_core/data_handling.py +195 -141
- power_grid_model/_core/data_types.py +142 -0
- power_grid_model/_core/dataset_definitions.py +109 -109
- power_grid_model/_core/enum.py +226 -0
- power_grid_model/_core/error_handling.py +215 -202
- power_grid_model/_core/errors.py +134 -0
- power_grid_model/_core/index_integer.py +17 -17
- power_grid_model/_core/options.py +71 -69
- power_grid_model/_core/power_grid_core.py +577 -597
- power_grid_model/_core/power_grid_dataset.py +545 -528
- power_grid_model/_core/power_grid_meta.py +262 -244
- power_grid_model/_core/power_grid_model.py +1025 -692
- power_grid_model/_core/power_grid_model_c/__init__.py +3 -0
- 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 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/basics.h +251 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/buffer.h +108 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/dataset.h +332 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/dataset_definitions.h +1060 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/handle.h +111 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/meta_data.h +189 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/model.h +130 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/options.h +142 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/serialization.h +118 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_c.h +36 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/basics.hpp +65 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/buffer.hpp +61 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/dataset.hpp +224 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/handle.hpp +108 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/meta_data.hpp +84 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/model.hpp +63 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/options.hpp +52 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/serialization.hpp +124 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/utils.hpp +81 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp.hpp +19 -0
- power_grid_model/_core/power_grid_model_c/lib/cmake/power_grid_model/power_grid_modelConfig.cmake +37 -0
- power_grid_model/_core/power_grid_model_c/lib/cmake/power_grid_model/power_grid_modelConfigVersion.cmake +65 -0
- power_grid_model/_core/power_grid_model_c/lib/cmake/power_grid_model/power_grid_modelTargets-release.cmake +19 -0
- power_grid_model/_core/power_grid_model_c/lib/cmake/power_grid_model/power_grid_modelTargets.cmake +144 -0
- power_grid_model/_core/power_grid_model_c/lib/power_grid_model_c.lib +0 -0
- power_grid_model/_core/power_grid_model_c/share/LICENSE +292 -0
- power_grid_model/_core/power_grid_model_c/share/README.md +15 -0
- power_grid_model/_core/serialization.py +319 -317
- power_grid_model/_core/typing.py +20 -0
- power_grid_model/{_utils.py → _core/utils.py} +798 -783
- power_grid_model/data_types.py +321 -319
- power_grid_model/enum.py +27 -214
- power_grid_model/errors.py +37 -123
- power_grid_model/typing.py +43 -48
- power_grid_model/utils.py +529 -400
- power_grid_model/validation/__init__.py +25 -14
- power_grid_model/validation/_rules.py +1167 -904
- power_grid_model/validation/_validation.py +1172 -980
- power_grid_model/validation/assertions.py +93 -92
- power_grid_model/validation/errors.py +602 -520
- power_grid_model/validation/utils.py +313 -318
- {power_grid_model-1.10.74.dist-info → power_grid_model-1.12.119.dist-info}/METADATA +162 -171
- power_grid_model-1.12.119.dist-info/RECORD +65 -0
- {power_grid_model-1.10.74.dist-info → power_grid_model-1.12.119.dist-info}/WHEEL +1 -1
- power_grid_model-1.12.119.dist-info/entry_points.txt +3 -0
- power_grid_model/_core/_power_grid_core.dll +0 -0
- power_grid_model-1.10.74.dist-info/RECORD +0 -32
- power_grid_model-1.10.74.dist-info/top_level.txt +0 -1
- {power_grid_model-1.10.74.dist-info → power_grid_model-1.12.119.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,520 +1,602 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
|
|
2
|
-
#
|
|
3
|
-
# SPDX-License-Identifier: MPL-2.0
|
|
4
|
-
|
|
5
|
-
"""
|
|
6
|
-
Error classes
|
|
7
|
-
"""
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
from
|
|
11
|
-
from
|
|
12
|
-
|
|
13
|
-
from
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
components
|
|
44
|
-
"""
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
"""
|
|
48
|
-
The
|
|
49
|
-
|
|
50
|
-
"""
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
)
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
context =
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
)
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
def
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
"""
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
class
|
|
306
|
-
"""
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
"
|
|
318
|
-
|
|
319
|
-
""
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
super().__init__(component=component, field=
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
"""
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
if isinstance(
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
""
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
"""
|
|
488
|
-
|
|
489
|
-
_message = "
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
""
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
1
|
+
# SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
|
|
2
|
+
#
|
|
3
|
+
# SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
|
|
5
|
+
"""
|
|
6
|
+
Error classes
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import re
|
|
10
|
+
from abc import ABC
|
|
11
|
+
from collections.abc import Iterable
|
|
12
|
+
from enum import Enum
|
|
13
|
+
from typing import Any
|
|
14
|
+
|
|
15
|
+
from power_grid_model import ComponentType
|
|
16
|
+
from power_grid_model._core.dataset_definitions import DatasetType
|
|
17
|
+
|
|
18
|
+
_MIN_FIELDS = 2
|
|
19
|
+
_MIN_COMPONENTS = 2
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class ValidationError(ABC):
|
|
23
|
+
"""
|
|
24
|
+
The Validation Error is an abstract base class which should be extended by all validation errors. It supplies
|
|
25
|
+
three public member variables: component, field and ids; storing information about the origin of the validation
|
|
26
|
+
error. Error classes can extend the public members. For example:
|
|
27
|
+
|
|
28
|
+
NotBetweenError(ValidationError):
|
|
29
|
+
component = 'vehicle'
|
|
30
|
+
field = 'direction'
|
|
31
|
+
id = [3, 14, 15, 92, 65, 35]
|
|
32
|
+
ref_value = (-3.1416, 3.1416)
|
|
33
|
+
|
|
34
|
+
For convenience, a human readable representation of the error is supplied using the str() function.
|
|
35
|
+
I.e. print(str(error)) will print a human readable error message like:
|
|
36
|
+
|
|
37
|
+
Field `direction` is not between -3.1416 and 3.1416 for 6 vehicles
|
|
38
|
+
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
component: ComponentType | list[ComponentType] | None = None
|
|
42
|
+
"""
|
|
43
|
+
The component, or components, to which the error applies.
|
|
44
|
+
"""
|
|
45
|
+
|
|
46
|
+
field: str | list[str] | list[tuple[ComponentType, str]] | None = None
|
|
47
|
+
"""
|
|
48
|
+
The field, or fields, to which the error applies. A field can also be a tuple (component, field) when multiple
|
|
49
|
+
components are being addressed.
|
|
50
|
+
"""
|
|
51
|
+
|
|
52
|
+
ids: list[int] | list[tuple[ComponentType, int]] | None = None
|
|
53
|
+
"""
|
|
54
|
+
The object identifiers to which the error applies. A field object identifier can also be a tuple (component, id)
|
|
55
|
+
when multiple components are being addressed.
|
|
56
|
+
"""
|
|
57
|
+
|
|
58
|
+
_message: str = "An unknown validation error occurred."
|
|
59
|
+
|
|
60
|
+
_delimiter: str = " and "
|
|
61
|
+
|
|
62
|
+
__hash__ = None # type: ignore[assignment]
|
|
63
|
+
|
|
64
|
+
@property
|
|
65
|
+
def component_str(self) -> str:
|
|
66
|
+
"""
|
|
67
|
+
A string representation of the component to which this error applies
|
|
68
|
+
"""
|
|
69
|
+
if self.component is None:
|
|
70
|
+
return str(None)
|
|
71
|
+
if isinstance(self.component, list):
|
|
72
|
+
return "/".join(component.value for component in self.component)
|
|
73
|
+
return self.component.value
|
|
74
|
+
|
|
75
|
+
@property
|
|
76
|
+
def field_str(self) -> str:
|
|
77
|
+
"""
|
|
78
|
+
A string representation of the field to which this error applies
|
|
79
|
+
"""
|
|
80
|
+
|
|
81
|
+
def _unpack(field: str | tuple[ComponentType, str]) -> str:
|
|
82
|
+
if isinstance(field, str):
|
|
83
|
+
return f"'{field}'"
|
|
84
|
+
return ".".join(field)
|
|
85
|
+
|
|
86
|
+
if isinstance(self.field, list):
|
|
87
|
+
return self._delimiter.join(_unpack(field) for field in self.field)
|
|
88
|
+
return _unpack(self.field) if self.field else str(self.field)
|
|
89
|
+
|
|
90
|
+
def get_context(self, id_lookup: list[str] | dict[int, str] | None = None) -> dict[str, Any]:
|
|
91
|
+
"""
|
|
92
|
+
Returns a dictionary that supplies (human readable) information about this error. Each member variable is
|
|
93
|
+
included in the dictionary. If a function {field_name}_str() exists, the value is overwritten by that function.
|
|
94
|
+
|
|
95
|
+
Args:
|
|
96
|
+
id_lookup: A list or dict (int->str) containing textual object ids
|
|
97
|
+
"""
|
|
98
|
+
context = self.__dict__.copy()
|
|
99
|
+
if id_lookup:
|
|
100
|
+
if isinstance(id_lookup, list):
|
|
101
|
+
id_lookup = dict(enumerate(id_lookup))
|
|
102
|
+
context["ids"] = (
|
|
103
|
+
{i: id_lookup.get(i[1] if isinstance(i, tuple) else i) for i in self.ids} if self.ids else set()
|
|
104
|
+
)
|
|
105
|
+
for key in context:
|
|
106
|
+
if hasattr(self, key + "_str"):
|
|
107
|
+
context[key] = str(getattr(self, key + "_str"))
|
|
108
|
+
return context
|
|
109
|
+
|
|
110
|
+
def __str__(self) -> str:
|
|
111
|
+
n_objects = len(self.ids) if self.ids else 0
|
|
112
|
+
context = self.get_context()
|
|
113
|
+
context["n"] = n_objects
|
|
114
|
+
context["objects"] = context.get("component", "object")
|
|
115
|
+
if n_objects != 1:
|
|
116
|
+
context["objects"] = re.sub(r"([a-z_]+)", r"\1s", context["objects"])
|
|
117
|
+
return self._message.format(**context).strip()
|
|
118
|
+
|
|
119
|
+
def __repr__(self) -> str:
|
|
120
|
+
context = " ".join(f"{key}={value}" for key, value in self.get_context().items())
|
|
121
|
+
return f"<{type(self).__name__}: {context}>"
|
|
122
|
+
|
|
123
|
+
def __eq__(self, other):
|
|
124
|
+
return (
|
|
125
|
+
type(self) is type(other)
|
|
126
|
+
and self.component == other.component
|
|
127
|
+
and self.field == other.field
|
|
128
|
+
and self.ids == other.ids
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
class SingleFieldValidationError(ValidationError):
|
|
133
|
+
"""
|
|
134
|
+
Base class for an error that applies to a single field in a single component
|
|
135
|
+
"""
|
|
136
|
+
|
|
137
|
+
_message = "Field {field} is not valid for {n} {objects}."
|
|
138
|
+
component: ComponentType
|
|
139
|
+
field: str
|
|
140
|
+
ids: list[int] | None
|
|
141
|
+
|
|
142
|
+
def __init__(self, component: ComponentType, field: str, ids: Iterable[int] | None):
|
|
143
|
+
"""
|
|
144
|
+
Args:
|
|
145
|
+
component: Component name
|
|
146
|
+
field: Field name
|
|
147
|
+
ids: List of component IDs (not row indices)
|
|
148
|
+
"""
|
|
149
|
+
self.component = component
|
|
150
|
+
self.field = field
|
|
151
|
+
self.ids = sorted(ids) if ids is not None else None
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
class MultiFieldValidationError(ValidationError):
|
|
155
|
+
"""
|
|
156
|
+
Base class for an error that applies to multiple fields in a single component
|
|
157
|
+
"""
|
|
158
|
+
|
|
159
|
+
_message = "Combination of fields {field} is not valid for {n} {objects}."
|
|
160
|
+
component: ComponentType
|
|
161
|
+
field: list[str]
|
|
162
|
+
ids: list[int]
|
|
163
|
+
|
|
164
|
+
def __init__(self, component: ComponentType, fields: list[str], ids: list[int]):
|
|
165
|
+
"""
|
|
166
|
+
Args:
|
|
167
|
+
component: Component name
|
|
168
|
+
fields: List of field names
|
|
169
|
+
ids: List of component IDs (not row indices)
|
|
170
|
+
"""
|
|
171
|
+
self.component = component
|
|
172
|
+
self.field = sorted(fields)
|
|
173
|
+
self.ids = sorted(ids)
|
|
174
|
+
|
|
175
|
+
if len(self.field) < _MIN_FIELDS:
|
|
176
|
+
raise ValueError(f"{type(self).__name__} expects at least 2 fields: {self.field}")
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
class MultiComponentValidationError(ValidationError):
|
|
180
|
+
"""
|
|
181
|
+
Base class for an error that applies to multiple components, and, subsequently, multiple fields.
|
|
182
|
+
Even if both fields have the same name, they are considered to be different fields and notated as such.
|
|
183
|
+
E.g. the two fields `id` fields of the `node` and `line` component: [('node', 'id'), ('line', 'id')].
|
|
184
|
+
"""
|
|
185
|
+
|
|
186
|
+
component: list[ComponentType]
|
|
187
|
+
field: list[tuple[ComponentType, str]]
|
|
188
|
+
ids: list[tuple[ComponentType, int]]
|
|
189
|
+
_message = "Fields {field} are not valid for {n} {objects}."
|
|
190
|
+
|
|
191
|
+
def __init__(self, fields: list[tuple[ComponentType, str]], ids: list[tuple[ComponentType, int]]):
|
|
192
|
+
"""
|
|
193
|
+
Args:
|
|
194
|
+
fields: List of field names, formatted as tuples (component, field)
|
|
195
|
+
ids: List of component IDs (not row indices), formatted as tuples (component, id)
|
|
196
|
+
"""
|
|
197
|
+
self.component = sorted({component for component, _ in fields}, key=str)
|
|
198
|
+
self.field = sorted(fields)
|
|
199
|
+
self.ids = sorted(ids)
|
|
200
|
+
|
|
201
|
+
if len(self.field) < _MIN_FIELDS:
|
|
202
|
+
raise ValueError(f"{type(self).__name__} expects at least {_MIN_FIELDS} fields: {self.field}")
|
|
203
|
+
if len(self.component) < _MIN_COMPONENTS:
|
|
204
|
+
raise ValueError(f"{type(self).__name__} expects at least {_MIN_COMPONENTS} components: {self.component}")
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
class NotIdenticalError(SingleFieldValidationError):
|
|
208
|
+
"""
|
|
209
|
+
The value is not unique within a single column in a dataset
|
|
210
|
+
E.g. When two nodes share the same id.
|
|
211
|
+
"""
|
|
212
|
+
|
|
213
|
+
_message = "Field {field} is not unique for {n} {objects}: {num_unique} different values."
|
|
214
|
+
values: list[Any]
|
|
215
|
+
unique: set[Any]
|
|
216
|
+
num_unique: int
|
|
217
|
+
|
|
218
|
+
def __init__(self, component: ComponentType, field: str, ids: Iterable[int], values: list[Any]):
|
|
219
|
+
super().__init__(component, field, ids)
|
|
220
|
+
self.values = values
|
|
221
|
+
self.unique = set(self.values)
|
|
222
|
+
self.num_unique = len(self.unique)
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
class NotUniqueError(SingleFieldValidationError):
|
|
226
|
+
"""
|
|
227
|
+
The value is not unique within a single column in a dataset
|
|
228
|
+
E.g. When two nodes share the same id.
|
|
229
|
+
"""
|
|
230
|
+
|
|
231
|
+
_message = "Field {field} is not unique for {n} {objects}."
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
class MultiComponentNotUniqueError(MultiComponentValidationError):
|
|
235
|
+
"""
|
|
236
|
+
The value is not unique between multiple columns in multiple components
|
|
237
|
+
E.g. When a node and a line share the same id.
|
|
238
|
+
"""
|
|
239
|
+
|
|
240
|
+
_message = "Fields {field} are not unique for {n} {objects}."
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
class InvalidValueError(SingleFieldValidationError):
|
|
244
|
+
"""
|
|
245
|
+
The value is not a valid value in the supplied list of supported values.
|
|
246
|
+
E.g. an enum value that is not supported for a specific feature.
|
|
247
|
+
"""
|
|
248
|
+
|
|
249
|
+
_message = "Field {field} contains invalid values for {n} {objects}."
|
|
250
|
+
values: list
|
|
251
|
+
__hash__ = None # type: ignore[assignment]
|
|
252
|
+
|
|
253
|
+
def __init__(self, component: ComponentType, field: str, ids: list[int], values: list):
|
|
254
|
+
super().__init__(component, field, ids)
|
|
255
|
+
self.values = values
|
|
256
|
+
|
|
257
|
+
@property
|
|
258
|
+
def values_str(self) -> str:
|
|
259
|
+
"""
|
|
260
|
+
A string representation of the field to which this error applies.
|
|
261
|
+
"""
|
|
262
|
+
return ",".join(v.name if isinstance(v, Enum) else v for v in self.values)
|
|
263
|
+
|
|
264
|
+
def __eq__(self, other):
|
|
265
|
+
return super().__eq__(other) and self.values == other.values
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
class InvalidEnumValueError(SingleFieldValidationError):
|
|
269
|
+
"""
|
|
270
|
+
The value is not a valid value in the supplied enumeration type.
|
|
271
|
+
E.g. a sym_load has a non existing LoadGenType.
|
|
272
|
+
"""
|
|
273
|
+
|
|
274
|
+
_message = "Field {field} contains invalid {enum} values for {n} {objects}."
|
|
275
|
+
enum: type[Enum] | list[type[Enum]]
|
|
276
|
+
__hash__ = None # type: ignore[assignment]
|
|
277
|
+
|
|
278
|
+
def __init__(self, component: ComponentType, field: str, ids: list[int], enum: type[Enum] | list[type[Enum]]):
|
|
279
|
+
super().__init__(component, field, ids)
|
|
280
|
+
self.enum = enum
|
|
281
|
+
|
|
282
|
+
@property
|
|
283
|
+
def enum_str(self) -> str:
|
|
284
|
+
"""
|
|
285
|
+
A string representation of the field to which this error applies.
|
|
286
|
+
"""
|
|
287
|
+
if isinstance(self.enum, list):
|
|
288
|
+
return ",".join(e.__name__ for e in self.enum)
|
|
289
|
+
|
|
290
|
+
return self.enum.__name__
|
|
291
|
+
|
|
292
|
+
def __eq__(self, other):
|
|
293
|
+
return super().__eq__(other) and self.enum == other.enum
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
class SameValueError(MultiFieldValidationError):
|
|
297
|
+
"""
|
|
298
|
+
The value of two fields is equal.
|
|
299
|
+
E.g. A line has the same from_node as to_node.
|
|
300
|
+
"""
|
|
301
|
+
|
|
302
|
+
_message = "Same value for {field} for {n} {objects}."
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
class NotBooleanError(SingleFieldValidationError):
|
|
306
|
+
"""
|
|
307
|
+
Invalid boolean value. Boolean fields don't really exist in our data structure, they are 1-byte signed integers and
|
|
308
|
+
should contain either a 0 (=False) or a 1 (=True).
|
|
309
|
+
"""
|
|
310
|
+
|
|
311
|
+
_message = "Field {field} is not a boolean (0 or 1) for {n} {objects}."
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
class MissingValueError(SingleFieldValidationError):
|
|
315
|
+
"""
|
|
316
|
+
A required value was missing, i.e. NaN.
|
|
317
|
+
"""
|
|
318
|
+
|
|
319
|
+
_message = "Field {field} is missing for {n} {objects}."
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
class IdNotInDatasetError(SingleFieldValidationError):
|
|
323
|
+
"""
|
|
324
|
+
An object identifier does not exist in the original data.
|
|
325
|
+
E.g. An update data set contains a record for a line that doesn't exist in the input data set.
|
|
326
|
+
"""
|
|
327
|
+
|
|
328
|
+
_message = "ID does not exist in {ref_dataset} for {n} {objects}."
|
|
329
|
+
ref_dataset: DatasetType
|
|
330
|
+
__hash__ = None # type: ignore[assignment]
|
|
331
|
+
|
|
332
|
+
def __init__(self, component: ComponentType, ids: list[int], ref_dataset: DatasetType):
|
|
333
|
+
super().__init__(component=component, field="id", ids=ids)
|
|
334
|
+
self.ref_dataset = ref_dataset
|
|
335
|
+
|
|
336
|
+
def __eq__(self, other):
|
|
337
|
+
return super().__eq__(other) and self.ref_dataset == other.ref_dataset
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
class InvalidIdError(SingleFieldValidationError):
|
|
341
|
+
"""
|
|
342
|
+
An object identifier does not refer to the right type of object.
|
|
343
|
+
E.g. An line's from_node refers to a source.
|
|
344
|
+
|
|
345
|
+
Filters can have been applied to check a subset of the records. E.g. This error may apply only to power_sensors
|
|
346
|
+
that are said to be connected to a source (filter: measured_terminal_type=source). This useful to spot validation
|
|
347
|
+
mistakes, due to ambiguity.
|
|
348
|
+
|
|
349
|
+
E.g. when a sym_power_sensor is connected to a load, but measured_terminal_type is accidentally set to 'source',
|
|
350
|
+
the error is:
|
|
351
|
+
|
|
352
|
+
"Field `measured_object` does not contain a valid source id for 1 sym_power_sensor. (measured_terminal_type=source)"
|
|
353
|
+
|
|
354
|
+
"""
|
|
355
|
+
|
|
356
|
+
_message = "Field {field} does not contain a valid {ref_components} id for {n} {objects}. {filters}"
|
|
357
|
+
ref_components: list[ComponentType]
|
|
358
|
+
__hash__ = None # type: ignore[assignment]
|
|
359
|
+
|
|
360
|
+
def __init__(
|
|
361
|
+
self,
|
|
362
|
+
component: ComponentType,
|
|
363
|
+
field: str,
|
|
364
|
+
ids: list[int] | None = None,
|
|
365
|
+
ref_components: ComponentType | list[ComponentType] | None = None,
|
|
366
|
+
filters: dict[str, Any] | None = None,
|
|
367
|
+
):
|
|
368
|
+
super().__init__(component=component, field=field, ids=ids)
|
|
369
|
+
ref_components = ref_components if ref_components is not None else []
|
|
370
|
+
self.ref_components = [ref_components] if isinstance(ref_components, (str, ComponentType)) else ref_components
|
|
371
|
+
self.filters = filters if filters else None
|
|
372
|
+
|
|
373
|
+
@property
|
|
374
|
+
def ref_components_str(self):
|
|
375
|
+
"""
|
|
376
|
+
A string representation of the components to which this error applies
|
|
377
|
+
"""
|
|
378
|
+
return "/".join(self.ref_components)
|
|
379
|
+
|
|
380
|
+
@property
|
|
381
|
+
def filters_str(self):
|
|
382
|
+
"""
|
|
383
|
+
A string representation of the filters that have been applied to the data to which this error refers
|
|
384
|
+
"""
|
|
385
|
+
if not self.filters:
|
|
386
|
+
return ""
|
|
387
|
+
filters = ", ".join(f"{k}={v.name if isinstance(v, Enum) else v}" for k, v in self.filters.items())
|
|
388
|
+
return f"({filters})"
|
|
389
|
+
|
|
390
|
+
def __eq__(self, other):
|
|
391
|
+
return super().__eq__(other) and self.ref_components == other.ref_components and self.filters == other.filters
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
class TwoValuesZeroError(MultiFieldValidationError):
|
|
395
|
+
"""
|
|
396
|
+
A record has a 0.0 value in two fields at the same time.
|
|
397
|
+
E.g. A line's `r1`, `x1` are both 0.
|
|
398
|
+
"""
|
|
399
|
+
|
|
400
|
+
_message = "Fields {field} are both zero for {n} {objects}."
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
class ComparisonError(SingleFieldValidationError):
|
|
404
|
+
"""
|
|
405
|
+
Base class for comparison errors.
|
|
406
|
+
E.g. A transformer's `i0` is not greater or equal to it's `p0` divided by it's `sn`
|
|
407
|
+
"""
|
|
408
|
+
|
|
409
|
+
_message = "Invalid {field}, compared to {ref_value} for {n} {objects}."
|
|
410
|
+
|
|
411
|
+
RefType = int | float | str | tuple[int | float | str, ...]
|
|
412
|
+
|
|
413
|
+
__hash__ = None # type: ignore[assignment]
|
|
414
|
+
|
|
415
|
+
def __init__(self, component: ComponentType, field: str, ids: list[int], ref_value: "ComparisonError.RefType"):
|
|
416
|
+
super().__init__(component, field, ids)
|
|
417
|
+
self.ref_value = ref_value
|
|
418
|
+
|
|
419
|
+
@property
|
|
420
|
+
def ref_value_str(self):
|
|
421
|
+
"""
|
|
422
|
+
A string representation of the reference value. E.g. 'zero', 'one', 'field_a and field_b' or '123'.
|
|
423
|
+
"""
|
|
424
|
+
if isinstance(self.ref_value, tuple):
|
|
425
|
+
return self._delimiter.join(map(str, self.ref_value))
|
|
426
|
+
if self.ref_value == 0:
|
|
427
|
+
return "zero"
|
|
428
|
+
if self.ref_value == 1:
|
|
429
|
+
return "one"
|
|
430
|
+
return str(self.ref_value)
|
|
431
|
+
|
|
432
|
+
def __eq__(self, other):
|
|
433
|
+
return super().__eq__(other) and self.ref_value == other.ref_value
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
class NotGreaterThanError(ComparisonError):
|
|
437
|
+
"""
|
|
438
|
+
The value of a field is not greater than a reference value or expression.
|
|
439
|
+
"""
|
|
440
|
+
|
|
441
|
+
_message = "Field {field} is not greater than {ref_value} for {n} {objects}."
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
class NotGreaterOrEqualError(ComparisonError):
|
|
445
|
+
"""
|
|
446
|
+
The value of a field is not greater or equal to a reference value or expression.
|
|
447
|
+
"""
|
|
448
|
+
|
|
449
|
+
_message = "Field {field} is not greater than (or equal to) {ref_value} for {n} {objects}."
|
|
450
|
+
|
|
451
|
+
|
|
452
|
+
class NotLessThanError(ComparisonError):
|
|
453
|
+
"""
|
|
454
|
+
The value of a field is not less than a reference value or expression.
|
|
455
|
+
"""
|
|
456
|
+
|
|
457
|
+
_message = "Field {field} is not smaller than {ref_value} for {n} {objects}."
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
class NotLessOrEqualError(ComparisonError):
|
|
461
|
+
"""
|
|
462
|
+
The value of a field is not smaller or equal to a reference value or expression.
|
|
463
|
+
"""
|
|
464
|
+
|
|
465
|
+
_message = "Field {field} is not smaller than (or equal to) {ref_value} for {n} {objects}."
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
class NotBetweenError(ComparisonError):
|
|
469
|
+
"""
|
|
470
|
+
The value of a field is not between two a reference values or expressions (exclusive).
|
|
471
|
+
"""
|
|
472
|
+
|
|
473
|
+
_message = "Field {field} is not between {ref_value} for {n} {objects}."
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
class NotBetweenOrAtError(ComparisonError):
|
|
477
|
+
"""
|
|
478
|
+
The value of a field is not between two a reference values or expressions (inclusive).
|
|
479
|
+
"""
|
|
480
|
+
|
|
481
|
+
_message = "Field {field} is not between (or at) {ref_value} for {n} {objects}."
|
|
482
|
+
|
|
483
|
+
|
|
484
|
+
class InfinityError(SingleFieldValidationError):
|
|
485
|
+
"""
|
|
486
|
+
The value of a field is infinite.
|
|
487
|
+
"""
|
|
488
|
+
|
|
489
|
+
_message = "Field {field} is infinite for {n} {objects}."
|
|
490
|
+
|
|
491
|
+
|
|
492
|
+
class TransformerClockError(MultiFieldValidationError):
|
|
493
|
+
"""
|
|
494
|
+
Invalid clock number.
|
|
495
|
+
"""
|
|
496
|
+
|
|
497
|
+
_message = (
|
|
498
|
+
"Invalid clock number for {n} {objects}. "
|
|
499
|
+
"If one side has wye winding and the other side has not, the clock number should be odd. "
|
|
500
|
+
"If either both or none of the sides have wye winding, the clock number should be even."
|
|
501
|
+
)
|
|
502
|
+
|
|
503
|
+
|
|
504
|
+
class FaultPhaseError(MultiFieldValidationError):
|
|
505
|
+
"""
|
|
506
|
+
The fault phase does not match the fault type.
|
|
507
|
+
"""
|
|
508
|
+
|
|
509
|
+
_message = "The fault phase is not applicable to the corresponding fault type for {n} {objects}."
|
|
510
|
+
|
|
511
|
+
|
|
512
|
+
class PQSigmaPairError(MultiFieldValidationError):
|
|
513
|
+
"""
|
|
514
|
+
The combination of p_sigma and q_sigma is not valid. They should be both present or both absent.
|
|
515
|
+
"""
|
|
516
|
+
|
|
517
|
+
_message = "The combination of p_sigma and q_sigma is not valid for {n} {objects}."
|
|
518
|
+
|
|
519
|
+
|
|
520
|
+
class InvalidAssociatedEnumValueError(MultiFieldValidationError):
|
|
521
|
+
"""
|
|
522
|
+
The value is not a valid value in combination with the other specified attributes.
|
|
523
|
+
E.g. When a transformer tap regulator has a branch3 control side but regulates a transformer.
|
|
524
|
+
"""
|
|
525
|
+
|
|
526
|
+
_message = "The combination of fields {field} results in invalid {enum} values for {n} {objects}."
|
|
527
|
+
enum: type[Enum] | list[type[Enum]]
|
|
528
|
+
__hash__ = None # type: ignore[assignment]
|
|
529
|
+
|
|
530
|
+
def __init__(
|
|
531
|
+
self,
|
|
532
|
+
component: ComponentType,
|
|
533
|
+
fields: list[str],
|
|
534
|
+
ids: list[int],
|
|
535
|
+
enum: type[Enum] | list[type[Enum]],
|
|
536
|
+
):
|
|
537
|
+
"""
|
|
538
|
+
Args:
|
|
539
|
+
component: Component name
|
|
540
|
+
fields: List of field names
|
|
541
|
+
ids: List of component IDs (not row indices)
|
|
542
|
+
enum: The supported enum values
|
|
543
|
+
"""
|
|
544
|
+
super().__init__(component, fields, ids)
|
|
545
|
+
self.enum = enum
|
|
546
|
+
|
|
547
|
+
@property
|
|
548
|
+
def enum_str(self) -> str:
|
|
549
|
+
"""
|
|
550
|
+
A string representation of the field to which this error applies.
|
|
551
|
+
"""
|
|
552
|
+
if isinstance(self.enum, list):
|
|
553
|
+
return ",".join(e.__name__ for e in self.enum)
|
|
554
|
+
|
|
555
|
+
return self.enum.__name__
|
|
556
|
+
|
|
557
|
+
def __eq__(self, other):
|
|
558
|
+
return super().__eq__(other) and self.enum == other.enum
|
|
559
|
+
|
|
560
|
+
|
|
561
|
+
class UnsupportedMeasuredTerminalType(InvalidValueError):
|
|
562
|
+
"""
|
|
563
|
+
The measured terminal type is not a supported value.
|
|
564
|
+
|
|
565
|
+
Supported values are in the supplied list of values.
|
|
566
|
+
"""
|
|
567
|
+
|
|
568
|
+
_message = "measured_terminal_type contains unsupported values for {n} {objects}."
|
|
569
|
+
|
|
570
|
+
|
|
571
|
+
class MixedCurrentAngleMeasurementTypeError(MultiFieldValidationError):
|
|
572
|
+
"""
|
|
573
|
+
Mixed current angle measurement type error.
|
|
574
|
+
"""
|
|
575
|
+
|
|
576
|
+
_message = (
|
|
577
|
+
"Mixture of different current angle measurement types on the same terminal for {n} {objects}. "
|
|
578
|
+
"If multiple current sensors measure the same terminal of the same object, all angle measurement types must be "
|
|
579
|
+
"the same. Mixing local_angle and global_angle current measurements on the same terminal is not supported."
|
|
580
|
+
)
|
|
581
|
+
|
|
582
|
+
|
|
583
|
+
class MixedPowerCurrentSensorError(MultiComponentValidationError):
|
|
584
|
+
"""
|
|
585
|
+
Mixed power and current sensor error.
|
|
586
|
+
"""
|
|
587
|
+
|
|
588
|
+
_message = (
|
|
589
|
+
"Mixture of power and current sensors on the same terminal for {n} {objects}. "
|
|
590
|
+
"If multiple sensors measure the same terminal of the same object, all sensors must measure the same quantity."
|
|
591
|
+
)
|
|
592
|
+
|
|
593
|
+
|
|
594
|
+
class MissingVoltageAngleMeasurementError(MultiComponentValidationError):
|
|
595
|
+
"""
|
|
596
|
+
Missing voltage angle measurement error.
|
|
597
|
+
"""
|
|
598
|
+
|
|
599
|
+
_message = (
|
|
600
|
+
"Missing voltage angle measurement for {n} {objects}. "
|
|
601
|
+
"If a voltage sensor measures the voltage of a terminal, it must also measure the voltage angle."
|
|
602
|
+
)
|