Data Trending with OPC Client

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
SaKovac
In need of some credit
In need of some credit
Posts: 2
Joined: Wed Dec 07, 2022 12:35 am

Data Trending with OPC Client

Post by SaKovac »

Hello guys,
I have developed data trending peace of software back in '96 using wxWidgets (wxWindows) version 1.68. It was working excellent for many years. Since this code is very old and not compatible with wx version 2 and higher, I want to rewrite the whole software in the latest wx 3.2.x and add some new features. Purpose of this project is scientific data analysis were various mathematical functions are applied for teaching and research. The software needs to handle up to 20 different data sets, and each data set could be 32k long. I'm thinking to feed data into max 20 arrays[32k], display them on a graph (wxDC) and shift them to free the first element of the array for new data. New data will be collected by OPC Client (Ole for Process Control), where the client will be reading the data from a OPC server (already available, like KepWare). This OPC client is a new component and I need to build that too. As a starting point software can also read data from a file.

Maybe I'm asking for too much, but if somebody has done something similar and wants to share the code that would be very much appreciated.
Any code for data trending or OPC client or ideally both is what I'm looking for.
If not, any advice witch example to use as a starting point, will be of a great value for me and my students.

The deadline is pretty tight, I need to finish this in 2-3 months.

Thank you very much in advance.
User avatar
doublemax
Moderator
Moderator
Posts: 19115
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Data Trending with OPC Client

Post by doublemax »

Shouldn't the "difficult" part already exist in your old code?

Maybe wxMathPlot does what you need? The original component is not supported any longer, but there are some more up-to-date forks:
https://github.com/GitHubLionel/wxMathPlot
https://github.com/naiche/wxMathPlot
I'm thinking to feed data into max 20 arrays[32k], display them on a graph (wxDC) and shift them to free the first element of the array for new data.
That doesn't sound like a good idea from a performance point of view. I'd use a circular buffer. Google should be able to find an implementation that fits your needs.
Use the source, Luke!
SaKovac
In need of some credit
In need of some credit
Posts: 2
Joined: Wed Dec 07, 2022 12:35 am

Re: Data Trending with OPC Client

Post by SaKovac »

Yes, you are right, the difficult part is already there. But, I had to program everything, legends, zooming.. I was thinking to improve the code using latest wx classes for plotting and other things, since they didn't exist in 1.68 version.
Regarding the performance, it was excellent in my old code. The chart was moving nicely without flickering even at 100ms refresh rate.
I was using memcopy instead of shifting values in the buffers (this would be really slow). Maybe circual buffers will work better.
Anyhow, thank you very much for your input. I wouldn't mind to buy or to pay somebody who is more fluent in coding this kind of stuff.
I didn't do much of the programming for last 20 years.
Thank you again.
Post Reply