Page 1 of 1

Problem with a COMMAND file that stopped working

Posted: Sun Nov 01, 2020 3:55 pm
by John Swanson
I set up a command file to batch run a sequence of model runs. It loads the model, uses ?alias to choose which input files to use, runs the model and exports to a TAB file.
I tested it with two sequential runs, and it was fine, so I stacked up 16 runs and ran it. It stopped after the first four. I progressively cut the .cmd file back to find the error, but now even the first one won't run. Here's the .cmd for one run:

SPECIAL>LOADMODEL|NSIM scenarios with crud file and alias names.mdl
SIMULATE>SPREADALIAS|?NSIM Do Minimum Schemes=NSIM Do Minimum Schemes.xlsm
SIMULATE>SPREADALIAS|?NSIM Inptdata=NSIM Inptdata.xlsm
SIMULATE>SPREADALIAS|?NSIM new land for growth=NSIM new land for growth NTEM plus.xlsx
SIMULATE>SPREADALIAS|?NSIM Scenario file=NSIM Scenario File Empty.xlsm
SIMULATE>SPREADALIAS|?NSIM Travel Time database=NSIM Travel Time database.xlsx
SIMULATE>RUNNAME|NSIM D1T1S1
MENU>RUN|O
MENU>VDF2TAB|NSIM D1T1S1.vdf|NSIM D1T1S1.tab|Export for reporting v2.lst
SPECIAL>CLEARRUNS

This used to work, but now it won't. I haven't changed the model or the files it uses.
I stripped it right down to this:
SPECIAL>LOADMODEL|NSIM scenarios with crud file and alias names.mdl
SIMULATE>RUNNAME|NSIM D1T1S1
MENU>RUN|O

It still doesn't run. The model loads, I get a message about parsing, and it stops.
I'm using Vensim 8.0 64 bit.
What's going wrong?
Thank you

Re: Problem with a COMMAND file that stopped working

Posted: Sun Nov 01, 2020 4:07 pm
by Administrator
What is the exact error message are you getting?

Re: Problem with a COMMAND file that stopped working

Posted: Sun Nov 01, 2020 5:31 pm
by John Swanson
There are no messages. Nothing happens, after the parsing message.

Re: Problem with a COMMAND file that stopped working

Posted: Sun Nov 01, 2020 5:41 pm
by Administrator
What is the parsing message?

Re: Problem with a COMMAND file that stopped working

Posted: Sun Nov 01, 2020 6:08 pm
by John Swanson
It says 'Parsed OK. Analysing the equations.' Then nothing more happens. The model remains loaded and open.

Re: Problem with a COMMAND file that stopped working

Posted: Sun Nov 01, 2020 6:13 pm
by John Swanson
By the way, I have a much smaller model that I used to test the cmd files before using them with the big model. This runs fine.

SPECIAL>LOADMODEL|check initial conditions.mdl
SIMULATE>SPREADALIAS|?Main data file=NSIM Inptdata.xlsm
SIMULATE>RUNNAME|check1
MENU>RUN|O
MENU>VDF2TAB|check1.vdf|check1.tab|checklist.lst
SPECIAL>LOADMODEL|check initial conditions.mdl
SIMULATE>SPREADALIAS|?Main data file=NSIM Inptdata version 1.xlsm
SIMULATE>SETVAL|Input value=4
SIMULATE>RUNNAME|check2
MENU>RUN|O
MENU>VDF2TAB|check2.vdf|check2.tab|checklist.lst

The main model is large, but it's been running happily for a long time under Windows Server 2019 Standard and still does, just not with a cmd.

Re: Problem with a COMMAND file that stopped working

Posted: Sun Nov 01, 2020 10:23 pm
by John Swanson
I might have found the cause. Missing value in a cell in one of the input spreadsheets. It seems to be running, after correcting that. My problem now is how that happened - the data value was there earlier. But it would be useful if Vensim generated an error message when that happens.

Re: Problem with a COMMAND file that stopped working

Posted: Mon Nov 02, 2020 4:59 pm
by tomfid
It sounds like there's an error message that's getting suppressed, that would normally be evident in a single (non-cmd) simulation.

The missing spreadsheet entry could potentially be avoided by using GET DIRECT access to the spreadsheet, so that Excel doesn't have to open to read values. However, if opening the spreadsheet for interactive changes is your purposes, that's obviously counterproductive.

Excel autosaving is now on by default, which is a possible risk, because it means that any inadvertent keystrokes are absorbed into your document.

Re: Problem with a COMMAND file that stopped working

Posted: Mon Nov 02, 2020 9:52 pm
by John Swanson
Thanks Tom. Yes, this would normally generate an error message in a single simulation. It would be helpful if Vensim didn't suppress it.
I'm using GET DIRECT already. It's faster and safer.
By the way, I can't see how to put comments in a cmd file. If anyone knows, please tell me!

Re: Problem with a COMMAND file that stopped working

Posted: Mon Nov 02, 2020 10:35 pm
by tomfid
OK, that's an easy one. Prefix the comment with !

Code: Select all

! Reproduce scenario runs

SIMULATE>RUNNAME|Base
MENU>RUN|o

! Scenario 1a

Re: Problem with a COMMAND file that stopped working

Posted: Tue Nov 03, 2020 1:06 pm
by John Swanson
Thank you for the ! (!)
Unfortunately the missing Excel data thing was a red herring. If I run the command file with 8 model runs in it, only 4 run and it stops. If I try again, having made no changes, it won't run at all. I tried deleting the vdf files it generated, but the result is the same - I get the parsing equations message, then it stops. No error messages, nothing.
This is now getting to a crunch time for me and I need some clues. What can be going wrong? What should I look for?

I'm using V8.0 64 bit on a remote virtual computer under Windows Server 2019 Standard (that's how our IT people do these things). I've got 10GB RAM and loads of empty disk space. I've tried closing and re-opening Vensim, and logging off the virtual PC and back on again, but it makes no difference.

Re: Problem with a COMMAND file that stopped working

Posted: Tue Nov 03, 2020 1:44 pm
by Administrator
Can you see anything in the Vensim warnings window?

Re: Problem with a COMMAND file that stopped working

Posted: Tue Nov 03, 2020 4:09 pm
by John Swanson
No, the warnings window doesn't open. There's nothing. No message boxes hidden behind the main view, etc.

Re: Problem with a COMMAND file that stopped working

Posted: Tue Nov 03, 2020 4:33 pm
by tomfid
Presumably Tools>Options>Settings>Warnings>Display is already on, though it's worth checking.

You could also check Windows>Error History. Both are long shots though.

Re: Problem with a COMMAND file that stopped working

Posted: Tue Nov 03, 2020 4:36 pm
by tomfid
One possible approach would be to divide the command script into a few subsets, perhaps breaking at the point where it stops. Run those independently and see what happens.

I assume you don't have SPECIAL>NOINTERACTION in your script header.

Re: Problem with a COMMAND file that stopped working

Posted: Tue Nov 03, 2020 10:34 pm
by John Swanson
Presumably Tools>Options>Settings>Warnings>Display is already on, though it's worth checking. - Yes, I checked and it's on.

You could also check Windows>Error History. Both are long shots though. - There's nothing there

I assume you don't have SPECIAL>NOINTERACTION in your script header. - Correct

I tried cutting the script right down. I took a longish script and cut it down until it was only three lines:
SPECIAL>LOADMODEL|NSIM scenarios with crud file and alias names.mdl
SIMULATE>RUNNAME|NSIM D1T1S1
MENU>RUN|O

It still wouldn't run. This was after the initial run worked. Something changes that causes it to stop working, but I can't see what it is and can't think how to detect it.
If I run the model one run at a time from the normal Vensim interface, it all works. But I have a lot of runs to stack up and that's too slow & risky.

Re: Problem with a COMMAND file that stopped working

Posted: Wed Nov 04, 2020 2:30 pm
by John Swanson
It's resolved. I installed a newer version, V8.1.2, and it all works. Quite a relief.