YetAnotherForum
Welcome Guest Search | Active Topics | Log In | Register

value of Digital tag Options · View
Danny
#1 Posted : Tuesday, February 23, 2010 7:15:59 AM
Rank: Newbie
Groups: Member

Joined: 2/6/2010
Posts: 6
can anyone help me how to get the state of a digital tag,i mean 'ON or OFF' using VB for displaying on a web page.I can able to read the analog tags using 'snapshot.value" but not digital tags.How to handle digital tags in vb ?

cheers,

danny
Sponsor  
 

OSIsoft vCampus is a subscription-based, online offering that consists of providing everything people need to develop applications on the PI System.
We invite you to take a "tour" of the OSIsoft Virtual Campus - also feel free to consult the FAQ  or contact OSIsoft vCampus for more details.
RJK Solutions
#2 Posted : Tuesday, February 23, 2010 8:25:48 AM
Rank: Administration

Groups: Administration

Joined: 6/20/2008
Posts: 612
Location: Cheshire, United Kingdom.
Hi Danny,

When dealing with a digital tag (or a digital error state for analog tags) then you require a variable of type PISDK.DigitalState. Example is below, enjoy!

Code:

Dim DigValue As PISDK.DigitalState = Nothing
        Dim PIPoint As PISDK.PIPoint = Server.PIPoints("TestDigitalTag")
        If PIPoint.PointType = PISDK.PointTypeConstants.pttypDigital Then
            DigValue = CType(PIPoint.Data.Snapshot.Value, PISDK.DigitalState)
        Else
            If PIPoint.Data.Snapshot.IsGood Then
                '...
            Else
                DigValue = CType(PIPoint.Data.Snapshot.Value, PISDK.DigitalState)
            End If
        End If


Rhys.
Principal Consultant
Real-Time Data Management @ Wipro Technologies
Danny
#3 Posted : Thursday, March 04, 2010 7:17:02 AM
Rank: Newbie
Groups: Member

Joined: 2/6/2010
Posts: 6
Hi Rhys,

Thank you very much. As you said I really enjoyed with the example given by you.Here one more thing i have to clear from you " Is to possible to have the digital state of tag in 1 or 0 form?.I mean now I am getting the value as "ON or OFF". i want this in a general form '0'or'1'.


Danny
RJK Solutions
#4 Posted : Thursday, March 04, 2010 8:33:41 AM
Rank: Administration

Groups: Administration

Joined: 6/20/2008
Posts: 612
Location: Cheshire, United Kingdom.
Hi Danny,

The PISDK.DigitalState offers you couple of options for the value:
- ".Name" The name of the digital state (On/Off)
- ".Code" The code for the digital state (0/1) according to the StateSet. (You can check this for a StateSet in PI-SMT)

In the example I posted, the "DigValue" variable will give you what you need, e.g.

Code:

DigValue.Code


Cheers,
Rhys.
Principal Consultant
Real-Time Data Management @ Wipro Technologies
Danny
#5 Posted : Saturday, March 06, 2010 9:29:07 AM
Rank: Newbie
Groups: Member

Joined: 2/6/2010
Posts: 6
Hi Rhys,

Thank u , i got it.ThumbsUp

Cheers,Boo hoo!
Danny.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.