LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Key Value Pairs

I'm new to LabVIEW and have been learning by using example codes. It's been challenging, but I've managed to achieve the desired output, even though my code isn't very clean.

I'm now rewriting the code and realize I lack knowledge in certain areas. I'm testing a system connected to 432 sensors via a multiplexer using the USB-6363 and two custom PCBs. I'm looking for a better way to organize and evaluate my results.

Here's the tricky part: each sensor (or channel) has 5 ICs, each providing 2 Boolean outputs and 3 numeric outputs. Additionally, there are about 5 more Boolean outputs to ensure the serial connection with the multiplexer is functioning correctly. This totals to 15 Boolean outputs and 15 numeric outputs per channel.

I want to create a kind of dictionary to store this data while the cases are running, and then evaluate all outputs at the end. How can I save these outputs so I can easily refer to each channel directly or log the data after the code has finished running?

0 Kudos
Message 1 of 6
(695 Views)

I would just put the information in an array of clusters, but a Map should work (or variant property if you're going more old-school). Name/Number the sensors and use the just mentioned cluster as data. That way it should be easy to store/pull the information needed.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 2 of 6
(685 Views)

Hi khaledag,

 


@khaledag28 wrote:

How can I save these outputs so I can easily refer to each channel directly … ?


Use Key-Value pairs…

 

Which LabVIEW version do you use? Since several versions there is a "map" datatype, that will implement those key-value pairs easily. (In older versions you could implement the same using Variant attributes…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 6
(678 Views)

I am using LabVIEW 2022 Q3, I will see how I can implement the map you just mentioned, thank you. 

0 Kudos
Message 4 of 6
(675 Views)

Will that also work if I want the data of each channel to remain in the memory? or should it be reseted after every channel? 

0 Kudos
Message 5 of 6
(672 Views)

Hi khaledag,

 


@khaledag28 wrote:

Will that also work if I want the data of each channel to remain in the memory?


The data stay in memory as long as you keep the data alive: "THINK DATAFLOW!"

 

So as long as you keep the map (or the variant) in your running VI the data will stay in memory!

 


@khaledag28 wrote:

or should it be reseted after every channel?


When you want to reset the data then you need to implement this behaviour…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 6
(655 Views)