PIAdminUnison

AF connections for Parallel.ForEach

Discussion created by PIAdminUnison on Apr 7, 2014
Latest reply on Apr 8, 2014 by PIAdminUnison

Hi All,

 

I may have asked this before but can't seem to find a define answer concerning AF SDK 2.6.  So here is my issue:

 

 

 

My objective is to put data into PI tags via the AF SDK.  I first need to search the AF for elements belonging to an Element Template.  Once I've got the elements, I want to create a separate thread for each of the elements to do some work on them.  This is my problem, I'm newish to multithreading and I'm not sure of the connection and threading to the AF.  In my current thoughts, I'd have connection to AF server before going into the thread, but do I pass that connection into the thread or do I just pass the GUID for the element to the thread and make a new connection to the AF server and AF database once in the thread?  Help!  Once in the thread, I don't need to pass anything between the threads, but the main thread would need to know when all the threads completed.  One other thing.  Within each thread, I will be getting an AFAttributeList based on the timestamp I am writing to PI, so each thread maybe searching PI AF versioning for different times.

 

Thing anyone could help?  :-)

 

 

 

Cheers,

 

Jimmy

Outcomes