Add instances of Tag classes to the TagGroup collection.
E_SUCCESS successful else ResultCode for list of possible errors.
The Active property must = true for this method to executed. Setting the Active property enables or disables individual tags for group updates. Call this method will invoke the Update event handler for the group as well as Changed event for individual tags.
If the Tag.Name already exists in the TagGroup collection, an exception is thrown.
| Exception Type | Condition |
|---|---|
| ArgumentNullException | Thrown if Tag parameter = a null reference (Nothing in Visual Basic) |
| ArgumentOutOfRangeException
|
Thrown if Tag parameter not type ABLink.Tag
|
VB ' *********************************** ' * initialize the Controller class Dim MyPLC as New ABLink.Controller() ' *********************************** ' * initialize TagGroup class Dim tagGroup as New ABLink.TagGroup ' *********************************** ' * initialize tag classes Dim Tag1 as New ABLink.Tag("N7:0") Dim Tag2 as New ABLink.Tag("N7:13") Dim Tag3 as New ABLink.Tag("F8:100") '************************************ '* set controller properties MyPLC.IPAdress = "192.168.1.32" MyPLC.CPUType = CPU.SLC MyPLC.DriverType = Driver.ENET '************************************ '* add tags to the group tagGroup.AddTag(Tag1) tagGroup.AddTag(Tag2) tagGroup.AddTag(Tag3) ' *********************************** ' * update the group MyPLC.GroupRead(tagGroup) ' *********************************** ' * Tag1 Results If Tag1.QualityCode = ResultCode.QUAL_GOOD Then Console.WriteLine(Convert.ToString(Tag1.Value)) Console.WriteLine(Tag1.Timestamp.ToString()) Else Console.WriteLine(Tag1.ErrorString) End If Console.WriteLine(Tag1.QualityString) ' ************************************ ' * Tag2 Results If Tag2.QualityCode = ResultCode.QUAL_GOOD Then Console.WriteLine(Convert.ToString(Tag2.Value)) Console.WriteLine(Tag2.Timestamp.ToString()) Else Console.WriteLine(Tag2.ErrorString) End If Console.WriteLine(Tag2.QualityString) ' ************************************** ' * Tag3 Results If Tag3.QualityCode = ResultCode.QUAL_GOOD Then Console.WriteLine(Convert.ToString(Tag3.Value)) Console.WriteLine(Tag3.Timestamp.ToString()) Else Console.WriteLine(Tag3.ErrorString) End If Console.WriteLine(Tag3.QualityString)
C# /////////////////////////////////////// // initialize the Controller class ABLink.Controller MyPLC = new ABLink.Controller(); /////////////////////////////////////// // initialize TagGroup class ABLink.TagGroup tagGroup = new ABLink.TagGroup(); /////////////////////////////////////// // initialize tag classes ABLink.Tag Tag1 = new ABLink.Tag("N7:0"); ABLink.Tag Tag2 = new ABLink.Tag("N7:13"); ABLink.Tag Tag3 = wew ABLink.Tag("F8:100"); /////////////////////////////////////// // set controller properties MyPLC.IPAdress = "192.168.1.32"; MyPLC.CPUType = CPU.SLC; MyPLC.DriverType = Driver.ENET; /////////////////////////////////////// // add tags to the group tagGroup.AddTag(Tag1); tagGroup.AddTag(Tag2); tagGroup.AddTag(Tag3); /////////////////////////////////////// // update the group MyPLC.GroupRead(tagGroup); ////////////////////////////////////// // Tag1 Results if (ResultCode.QUAL_GOOD == Tag1.QualityCode) { Console.WriteLine(Convert.ToString(Tag1.Value)); Console.WriteLine(Tag1.Timestamp.ToString()); } else Console.WriteLine(Tag1.ErrorString); Console.WriteLine(Tag1.QualityString) ////////////////////////////////////// // Tag2 Results if (ResultCode.QUAL_GOOD == Tag2.QualityCode) { Console.WriteLine(Convert.ToString(Tag2.Value)); Console.WriteLine(Tag2.Timestamp.ToString()); } else Console.WriteLine(Tag2.ErrorString); Console.WriteLine(Tag2.QualityString) ////////////////////////////////////// // Tag3 Results if (ResultCode.QUAL_GOOD == Tag3.QualityCode) { Console.WriteLine(Convert.ToString(Tag3.Value)); Console.WriteLine(Tag3.Timestamp.ToString()); } else Console.WriteLine(Tag3.ErrorString); Console.WriteLine(Tag3.QualityString)
TagGroup Class | ABLink Namespace | RemoveTag | Clear | Count | Tags | GroupWrite | ReadTag