LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to avoid using property nodes

I have a problem with the speed of my program.
 
When using property nodes, Labview becomes very slow. I want to do the following:
 
- read a number of data
- Only if a value changes, or a value suits certain conditions, put the value in an array.
- hence, the created array contains only those values that are of interest to me.
 
At the moment I use a property node (value) inside a case structure. If the value corresponds to my criteria, the case is true, and the value passes through to the property node (value) which links to a numerical control outside the case structure.
 
If the value does not correspond to my criteria (case = false), nothing happens, and the numerical control maintains the last value. (Hence, the case structure has no wired outputs, because then a value would be necessary for the false case).
 
This works, but this is very slow, due to the property node function. How can I do the same, but without the need to use a property node?
 
Attached is a small labview 7.1 VI that shows the problem
 
Thijs
0 Kudos
Message 1 of 9
(3,163 Views)
Hi Thijs,

Have a look at this VI and feel free to ask if you need more help.


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

Message 2 of 9
(3,156 Views)

Thanks TiTou, I hadn't thought of the use of shift registers yet!

You are restricted to use a loop though, but a FOR loop with a loop count of 1 does the job beautifully well!

Thanks!

Thijs

0 Kudos
Message 3 of 9
(3,125 Views)
Thijs,

Depending on what you want to do, you don't alway need a shift register to do that.
Also I added other ideas with comments in the attached file.

Hope that will be a usefull source of inspiration for the future...

We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 4 of 9
(3,120 Views)
Thanks,
 
The idea is to keep the last value as output, and not to use NaN instead.
Any idea how to get rid of the FOR loop?
 
See attached VI
 
Thijs
0 Kudos
Message 5 of 9
(3,117 Views)
If the indcator should only update under certain conditions, place it inside the case structure. No need for a FOR loop. 🙂
0 Kudos
Message 6 of 9
(3,104 Views)
Since you connected a "1" constant , the for loop will run just once... so the for loop is totally useless in your code. You will see no difference if you remove it.


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 7 of 9
(3,099 Views)
It seems to me that you are using the For loop just so you can use the shift register to keep the previous value of the mean from the last time the program was run. Perhaps you could use a local variable?
Image hosting by TinyPic

(By the way, there was recently a very enlightening thread about the best way to discard data in an array that is outside of a certain range. You may find it interesting: http://forums.ni.com/ni/board/message?board.id=170&message.id=175488 )
0 Kudos
Message 8 of 9
(3,099 Views)


@kehander wrote:
Perhaps you could use a local variable?

Why???
 
Personally, I almost always prefer shift registers over local variables, but in this case we don't need either. Look at my example above (http://forums.ni.com/ni/board/message?board.id=170&message.id=177091#M177091), if the terminal is inside the case structure, it will automatically retain its previous value until the case turns TRUE again in the future. 🙂
 
No local needed. 😄
Message 9 of 9
(3,076 Views)