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

Digital State Options · View
najjarja
#1 Posted : Wednesday, December 15, 2010 3:38:31 PM
Rank: Member
Groups: Member

Joined: 7/16/2009
Posts: 12
Location: saudi arabia
I've tried to get the Digital State work using the below code on a vb.net form with no hope. All PI tags works fine except the digital state.

Public Class Jaism
Dim mySDK As PISDK.PISDK ' Instance of PISDK object
Dim myPIServer As PISDK.Server ' Our PI server to connect to
Dim myPipe As PISDK.EventPipe ' The event pipe that data will flow down
Dim myEvents As PISDK._DEventPipeEvents_Event ' The event that a new value has arrived
Dim myPoint As PISDK.PIPoint
Dim myValHandler As [Delegate]


Private m_EnableTimer As Boolean = False
Private m_Interval As Integer = 1000
Private m_IsConnected As Boolean = False
Private intTry As Integer = 0
Private m_Busy As Boolean = False
Public Event Updating()
Public Event UpdateComplete()
Public Property DigtalState As String = ""
Public ReadOnly Property Busy() As Boolean
Get
Return m_Busy
End Get
End Property
Public Property IsConnected() As Boolean
Get
Return m_IsConnected
End Get
Set(ByVal value As Boolean)
m_IsConnected = value
End Set
End Property
Public Property EnableTimer() As Boolean
Get
Return m_EnableTimer
End Get
Set(ByVal value As Boolean)
m_EnableTimer = value
Me.tmTimer.Enabled = value
End Set
End Property
Public Property Interval() As Integer
Get
Return m_Interval
End Get
Set(ByVal value As Integer)
m_Interval = value
Me.tmTimer.Interval = value
End Set
End Property

Public Sub ReadData()
Dim Ctl As Control = Nothing
Dim jValue As PISDK.PIValue
'Ctl = Me.Parent.Controls(0)
On Error Resume Next
Dim strTag As String = ""
Dim DgState As PISDK.StateSet
Dim Ds As PISDK.DigitalState
m_Busy = True
RaiseEvent Updating()
'Do While Not Ctl Is Nothing
' Ctl = Me.GetNextControl(Ctl, True)
For Each Ctl In Me.Parent.Controls
If TypeOf (Ctl) Is Label OrElse TypeOf (Ctl) Is TagLabel Then
If Not String.IsNullOrEmpty(Ctl.Tag) Then
If Ctl.Tag.ToString.StartsWith("_") Then
strTag = Ctl.Tag.ToString.Substring(1)
Else
strTag = Ctl.Tag.ToString
End If

myPoint = myPIServer.PIPoints(strTag)
If Ctl.Tag.ToString.StartsWith("_") Then
DgState = myPIServer.StateSets(myPoint.PointAttributes("digitalset").Value.ToString())
Ds = DgState.Item(0)
Ctl.Text = Ds.Code
Else

jValue = myPoint.Data.Snapshot
Ctl.Text = Format(jValue.Value, "0.0")
End If

End If
End If
Next

'Loop
m_Busy = False
RaiseEvent UpdateComplete()
'MsgBox(Me.Parent.Name & " Ctl Type " & Ctl.Name)
End Sub
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 : Wednesday, December 15, 2010 5:23:42 PM
Rank: Administration

Groups: Administration

Joined: 6/20/2008
Posts: 617
Location: Cheshire, United Kingdom.
Hello,

Couple of comments:

- It looks to me as though you are using the character "_" to denote digital points, I would just check the Point Type property of the PI Point object instead.
- You probably want to make use of the "Name" property of a DigitalState object instead of the "Code" property.
- It is possible to have a System DigitalState as the value of a non-digital PI Point. Your formatting may raise an exception if your PI Point has a bad value.

What is it about the digitalstate that isn't working, you are unable to read the value?
Principal Consultant
Real-Time Data Management @ Wipro Technologies
najjarja
#3 Posted : Thursday, December 16, 2010 12:09:23 PM
Rank: Member
Groups: Member

Joined: 7/16/2009
Posts: 12
Location: saudi arabia
Thank u for your reply

Actually I'm not a proffissional programmer, a freind of mine has helped me to develop the project. He created to to tags, one for pivalue point and the second one is for the digital state tags. The tag for Pivalues work fine. the digital state tags did not work

the _ is for the digital tag example _53GM305A.PV

regards;
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.