Replace old XTS Utility calls

Replace old XTS Utility calls 1:

As the structure of the XTS objects in the project has changed fundamentally during the conversion, the structure of the XTS Utility has also been changed. In the new configuration the old calls of the function blocks FB_XtsUnit and FB_XtsVisuDiag do not work correctly anymore.

Because the ADS read commands and write commands refer to other object IDs in the background, it is not possible to read data from or write data to the XtsIoDriver object. The XtsUnit structure does not allow access to the data of the corresponding XTS objects, such as the Module CoE data.

Each XTS Utility call to the PLC must be checked and replaced with a new function to obtain the desired values. It is necessary to find all the places where the old XtsUnit structure was used and determine the values that were written or read there.

Many of the old calls to the XtsUnit structure can be replaced with the XTS Environment structure method.

A basic example of what needs to be changed in the structure is the procedure for Mover ID detection:


//MoverId Functionality
//check whether the position detection of the Movers has been completed.
IF fbXtsUnit.stXtsUnit.stTcIoXtsDrv.stParameter.bAreAllMoverPositionsValid THEN

    //Check if “MoverIdDetectionMode” has been activated under the XtsIoDriver object
    IF fbXtsUnit.stXtsUnit.stTcIoXtsDrv.stParameter.eMoverIdDetectionMode = ­E_MoverIdDetectionMode.Mover1
        //and that we are not running in simulation.
        AND NOT bSimulation
        THEN
            //Check whether the “MoverIdDetection” has already been started or the Mover1 was found.
            IF NOT (bMoverIdDetectionStarted OR bMoverIdDetected)
            THEN
                //Trigger the “MoverIdDetection”.
                fbXtsUnit.stXtsUnit.stTcIoXtsDrv.ipTcXtsIo.TriggerMoverIdDetection();
                // “bMoverIdDetectionStarted” is set to “True” after a single initiation.
                bMoverIdDetectionStarted := TRUE;
            END_IF

//Check for error or success of “MoverIdDetection”.
bMoverIdDetectionError := fbXtsUnit.stXtsUnit.stTcIoXtsDrv.stParameter.bHasMoverIdDetectionError;
bMoverIdDetected := fbXtsUnit.stXtsUnit.stTcIoXtsDrv.stParameter.bIsMoverIdDetectionValid;

//Do not process any further until the “MoverId” was detected.
IF NOT bMoverIdDetected THEN
RETURN;
END_IF
// If the “MoverIdDetection” was not activated in the XtsIoDriver object or running in simulation,
// then the activation of the “MoverIdDetection” and the search of Moer1 is skipped.
ELSE
;
END_IF

//If not all Mover positions are valid, do not process any further.
ELSE
RETURN;
END_IF
Replace old XTS Utility calls 2:
Replace old XTS Utility calls 3:

In the old configuration, some calls to the Mover ID detection got the information of the XtsIoDriver object using the XtsUnit structure:

Replace old XTS Utility calls 4:

Since the XtsIoDriver object is not present in the new configuration, the calls must be adapted so that the XtsEnvironment structure provides the information of the XtsProcessingUnit object for the calls:

Replace old XTS Utility calls 5:

In this way, many of the calls can be replaced. It should be noted that the XtsEnvironment structure differs from the old XTS structure in terms of initialization and collection of cycle data. Further information can be found in chapter Add library.

Once all XtsUnit calls have been removed from the project, the configuration can be activated.