LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

two short questions regarding labview

Hello everybody,

 

I have two short questions that probably can be answered by experts on the board here:

 

a) I currently have a VI with several channels (8) of incoming analog data. I want the user of the VI to give the option which values to log to file. He can check a checkbox.
Currently I'm using the 'select' function, if its true it passes on the analog value, if false it passes a 0, but I dont want it to appear in my array at all because logged zeros are kinda useless.

 Whats the way to do this?

 

b)As a programming habit, when I want to pass values between various running loops I tend to make an invisible indicator in that loop (string, numeric etc), and then use a property node of that indicator for the value in other loops. Is this a good way to do this? Works though.

0 Kudos
Message 1 of 17
(3,742 Views)

Hello Faust,

 

for a) the following picture shows one solution to log only several channels

for b) the queue-VIs are a very good (fast, easy to use, needs little ressources) way to pass data between different loops. Please see at the examples shipped with LabVIEW (Help->Find Examples).

 

 

Message Edited by daveTW on 01-26-2010 11:21 AM
Greets, Dave
Message 2 of 17
(3,728 Views)

a) the code posted above can also be implemented using a select instead of the case structure. Wire the output of the build array to the true input, and the output of the shift register to the false input.

b) Property nodes is about the worst solution. Local variables are better in performance. Both lead to race conditions, which is very bad. Take a look in the breakpoint forum at the thread 'why local variables are bad'.

You can use queues as suggested, but also notifiers are the right tool in some cases. Have a look (= search for) at what is called 'producer/consumer design pattern'.

Post some example code here, and we will post back how to make it 'the right way'. 

 

Felix 

Message 3 of 17
(3,713 Views)

For extra Information on b)

 

You can use property nodes, local variables, global variables and Queues etc etc to pass data from one loop to another however some are MUCH more efficient than others.  Probably something like this..

 

GOOD

 |

 |  Queues

 |  Notifiers

 |  Local Var

 |  Global Var

 |  ...

 |  ...

 |  Property Node

\/

BAD

 

Craig

 

[Schubert - got there before me!  Also using your shift register for solution a) - Another trick on top is to use a feedback node 😉 ]

Message Edited by craigc on 26--01-2010 11:21 AM
LabVIEW 2012
Message 4 of 17
(3,711 Views)

Ok Guys thanks for the fast and helpful replies. I'm still learning Labview so I'm looking into the queues. But if a property node is so bad, why is the option in there?

 

Thanks again for all the help! I will post a VI once I've implemented the suggested code.

 

I've been learning labview by using the " advanced propramming techniques" book the last week, are there any suggestions for other GOOD books or courses?

And one last question, what is an easy way to get in the logged file a header above each column with data indicating which channel it is?

 

0 Kudos
Message 5 of 17
(3,698 Views)

Dave, could you maybe post the VI instead of the figure? I'd like to study it. Appreciated!

 

 

0 Kudos
Message 6 of 17
(3,687 Views)

To learn, continue posting and reading this forum. As book, I would recommend you 'LabVIEW for Everyone'.

 

The Value-Property isn't useless, it is very cool if you work with control references. IIRC Ben wrote a nugget on this. He also has a Tag cloud to find these. 

 

Felix 

Message 7 of 17
(3,674 Views)

I did not see Action Engines mentioned in the above list. I wrote about them in this Nugget. They can be thought of as a poratble shift register taht works in more than one loop.

 

Here is a Tag cloud that may have some interesting links.

 

Take home leason:

 

Controls and indicators in LabVIEW should only be used to enter infor or display a value. They are not intended for storing data. All data in LV lives in wires.

 

Ben

 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 8 of 17
(3,663 Views)

I like to use an Open G vi to filter unwanted data from an array

 

 Example_VI_BD.png

 

 

Dan Shangraw, P.E.


   

Message 9 of 17
(3,661 Views)

Hi Ben,

 

Sorry, I left out Action engines, LV2 Globals and shared variables etc out of the picture as i didnt want to overwhelm the guy!

 

Craig

LabVIEW 2012
Message 10 of 17
(3,640 Views)