Is there a better way to compare data between my primary and secondary of a collective and see if they are really in sync when it comes to data. I have had some instances where the data do not match between them. ..
Primary and Secondary PI Server don't have sync data function. These are independent and PI Interaces send data to both Primary and Secondary PI Server by PI Buffer Subsystem.
If you do reinitialization, Primary data will be coppied to Secondary PI Server. Also the other way is copy the archive files. But you need to check start time and end time.
There is a possibility that Primary and Secondary have different Start time and End time.
Also you can use PI to PI Interface to copy the data.
Unfortunately, there is no comparison tool that would allow you to compare every archive value in one server to archive values in another.
The possible way I can imagine is that you can connect Primary or Secondary PI Server independently and compare values manually.
But it will be huge application if there are a lot of tags.
You can also consider using the PISDK for this task. Please see Writing to Secondary Members using the PI-SDK. The post covers how to connect to a specific member of a collective. You can then grab an event list from each member to perform a comparison.
You can also use AFSDK to get PI Server values. This is the example to get "cdt158"'s snapshot value from Secondary PI Server.
Dim myPIServers As New PIServers
Dim myPIServer As PIServer = myPIServers("collective name")
Dim secondary As PICollectiveMember = myPIServer.Collective.Members("secondary name")
Dim pt As PIPoint = PIPoint.FindPIPoint(secondary.PIServer, "cdt158")
Dim value As Single = pt.Snapshot.Value
I forgot to mention but AF 2.6 or later and taget = .net 4.5 for this code.
This method was suggested to do the check after merging PI Servers, but you can use this to do some random checks.
The best way would be comparing event count for all points (or just some of them) for whatever time range you like (I'd recommend going for a few short time-ranges rather than one long time-range).
You can use the power of Excel + PI DataLink to do it.
1. Load a list of PI Points into column A
2. Prepare 4 more "parameter cells" somewhere in E column
a. start time
b. end time
c. PI server A name
d. PI Server B name
3. In column B, use Calculated Function > point data item/tag to column A, and start/end time, PI Server to appropriate cells in the E column.
Make sure the parameter cells are absolute references ($E$1), whereas data item/tag is a relative reference (A1).
Use Event-Weighted calc mode and Count calc mode.
4. Drag and drop the to get event count for all the points in column A.
5. Repeat the same call against the other PI Server (column C).
Compare results using (=IF(B2=C2,"Good", "MISMATCH") formula in column D, drag and drop, and you're done.
Were you able to reach a resolution regarding your question above? If so, please let us know by marking one of the answers as "Correct Answer"? If not, please give us some more information on the current status of the project so we can further assist you
Retrieving data ...