Predict()
The Predict method submits an asynchronous inference order to the TcMlServer.
The method expects the provision of input data according to the specification of the ONNX file, see Preparing ONNX for use with TwinCAT Machine Learning Server.
The provided pointer to the output data must be valid and point to an instance of the output data type according to the created PlcOpenXml. Once the asynchronous inference has been successfully completed, the data in the transferred output memory area is valid and released for further processing.
See also Execute AI model.
| Parameter | Type | Default | Description |
---|---|---|---|---|
INPUT | pDataIn | PVOID |
| Pointer to the instance of the input data type |
INPUT | nDataInSize | UDINT | 0 | Size of the input data type |
INPUT | pDataOut | PVOID |
| Pointer to the instance of an output data type |
INPUT | pDataOutSize | UDINT |
| Size of the output data type |
INPUT | nTimeout | ULINT |
| Number of PLC task cycles before the timeout error is returned. |
INPUT | nPriority | UDINT | 0 | Priority of the request. Bigger means higher priority. |
OUTPUT | Predict | BOOL |
| Return value. TRUE as soon as the result of the asynchronous call is available. The result of the call can then be checked using the 'bError' and 'nErrorCode' properties. |