1 Reply Latest reply on Jan 20, 2010 10:20 PM by spilon

    Writing to a tag's status


      I am developing a lab data entry screen and currently write the data using the SDK but I would like to write to the tag status whenever a lab instrument is out of service.  Is there a way to write this using the System digital state?  Thanks for any suggestions.

        • Re: Writing to a tag's status

          You can use any of the states in the SYSTEM digital state set, regardless of the type of the PI Point you are writing to. In the case of numerical or digital points, you can simply use the desired text string in the UpdateValue method. The PI SDK will detect that it is a "system" state you are trying to insert.

          PISDK.PIPoint pt = myServer.PIPoints["yourPIPoint"];
          pt.Data.UpdateValue("Out of Service", "*", PISDK.DataMergeConstants.dmInsertDuplicates, null);

          If the state you would like to use is not already in the SYSTEM digital state set (e.g. Out of Service), you can add it in a free spot (one that begins with a question mark) in the Digital States plug-in in SMT.


          In a few scenarios, such as if you are writing to a string PI Point, you will need to use a PISDK.DigitalState object:

          PISDK.PIPoint pt = myServer.PIPoints["yourPIPoint"];
          PISDK.StateSet stateSet = myServer.StateSets["SYSTEM"];
          PISDK.DigitalState state = stateSet["Out of Service"];
          pt.Data.UpdateValue(state, "*", PISDK.DataMergeConstants.dmInsertDuplicates, null);

          This is to differentiate between a simple string value (which is considered "good data") and a system state (which is considered "bad data").


          Hope this helps!