Fix 1D container creation ahead of IOM issue #15 assertion#174
Open
luke-kiernan wants to merge 1 commit into
Open
Fix 1D container creation ahead of IOM issue #15 assertion#174luke-kiernan wants to merge 1 commit into
luke-kiernan wants to merge 1 commit into
Conversation
IOM is adding a runtime check that rejects any variable/constraint container built with only one index axis. Proactively fixes every POM call site that would trip it: - Storage/hydro/thermal end-of-horizon and initial-condition constraints built with just a names axis but indexed with an extra time key; adds the matching singleton time axis ([time_steps[end]] / [1]). - Whole-horizon budget constraints (hydro energy/water budget, source import/export) that have no time axis by design; adds a ["horizon"] singleton axis. - The AGC steady-state frequency deviation variable/constraint, which are genuinely system-wide scalars; adds a ["System"] singleton axis. - Also fixes 4 latent bugs in storage_models.jl (StorageCyclingCharge/ Discharge, no test coverage) that built a 1D container but were already being indexed with 2 keys downstream. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
IOM is adding a runtime assertion (Sienna-Platform/InfrastructureOptimizationModels.jl#137, tracking Sienna-Platform/InfrastructureOptimizationModels.jl#15) that rejects any variable/constraint/expression/dual/parameter container built with only one index axis — containers must always be indexable as
x[i, j]. This proactively fixes every call site in POM that currently builds such a 1D container, so nothing breaks once that assertion lands.Three patterns, fixed consistently:
thermal_generation.jlActiveRangeICConstraint,hydro_generation.jlReservoirLevelTargetConstraint,storage_models.jlStateofChargeTargetConstraint): built with just anamesaxis but indexed with an extra time key downstream. Added the matching singleton time axis ([time_steps[end]]/[1]).hydro_generation.jlEnergyBudgetConstraint/WaterBudgetConstraint,source.jlImportExportBudgetConstraint): aggregate over the entire horizon with no time axis by design. Added a["horizon"]singleton axis, consistent across all budget sites.agc.jlSteadyStateFrequencyDeviationvariable +FrequencyResponseConstraint): added a["System"]singleton axis.Also fixes 4 latent bugs in
storage_models.jl(StorageCyclingCharge/StorageCyclingDischarge, marked# no test coverage) that built a 1D container but were already being indexed with 2 keys (constraint[name, time_steps[end]]) downstream — that would already error today against a 1DDenseAxisArray.Test plan
Meta.parseall)maincurrently fails to precompile (TypeErrorinNetworkModel/AbstractNetworkModel,common_models/add_expressions.jl:10), a pre-existing, unrelated breakage someone else is already fixing. Confirmed by reproducing the identical failure with these changes fully reverted. Recommend re-running CI on this branch once that's resolved.🤖 Generated with Claude Code