Some SIMULATE commands only record a setting, which Vensim applies when the run starts. Others act on the model's working values the moment they run, and two of those reset the working values first. Order matters for the second kind and not for the first.
The reset is the trap. SIMULATE>BASED and SIMULATE>READCIN each discard the changes made before them, so a script that sets values and then names a Based On run loses the values.
Command
Kind
What it does
SIMULATE>RESUME|n|t
Setting
Records the resume switch and the optional resume time. Must come before BASED, because BASED reads the dataset immediately and consults these two values at that moment. If RESUME comes afterwards, BASED has already read end-of-run values and nothing re-reads them.
SIMULATE>BASED|oldrun
Action
Resets the working values to the model's own, then reads the Constants, Lookups and - when resuming - the Levels out of oldrun. Any earlier READCIN, ADDCIN, SETVAL or READRUNCHG edits are discarded. Put it first.
SIMULATE>READRUNCHG|oldrun
Action
The same handler as BASED, and the same reset.
SIMULATE>READCIN|file
Action
Resets the working values to the model's own, then applies file. Discards earlier SETVAL and READCIN edits, so only the last READCIN in a sequence survives.
SIMULATE>ADDCIN|file
Action
Applies file on top of whatever is already set, with no reset. Use this to layer a second changes file onto a READCIN or a BASED.
SIMULATE>SETVAL|var=value
Action
Changes one Constant or Lookup, with no reset. Later SETVALs for the same variable win.
SIMULATE>CHGFILE|files
Setting
Records a comma-separated list of changes files, applied when the simulation starts. Order relative to the action commands does not matter. Where two listed files change the same variable, the last file listed wins.
SIMULATE>DATA|files
Setting
Records the list of data files. Applied when the simulation starts.
So the working order is: RESUME, then BASED, then READCIN, then ADDCIN and SETVAL, then RUNNAME and MENU>RUN. Settings such as CHGFILE and DATA can go anywhere before the run.
A command script run with the -log flag records each command as it executes, which is the quickest way to see what a sequence actually did.