INGEAR.NET.ABLink

 

Controller.GroupRead Method 

Executes an optimized read for all the Tag classes in the TagGroup, or array of TagGroups

[Visual Basic]
Public Function GroupRead( _
   ParamArray TagGroup As TagGroup() _
) As Integer
[C#]
public int GroupRead(
   params TagGroup[] TagGroup
);

Parameters

TagGroup
An instance or array of instances of the TagGroup class

Return Value

ResultCode.E_SUCCESS if successful, else ResultCode for a list of possible errors.

Exceptions

Exception Type Condition
ArgumentNullException Thrown if TagGroup parameter is a null reference (Nothing in Visual Basic)
ArgumentOutOfRangeException Thrown if TagGroup parameter not type ABLink.TagGroup

Remarks

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.

Example

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)

See Also

Controller Class | ABLink Namespace | GroupWrite | ReadTag