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.
Three
add_to_expression!paths insrc/common_models/add_to_expression.jlwere latently broken (would error or mis-index) and went undetected because no test system exercises them. They were just fixed onlk/issue-9(porting PSI fix22d2059c2plus a constant-add correction), but we need tests that actually hit them so they can't silently regress again.1. must-run compact-UC
OnVariableThe
must_runbranch of the compact-UCOnVariable→ balance methods called a non-existent 2-argadd_proportional_to_jump_expression!, so it would have thrown aMethodErrorif ever reached. It's nowadd_constant_to_jump_expression!(expr, p_min*mult)(must-run units haveOn ≡ 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/ThermalGenunderAreaBalancePowerModelThis method fetched the
PSY.ACBusexpression container but indexed it by area name, which wouldKeyError. Fixed to fetchPSY.Area. Needs anAreaBalancePowerModeltest with a compact-UC thermal unit.3.
FlowActivePowerToFromVariable/TwoTerminalHVDCunderAreaBalancePowerModelThis method referenced an undefined
network_reduction(onlyradial_network_reductionwas bound, via a nonexistentget_radial_network_reduction) and an unbound type parameterW, so it wouldUndefVarError. Fixed to index byPSY.Areaand bindHVDCTwoTerminalDispatch. Needs anAreaBalancePowerModeltest with aTwoTerminalHVDCline.