LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sorting serial packet data into queues

I am receiving serial packet data which originates from different sensor nodes in a network. Each sensor node

has a unique ID which is sent in the packet. The idea is to display the data in one chart and choose which sensor data to display

by using a cluster of booleans. I was thinking of using queues to buffer the data from single nodes, so for a network of 12 nodes 

I would need 12 queues and use a simple case structure to decide to which queue the element should be enqueued. Does this approach 

make sense or is there a simpler way to solve this problem? 

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

That seems reasonable.  You certainly need 12 of something for the data from the separate sensors. If the number of sensors can change, a 2D array might be better because you do not need to duplicate anything (such as adding another queue) to add a sensor.  However, arrays must be rectangular so if different amounts of data are received from different sensors, some method of keeping track what data is valid for each sensor will be required. The data from each sensor could be in a different row.

 

You probably want to use a graph, not a chart.  When you switch the display to a different sensor, you just wire that array row for that sensor to the graph.  Charts have an internal hsitory buffer and would be much more complicated to switch.

 

Lynn

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

That makes sense.

 

I recommend using an Action Engine to store and retrieve the references to your 12 queues.  The queue references can be stored as an array of references.

0 Kudos
Message 3 of 5
(2,289 Views)

Hi.  I hope this thread is still live

 

I have a requirement to sort data being delivered to my LV application by an MQTT broker. This data is in the form of packets, which will have originated from a number of remote devices. The data packets (which will be ID tagged) may be from many devices and can arrive out of sequence, and non contiguously, and may be delayed and interleaved with data from other devices.


Please can someone provide me with guidance as to the best way to approach this problem. I have tried a combination of arrays and clusters, but neither seem appropriate.

 

Thanks for any suggestions

 

Alan K.

0 Kudos
Message 4 of 5
(48 Views)

@Alan_K. wrote:

Hi.  I hope this thread is still live

 

I have a requirement to sort data being delivered to my LV application by an MQTT broker. This data is in the form of packets, which will have originated from a number of remote devices. The data packets (which will be ID tagged) may be from many devices and can arrive out of sequence, and non contiguously, and may be delayed and interleaved with data from other devices.


Please can someone provide me with guidance as to the best way to approach this problem. I have tried a combination of arrays and clusters, but neither seem appropriate.

 

Thanks for any suggestions

 

Alan K.


Hmmm.... In this instance I would probably handle it with a Producer/Consumer architecture similar to the way I handle CAN bus decoding.

 

As the packets are received in the Producer Loop place them into a Queue (You only need one Queue, NOT a seperate queue for every sensor!) 

 

In the Consumer Loop use the data packet ID tag to determine how to decode and display/save the data.

 

BTW: Without knowing your packet structure I am guessing you have mixed data types, so your Queue will be at minimum a Cluster containing your ID Tag and data. 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 5 of 5
(42 Views)