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

set a tag to a value for a time interval with VB and PI SDK Options · View
RBJA
#1 Posted : Tuesday, November 16, 2010 4:43:20 PM
Rank: Newbie
Groups: Member

Joined: 11/16/2010
Posts: 1
Location: Eindhout
Dear colleagues,

Your forum already got me through a lot of obstacles but now I am stuck.
I am building an application for connecting batch related data (eg. density) to a tag. Batch 1 ends when batch 2 begins and so on.
Batch 1 started t0 ended t1
Batch 2 started t1 ended t2
Batch 3 started t2 ended t3
Batch 4 started t3 ended t4
Now when I add a value to a tag for a batch that value is attached from the provided timestamp (the begin of the batch) till ... forever. So when the lab has figured out the density for batch 4 before the density of batch 3 then the value from batch 4 will be overwritten when the value for batch 3 is entered.
So i want to alter below code as such that the updatevalue works with an interval.

generic something like Set pvValueToAdd.TimeInterval(Begin,End) ??

Current, not satisfying, code
Code:
   
Global g_oPIServer          As PISDK.server
Global ptmTimestamp         As New PITimeServer.PITimeFormat
Global pvValueToAdd         As PISDK.PIValue
Global ptPIPoint            As PISDK.PIPoint
Set g_oPIServer = PISDK.Servers.Item("our server")
g_oPIServer.Open ("our server")

Set pvValueToAdd = New PISDK.PIValue
            Set ptPIPoint = g_oPIServer.PIPoints(pitags(K + 1))
            ptmTimestamp.InputString = UserForm1_input_Q.Blend_n_0_time 'Blend_n_0_time holds the start time
            pvValueToAdd.Value = UserForm1_input_Q.Controls("Txttest" & K + 1).Text 'in this textbox the value is entered
            'pvValueToAdd.Value = "No Data"
            Set pvValueToAdd.TimeStamp = ptmTimestamp
            ptPIPoint.Data.UpdateValue pvValueToAdd, 0


I played with IPIdata2 and InterpolatedValues2, found on this forum, but I am too newbie to get the story together. I am still discovering the wonderfull possibilities PI creates in our business and if anybody can recommand a must do training you'll make me happy.

Please any suggestions to the topic title are welcome if it seems not clear enough.

Kind regards,
Rob
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.
Tommy
#2 Posted : Friday, November 19, 2010 9:02:22 PM
Rank: Member
Groups: Member

Joined: 7/19/2010
Posts: 20
In other words, are you wanting to manually enter data for a point and enter a specific time for it too?

Is the point Step on or off? If it's on, then your data point at time t2 would remain the same until the next data point at time t3. This way, the Batch 3 value will be at t2 and will not overwrite the Batch 4 value at t3.
Disclaimer: Any code presented by myself might be unconventional because of the lack of formal training. Any corrections are welcome. =)
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.