INGEAR.NET.Logix

 

Tag.QualityCode Property

Returns numeric quality state for the Tag.

[Visual Basic]
NotOverridable Public ReadOnly Property QualityCode As Integer _
    Implements ITag.QualityCode
[C#]
public int QualityCode {get;}

Implements

ITag.QualityCode

Remarks

See ResultCode for possible QUAL_xxx codes.

Example

VB
Try
  ' ********************************
  ' * initialize controller and tag
   Dim MyPLC as New Logix.Tag.Controller("192.168.1.31")
   Dim MyTag as New Logix.Tag("MyIntTag")
   
   ' *******************************
   ' * read value from PLC
   MyPLC.ReadTag(MyTag)
    
   ' *******************************
   ' * check the status
   If ResultCode.QUAL_GOOD = MyTag.QualityCode Then
      Console.WriteLine(MyTag.Value.ToString())
      Console.WriteLine(MyTag.Timestamp.ToString())
   Else
      Console.WriteLine(MyTag.ErrorString)
   End If
   Console.WriteLine(MyTag.QualityString)
Catch ex As System.Exception
   Console.WriteLine(ex.Message)
End Try
   
C#
try
{
  //////////////////////////////////
  // initialize controller and tag
  Logix.Controller MyPLC = new Logix.Controller("192.168.1.31");
  Logix.Tag MyTag = new Logix.Tag("MyIntTag");
  /////////////////////////////////
  // read value from PLC
  MyPLC.ReadTag(MyTag);
  
  //////////////////////////////////
  // check results
  if(ResultCode.QUAL_GOOD == MyTag.QualityCode)
    Console.WriteLine(Convert.ToString(MyTag.Value));
    Console.WriteLine(MyTag.Timestamp.ToString());
  else
    Console.WriteLine(MyTag.ErrorCode);
  Console.WriteLine(MyTag.QualityString);    
}
catch(System.Exception ex)
{
  Console.WriteLine(ex.Message);
}  

See Also

Tag Class | Logix Namespace | QualityString