Requirement
-
The TIA Portal Openness application is connected to the TIA Portal.
-
A project is open.
Introduction
A device can be created via two methods, within a project or a device group:
-
Create a device via a device item type identifier like in TIA hardware catalog
Device CreateWithItem(DeviceItemTypeId, DeviceItemName, DeviceName) -
Create only the device
Device Create(DeviceTypeId, DeviceName)
|
Name |
Type |
Description |
|---|---|---|
|
DeviceItemTypeId |
string |
Type identifier of the device item |
|
DeviceTypeId |
string |
Type identifier of the device |
|
DeviceItemName |
string |
Name of the created device item |
|
DeviceName |
string |
Name of the created device |
See: Get type identifier of devices and device items
Program code
Modify the following code to create a device object via a type identifier:
|
private static void CreateDeviceWithTypeIdentifier(DeviceComposition devices) { Device device = devices.CreateWithItem ("OrderNumber:6ES7 510-1DJ01-0AB0/V2.0", "PLC_1", "NewDevice"); Device gsdDevice = devices.CreateWithItem ("GSD:SIEM8139.GSD/M/4 ", "GSD Module", "NewGsdDevice"); } |
Program code
Modify the following code to create only the device object: