[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: switch off error message in batch



Griet,

I use Trnsys in batch mode within a genetic algorithm model.
As a genetic algorithm produces input values in a rather random way, this results something in an invalid deck-file, which results in the error message:
one error was found in the deck file
check the listing file for more information
... Is there a way to switch-off this error message, eventually with adding a kind of counter to check afterwards how many times or when it occured?
At this moment the switch-off is for me the most important issue, the counter is of minor importance.
It is not possible to avoid that in TRNSYS 15. We will think about adding that functionality to TRNSYS 16.

In the meantime, I propose to use a workaround: by changing your batch file, you can either kill TRNSYS instances that are displaying the error message, or start other instances without waiting for the previous one to terminate.

The principle is as follows:
- Start a first TRNSYS instance to run your 1st deck file. TRNSYS
must be started as a separate process using the START command
- Wait N seconds. N should be an estimate of the maximum time
required to run a simulation
- Launch another TRNSYS instance to run the 2nd deck file
AND POSSIBLY kill the first instance
- Etc.

Examples: I assume your simulations never take more than 150 sec to run. I also assume that the simulations do not use the same output or building files (because you would have problems with one TRNSYS instance locking the files)

Example batch file (Windows XP batch file)

start C:\Trnsys15\trnsys.exe "C:\PathToFile\DeckFile1.dck" /n
sleep 150
start C:\Trnsys15\trnsys.exe "C:\PathToFile\DeckFile2.dck" /n
sleep 150
start C:\Trnsys15\trnsys.exe "C:\PathToFile\DeckFile3.dck" /n
sleep 150
ETC.

At the end of the batch run, all the TRNSYS instances that gave errors will remain open. If a simulation takes longer than 150 sec to run, the batch file will launch another one in parallel. That should be OK if it only happens occasionally.

Other example (Windows XP batch file):

start C:\Trnsys15\trnsys.exe "C:\PathToFile\DeckFile1.dck" /n
sleep 150
taskkill /im trnsys.exe /F
start C:\Trnsys15\trnsys.exe "C:\PathToFile\DeckFile2.dck" /n
sleep 150
taskkill /im trnsys.exe /F
start C:\Trnsys15\trnsys.exe "C:\PathToFile\DeckFile3.dck" /n
sleep 150
taskkill /im trnsys.exe /F

At the end of the batch run, all TRNSYS windows will be closed. If a simulation takes longer than 150 sec to run, it will get killed (so you will not have complete results for that run).


I am sure there are better ways to achieve the same result, but at least it should get you started.

Good luck,

Michaël Kummert

PS. The examples here above use command line instructions available in Windows XP. If you are using another windows version, you will have to find the equivalent commands or use utility programs. In particular, taskkill does not exist in previous Windows versions but an equivalent program is available free of charge from System Internals: http://www.sysinternals.com/ntw2k/freeware/pskill.shtml


--
_________________________________________________________

Michaël Kummert

Solar Energy Laboratory - University of Wisconsin-Madison
1303 Engr Res Bldg, 1500 Engineering Drive
Madison, WI 53706

Tel: +1 (608) 263-1589
Fax: +1 (608) 262-8464
E-mail: kummert@engr.wisc.edu

SEL Web Site: http://sel.me.wisc.edu
TRNSYS Web Site: http://sel.me.wisc.edu/trnsys