-
Notifications
You must be signed in to change notification settings - Fork 54
Description
Summary
Add validation to the Python data validator to detect invalid tap regulator control side configuration
before running power flow calculations. This validation should catch cases where a transformer is being
controlled from the non-source side towards the source side, which is currently only detected during
runtime calculation.
Related Issues and PRs
- Origin: Issue [FEATURE] Power flow calculation. Case of incorrectly specified transformer tap_regulator control_side #1263 - Power flow calculation. Case of incorrectly specified transformer
tap_regulator control_side - Short-term solution: PR Extend regulated transformer control side error #1273 - Extend regulated transformer control side error, PR Report unique ID in trafrmer regulate side error message #1279 - Report unique ID in transformer regulate side error message
- Current status: Runtime error messages now include transformer IDs, but this information is only made available as error message during calculation.
Problem Statement
Current Behavior
Currently, when a tap regulator has an invalid control side configuration (controlling from non-source
side towards source side), the error is only detected during power flow calculation in the C++ core:
AutomaticTapInputError: Automatic tap changer has invalid configuration.
The transformer is being controlled from non source side towards source side.
Transformer IDs: [123, 456, 789]
Why This Is a Problem
-
Late error detection: Errors are only discovered after the model is constructed and calculation
begins, wasting computation time -
Poor development experience: Developers must wait for calculation to start before discovering
data issues -
Incomplete validation workflow: The Python data validator doesn't catch this error, creating a
gap in pre-calculation validation -
Inconsistent with best practices: The documentation recommends validating data before
construction, but this specific check is missing
User Impact
For users with large models (e.g., 50+ transformers with tap regulators):
- Cannot validate all input data (wrt this regulated side) before construction
- Must rely on trial-and-error with calculations to find configuration issues
- Difficult to integrate into automated data validation pipelines
Proposed Solution
Add a new validation check in the Python data validator
(src/power_grid_model/validation/_validation.py) to detect invalid tap regulator control side
configurations.
Validation Logic
The validation should check for each transformer_tap_regulator in topology:
-
Identify the regulated transformer (using
regulated_objectfield) -
Determine the trafo-topology:
- Simplified trafo graph: build with shortest distance in mind
-
Validate control side:
- The
control_sidemust point to a side that is closer to or at the source - If controlling from a side that is farther from the source, append trafo user side ID
- raise a validation error containing these trafo user side IDs
- The
Backward Compatibility
- New validation should be additive only
- Existing validation should continue to work
- Consider adding a warning first, then making it an error in a future release
Metadata
Metadata
Assignees
Labels
Type
Projects
Status