Sienna-Platform / Sienna-Platform/PowerOperationsModels.jl
Add test coverage for `add_to_expression!` paths
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 2
- Forks
- 1
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 26
Description
Three add_to_expression! paths in src/common_models/add_to_expression.jl were latently broken (would error or mis-index) and went undetected because no test system exercises them. They were just fixed on lk/issue-9 (porting PSI fix 22d2059c2 plus a constant-add correction), but we need tests that actually hit them so they can't silently regress again.
1. must-run compact-UC OnVariable
The must_run branch of the compact-UC OnVariable → balance methods called a non-existent 2-arg add_proportional_to_jump_expression!, so it would have thrown a MethodError if ever reached. It's now add_constant_to_jump_expression!(expr, p_min*mult) (must-run units have On ≡ 1, so P_min enters as a constant). No test system contains a must-run compact-UC thermal unit — add one and assert the constant lands in the balance expression.
2. OnVariable / ThermalGen under AreaBalancePowerModel
This method fetched the PSY.ACBus expression container but indexed it by area name, which would KeyError. Fixed to fetch PSY.Area. Needs an AreaBalancePowerModel test with a compact-UC thermal unit.
3. FlowActivePowerToFromVariable / TwoTerminalHVDC under AreaBalancePowerModel
This method referenced an undefined network_reduction (only radial_network_reduction was bound, via a nonexistent get_radial_network_reduction) and an unbound type parameter W, so it would UndefVarError. Fixed to index by PSY.Area and bind HVDCTwoTerminalDispatch. Needs an AreaBalancePowerModel test with a TwoTerminalHVDC line.
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.
Research direction
Start with src/common_models/add_to_expression.jl and identify the existing test system patterns for compact-UC units and AreaBalancePowerModel. Add coverage for a must-run compact-UC thermal unit, an OnVariable/ThermalGen case, and a TwoTerminalHVDC case under AreaBalancePowerModel. Verify the balance expressions receive the expected constant or area-indexed entries without errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100