Validation#

class IssueSeverity(*values)#

Bases: Enum

Validation issue severity.

class IssueCode(*values)#

Bases: Enum

Stable issue codes for validation results.

Codes are grouped by category:

  • 1xx: Load issues

  • 2xx: Generator issues

  • 3xx: Branch issues

  • 4xx: Transformer issues

  • 5xx: Shunt issues

  • 6xx: DC/FACTS issues

  • 9xx: General/system issues

class ValidationIssue(severity, code, object_kind, object_key, message, can_approximate=False)#

Bases: object

A single validation issue.

severity#

ERROR (cannot solve) or WARNING (approximated)

Type:

gpf.IssueSeverity

code#

Stable issue code for testing/integration

Type:

gpf.IssueCode

object_kind#

Type of object ("load", "generator", "transformer", etc.)

Type:

str

object_key#

Identifier tuple (e.g., (bus, id) for loads)

Type:

tuple

message#

Human-readable description

Type:

str

can_approximate#

If True, solver will proceed with approximation

Type:

bool

class PfCapabilities(load_zip=True, gen_remote_regulation=True, gen_wind_mode=True, xfmr_2w_tap_control=True, xfmr_3w=True, shunt_switched=True, two_terminal_dc=True, vsc_dc=True, multi_terminal_dc=False, facts=True, facts_statcom=True)#

Bases: object

Solver capability manifest.

Defines what the solver supports. Used for validation before solve. Only fields with actual validation logic are included.

gpf.PF_CAPABILITIES_V1: PfCapabilities#
class ValidationResult(issues=<factory>)#

Bases: object

Result of validating a case against solver capabilities.

property can_solve#

True if no ERROR-severity issues.

property errors#

All ERROR-severity issues.

raise_if_unsupported()#

Raise ValueError if case cannot be solved.

property warnings#

All WARNING-severity issues.

validate_case(case, caps=PfCapabilities(load_zip=True, gen_remote_regulation=True, gen_wind_mode=True, xfmr_2w_tap_control=True, xfmr_3w=True, shunt_switched=True, two_terminal_dc=True, vsc_dc=True, multi_terminal_dc=False, facts=True, facts_statcom=True))#

Validate a GpfCase against solver capabilities (does NOT mutate the case).

Parameters:
  • case -- Parsed case (high-fidelity IR)

  • caps -- Solver capabilities to validate against

Returns:

ValidationResult with all issues found