Install Device Description with Python

Sebi-11
2017-11-28
2017-12-01
  • Sebi-11 - 2017-11-28

    Hi everyone,

    I found this forum and i hope you can help me with my Problem.

    I use the Automation Builder from ABB and i try to install a Siemens device description with python i need this for an automated Test with Third Party Devices.

    The dev Desc is stored on a local Harddrive.

    I have found some functions, which i think, i can use for this.
    This is the code i used:

    import scriptengine
    source_list = scriptengine.device_repository.sources
    print(source_list)
    scriptengine.device_repository.import_device('S:\\Libraries\\ThirdPartyDevices\\GSDML-V2.32-Siemens-ET200SP-20170518.xml',source_list[0])
    

    The output of the code is

    <_3S.CoDeSys.ScriptDriverDeviceObject.ScriptRepositorySourceList object at 0x000000000000003A [_3S.CoDeSys.ScriptDriverDeviceObject.ScriptRepositorySourceList]>
    SystemError: Invalid device description: Node 'DeviceDescription' not found
    

    The problem is that i don´t no if i used the correct function to install the device description and the correct inputs.

    I have a second problem, but i don´t know if this is the right place of the forum to ask. If not please let me know where i can post it here.

    In my test I also use V2 Codesys, which is also integrated in the Automation Builder of ABB. And i want to know if it is possible to read out the massages of Codesys V2 ether with python or cmd commands?

    I hope someone can help me with my problem.

    Best Regards and have a nice week

    Sebastian

     
  • mkeller - 2017-11-28

    Hi Sebastian.

    Sebi_11 hat geschrieben:
    I use the Automation Builder from ABB and i try to install a Siemens device description with python i need this for an automated Test with Third Party Devices.
    The dev Desc is stored on a local Harddrive.
    I have found some functions, which i think, i can use for this.
    This is the code i used:

    import scriptengine
    source_list = scriptengine.device_repository.sources
    print(source_list)
    scriptengine.device_repository.import_device('S:\\Libraries\\ThirdPartyDevices\\GSDML-V2.32-Siemens-ET200SP-20170518.xml',source_list[0])
    

    The output of the code is

    <_3S.CoDeSys.ScriptDriverDeviceObject.ScriptRepositorySourceList object at 0x000000000000003A [_3S.CoDeSys.ScriptDriverDeviceObject.ScriptRepositorySourceList]>
    SystemError: Invalid device description: Node 'DeviceDescription' not found
    

    The problem is that i don´t no if i used the correct function to install the device description and the correct inputs.

    We added the support for importing third party device desciptions through the Scripting API with CODESYS V3.5 SP10.

    Here some example code:

    allConvert = Guid('{C633F245-876F-45E8-AAB4-3FBD994C08B8}')
    print("Import EDS device description")
    devId = device_repository.import_device(basepath + r'\750-337.EDS', repoSource, allConvert)
    devDesc = device_repository.get_device(devId)
    

    The important part is the parameter which specifies the Guid of the conversion factory. The Guid in my example is the most used factory because it tries different other factories to convert the input file to our native format.

    Sebi_11 hat geschrieben:
    I have a second problem, but i don´t know if this is the right place of the forum to ask. If not please let me know where i can post it here.
    In my test I also use V2 Codesys, which is also integrated in the Automation Builder of ABB. And i want to know if it is possible to read out the massages of Codesys V2 ether with python or cmd commands?

    Please post this part in a suitable thread of the CODESYS V2 sub forum because in here the chance of an answer is not very high.

    BR
    Martin

     
  • Sebi-11 - 2017-11-30

    Hi Martin,

    first of all thank you very much for your help.

    I used your examplecode and now part of my script is working.

    But i have a Problem to import DevDesc in XML Format.

    If i run this code:

    import scriptengine
    source_list = scriptengine.device_repository.sources
    allConvert = Guid('{C633F245-876F-45E8-AAB4-3FBD994C08B8}')
    devId_ECAT = scriptengine.device_repository.import_device('S:\\Libraries\\ThirdPartyDevices\\Balluff BNI ECT 508 105 Z015 ECS V2.2.X IO-Link-Master.xml',source_list[0], allConvert)
    

    The value of devId_ECAT of this is None, and the DevDesc isn´t imported.

    Does the convert Guid work for XML DevDesc´s? Is it possible to import XML DevDesc?

    Best Regards
    Sebastian

     
  • mkeller - 2017-11-30

    Hi Sebastian.

    Sebi_11 hat geschrieben:
    But i have a Problem to import DevDesc in XML Format.
    If i run this code:

    import scriptengine
    source_list = scriptengine.device_repository.sources
    allConvert = Guid('{C633F245-876F-45E8-AAB4-3FBD994C08B8}')
    devId_ECAT = scriptengine.device_repository.import_device('S:\\Libraries\\ThirdPartyDevices\\Balluff BNI ECT 508 105 Z015 ECS V2.2.X IO-Link-Master.xml',source_list[0], allConvert)
    

    The value of devId_ECAT of this is None, and the DevDesc isn´t imported.
    Does the convert Guid work for XML DevDesc´s? Is it possible to import XML DevDesc?

    I found nearly the same device description of your code in the Internet and the script could import it without a problem.

    Was there any error message in the Message view of CODESYS or anything else? Which version of CODESYS do you use?

    BR
    Martin

     
  • Sebi-11 - 2017-12-01

    Hi Martin,

    thanks again for your help and I found my mistake. I used the wrong path in the script .

    Now, after i changed the Path, everything works fine .

    Best Regards
    Sebastian

     

Log in to post a comment.