Skip to main content

KnowledgeBase

Batch operation

Batch operation can be used to execute scripts on a fully automated basis. In batch operation, FVA-Workbench starts without the graphical interface, runs defined scripts in succession, saves calculation results, and closes.

batch_operation.png

Input and output files used in batch operation

Directory structure

batch_folder.png

Example batch job directory structure

  1. Batchfile (.cmd) Definition of start parameters for the FVA-Workbench.

  2. Jobdefinition (.wbj) Definition of the path for input and output files.

  3. Calculationscript (.wbjs) Script file with calculation commands.

  4. Gearmodel (.wbpz) FVA-Workbench project file that includes the model to be calculated.

  5. Logfile (.txt) File created while executing the batch that contains messages for troubleshooting.

Jobfile (.wbj)

The paths for the input and output files are defined in this file. Variables can also be defined which can be addressed later in the script. This way, variables can be managed centrally without having to make changes to the script.

Notice

Paths can be specified absolutely or relative to the directory where the .wbj or .cmd file is located.

[Control]
1InputDirectory = "input\"
2InputModel = transmission.wbpz
3InputScript1 = calculation_script.wbjs
4ErrorReport = "output\log.txt"

5[VariablesToInject]
6resultDirectory = "output\result_report.html"
7reportTemplate = "input\template.wbrep"
8InputTorque_to_inject = "500"

1

Directory for input files

2

Name of the FVA-Workbench project file

3

Name of the first script to be run

4

Directory and name of the log file

5

The following are all optional variables that can be used in the calculation script (.wbjs).

6

Injected path variable for the report (can be used in the .wbjs script file)

7

Injected path variable for a report template

8

Another example of an injected variable (torque)

Job list (.wbjlist)

Multiple .wbj files can be referenced in a .wbjlist file (job list). These are automatically executed in order when the .wbjlist is run. The FVA-Workbench is only started once. Optional variables can also be "injected" here, which can then be used by every script.

[Control]
job1=pathTo/jobFile.wbj
job2=pathToAnother/jobFile.wbj

[VariablesToInject]
InputTorque="500"

Calling a .wbjlist in the .cmd file works as follows: \FVA-Workbench.exe -WBJobList="WB-Job.wbjlist"

Script file (.wbjs)

The script file includes all instructions to manipulate the gear model. It is recommended to test the script in the FVA-Workbench Scripting Editor before running it in batch operation. The calculation will only be successful in batch operation if it also generates correct results when manually started within the FVA-Workbench.

Example - Script using injected variables (see .wbj file)

gearUnitID = 1;
forceID = 10;
let torque = torque_to_inject;
let reportTemplatePath = reportTemplate;
let reportPath = resultDirectory;

setAttr("scaled torque", forceID, torque, EDAT);
runCalcMethod("001_SYSTEM_CALCULATION", gearUnitID);
generateReport(reportTemplatePath, reportPath);

In the script, the torque of a load component is set to the value of an injected component and then a system calculation is run. Afterward, an HTML report is generated with the assistance of the injected path variable.

Gear model (.wbpz/.wbpx)

The FVA-Workbench model (.wbpz / .wbpx file) is the foundation for batch operation. It must be sufficiently detailed to be able to perform the desired calculations. The calculation will only be successful in batch operation if it also generates correct results when manually started within the FVA-Workbench.

The loadModel() function can be used to load, manipulate, and calculate other gear models during batch operation runtime.

Batch file (.cmd)

Multiple parameters for starting the FVA-Workbench can also be specified with the optional batch file. In theory, it is sufficient to create a text file which includes the path to FVA-Workbench.exe and a path to the job definition (.wbj).

C:\FVA\FVA-Workbench-6.0\FVA-Workbench.exe -WBJob="C:\WB_job\WB-Job.wbj"

Headless mode (does not show the startup splash screen)

C:\FVA\FVA-Workbench.exe -WBJob="C:\WB_job\WB-Job.wbj" -nosplash

License specified as a parameter

Parameters for Client License

C:\FVA\FVA-Workbench.exe -WBJob="C:\WB_job\WB-Job.wbj" -Lic="CLic;C:\Lizenzen\Lic12345.lic"

Parameters for Server License

C:\FVA\FVA-Workbench.exe -WBJob="C:\WB_job\WB-Job-Demo.wbj" -Lic="SLic;license.fva-service.de:5006;Li13270;username;password"

Notice

If the license specified via the parameter is not valid, an attempt is made to load the license specified in the FVA-Workbench settings.

Log file (.txt)

The ErrorReport variable, which specifies where the log file should be stored, is defined in the job file (.wbj). All notes, warnings, and errors that occur during execution are included here to simplify troubleshooting.

Example for a .log file

08.09.2020 10:57:32, start processing new job wb_job_demo.wbj

input directory: input
input model (file in input directory): transmission.wbpz
count of scripts: 1
input script 1 (file in input directory): CalculationScript.wbjs
variables to inject into the script context:
	ResultFilePath=output\result.txt
	TempDirectory=temp\
	InputTorque_to_inject=500
	OutputDirectory=output\
	HTML_TemplatePath=input\report_template.wbrep
	HTML_ResultFilePath=output\result.html
 
loading the model returns status: 0 ()

Example

A complete batch job is stored in the installation directory at: FVA-Workbench\plugins\de.fva.workbench.ui.intro_6.0.0\doc\batch_example. The file start _job.cmd starts the batch job.

The batch job performs the following actions:

  1. Sets the calculation switches for the system calculation.

  2. Sets the torque of the first load to 500 Nm (with the injected variable "InputTorque_to_inject").

  3. Runs the system calculation.

  4. Reads the result attributes (RDAT) of the "cylindrical_mesh" component (for all stages in the gear unit).

  5. Writes the result attributes to an ASCII text file.

  6. Reads the result attribute (RDAT) of the "notch" component (for all notches in the gear unit).

  7. Writes the result attributes to the ASCII text file.

  8. Generates an HTML Report.