How to use AFSDK?

I use PISDK to read and write tags,but it can not write multiple tags at once.

With AFSDK, Init C# code like

"PISystems myPISystems = new PISystems();"

the error code is

"

System.MissingMethodException

 HResult=0x80131513

 Message=Method not found: 'System.Security.AccessControl.DirectorySecurity System.IO.DirectoryInfo.GetAccessControl()'.

 Source=OSIsoft.AFSDK

 StackTrace:

  at OSIsoft.AF.Service.dcServerCommon.get_CommonApplicationDataPath()

  at OSIsoft.AF.PISystem.get_CommonApplicationDataPath()

  at OSIsoft.AF.Support.AFConfigSettings.get_ConfigFileFullPath()

  at OSIsoft.AF.Support.AFConfigSettings.Read(PISystemsGlobal systems, Boolean inLoad)

  at OSIsoft.AF.PISystemsManager.GetPISystems(Boolean forceNewInstance, String currentUserID, String currentUserName)

  at OSIsoft.AF.PISystemsManager.GetPISystems(Boolean forceNewInstance)

  at OSIsoft.AF.PISystems..ctor(Boolean forceNewInstance)

  at OSIsoft.AF.PISystems..ctor()

",

if somebody can tell me why?


image.png

Parents
  • Hello ​ ,

    yes, please target .NET Framework 4.8. I recall that there is limitations with Visual Studio Community Edition but I do not recall any details.

    AF SDK implements so called bulk methods which are designed to deal with multiple data items in a single call. Those do not require any parallel processing and are very powerful. For your purposes, I suggest to look into UpdateValues. There exist multiple options.

    PIPoint.UpdateValues Method

    PIServer.UpdateValues Method

    AFData.UpdateValues Method

    AFListData.UpdateValues Method

    Make sure you check out the linked documentation of the overloads. The ones including AFBufferOption usually contain sample code.

    Finally, a word of caution. Please recall, with great power comes great responsibility. A production PI System usually has different data sources and user applications connected and you will want to avoid overloading the PI Data Archive. Please do not utilize bulk methods in parallel threads and consider reasonable bulk sizes. Real performance always depends on many factors. Sending ~10k updates in a single call should be possible and you should experience good performance.

Reply
  • Hello ​ ,

    yes, please target .NET Framework 4.8. I recall that there is limitations with Visual Studio Community Edition but I do not recall any details.

    AF SDK implements so called bulk methods which are designed to deal with multiple data items in a single call. Those do not require any parallel processing and are very powerful. For your purposes, I suggest to look into UpdateValues. There exist multiple options.

    PIPoint.UpdateValues Method

    PIServer.UpdateValues Method

    AFData.UpdateValues Method

    AFListData.UpdateValues Method

    Make sure you check out the linked documentation of the overloads. The ones including AFBufferOption usually contain sample code.

    Finally, a word of caution. Please recall, with great power comes great responsibility. A production PI System usually has different data sources and user applications connected and you will want to avoid overloading the PI Data Archive. Please do not utilize bulk methods in parallel threads and consider reasonable bulk sizes. Real performance always depends on many factors. Sending ~10k updates in a single call should be possible and you should experience good performance.

Children
No Data