Validation¶
This module provides functions for validating the integrity and physical consistency of generated power flow data.
validate_generated_data¶
Run all validation tests on the generated data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_paths
|
Dict[str, str]
|
Dictionary containing paths to data files (bus_data, branch_data, gen_data, y_bus_data). |
required |
mode
|
str
|
Operating mode ("opf" or "pf"). |
required |
n_partitions
|
int
|
Number of partitions to sample for validation (0 for all partitions). |
0
|
sn_mva
|
float
|
Base MVA used to scale power quantities |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if all validations pass. |
Raises:
| Type | Description |
|---|---|
AssertionError
|
If any validation fails. |
Source code in gridfm_datakit/validation.py
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 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 | |
Functions¶
validate_ybus_diagonal_consistency¶
Test Y-bus diagonal consistency with bus and branch data (vectorized).
Source code in gridfm_datakit/validation.py
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 | |
validate_deactivated_lines_zero_admittance¶
Test that deactivated lines have zero power flows and admittances.
Source code in gridfm_datakit/validation.py
468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 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 | |
validate_computed_vs_stored_power_flows¶
Test that computed power flows match stored power flows.
Source code in gridfm_datakit/validation.py
692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 | |
validate_branch_loading_opf_mode¶
Test branch loading limits in OPF mode, compute loading statistics in PF mode.
Source code in gridfm_datakit/validation.py
752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 | |
validate_deactivated_generators_zero_output¶
Test that deactivated generators have zero output.
Source code in gridfm_datakit/validation.py
811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 | |
validate_generator_limits¶
Test that generator outputs respect their limits.
Source code in gridfm_datakit/validation.py
839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 | |
validate_voltage_magnitude_limits_opf_mode¶
Test voltage magnitude limits in OPF mode.
Source code in gridfm_datakit/validation.py
916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 | |
validate_bus_generation_consistency¶
Test that Pg in bus data equals sum of generators at each bus (vectorized).
Source code in gridfm_datakit/validation.py
1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 | |
validate_power_balance_equations¶
Test power balance equations (Kirchhoff's Current Law).
Source code in gridfm_datakit/validation.py
1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 | |
validate_constant_cost_generators_unchanged¶
Test that generators with constant-only costs remain unchanged across scenarios (vectorized).
Generators with constant costs (only c0 != 0, with c1 == 0 and c2 == 0) should not be perturbed or permuted, so their cost coefficients should remain identical across all scenarios. This validation checks that constraint.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
generated_data
|
Dict[str, DataFrame]
|
Dictionary containing gen_data DataFrame. |
required |
Raises:
| Type | Description |
|---|---|
AssertionError
|
If any constant-cost generator has varying costs across scenarios. |
Source code in gridfm_datakit/validation.py
1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 | |
validate_bus_type_generator_consistency¶
Test that bus types are consistent with generator presence (vectorized).
Validates fundamental power system constraints: - PV buses (voltage-controlled) must have at least one active generator - PQ buses (load buses) must have NO active generators - REF buses (slack/reference) must have at least one active generator
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
generated_data
|
Dict[str, DataFrame]
|
Dictionary containing bus_data and gen_data DataFrames. |
required |
Raises:
| Type | Description |
|---|---|
AssertionError
|
If any bus type constraint is violated. |
Source code in gridfm_datakit/validation.py
1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 | |
validate_scenario_indexing_consistency¶
Test that scenario indices are consistent across all data files.
Source code in gridfm_datakit/validation.py
1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 | |
validate_bus_indexing_consistency¶
Test that bus indices are consistent across data files.
Source code in gridfm_datakit/validation.py
1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 | |
validate_data_completeness¶
Test that all required columns are present and contain no NaN values.
Source code in gridfm_datakit/validation.py
1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 | |