Modular Application Creator Use Case Based Documentation
Loading...
Searching...
No Matches
CreateVariables.cs
1using Siemens.Automation.ModularApplicationCreator.Tia.Openness;
2using Siemens.Automation.ModularApplicationCreator.Tia.Openness.SoftwareUnit;
3
5
9public class CreateVariables
10{
27 public static ControllerTags CreateTagTable(PlcDevice plcDevice, string tableName)
28 {
29 return plcDevice.Tags.GetOrCreateGlobalTagTable(tableName);
30 }
31
48 public static ControllerTags CreateTagTable(ISoftwareUnitBase softwareUnit, string tableName)
49 {
50 return softwareUnit.Tags.GetOrCreateGlobalTagTable(tableName);
51 }
52
53
65 public static void CreateTagInTagTable(ControllerTags tagTable, string addressType, string addressByte,
66 string addressBit, string tagName, string dataType, string tagComment)
67 {
68 var tagAddress = addressType + addressByte + "." + addressBit;
69
70 var tag = tagTable[tagName];
71
72 tag?.Delete();
73
74 tag = tagTable.AddTag(tagName, dataType, tagAddress);
75 tag.SetComment("en-EN", tagComment);
76 }
77}
All the functions to configure and generate Tags and Tag Tables are defined here.
static ControllerTags CreateTagTable(PlcDevice plcDevice, string tableName)
Creates a new tag table or retrieves an existing one in the specified PLC device.
static void CreateTagInTagTable(ControllerTags tagTable, string addressType, string addressByte, string addressBit, string tagName, string dataType, string tagComment)
This Function creates a Tag in a Tag Table.
static ControllerTags CreateTagTable(ISoftwareUnitBase softwareUnit, string tableName)
Creates a new tag table or retrieves an existing one in the specified software unit.