emladeira

PISDK - VB 2008 Executable

Discussion created by emladeira on Jun 18, 2012
Latest reply on Jun 20, 2012 by emladeira

I'm trying to make an Executable on VB 2008 to run on a client computer that doesn't have a Process Book installed.This computer has access to PI server. The program would get values from a PI server and watch if a tag is >= 20, then call another sub, that'll send a mail. I've imported SDK dll's but it doesn't work... Is it possible to make this work? How can I enter my credential to PI server?
The program works on a computer that has ProccessBook intalled. I put a timer to update values every 1 min, but when the value is >= 20 it calls the sub "Mensagem" every min, but I want it to call it only once, then call again if the value gets < 20 and >= 20 again. Any clues? Thanks in advance.

 

Here is my code:

 
Public Class Principal
    Dim myPISDK As PISDK.PISDK = New PISDK.PISDK
    Private Sub Principal_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Call Timer1_Tick(Nothing, Nothing)
    End Sub

    Public Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        'to update variable "valor" and trigger every minut
        Dim valor As Double
        Dim trigger As Integer
        valor = myPISDK.GetPoint("\\piserver\pitag").Data.Snapshot.Value
        l_valor.Text = Format(valor, "0.00")
        If valor >= 20 Then
            l_valor.BackColor = Color.Red 'label
            trigger = 1
            l1.Text = trigger
        Else
            trigger = 0
            l_valor.BackColor = Color.Green
            l1.Text = trigger
        End If
        If trigger = 1 Then
            Call l_valor_TextChanged(Nothing, Nothing) 'Call only on label text change from 0 to 1
        End If
    End Sub

    Private Sub l1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles l_valor.TextChanged
        Call CDO_Mail() 'this sub is supposed to be called only on label's text change, not evey minute as stated on Timer_Tick
    End Sub
End Class

 

Outcomes