vendredi 17 avril 2015

Effective way of reducing data for real-time plot

This is my first post, so please inform me if there will be anything wrong.


I am developing scientific application in Windows Forms (VC++ 2010), which controls relatively new, electronic device. I control it by additional, wrapped library written in C. After initial setup of all parameters, this application triggers a measurement in the device. Then, it sends to my app a huge data of over 200k samples of int at significant rate – let’s assume it’s 50 datasets per second.


Now, I need to plot my data at the real-time pace using Windows Forms chart. It would be perfect to have 750 samples plotted inside chart at rate of about 30 FPS. The problem I encountered lies in the algorithm of reducing database in a fast way without losing reliability of plot.


My ideas (data is oscilating around value = 127):




  1. Choose 750 points just by selecting every (200 000/ 750) th point




  2. Group the data and calculate mean value




  3. Group the data and select maximum or minimum (based on overall group placement – if most of them is above 127 – select minimum, else maximum).




Which one (if any) of those solution is the best considering I have to plot data at real-time speed and plot should not miss spots, where we have any significant signal (looking like a kind of narrowed, modulated sine wave)? Is there any better approach?


And the last question: should I consider using table of pointers to my huge data buffer or data copies as data for plot considering I always have the same buffer of collected data (device just overwrites this buffer constantly with new data)?


Aucun commentaire:

Enregistrer un commentaire