Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Altair SimLab Tutorials

Tutorials > Automation

SL-R930[WIN]: Script Execution in Batch Mode


SL-R915, SL-R925 > SL-R930

 This tutorial is based on the parametric macros created in SL-R925 (or SL-R915), but you can use any other
SimLab macro of your choice, with or without parameters.

In this lesson you will learn to:

 Execute a script in batch mode, using a *.bat file or in a console window.

The command to execute a JavaScript or a Python script in batch for a Windows-environment is:

SimLab.bat –auto d:\script.js -param d:\Param.xml

where:
 "-auto" (or) "-sp" specifies the name of the session file (i.e., the script).
 "-param" specifies the name of the SimLab parameter file. The parameter file may be a link to an xml or csv
file. You can also specify directly the parameters:
-param ModelName=Sample.gda -param MeshSize=4.

Additional field to add in case of DOEs:


 "-doe" specifies the name of the design of experiment file.

Other optional fields:


 "-nographics" with this option the script will run SimLab as a service with no graphics window.
 "-nowait" to prompt the next command in the console window (DOS window) without waiting for the full
session to be completed.

This command can by typed in a DOS window or included in a *.bat file to be executed.

Step1: Create a *.bat file

1. Use your text editor to create a new *.bat file. Save it in a location of your choice, for example as
R9_Batch.bat
2. Copy-paste following lines:

SET CAE_HOME=D:\AltairHyperWorks2017\SimLab2017

SET PROJECT_DIR=D:\SimLab_Tutorials\_Models\R9_Conrod_Automation\Project

%CAE_HOME%\SimLab.bat -auto %PROJECT_DIR%\R920_Conrod_Process_Templates.js -param


%PROJECT_DIR%\R925_Parameters.xml –nographics

© 2017 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.
Altair SimLab Tutorials

3. Edit the value of the variable CAE_HOME to match the installation folder of SimLab. The path must lead to
the folder containing directly the file SimLab.bat.
4. Edit the value of PROJECT_DIR with the path of the folder containing your script and parameter file.
5. Save the *.bat file.

Step2: Execute the macro.

1. Edit the file containing the parameters (R925_Parameters.xml) typing the values of the parameters you want
to use.
2. Double click the R9_Batch.bat file to run the process.
3. Once the process is finished, the results will be stored in the Output folder defined in the process.

For Linux:

In order to run the batch process in Linux, for example in a console window, use the command Simlab.sh like in
the example below.

© 2017 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.

You might also like