Why not write via PIBufss from your application so that you don't get a buffer lock?
As Rhys mentioned, the best option would be for your application to write via PIBufss. Is it a PI SDK or AF SDK application? Previously, PIBufss can only handle PI SDK buffering. However, starting in AF SDK version 2.6 with PIBufss 4.3, PI buffer subsystem can now buffer AF SDK applications as well. Please let us know if this will be applicable for your scenario. Thanks.
Any sample code will help.
From the AF SDK reference:
The AF SDK supports data write methods through the SetValue, UpdateValue and UpdateValues, in AFAttribute , AFData , AFListData , PIPoint , and PIServer . When no buffering option is specified in the call, the default buffering behavior for these methods is determined by the system level AF SDK configuration or programmatically for the current client process.
In summary, the buffering behavior can be set at the following levels:
- System level: In AFSDK.config GlobalSettings, bufferOption can be set to either “DoNotBuffer”, “BufferIfPossible”, or “Buffer”. This setting will be valid for all AF SDK applications running in the same client machine. If this setting is not specified or is misspelled then the buffering behavior is assumed to be “BufferIfPossible”.
- Process instance level: Programmatically, one can set AFData..::..BufferOption static property to the desired AFBufferOption . This setting will be valid for the corresponding AF SDK client process instance and will override the system level setting.
- Per Call level: The buffering behavior can also be set at the method level through the AFData.AFBufferOption parameter, which will override process level and system level settings. The AF SDK data write overload methods with this parameter are implemented in the AFData , AFListData , PIPoint , and PIServer AF SDK classes, as follows:
1 of 1 people found this helpful
As Eugene mentioned, there are different ways to set up AF SDK buffering. The easiest way to configure AF SDK buffering would be to configure it through buffering manager. You can find detailed instructions on this article in live library: configure n-way buffering for AF SDK clients. Before you begin, make sure PI buffer subsystem is running, or else you won't be able to open buffer manager. After opening up buffer manager, go to the global setting and set the desired buffering behavior for AF SDK buffering:
Note that this essentially writes to the AFSDK.config file. (If you are interested, the file is located at C:\ProgramData\OSIsoft\AF\AFSDK.config. I would recommend going through buffer manager to make changes instead of manually editing the config file.) This sets buffer settings for all AF SDK applications on the machine, unless you override them in the process instance or call level (see above). For more information about AF SDK buffering, you can also refer to the AFSDK reference guide, available at %pihome%\help\afsdk.chm (search for buffer).
An example of override the system-level setting in the process level would be:
AFData.BufferOption = AFBufferOption.BufferIfPossible;
An example of overriding the system-level setting in the call level would be:
attribute.Data.UpdateValue(newAFValue, OSIsoft.AF.Data.AFUpdateOption.Insert, AFBufferOption.BufferIfPossible);
To check whether your application is indeed writing to PI through PIBufss, one way would be to navigate to %pihome%\bin and run the command:
to make sure your AF SDK application is registered. E.g. (my AF SDK application is AFSDKTest):
Hope it helps. Let me know if you have any questions.
I have marked this question as Assumed Answered. If the answers from Rhys, Eugene and Daphne help. please mark the most helpful one as the correct answer. Otherwise, please let us know and we can assist you further.