LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

optimize save to GOOP repository

Solved!
Go to solution

Hi,

 

I am writing an application that reads an RS232 unit that sends data with a fewquency of 33 Hz. I am polling the RS232 data with a while loop that runs with a fewquency of 66Hz. In this while loop I have placed the attached .vi. My problem is that as my applicatios does a lot of other things in parallel the application laggs heavily or crashes after a while (about a minute). However, When I remore the attached .vi the program runs perfectly. This leads me to the conclusion that saving arrays to a GOOP repository takes a lot of time (more than 15 ms) when the arrays get big. Is there any other way more optimized way to save data?

 

I'd really appreciate your advice,

 

Rui

0 Kudos
Message 1 of 5
(2,606 Views)

Hi!

 

Do you lock the COM object elsewhere in the code? There might be a race, and this code might then wait for that lock to unlock before adding the arrays into the attributes.

Also, have you tried disabling the array handling part to verify that it is this that takes time?

 

Just my two cents...

 

//Martin



CLA
www.dvel.se
0 Kudos
Message 2 of 5
(2,586 Views)

Thanks for your reply! I am pretty sure that I don't lock the database elsewhere in the code. But you were right, it seems like it is the array handling part (or a combinaion of array handling and saving) that takes time. The input to LabView from the RS232 unit is a string that contains two status chars, three index chars and six data chars. (SS:III:DDDDDD) Do you know a more effective way of dividing that string into three parts and save them?

 

Thanks again,

 

Rui

0 Kudos
Message 3 of 5
(2,559 Views)
Solution
Accepted by Rui_Chen

Hi!

Just off the top of my head:

The string dividing part should not be a problem. The array handling is the usual suspect, arrays that are continuously built on are slow to handle, they must reallocate more memory from time to time. Do you know how big your array will be in the end? Or at least have a maximum array size? In that case, try to initialise the arrays (using "initialise array") to that size when creating the object, then that memory space wil be pre-allocated for them. This might speed things up. Can you get a size indicator or probe on the arrays to se how big they are when things start to get bad? If they are huge, you need to find another solution.

//Martin



CLA
www.dvel.se
0 Kudos
Message 4 of 5
(2,556 Views)

Initialize array did it! Thanks Martin!

 

//Rui

0 Kudos
Message 5 of 5
(2,535 Views)