Skip to content

Name the component and key when a simulation state value was never written - #1698

Open
m-bossart wants to merge 1 commit into
psy6from
mb/state-value-checks
Open

m-bossart wants to merge 1 commit into
psy6from
mb/state-value-checks

Conversation

@m-bossart

Copy link
Copy Markdown
Contributor

Summary

Simulation state now covers the union of each key's columns across models (3a1dabe).
A component that no model writes stays NaN for the whole run.
When a model read that value, the failure was unclear:

  • Initial-condition updates hit IOM's @assert isfinite in set_ic_quantity!, which prints the whole component and names neither the state key nor the cause.
  • The emulator feedforward update copied the value into the model without any check.

On the previous code, the same setup failed at build with a message about device filters.

Changes

  • _check_state_value (src/simulation/simulation_state.jl) raises IS.InvalidValue naming the component, the state key, and both causes: a decision not yet made for the time being read, or no model writing that component, usually from different device filters.
  • Every initial-condition update reads through _get_state_value, which applies the check.
  • The five copies of the finite-value error in update_container_parameter_values.jl call the shared check.
  • The emulator feedforward update (VariableValueAttributes, EmulationModel) now checks too.
  • The decision-model event parameter update builds its ParameterKey once per call and uses it for its state reads and the check.

The check runs only on values a model actually reads.
Unwritten cells for components nobody reads are expected under union columns and are not flagged.

Testing

  • New end-to-end test in test/test_simulation_state_union_columns.jl: an emulator whose UC formulation filters out Alta leaves Alta's OnVariable state unwritten, and UC's initial conditions read it at step 2. The test checks that the simulation log names Alta, OnVariable__ThermalStandard, and device filters. It fails without the change.
  • Full suite against current IS4, IOM main and POM main: 29,715 pass, 2 fail.
    The 2 failures are the hot-start coverage check at test/test_market_bid_cost.jl:388, which fails the same way on psy6. POM now reads time limits in minutes, and that test's multi-start scenarios no longer produce a hot start. That fix is a separate test-data change.

🤖 Generated with Claude Code

…itten

Every simulation state value starts as NaN. With state kept over the union of
each key's columns, a component that no model writes stays NaN for the whole
run. Initial-condition updates passed such a value to IOM's set_ic_quantity!,
which failed with an AssertionError that printed the whole component and named
neither the state key nor the cause. The emulator feedforward update copied it
into the model without any check.

A shared _check_state_value raises IS.InvalidValue naming the component, the
state key, and the two causes: a decision not yet made for the time being read,
or no model writing that component, usually from different device filters.
Every initial-condition update reads through it, and it replaces the five
copies of the finite-value check in the parameter updates. The emulator
feedforward update now checks too.
@m-bossart
m-bossart marked this pull request as ready for review October 16, 2026 22:16
@m-bossart
m-bossart requested a review from jd-lara October 16, 2026 22:16

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant