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: 

Newbie: How to store/analyze data in a time critical path

Hi,
I monitor two CAN channels with LabView. To monitor I use a special PCMCIA card and a dll from the card manufacturer.
I get a lot of messages from each channel and I have to compare them.
To get all messages I have to use the dll in a while loop.
But to store the data in two 2d arrays and analyze it during one loop is to slow.
So how can I do it? Somehow a hash table, queue or parallel tasks - one for the data collecting and one for analyzing?
And how to handle the two CAN channels?
As you can see I'm new in LabView and I'm looking for a good program architecture...
Thanks,
Thomas
 
 
0 Kudos
Message 1 of 2
(2,134 Views)

Hi Thomas,

You raise a good point, and I'm happy to see that you are wanting to make your LabVIEW code more efficient! In general, you want to avoid building up large arrays in a while loop (as you've already alluded to). I believe a queue is an appropriate data structure to offload the processing of the data to another loop. We usually call this a producer-consumer type architecture, the details of which you can find here:

Application Design Patterns: Producer/Consumer

http://zone.ni.com/devzone/conceptd.nsf/webmain/c54badadd8bbde4286256c5200533b80

You're producer loop will be the code acuiring from the CAN channels using your DLL. The queue will pass data from the producer to the consumer, where you will perform whatever analysis you need.

Have a good one!

Charlie S.

Visit ni.com/gettingstarted for step-by-step help in setting up your system
0 Kudos
Message 2 of 2
(2,111 Views)