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.
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.
12-14-2015 02:02 AM
Hi!
I would lika to read every control (label and value) in my global variable which contains a cluster. The problem is that I am trying to do this on a cDAQ and as far as I undestand and has seen th property node do not worl that good on real time target. The code I have tested so far is the following:
This is the main/fornpanel on my cDAQ. The subVI in the main code contains the following:
The phenonomen that I hav seen is that it works fine maybe the first and second time when I run the cod bu for the third time the labels are empty. I have read something that the propertynode dose not work properly for real time target but it there a way to come to the same solution by not using the propertynode or could you use the propertynode different?
Best Regards
Anton
Solved! Go to Solution.
12-14-2015 02:27 AM - edited 12-14-2015 02:31 AM
Hi Anton,
question: why do you need to read the cluster element's labels in each iteration?
The cluster will never change (it should be typedefined anyway!)…
question: why do you need to read the values by property node when you have the cluster wired into the subVI?
(And why do you have that race condition in your MainVI?)
Which target does that VI run on? What hardware do you use?
12-14-2015 02:34 AM
I want to do this because in the end I want to write it to a TDMS file (where the cahennel is the label and the value is the value in the cluster) which my intetion is to do in the foor loop. This is because there are a lot of controls in the cluster meaning the code become very large when using unbundle by name and save each element to the TDMS-file.
It is a typedef but in the project it might happen that we add or remove parts in the cluster. This means that if I cannot dynamically read what the cluster actually contains I need to change is everywhere which opens for misstakes.
However there might be other wasy to just save a cluster directyl into a TDMS file?
The hardware is a cDAQ-9132.
12-14-2015 02:45 AM
Hi Anton,
I wouldn't use a cluster then…
- You could use arrays, one array for "labels", one for data vlues.
- You could use a CVT (current value table) implementation, it will also give you arrays of labels and values…
- You could use waveforms, they allow attributes (like names) and TDMS routines handle those attributes (AFAIK)…
12-14-2015 07:22 AM
This definately sounds like a place for Current Value Table (CVT). It uses a lookup, by string, to get your value. So if you know your names, you can quickly get your values.
Alternatively, you could create an array of strings to iterate over with a FOR loop and use a case structure to get the individual value and save it to the TDMS file.
12-15-2015 07:27 AM
I solved it by using an libray (Cluster Toolkit by Autotestware) to ge cluster into arrays of variant and depending on the type I converted the variant accordingly adn saved it. I guess CVT would be able to do it but since I already uses the cluster and they are "already there" it was more convinient for me to use this solution.