Sienna-Platform / Sienna-Platform/PowerOperationsModels.jl
Unify the trait-vs-list pattern in _pf_provides_aux_var
Open
@luke-kiernan is already working on this.
Since Jul 17, 2026.
- Dominant language
- Julia
- Stars
- 2
- Forks
- 1
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 26
Description
_pf_provides_aux_var (src/network_models/power_flow_evaluation.jl) mixes two dispatch styles:
- Generic PowerFlowAuxVariableType → list membership: T in branch_aux_vars(pf_data) || T in bus_aux_vars(pf_data).
- HVDC / discrete-control types → predicate/trait: _provides_control_aux_vars(pf_data).
The two halves answer structurally different questions (fixed per-formulation enumeration vs. runtime control-enrollment), which is why the code grew two shapes. Correct today, but harder to follow.
The fix is kinda like this
- Express both through one mechanism — e.g. a single _pf_provides_aux_var(::Type{T}, pf_data) trait surface where the list cases derive from per-formulation methods rather than an in check, so the whole predicate reads as dispatch.
- Keep it dispatch-based (no isa, no Union enumerations).
- Preserve the no-op behavior for evaluators that provide nothing (NFA/CopperPlate/PSSEExporter).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.