-
Notifications
You must be signed in to change notification settings - Fork 8
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
"Merge" buffer implementation and seriously consider introducing it into the generic SensorAgent's interface #40
Comments
I did some research on efficient implementations and the most straight-forward approach seems to me using Python's built-in collections.deque as @mgrub already proposed and implemented. Although, as I had in the back of my mind, a deque is not the right datatype in general, because it allows to append and to pop elements on both sides, which we actually do not want, as we discussed today, it is in this case most efficiently implemented to do these operations in almost O(1) as they state themselves, whatever this means in detail. @mgrub well done, to come up with the proposal! One last remark is on this before we discuss on Friday how tot tackle this issue is taken from the linked page as well:
|
... although on second glace we might be better off for the agents with a queue.Queue which includes locking mechanisms in case several data sources are delivering measurement values at the (almost) same time (to the same buffering/queueing SensorAgent). If we can exclude this possibility in all use cases, we might stick to collections.deque but aiming for higher samping rates, we should consider this and choose carefully. |
As discussed on Wednesday and on Friday this ideally includes a test implementation with a two node setup, one sender, one receiver, to visualize when frequencies get higher than processing capabilities. That means the receiver has to do some easy processing task as well. The idea is to monitor, when a buffer overflow is probable. |
A suggested processing task is to compute the mean which acts as a filter |
For the implementation of the interface, especially against the background of the high-speed requirement, we should be aware that we do not necessarily have to process at 10 kHz, but could also use an aliasing agent and low-pass filter to work at lower speeds. |
In the meantime @mgrub provided a Buffer class in PyDynamic. |
There are two implementations here : deque and dict to be compared - |
We can abstract the buffer implementation further - and a check for buffer filled instead of : we can have -
|
Updated the implementation for |
Need to resolve these two tasks-
|
This is already resolved and thus can be closed. We introduced a neat buffer class AgentBuffer and will continue using and extending it if needed. |
Max has got some implementation ready using a Python's deque und we got some in the examples. We should merge these into one residing in the master.
The text was updated successfully, but these errors were encountered: