Is it possible to call, from my client PI AF process, within my custom data reference library, a WCF service on another machine? If so, where do I configure the endpoint declaration so that PI AF can find it?
Yes, that's possible. If you create a connection using a custom DR to another system, be aware that EVERY client must be able to access (connect, authenticate, authorize) the remote datasource. The custom DR is run at each client.
Depending on the granularity you need in configuration, you can store the endpoint details either in the configstring of your AF attribute, or in the configuration of the DR.
In any case, please be aware that custom DR's are on the edge of what the PI system can cope with. I have seen quite simple custom DR's bring down parts of the PI system in specific combinations of access methodes, custom DR programming and system load. So handle with care and keep the exposure and reliance on custom DR's as small as possible. Nothing wrong with the individual parts, but in combinations they might cause issues.
Refer to these for details:
Implementing custom DR: https://techsupport.osisoft.com/Downloads/All-Downloads/All-Groups/All-Products/All-Categories/Current-Version/data%20re… http://techsupport.osisoft.com/Downloads/File/5cbefb97-d253-46dd-b369-f36cda374e47
Configstring property of a custom DR: AFDataReference.ConfigString Property
You can even attach a GUI to that, but i could not find those details quickly enough. But this should get you started.
When you day "custom DRs are on the edge of what the PI system can cope with" is this probably the reason why ProcessBook does not get any data for my CDR (from the error I am seeing it appears that ProcessBook might not be able to access the dll correctly) and the PI excel add-in doesn't return the the expected data either.
Should I now assume that the custom DR that works correction in PI System Explorer will not work with ProcessBook and other PI tools? This is very unfortunate if that is the case.
Thanks for any insight you can give me.
In a correctly implemented Custom DataReference, data can be viewed from all clients. I suspect you might be missing some overrides on methods. This whitepaper is a must-read for implementing custom DataReferences: https://techsupport.osisoft.com/Downloads/File/5cbefb97-d253-46dd-b369-f36cda374e47
Thanks very much for the information.
I appreciate all the information you have given me so far, so, I'm hoping you might know the answer to my new question.
I have the CDR working for GetValue (and it returns data to a processbook display). My question is:
I have implemented the "Exact" option because some of the data that I am fetching is event based and the value is not supposed to be used in any AF formulas other than the event day. Is there a way to set the AFValue.value to NULL when the GetValue returns zero rows? I have to set the AFValue.value to zero or I get an "object is not set" error in PI System Explorer.
No, you can't return a NULL value, as the datatypes in the AFSDK do not support nulling. However, the system digital state "No Data" is probably the best way to resolve this for use in PI Clients:
AFValue newValue = new AFValue(systemSet["No Data"], AFTime.Now);
Thanks for the information.
Retrieving data ...