You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
mdl: saving an arrayed GET DIRECT variable drops the GET DIRECT call #393
Saving to MDL an arrayed variable that was read from GET DIRECT CONSTANTS, GET DIRECT DATA or GET DIRECT LOOKUPS writes one equation per element with the values, not the original call.
The saved file no longer reads from the spreadsheet; it should write the call back.
Example
b[DimB] = GET DIRECT CONSTANTS('data/a.csv', ',', 'B2') ~~|
Expected after a save: the same call.
Actual: b[b1] = ..., b[b2] = ..., one equation per element holding what the import resolved for it.
A scalar or apply-to-all variable already writes the call back; only the arrayed path ignores the recorded source.
Why it matters
Models that keep their data in spreadsheets (sdeverywhere directconst, directdata, directlookups; the get_* tests in test/test-models) lose the link to their data on save; editing the spreadsheet no longer changes the model.
Fix
The importer records the source in compat.data_source, but takes it from the first equation that has one, so it cannot tell whether one call covered the whole variable. test/test-models/tests/get_mixed_definitions defines one variable from two different GET DIRECT calls plus a number list; writing a single call back there would be wrong.
Record the source only when one GET DIRECT equation defines the whole variable, and have the arrayed writer write that one equation when it is present.
Pointers
src/simlin-engine/src/mdl/writer.rs: compat_get_direct_equation, and the Equation::Arrayed arm that passes compat to writer_arrayed.rs
src/simlin-engine/src/mdl/convert/variables.rs: where data_source is extracted for arrayed variables (around line 822)
changed the title [-]MDL writer does not reconstruct GET DIRECT calls for arrayed variables[/-][+]mdl: saving an arrayed GET DIRECT variable drops the GET DIRECT call[/+]on Oct 12, 2026
Activity
[-]MDL writer does not reconstruct GET DIRECT calls for arrayed variables[/-][+]mdl: saving an arrayed GET DIRECT variable drops the GET DIRECT call[/+]