-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Historize data in a circular buffer #2835
Comments
@peter-rustler-basyskom Can you have a look at this? |
I have the same question,it will take too much memory and break the program |
Hi everyone, The idea behind it is to have a fixed number of nodes to historize, that means it is mandatory to choose a maximum number of nodes (and that number will never be exceeded) and for each of that nodes a circular array of values will be saved and, each time a client performs a UA_HistoryReadRequest on a certain node, the current circular buffer (full of values) will be sent by the server. To do so I started from the original history functions and I did some modifications to obtain the desired result. This was the faster solution for me but it means that most of the code it is very similar to the original implementation. Sorry for that but I did not find a faster way to implement the algorithms. The following images describe the differences between the original history and the "circular" one. Original implementation of OPC UA Historical Data Access: nodes and Modified implementation of OPC UA Historical Data Access: if max Moreover it is useful to know that I have added a field to the To try this implementation all you need to do is to set:
While the History Database part (interface) will remain untouched. Find attached a zip file with the code, your opinions would be very appreciated ^_^ |
Hi I am trying to implement a circular buffer. But I cannot find the functions UA_DataValueMemoryStoreItem_deleteMembers and UA_NodeIdStoreContextItem_deleteMembers. Did you write them yourself? They are not in the ZIP file. Or is UA_DataValueMemoryStoreItem_deleteMembers =UA_DataValueMemoryStoreItem_clear and UA_NodeIdStoreContextItem_deleteMembers =UA_NodeIdStoreContextItem_clear? |
Hi @Max15421, Have you managed to compile the newest version of open62541 with these modifications? |
@luibass92 Thanks for your answer. I was able to compile it after some changes. I exchanged UA_DataValueMemoryStoreItem_deleteMembers and UA_NodeIdStoreContextItem_deleteMembers with UA_DataValueMemoryStoreItem_clear and UA_NodeIdStoreContextItem_clear because the functions were depricated. I also changed OPCUA_NULL to NULL. Unfortunately it doesn't work. I get an memory overflow after a while. I wasn't able to find the mistake yet. |
@Max15421 yes, I implemented the circular buffer several open62541 versions ago... In fact if you take a look at the final lines of this method, you should see:
And the use of Does not exist a new method that make the same job of Let me know if this help. |
@luibass92 thanks!
|
I finally decided to create a pull request after adapting the code with the latest version of the library. |
Merged on master #4740. Closing this issue. |
Goodmorning,
I am a "Historical Data" plugin user and I see that there is no limit on the size of the buffer which historizes data.
I can set an initial size but, each time it is reached, a UA_realloc is done and the buffer is re-allocated with its size doubled.
I would like to configure the historical data in order to have something similar to a circular buffer beacause I want to be sure to not have undesired memory growths.
I managed how to do it with the Gathering, now I can register only a maximum number of nodes and if I overcome that limit an UA_STATUS_BADOUTOFMEMORY is returned.
Now I am trying to do the same with the Backend part but it seems way more complicated.
In this case I do not want to simply return a bad status code, but I want to historize data in a circular buffer which does not double its size but overwrite the oldes data as a circlar buffer would do.
Someone could please help me or give me some tips?
Thanks,
Luigi
The text was updated successfully, but these errors were encountered: