|
|
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
|
|
|
|
|
|
|
|
Rank: Administration
 Groups: Administration
Joined: 6/20/2008 Posts: 458 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. OSIsoft PI System SpecialistsPI consultancy on PI Systems, PISDK, AFSDK, OLEDB etc and PI custom developments. Well pretty much anything to do with PI!
|
|
|
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
|
|
|
Rank: Administration
 Groups: Administration
Joined: 6/20/2008 Posts: 458 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. Cheers, Rhys. OSIsoft PI System SpecialistsPI consultancy on PI Systems, PISDK, AFSDK, OLEDB etc and PI custom developments. Well pretty much anything to do with PI!
|
|
|
Rank: Newbie Groups: Member
Joined: 2/6/2010 Posts: 6
|
Hi Rhys, Thank u , i got it. Cheers, Danny.
|
|
|
|
Guest
|