Prescan Runner is a plugin for OpenSBT to apply search-based testing to a Simulink-based system simulated in Prescan.
This plugin is compatible with Python 3.8/3.7. Installation has been tested with Windows 10/11 and Prescan 2021.3.0.
The easiest way to get the Prescan Runner up and running is to build it as a Python package and install it.
To build the package, run python -m build
in the repository's root directory (npms build package has to be installed before). Once completed, install the *.whl package found in the newly created dist
folder via python -m pip install /path/to/the/package.whl
The current implementation of Prescan Runner requires that following is assured:
- The scenario is parametrized using an
input.json
file. - A
ChangeModel.m
script is provided to update the.pb
experiment file using a file calledinput.json file
. - The simulink model contains blocks to write traces of actors of interest into
trace_online.csv
. The format of the output can be adapted here. - The prescan experiment has been compiled, i.e. simulation is triggered via running an executable. The name of the executable can be set here.
Execute the following steps before running experiments with OpenSBT:
(Note, that step 1 is only required once.)
-
Import the matlab engine into OpenSBT:
cd MATLAB_DIR/extern/engines/python py -3.8 setup.py install --prefix="C:\Path\To\Project\venv"
Further description/options are available here.
-
Start MATLAB via the Prescan Process Manager.
-
Share the MATLAB engine to be accessable by OpenSBT by executing from the MATLAB terminal:
matlab.engine.shareEngine
-
Make sure all files have been added to the MATLAB path which a required for executing the simulink SUT, as done in this example startup script.