I am attempting to add devices(sercos master, drives, profinet I/O etc.) to my application object. I read in one of the posts about an API implementation for device repository to be available from v3.5 sp9. Can you please provide a code snippet with its usage??.
The goal is to add devices to my application object( starting with an empty project) using scripts. Thanks in advance.
(Edit): Where can I find the parameters DeviceType, DeviceID, Supported Firmware Version and ModuleID pertaining to the device?
Best Regards,
SK
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
codesys_sig_forum hat geschrieben:
I am attempting to add devices(sercos master, drives, profinet I/O etc.) to my application object. I read in one of the posts about an API implementation for device repository to be available from v3.5 sp9. Can you please provide a code snippet with its usage??.
At the moment we only support our own device description format but we plan to support the other formats through the converters.
codesys_sig_forum hat geschrieben:
The goal is to add devices to my application object( starting with an empty project) using scripts. Thanks in advance.
\# CheckifthenecessarydevicedescriptionisinstalleddevId=device_repository.create_device_identification(4096, '0000 0001', '3.5.9.0')devDesc=device_repository.get_device(devId)ifdevDescisNone:
Β Β raiseException('No WinV3 PLC available in device repo')proj=projects.primary
\# AddPLCtoanemptyprojectusingaDeviceIdinstanceproj.add('Device', devId)found=proj.find('Device', False)assert(foundisnotNoneandlen(found)==1, 'No object with the name Device found')assert(found[0].is_device, 'Found object is not a device')device=found[0]
\# AddEthernetdeviceusingthetype, IDandversioninsteadofaDeviceIDdevice.add('Ethernet', 110, '0000 0002', '3.5.9.0')ethernet=device.find('Ethernet', False)[0]
codesys_sig_forum hat geschrieben:
(Edit): Where can I find the parameters DeviceType, DeviceID, Supported Firmware Version and ModuleID pertaining to the device?
You can find the required parameters on the tab "Information" of the corresponding device editor.
BR
Martin
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
M.Keller hat geschrieben:
At the moment we only support our own device description format but we plan to support the other formats through the converters.
Hi M.Keller,
May I know what those supported device description formats are?
I have tried to run the line below, it reported error saying "Data at the root level is invalid. Line 1, position 1" I assume it is because eds is the invalid format?
chenhe hat geschrieben:
May I know what those supported device description formats are?
I have tried to run the line below, it reported error saying "Data at the root level is invalid. Line 1, position 1" I assume it is because eds is the invalid format?
With CODESYS V3.5 SP10 or newer we also support the import of foreign device descriptions. You can import the same formats as through the UI.
You have to use the following method to import a foreign device description:
Hello,
I am attempting to add devices(sercos master, drives, profinet I/O etc.) to my application object. I read in one of the posts about an API implementation for device repository to be available from v3.5 sp9. Can you please provide a code snippet with its usage??.
The goal is to add devices to my application object( starting with an empty project) using scripts. Thanks in advance.
(Edit): Where can I find the parameters DeviceType, DeviceID, Supported Firmware Version and ModuleID pertaining to the device?
Best Regards,
SK
Hi SK.
At the moment we only support our own device description format but we plan to support the other formats through the converters.
You can find the required parameters on the tab "Information" of the corresponding device editor.
BR
Martin
Hi M.Keller,
May I know what those supported device description formats are?
I have tried to run the line below, it reported error saying "Data at the root level is invalid. Line 1, position 1" I assume it is because eds is the invalid format?
Hi chenhe.
With CODESYS V3.5 SP10 or newer we also support the import of foreign device descriptions. You can import the same formats as through the UI.
You have to use the following method to import a foreign device description:
BR
Martin