09-06-2012 08:40 PM
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?
09-06-2012 08:51 PM
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
09-06-2012 08:53 PM
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.
11-04-2024 11:05 AM
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.
11-04-2024 12:07 PM - edited 11-04-2024 12:09 PM
@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.