How can the AF SDK reference a secondary archive collective member when a PI SDK alias redirects it to the primary?

We want to copy data from a set of tags on the primary archive to the secondary. Using PIPoint.ReplaceValues fails, even when setting the bufferOption parameter to AFBufferOption.BufferIfPossible or AFBufferOption.Buffer.

 

This appears to be caused by a pesky alias that points from the secondary to the primary in PI SDK. When I delete the alias in PI SDK, it reappears shortly after doing so. I've also tried deleting the alias from the AFSDK.config file, to no avail.

 

To test this, I assigned PIServer objects to both members immediately after deleting the alias in About-PISDK. I also removed the secondary's name from the primary's AliasNames property, just to be safe (using PIthon):

piserv1 = PIServers()[primary_name]
if secondary_name in piserv1.AliasNames:
    piserv1.AliasNames.Remove(secondary_name)
piserv2 = PIServers()[secondary_name]

I then compared the PIServers' Name and UniqueID properties. They differed at first, as expected. However, after assigning PIPoint objects to PI tags on either server, the UniqueIDs matched, suggesting that piserv2 now pointed to the primary, just like piserv1.

 

if print_matches:
    if piserv1.Name == piserv2.Name:
        print("\nPIServer names match.")
    else:
        print("\nPIServer names don't match.")
    if piserv1.UniqueID == piserv2.UniqueID:
        print("PIServer UniqueID's match.")
    else:
        print("PIServer UniqueID's don't match.")
    if piserv1.ServerVersion == piserv2.ServerVersion:
        print("PIServer versions match.\n")
    else:
        print("PIServer versions don't match.\n")

pitag1 = PIPoint.FindPIPoint(piserv1, testtagname)
pitag2 = PIPoint.FindPIPoint(piserv2, testtagname)

values_primary = pitag1.RecordedValues(AFTR, boundaryType, "", True, maxCount)
values_secondary = pitag2.RecordedValues(AFTR, boundaryType, "", True, maxCount)

if print_matches:
    if piserv1.Name == piserv2.Name:
        print("PIServer names match.")
    else:
        print("PIServer names don't match.")
    if piserv1.UniqueID == piserv2.UniqueID:
        print("PIServer UniqueID's match.")
    else:
        print("PIServer UniqueID's don't match.")
    if piserv1.ServerVersion == piserv2.ServerVersion:
        print("PIServer versions match.\n")
    else:
        print("PIServer versions don't match.\n")

print("Value counts:\nPrimary : {}\nSecondary : {}".format(str(values_primary.Count), str(values_secondary.Count)))

Their RecordedValues counts matched, even though PI SMT shows no tag values on the secondary.

 

RecordedValues counts comparison:

 


RecordedValues counts match.png
 

PI SMT shows no values on secondary:

 



 

Can the PI AF SDK reference the secondary archive directly, without applying aliases, if PI SMT is able to do so?

 

 

 

 

 

 

Parents Reply Children