05-02-2024 01:27 AM
hi
I'm using shift register to plot graphs and I've noticed that when I have a lot of data, it gets slower and slower due to memory issues. (Labview 2020)
So I would like to ask following items.
1. is it possible to graph only characteristic intervals or specific moments in the shift register?
For example, if you look at the attached binary, there are 10 pieces of data plotted as sequentially increasing random values,
is it possible to have the x-axis plot only 1,2,5,8?
2. is there any way to work around the slowdown caused by memory issues when using the shift register in large volumes or for long periods of time, or is there another way to plot the graph in an additional format?
Any advice would be appreciated.
Thank you.
Solved! Go to Solution.
05-02-2024 01:45 AM - edited 05-02-2024 01:49 AM
Hi crise,
@crise99 wrote:
1. is it possible to graph only characteristic intervals or specific moments in the shift register?
For example, if you look at the attached binary, there are 10 pieces of data plotted as sequentially increasing random values,
is it possible to have the x-axis plot only 1,2,5,8?
2. is there any way to work around the slowdown caused by memory issues when using the shift register in large volumes or for long periods of time, or is there another way to plot the graph in an additional format?
Btw. when you want to build an array then you should use BuildArray. InsertIntoArray most often is the wrong function…
05-02-2024 02:25 AM - edited 05-02-2024 02:27 AM
Thanks GerdW for your response.
Currently I am using xy plot as you mentioned.
What I want is to plot only limited data, and I don't know how to configure it in vi.
Is it possible to plot only limited data in "shift register"?
If you could give me an example, it would be easier to understand.
Thanks.
Regards,
Crise
05-02-2024 02:32 AM
Hi crise,
@crise99 wrote:
What I want is to plot only limited data, and I don't know how to configure it in vi.
Is it possible to plot only limited data in "shift register"?
You don't need to "configure", you need to program your requirements!
Yes, it is possible to keep only "limited data" in your shift registers. But you need to program, which data gets collected in the arrays and which don't need to be collected!
What is the condition you want to apply to your data?
05-02-2024 02:51 AM
It makes little sense updating the graph in the for loop.
You'll only see the last update, but the speed is reduced by updating the graph 10 times.
If you put the graph terminal outside the loop, it will update only once.
If you do put the graph terminal outside the loop, the shift registers become completely redundant. You can simply use auto indexing.
If you want to conditionally add the values, put the insert (do use Build Array) in a case, or if you end up using auto indexing, use conditional indexing.
05-02-2024 04:19 AM
wiebe@CARYA Thank you for your response.
That sounds like a good approach.
I put the plot in a loop because I want to see the data being incremented and added in real time.
I want to show only the data I want in real time as the data is being incremented.
05-02-2024 04:28 AM
Thanks again GerdW.
Actually, the data I want to use is quite a large amount of data in real time and I have been graphing it so far.
As mentioned above, this will gradually slow down due to memory issues, so I want to draw only one expression out of 100 or one expression out of 500, or only a specific sequence of data.
The total number of data is over 100,000.
Of course, we want to see the change of the data along with the past data in a graph that is shown in real time.
05-02-2024 04:37 AM
Hi crise,
@crise99 wrote:
As mentioned above, this will gradually slow down due to memory issues, so I want to draw only one expression out of 100 or one expression out of 500, or only a specific sequence of data.
The total number of data is over 100,000.
05-02-2024 04:40 AM - edited 05-02-2024 04:51 AM
@crise99 wrote:
wiebe@CARYA Thank you for your response.
That sounds like a good approach.I put the plot in a loop because I want to see the data being incremented and added in real time.
I want to show only the data I want in real time as the data is being incremented.
I figured it was more of a mock up for something.
If the data grows, things will get slower.
What is especially slow is the growing arrays, and the visualization in the graph.
The growing of the array can be avoided by pre-allocating the memory, and replacing data in stead of adding it. Adding a sample will require a copy (at least every now an then) because the allocated memory isn't going to be enough. That's slow. Look into circular buffers, or use a queue. The details depend on what you want, e.g. fill the data until it's complete, or remove the oldest sample if the buffer is full.
Depending on the rate of the data, you can consider filling the data in one and showing it in another loop. Both a circular buffer and a queue will help with that. This allows adding data at e.g. 100 Hz, and updating it at 2 Hz.
This doesn't increase CPU load at all over time:
05-02-2024 09:08 PM
Thank you for your feedback.
My approach was to represent only what I needed in the graph as an array, and delete the data from the "shift register" array flow when it wasn't applicable.
The data plot is cleaner and the memory issue is solved.
Here's my approach and how I solved it.
For other people's reference.