Skip to content

mdl: one apply-to-all equation imports as N per-element equations #651

Closed

Description

@bpowers

The MDL importer turned every subscripted equation into one equation per element, even when the Vensim source has a single apply-to-all equation.
It should import a single apply-to-all equation as one apply-to-all equation.

Example

C-LEARN v77:

Atm conc CO2[scenario] = C in Atmosphere[scenario] * ppm CO2 per GtonC

imported as three per-element equations (Deterministic, High_2xCO2_sensitivity, Low_2xCO2_sensitivity), each with the same text.
Most of C-LEARN's auxiliaries were affected.

Why it matters

The model held 3 to 12 times more equations than its source, pysimlin showed these variables with an empty equation, and LTM built per-element link scores where one apply-to-all score would do, a large part of C-LEARN's LTM size (#647).

Status

The importer now collapses the slots back into one apply-to-all equation when they come from one source equation with no :EXCEPT:, no external data, no per-element initial value or graphical function, and cover every element (slots_are_one_apply_to_all).
A variable defined by several equations over subranges, like C-LEARN's Heat Transfer[scenario, layer1] and [scenario, lower], still imports per element; the datamodel has no form for "one equation per subrange".

Pointers

  • src/simlin-engine/src/mdl/convert/variables.rs: slots_are_one_apply_to_all
  • src/simlin-engine/src/mdl/convert/apply_to_all_tests.rs

Activity

  1. added
    bug
    engine
    on Jun 1, 2026
  2. changed the title [-]mdl: importer expands single apply-to-all Vensim equations into N identical per-element equations[/-] [+]mdl: one apply-to-all equation imports as N per-element equations[/+] on Oct 12, 2026
  3. bpowers commented on Oct 12, 2026

    @bpowers
    OwnerAuthor

    Closing: already fixed on main.

    The importer collapses slots from one source equation back into Equation::ApplyToAll via slots_are_one_apply_to_all (src/simlin-engine/src/mdl/convert/variables.rs:376, gate at :794). Pinned in src/simlin-engine/src/mdl/convert/apply_to_all_tests.rs (an_ordinary_apply_to_all_equation_stays_one_equation at :121, plus rows for each case that must stay arrayed).

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

    bugengine

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions