LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how can table execution be optimized?

Solved!
Go to solution

How can the update time of a table be optimized? I am reading data via USB RAW and storing the data in a table… the problem is that the table processes very slow missing out on some data packets. I used defer panel updates as well, that solved the issue of missing out on packets but obviously didn’t update the front panel… I can not miss any incoming data packets but need to update the table in runtime as well… a little help will be much appreciated… thanks in advance

0 Kudos
Message 1 of 16
(617 Views)
Highlighted

Which of tables are you use?
Listbox, 2D string etc?
show your code, it will be much easier for us to help you

0 Kudos
Message 2 of 16
(594 Views)
Highlighted

A table is an indicator and not useful for "storing" data, especially if that data is arriving rapidly and growing without bounds.

Data belongs on the diagram. What is the datatype of the original data? How do you want it formatted in the table? How big does the table get?

 

Easiest would be to store the incoming data in a 2D numeric array in a shift register. At leisure, you can format the last N rows into a table for display, keeping the front panel data lean and mean.

 

Please show us some code. Thanks!


LabVIEW Champion. It all comes together in GCentral GCentral
0 Kudos
Message 3 of 16
(579 Views)
Highlighted

sorry i shouldve used the word "display" instead of "storing"... incoming data is in hex and and i need to display the hex string(specific bytes) in a specific column of the table. 

i have posted the screenshot below... cannot capture the entire code it is placed within a while loop... 

0 Kudos
Message 4 of 16
(559 Views)
Highlighted

Hi Sidkay,

 

- why do you use local variables like "element 2", when there is a wire available next to it?

- how often do you need to change the IndexVlas of the table?

- how often do you need to set CellValues of the table?

- why do you need to use Method nodes of the table instead of changing the table array data directly? (Use ReplaceArraySubset to change single elements in the 2D array!)

- why don't you use GetMatrixSize instead of ArraySize followed by IndexArray?

- you might use a DeferPanelUpdate property node before and after changing the table…

- why don't you clean up your code?

- why don't you close the VISA port after using it?

 

cannot capture the entire code it is placed within a while loop

Posting images of code is quite senseless as we cannot debug images using LabVIEW. (Sidenote: you would like that with text-based programming languages either!)

When you can't post code because the VI is "too big" then you should think about modularizing your code…

Best regards,
GerdW
CLAD expired, using LV2011SP1 + LV2017 (+LV2019 sometimes) on Win7+cRIO
Kudos are welcome Smiley Wink

0 Kudos
Message 5 of 16
(556 Views)
Highlighted

@Sidkay wrote:

sorry i shouldve used the word "display" instead of "storing"... incoming data is in hex and and i need to display the hex string(specific bytes) in a specific column of the table. 


That picture does not help at all and you have not answered any of my questions. (size, etc.). What is the loop rate?

 

"Hex" is not a data type, all you have are strings, some formatted in decimal and some in hexadecimal.

 

As Gerd already pointed out, your VI is full of race conditions due to poor understanding of dataflow and blatant overuse of local variables. Your "element 2" local variable will get read before the "element 2" terminal has been updated, making the case structure operate on current data based on stale size. All you need is wire the "element 2" value across the selector terminal and make one case "default" and one case "15..". Right? Why do you think you need to take the array size twice and index it out twice in parallel? Are you expecting different results? Once is enough!

Where is actual the table terminal? Is it a control or indicator?

Are you really opening a new visa session with each iteration without ever closing one?

 

You really need to go back and do a few more tutorials before continuing.

 


@Sidkay wrote:

i have posted the screenshot below... cannot capture the entire code it is placed within a while loop... 


A while loop does not prevent you from capturing the entire code. Why would you think that? What have you tried?

You could attach the VI instead! You could create a snippet!


LabVIEW Champion. It all comes together in GCentral GCentral
0 Kudos
Message 6 of 16
(548 Views)
Highlighted

forgive me for my mistakes... i am new to labview... had recently done some changes to the code that's why had multiple instances of similar blocks... i have fixed those hopefully and cleaned up the code and replaced some blocks as well;since it was the better option; as much as i could...i hope none are left...

the table i have used is an indicator...

i need the index values to change with every new packet that VISA reads with every iteration but the loop rate is very low that it misses many packets by the time next iteration begins... i have used 6 instances of set cell value as i am using 6 different columns...

i tried using defer panel updates before n after the change as well but the execution speed was more or less the same as not using it... using that property node gives me the speed i want as it does not miss any packets but doesnt update the table until the VI has been stopped...

0 Kudos
Message 7 of 16
(537 Views)
Highlighted

Hi Sidkay,

 

all your screenshots are so overcrowded - and look wrong (IMHO)…

 

Get rid of those SetCellValue method nodes. When you want to change values in the table you only need to edit the 2D array of strings which is wired to the table terminal!

 

Problems with your last image:

- again locals where you should use a wire instead

- lots of terminals with no (or hidden) label

- duplicated code belongs into a loop!

- hidden wires

 

If you would attach your VI we would have a chance to edit the VI!

But we cannot debug images using LabVIEW…

Best regards,
GerdW
CLAD expired, using LV2011SP1 + LV2017 (+LV2019 sometimes) on Win7+cRIO
Kudos are welcome Smiley Wink

0 Kudos
Message 8 of 16
(534 Views)
Highlighted

Sidkay, you are iging tooooooo much property nodes

Replace all cells and only then draw table

table.png

Message 9 of 16
(532 Views)
Highlighted

@Artem.SPb wrote:

Replace all cells and only then draw table

 


You cannot replace elements in an empty array. The SR need to be initialized with a 2D array of strings at the full final size.


LabVIEW Champion. It all comes together in GCentral GCentral
0 Kudos
Message 10 of 16
(512 Views)