EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers.

Convert Device

Overview

Converting devices within the project can become a complex procedure. This API simplifies the conversion process and helps to avoid errors.

Using the DeviceID Object

The conversion API uses the DeviceID object which identifies a device or a device module by a specific version. The DeviceID is created as follows:

<device type> <device model> <device version> <module name>

Element

Example

Description

device type

4096

identifies a controller

device model

1003 0082 or 1003 009D

for LMCx00C or LMCx01C, respectively

device version

1.50.0.4

firmware version of the controller

module name

LXM52

target device module

The conversion API accepts the DeviceID as object instance or as single parameter. This allows using a DeviceID containing all elements mentioned in the above table or passing each element as a single parameter.

The following example shows how to create a DeviceID for an LMCx00C controller with firmware version 1.50.0.4:

Lmcx00c = DeviceID(4096, "1003 0082", "1.50.0.4")

Testing Whether a Device Can be Converted

The following script allows you to verify whether a conversion to a given version is possible before converting a device.

from __future__ import print_function
 
def main():
    # Set the project as primary project
    proj = projects.primary
    controller = proj.find('LMC_PacDrive', True)[0]
    drives = controller.find('DRV_Lexium62', True)
 
    if len(drives) == 0:
        print("Expected drive object not found")
        return
 
    drive = drives[0]
 
    # test if controller can be converted using DeviceID
    x01c = DeviceID(4096, "1003 009D", "1.53.5.4")
    if controller.can_convert(x01c):
        print("Conversion to LMCx01C possible")
 
    # test if drive can be converted using Parameters and module id
    if drive.can_convert(4096, "1003 0082", "1.53.5.4", "LXM52"):
        print("Conversion to LXM52 possible")
 
 
if not projects.primary:
    print("No project open.")
else:
    main()

Getting Alternative Conversion Targets

The API provides a call that retrieves the possible conversion targets for a certain device. It returns the DeviceID for each target.

from __future__ import print_function
 
#help function to print the delivered device ids
def deviceid_to_string(devId):
    mystr = "ID: {0.id} Type: {0.type} Version: {0.version}".format(devId)
 
    if hasattr(devId, 'module_id') and devId.module_id is not None:
        mystr += " ModuleID: {0.module_id}".format(devId)
        return mystr
 
 
def main():
    
    # Set the project as primary project
    proj = projects.primary
 
    controller = proj.find('LMC_PacDrive', True)[0]
    alternativeControllers = controller.get_alternative_devices()
 
    print("ALTERNATIVE DEVICES FOR LMC")
    for id in alternativeControllers:
        print(deviceid_to_string(id))
 
    drive = proj.find('DRV_Lexium62', True)[0]
    alternativeDrives = drive.get_alternative_devices()
 
    print("ALTERNATIVE DEVICES FOR DRIVE")
    for id in alternativeDrives:
        print(deviceid_to_string(id))
 
    print("Test complete. Please check the script output window")
 
 
 
if not projects.primary:
    print("No project open.")
else:
    main()

Converting the Device

The process of converting the device is straightforward because the only required action is calling the conversion method.

from __future__ import print_function
 
def main():
    proj = projects.primary
    controller = proj.find('LMC_PacDrive', True)[0]
    drive = proj.find('DRV_Lexium62', True)[0]
 
    # converting the controller
    controller.convert(4096, "1003 009D", "1.53.5.4")
    # converting the drive
    drive.convert(DeviceID(4096, "1003 0082", "1.53.5.4"), "LXM52")
 
 
if not projects.primary:
    print("No project open.")
else:
    main()