From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Slow update time

I've been using a Modbus development tool to read ADC output values without a problem. I've written a small vi which should do the same thing. It runs on the same PC and uses the same COM port. Obviously I have to close the Modbus programme to release the COM port for LabView. The vi runs fine, but the update rate is incredibly slow, about 10 seconds. I've attached the vi, Magnetron Power sub-vi edit, and the sub-vi's. I would appreciate any ideas on how to improve the update speed. Many thanks.
0 Kudos
Message 1 of 3
(2,392 Views)

Hi Placebo,

 

I've had a look at the SubVI you've created and notice you are using the Insert Into Array function twice in your For Loop. This method required Memory Reallocation (physically moving data about in your computer's RAM) every time the loop iterates - once for the first array function, then again for the second array function.

 

If you know what the upper limit (maximum ever required) of the array size is, then it would be better to allocate that memory at the beginning of the For Loop, and get rid of any unused elements after.

 

performance.png

 

Here are some useful resources on optimising for performance:

 

NI LabVIEW 2010 Performance Details

General Performance Improvements

Achieve Maximum System Performance at Minimum Cost

 

If you are interested in learning more about optimising for memory and performance, I would highly recommend the new LabVIEW Performance course. I hope that helps improve your VI further.

 

edit: added performance.png as downloadable attachment

Regards,


Imtiaz Chowdhury
Project Manager
Green Running / Austin Consultants

Message 2 of 3
(2,342 Views)
Thank you. Although I couldn't speed up the response time, by chance I met a colleague from another site here today who had a look for me. The problem seems to be associated with the "MB Serial Receive.vi". He modified it to read the data coming back and look at the 6101 time-out error. By putting in a delay, the problem disappeared. The optimum delay is 300ms. So he said the problem was with the board not responding fast enough for Labview. But by using COM port tool kit, I found the delay is only 94ms. I have also tried reading the board using ModbusMAT 1.1 which has a refresh limit of 300ms built in. This might be a co-incidence. I could go for delaying the operating speed of Labview, but I won't hit the response time for the system if I do that, so any other further suggestions would be gratefully received. I have attached a copy of the modified vi, but without the delay.
0 Kudos
Message 3 of 3
(2,308 Views)