LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

shift register & driving speed issue

Solved!
Go to solution

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.shiftRegister.JPG

Thank you.

0 Kudos
Message 1 of 11
(355 Views)

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?


  1. When you want to plot only certain parts of your data then you need to implement this in your VI. I recommend to use a XY graph when you need non-regular intervals between the samples…
  2. The simplest solution (and common recommendation) is to plot only a limited number of samples. There's no sense in plotting thousands of points in a graph of ~400 pixels width…

Btw. when you want to build an array then you should use BuildArray. InsertIntoArray most often is the wrong function…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 11
(348 Views)

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

0 Kudos
Message 3 of 11
(332 Views)

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?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 11
(323 Views)

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.

wiebeCARYA_0-1714636299959.png

 

 

0 Kudos
Message 5 of 11
(312 Views)

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.

0 Kudos
Message 6 of 11
(280 Views)

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.

0 Kudos
Message 7 of 11
(277 Views)

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.


  • Don't create ever-growing arrays in a (tight) loop. That's a NO-GO with your data sizes…
  • Don't update the graph so often.
  • Think about using a producer-consumer scheme to separate DAQ from UI handling.
  • Add only every 100th/500th sample to your graph data!
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 11
(274 Views)

@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:

wiebeCARYA_0-1714643448904.png

 

0 Kudos
Message 9 of 11
(273 Views)
Solution
Accepted by topic author crise99

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.

 

shiftRegister1.JPG

Message 10 of 11
(217 Views)