Skip to content

engine: C-LEARN data/graph-lookup variables import as 0+0 (zeroed) instead of their lookup/data values #590

@bpowers

Description

@bpowers

Summary

A cluster of C-LEARN graphical-function / lookup / data-table-backed series import into the engine with a literal 0+0 equation (or per-element 0+0 | 0+0 | ... for arrayed vars) while the genuine-Vensim reference output (test/xmutil_test_models/Ref.vdf) carries substantial real values. The whole variable is therefore zeroed at runtime. This is the dominant residual cluster in the post-element-cycle-resolution C-LEARN numeric reconciliation (relative error = 1.0 -- entire variables sit at 0 vs real Vensim values).

Discovered during the C-LEARN hero-model work (branch clearn-hero-model, HEAD 8775ae97) after C-LEARN began compiling, running to FINAL TIME, and matching Ref.vdf within 1% on 96.3% of matched cells (following the per-element-GF mapping fix #589 / commit 61573545, and a :NA:-aware + near-zero-robust comparator in ensure_vdf_results). The decision was made to bank the 96.3% and track the residual rather than investigate now: these variables are excluded from the simulates_clearn gate via the documented EXPECTED_VDF_RESIDUAL exclusion constant, so the test passes on the reconciled set. This issue is the tracking item for the largest residual cluster.

Affected variables (representative, not exhaustive)

All from test/xmutil_test_models/C-LEARN v77 for Vensim.mdl. Their imported datamodel equation is literally 0+0 (or 0+0 | 0+0 | ... per element) while Ref.vdf has real values:

  • historical_gdp_lookup -- e.g. [cop_developing_b] Vensim = 1.487e5, Simlin = 0
  • historical_forestry_lookup
  • global_emissions_from_graph_lookup
  • ref_global_emissions_from_graph_lookup
  • rs_ch4
  • rs_hfc125, rs_hfc134a, rs_hfc143a, rs_hfc152a, rs_hfc227ea, rs_hfc23, rs_hfc245ca, rs_hfc32
  • other_forcings_smooth_plus_rcp85
  • other_forcings_composite_plus_rcp85
  • ozone_precursor_forcings
  • oc,_bc,_and_bio_aerosol_forcings

These are graphical-function / lookup / data-table-backed series.

Two candidate root causes (not yet determined)

The user chose to track rather than investigate, so the root cause is open. Two candidates:

(a) MDL-import / lowering bug -- a lookup / WITH LOOKUP / graphical-function or GET ...-style data construct is dropped to a 0+0 stub on import. If so, this is a genuine importer defect that silently zeroes real series.

(b) Genuine external-data dependency -- C-LEARN needs external data that is not present, in which case those series cannot match without the data and the 0+0 import may be the correct degradation (no fix to the importer is warranted, only documentation of the missing-data requirement).

The follow-up should determine which by inspecting one representative variable's (historical_gdp_lookup) MDL source in test/xmutil_test_models/C-LEARN v77 for Vensim.mdl and tracing how the importer (src/simlin-engine/src/mdl/) converts it to the 0+0 stub.

Why it matters

  • Correctness: if (a), real lookup/data series are silently zeroed on import with no diagnostic -- wrong simulation output cascading through any downstream variable, no crash. This is the single largest source of C-LEARN's divergence from the Vensim reference.
  • Diagnosability: a 0+0 stub is indistinguishable at runtime from a legitimately-zero variable; the degradation is invisible without comparing against reference output.

Components affected

  • src/simlin-engine/src/mdl/ -- convert/, reader, and the lookup / data-equation handling that emits the 0+0 stub.
  • Test fixtures: test/xmutil_test_models/C-LEARN v77 for Vensim.mdl, test/xmutil_test_models/Ref.vdf
  • src/simlin-engine/tests/simulate.rs -- simulates_clearn (these vars live in its EXPECTED_VDF_RESIDUAL exclusion const)

Discovery context

Identified during the C-LEARN hero-model element-cycle-resolution work (branch clearn-hero-model, HEAD 8775ae97), element-cycle-resolution AC8.1. These variables are excluded from the simulates_clearn gate and tracked here.

Relationship to existing issues (all DISTINCT)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingengineIssues with the rust-based simulation engine

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions