Repository navigation
Description
The engine refuses Vensim's DELAY FIXED (XMILE DELAY, a pipeline delay) with NotSimulatable.
It should support it: the output is the input exactly one delay time ago, and the initial value until then.
Example
receiving = DELAY FIXED(shipping, shipping time, shipping)
The variable is refused with "DELAY (Vensim's DELAY FIXED) delays its input by exactly the delay time, which is not supported yet".
Vensim's expected output is in test/sdeverywhere/models/delayfixed/delayfixed.dat (also delayfixed2, test/test-models/tests/delay_fixed, and Stella-side test/test-models/tests/delay_xmile).
Why it matters
Seen in real models: metasd bathtub-statistics/integration3.mdl, social-network-valuation/groupon 1-3.mdl and early-warnings-catastrophe/catastropeWarning2.mdl all use it.
Vensim's DELAY MATERIAL is the same kind of delay (used by thyroid-2008-d.mdl), and the engine does not recognize it at all.
Fix
Give each pipeline-delay instance a ring buffer in the VM holding the input for the last delay-time / DT steps, filled with the initial value at the start.
It needs opcodes to push the current input and read the oldest value, and the wasm backend must match.
Vensim rounds a delay time that is not a whole number of DTs (test/test-models/tests/delay_pipeline/README.md); copy that rounding and test it against the fixture.
Decide whether a delay time that changes during the run is allowed.
If supporting it adds much complexity, refuse it with a clear error.
DELAY MATERIAL can then be mapped onto the same machinery.
Pointers
src/simlin-engine/src/builtins_visitor.rs:rewrite_alias_module_call(the refusal)src/simlin-engine/tests/integration/simulate.rs:refuses_delayfixed_*(turn these into simulate tests)src/simlin-engine/src/vm.rs,src/simlin-engine/src/wasmgen/- engine: DELAY N and SMOOTH N reject any order other than literal 1 or 3 #562 (order-N
DELAY N; thyroid needs both)
Activity
engine: performance pass on compile, simulation, and the LTM path (#1021
[-]engine: DELAY FIXED ring-buffer semantics blocks 4 simulation tests[/-][+]engine: DELAY FIXED is refused instead of simulated[/+]