Problem with a COMMAND file that stopped working

Use this forum to post Vensim related questions.
Post Reply
John Swanson
Member
Posts: 23
Joined: Mon Jan 10, 2005 12:39 pm

Problem with a COMMAND file that stopped working

Post 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
Administrator
Super Administrator
Posts: 4573
Joined: Wed Mar 05, 2003 3:10 am

Re: Problem with a COMMAND file that stopped working

Post by Administrator »

What is the exact error message are you getting?
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
John Swanson
Member
Posts: 23
Joined: Mon Jan 10, 2005 12:39 pm

Re: Problem with a COMMAND file that stopped working

Post by John Swanson »

There are no messages. Nothing happens, after the parsing message.
Administrator
Super Administrator
Posts: 4573
Joined: Wed Mar 05, 2003 3:10 am

Re: Problem with a COMMAND file that stopped working

Post by Administrator »

What is the parsing message?
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
John Swanson
Member
Posts: 23
Joined: Mon Jan 10, 2005 12:39 pm

Re: Problem with a COMMAND file that stopped working

Post by John Swanson »

It says 'Parsed OK. Analysing the equations.' Then nothing more happens. The model remains loaded and open.
John Swanson
Member
Posts: 23
Joined: Mon Jan 10, 2005 12:39 pm

Re: Problem with a COMMAND file that stopped working

Post 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.
John Swanson
Member
Posts: 23
Joined: Mon Jan 10, 2005 12:39 pm

Re: Problem with a COMMAND file that stopped working

Post 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.
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: Problem with a COMMAND file that stopped working

Post 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.
John Swanson
Member
Posts: 23
Joined: Mon Jan 10, 2005 12:39 pm

Re: Problem with a COMMAND file that stopped working

Post 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!
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: Problem with a COMMAND file that stopped working

Post 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
John Swanson
Member
Posts: 23
Joined: Mon Jan 10, 2005 12:39 pm

Re: Problem with a COMMAND file that stopped working

Post 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.
Administrator
Super Administrator
Posts: 4573
Joined: Wed Mar 05, 2003 3:10 am

Re: Problem with a COMMAND file that stopped working

Post by Administrator »

Can you see anything in the Vensim warnings window?
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
John Swanson
Member
Posts: 23
Joined: Mon Jan 10, 2005 12:39 pm

Re: Problem with a COMMAND file that stopped working

Post by John Swanson »

No, the warnings window doesn't open. There's nothing. No message boxes hidden behind the main view, etc.
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: Problem with a COMMAND file that stopped working

Post 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.
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: Problem with a COMMAND file that stopped working

Post 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.
John Swanson
Member
Posts: 23
Joined: Mon Jan 10, 2005 12:39 pm

Re: Problem with a COMMAND file that stopped working

Post 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.
John Swanson
Member
Posts: 23
Joined: Mon Jan 10, 2005 12:39 pm

Re: Problem with a COMMAND file that stopped working

Post by John Swanson »

It's resolved. I installed a newer version, V8.1.2, and it all works. Quite a relief.
Post Reply