Run an ASCMO Script

An *.ascmoScript file is a plain text file. Each line contains one ASCMO interface command. Use a script when you want to define the complete workflow with ASCMO interface commands, for example data import, model setup, optimization, and project export. For a complete list of available interface commands, see the ASCMO Interface Documentation.

Safety Advice in Non-Interactive Runs

The container runs without a graphical user interface. Therefore, ASCMO cannot display the safety advice interactively.

All start calls, for example mocastart, must include the following argument:

'acknowledgeSafetyAdvice'

By using this argument, you acknowledge the ASCMO safety advice programmatically.

Example Script

This example shows the command structure only. Adapt the commands, variable names, units, and file paths to your project.

Copy
id = mocastart('new', 'silent', 'acknowledgeSafetyAdvice');
importMocaData(id, rand(100, 3), {'X1', 'X2', 'Y1'}, {'N', 's', 'N/s'}, 'Dataset1', 1);
addParameter(id, 'a', 'Scalar', [0 10]);
addNode(id, '5 .* %X1% .* %a%', 'YOut', 'N/s');
setOptimizationCriteria(id, 'YOut', 'X1');
optimizeMoca(id);
saveMocaProject(id, '/data/result.moca');

Prepare the Script Folder

  1. Create a folder on the host machine.

  2. Copy the *.ascmoScript file into this folder.

  3. Copy all input files required by the script into the same folder or into the required relative subfolders.

  4. In the script, use container-side paths such as /data/....

Start the Script

Run the container with the script folder mounted to /data:

Copy
docker run --rm -t \
    -e LICENSE_USER=<your_user_name> \
    --mount type=bind,source=/path/to/script_folder,target=/data \
    --mount type=bind,source=/path/to/network.lic,target=/license/network.lic,readonly \
    ascmo_image script /data/my_workflow.ascmoScript

Note  

File paths used inside the script must reference the container-side path, not the host path. In the examples in this section, the mounted folder is available inside the container as /data, so script paths must use /data/....