Configuring the server from the PLC client

Calling the method configure instantiates a session for the respective instance of the function block FB_MlSvrPrediction in the TcMlServer. The configuration defined in the FB member stPredictionParameter is used for instantiation. As a rule, each instance of FB_MlSvrPrediction is assigned its own session on the server. However, sessions can also be used together via the parameter bExclusiveSession.

During the configuration call, the following is defined in particular:

Each session that is opened allocates resources on the Server Device. The number of parallel sessions is not limited on the software side, but is restricted solely by the available hardware resources. If there is not enough memory (RAM or vRAM) available to open another session, the Configure command will fail.

The deconfigure method can be used to close a session and thus release the resources.

If a client does not send a request to the server for a defined period of time, the so-called session time-out period, the server assumes that the client is no longer active. The session is automatically closed when the configured session timeout is reached.

Sample

Declaration

fbMlSvr : FB_MlSvrPrediction();

Code

// configure session paramaters
fbMlSvr.stPredictionParameter.sMlModelFilePath := 'C:\mdl\lemon_model.json';
fbMlSvr.stPredictionParameter.sMlSvrNetId := '127.0.0.1.1.1';
fbMlSVr.stPredictionParameter.eExecutionProvider := E_ExecutionProvider.CPU;

// Submit configuration request to the TcMlServer
// Provide a generous nTimeout, as the configuration can take a substantial amount of time
IF fbMlSvr.Configure(nTimeout := 1000, nPriority:=0) THEN
// check for error 
// change state
END_IF;