Skip to content

mdl: C-LEARN lookup-only variables simulate as zero #590

Closed

Description

@bpowers

In C-LEARN, a variable that is only a lookup table (no equation, just the graphical function, written 0+0 by the importer) used to simulate as a series of zeros, while Vensim's reference run showed real values for it.
About 17 variables were affected, for example Historical GDP LOOKUP and RS HFC125.

This is fixed on main.
A lookup-only variable is now a static table: it has no series, is left out of every runlist, and a bare reference to it (without an input) is the error LookupReferencedWithoutArgument.
The variables that call these tables match Vensim.
The VDF reader's handling of the lookup-only columns in Ref.vdf was fixed separately (#597, closed), and the intermediate gf(Time) lowering was replaced by the static-table rule (#606, closed).
EXPECTED_VDF_RESIDUAL lists none of these variables any more.

Pointers

Activity

  1. added
    bug
    engine
    on May 20, 2026
  2. bpowers commented on May 20, 2026

    @bpowers
    OwnerAuthor

    The full residual measurement methodology + the three-measurement histogram progression (baseline 28% genuine-divergence → post-GF-fix 3.27% → post-comparator 3.12%, across 873,982 matched cells) — i.e. the quantitative investigation context for this 0+0 cluster and all the residual clusters — is recorded in a comment on the companion umbrella issue #591. This 0+0 cluster is the dominant portion of that 3.12% genuine residual (rel = 1.0, whole variables zeroed).

  3. bpowers commented on May 20, 2026

    @bpowers
    OwnerAuthor

    Exact EXPECTED_VDF_RESIDUAL membership (measured on clearn-hero-model, un-stubbed simulates_clearn)

    The exact exhaustive exclusion set is now baked into EXPECTED_VDF_RESIDUAL in src/simlin-engine/tests/simulate.rs. This 0+0 data/graph-lookup-import cluster accounts for 17 of the 32 excluded bases:

    global_emissions_from_graph_lookup, ref_global_emissions_from_graph_lookup, historical_forestry_lookup, historical_gdp_lookup, oc,_bc,_and_bio_aerosol_forcings, other_forcings_composite_plus_rcp85, other_forcings_smooth_plus_rcp85, ozone_precursor_forcings, rs_ch4, rs_hfc125, rs_hfc134a, rs_hfc143a, rs_hfc152a, rs_hfc227ea, rs_hfc23, rs_hfc245ca, rs_hfc32.

    These are exactly the variables named in the issue body (the 0+0 whole-variable-zeroed cluster, relative error 1.0). Note: the BARE historical_gdp (without _lookup) is NOT in this cluster -- it imports fine and its only divergence is -2*NA NA-arithmetic cells, so it is attributed to #591 cluster 1 instead. The remaining 15 of 32 excluded bases are #591's SAMPLE UNTIL / NA-arithmetic / numeric-tail clusters.

  4. bpowers commented on May 20, 2026

    @bpowers
    OwnerAuthor

    Disposition: the engine 0+0 zeroing is FIXED; the residual is now a VDF-reader artifact (tracked in #597)

    Closing-recommendation. The engine bug this issue describes (graph-lookup / lookup-only variables importing as a literal 0+0 stub, so the whole variable runs at 0) is resolved.

    What was fixed

    • Phase 1 (commit 45596177): a lookup-only variable now lowers to gf(Time) (the graphical function applied to Time) instead of the 0+0 stub. The engine's output for every affected base now matches the model's tables byte-for-byte, and every applied consumer of these variables matches Ref.vdf exactly.

    So candidate (a) in this issue ("MDL-import / lowering bug dropping a lookup to 0+0") was the real defect, and it is fixed. Candidate (b) ("genuine missing external data") does not apply -- the data is inline graphical-function tables, not external data.

    Why these bases still appear in EXPECTED_VDF_RESIDUAL

    The remaining divergence for these same bases is not an engine bug. It is a reference-side decode artifact: our Ref.vdf reader mis-decodes the standalone graphical-function ("lookup-only") descriptor columns (the engine value is correct; the reference column we read is wrong). This is now tracked precisely in #597, which supersedes this issue's "engine 0+0" framing:

    • The scalar half of the reader decode was fixed in commit d69754bc (standalone_descriptor_rebinds, proven byte-exact for global_emissions_from_graph_lookup -> OT 1612, which has dropped out of the carve-out).
    • The arrayed half (13 bases: historical_forestry_lookup, historical_gdp_lookup, rs_ch4, rs_co2_ff, rs_gdp_in_trillions, rs_hfc125, rs_hfc134a, rs_hfc143a, rs_hfc152a, rs_hfc227ea, rs_hfc23, rs_hfc245ca, rs_hfc32) plus 4 scalar no-distinct-column cases (ref_global_emissions_from_graph_lookup, ozone_precursor_forcings, oc,_bc,_and_bio_aerosol_forcings, other_forcings_smooth_plus_rcp85) are tracked in engine: VDF reader mis-decodes arrayed standalone graphical-function ("lookup-only") descriptor columns (Ref.vdf) #597.

    Recommendation

    The engine correctness bug is resolved -- recommend closing this issue and letting #597 carry the reference-reader decode work. (Filing this as a comment rather than auto-closing so a human can confirm the disposition.) These 17 bases remain in tests/simulate.rs::EXPECTED_VDF_RESIDUAL as documented VDF-decode-artifact carve-outs, each with a one-line sourced reason, guarded for exactness by clearn_residual_exactness.

  5. changed the title [-]engine: C-LEARN data/graph-lookup variables import as 0+0 (zeroed) instead of their lookup/data values[/-] [+]mdl: C-LEARN lookup-only variables simulate as zero[/+] on Oct 12, 2026
  6. added
    compat
    on Oct 12, 2026
  7. bpowers commented on Oct 12, 2026

    @bpowers
    OwnerAuthor

    Closing: already fixed on main.

    A lookup-only variable is now a static table with no series, and a bare reference is LookupReferencedWithoutArgument (src/simlin-engine/src/db/var_fragment.rs:788; tests in src/simlin-engine/src/lookup_only_tests.rs). EXPECTED_VDF_RESIDUAL (src/simlin-engine/tests/integration/simulate.rs:3925) has no lookup-only entries, and simulates_clearn plus clearn_residual_exactness run by default, so the variables that call these tables are held to the 1% gate against Ref.vdf.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcompatengine

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions