File management of the ML description files

File management on the Engineering PC (XAE)

Conversion, editing of ONNX, XML and BML

The Machine Learning Model Manager serves as a central tool for the processing and conversion of Machine Learning models. If a file is loaded and edited, the resulting file is saved in the standard case in the following folders – depending on the action performed:

Each default folder can be adapted in the Model Manager.

If the Machine Learning Toolbox is used instead of the GUI-based Machine Learning Model Manager, the newly created file is stored in the active path as long as no other path has been specifically named.

Integrating a model into a TwinCAT solution

If a BML or XML description file is used in a TwinCAT solution, a distinction must be made between TcCOM API and the PLC API with regard to the file management.

TcCOM API

After the integration of a description file in the TcCOM TcMachineLearningModelCycal, the corresponding description file is copied into the Visual Studio project directory and is thus part of the project: <VS Projekt>\_MLInstall.

On activating the configuration, the file is copied from the Visual Studio project directory into the boot folder on the target system: \TwinCAT\3.1\Boot\ML_Boot.

PLC API

When using the PLC API, the file name and path of the Machine Learning model file are specified in the PLC code as T_MaxString – accordingly, the user must ensure that a corresponding file exists coming from the target system. This means that the description file does not become part of the Visual Studio project directory, nor is it transferred automatically to the target system.

Transfer of the ML description files to the target system on activating the configuration

TcCOM API

When using the TcCOM object TcMachineLearningModelCycal, the ML description file is transferred automatically from the XAE system to the XAR system.

The file is transferred from the Visual Studio project folder <VS Project>\_MLInstall to the Boot folder TwinCAT\3.1\Boot\ML_Boot on the XAR.

PLC API

If the PLC API is used, the user is responsible for the transfer of the ML description file. As a result, the flexibility of the application is increased on the one hand, while corresponding steps have to be implemented by the user on the other.

The ML description file can be transferred to the target system in many ways. One of them is named below by way of example.

File management of the ML description files 1:

Notice

Writing rights on the target system

The writing rights on the operating system side and the Write Filter settings must be observed.

Updating ML description files in the field

An important scenario in machine learning is the updating of data-based algorithms in the field during the running time of a machine. Here too, distinction must be made between use of the TcCOM API and use of the PLC API.

TcCOM API

In the case of the TcCOM API, the update behavior is the same as with other changes in the TcCOM area. An XAE system is necessary with an ADS route to the target system. In the XAE, a new ML description file can be integrated in the TwinCAT project. The new project is then transferred to the target system by activating the configuration. Therefore, it is necessary to restart the TwinCAT runtime here.

PLC API

If the PLC API is used, it is possible to update the ML description file on the target system without restarting the TwinCAT runtime. To do this it is merely necessary to update the ML description file on the target system and to retrigger the Configure method.

In addition, for example using ADS, you can set the PLC variable containing the full path of the ML description file to the value of the new file that was transferred beforehand to the file system and then set the state of the state machine back to "load".