LAVA Forums Buy cool LAVA gear Forums RSS Feed

Welcome Guest ( Log In | Register )

Tags
This content has not been tagged yet
2 Pages V   1 2 >  
Reply to this topic Start new topic
> Conditional Append, Suggestion for easy programming
MartinGreil
post May 2 2008, 03:30 PM
Post #1


I want a LabVIEW icon under my name!


Member
Posts: 3
Joined: 23-April 07
Member No.: 8399
Using LabVIEW Since:1997
LV:8.2.1 ,. ,.
Germany Nothing Selected Nothing Selected


Compare the upper loop with the lower loop.
Take a close look at the loop exit.



greetings from
martin


Tags
This content has not been tagged yet
Go to the top of the page
+Quote Post
Ad
post May 2 2008, 03:30 PM
Post #















Tags
This content has not been tagged yet
Go to the top of the page
Quote Post
TobyD
post May 2 2008, 03:40 PM
Post #2


Extremely Active
****

Premium Member
Posts: 366
Joined: 19-June 07
From: Everett, WA
Member No.: 8758
Using LabVIEW Since:2007
LV:8.5 ,8.2.1 ,.
United States Italy Nothing Selected


QUOTE (MartinGreil @ May 2 2008, 08:30 AM) *
Take a close look at the loop exit.



That's a great idea thumbup1.gif


Tags
This content has not been tagged yet
Go to the top of the page
+Quote Post
neB
post May 2 2008, 03:56 PM
Post #3


Certified Kool-Aid Kid
*****

Premium Member
Posts: 1133
Joined: 6-December 02
From: Pittsburgh PA USA
Member No.: 29
Using LabVIEW Since:1998
LV:7.1 ,. ,.
United States Germany Nothing Selected


QUOTE (MartinGreil @ May 2 2008, 11:30 AM) *
Compare the upper loop with the lower loop.
Take a close look at the loop exit.



greetings from
martin


Help me understand this post, please.

How does that image differ from using the "Conditional Terminal" that is now availabe in the For Loop under LabVIEW 8.5 plus.

Never mind!

You are looking to control in the data gets added to the arry being built in the tunnel. "Duh"

Ben


Tags
This content has not been tagged yet
Go to the top of the page
+Quote Post
crelf
post May 2 2008, 04:35 PM
Post #4


I'm a LAVA, not a fighter.
******

V I Engineering, Inc.
Posts: 3635
Joined: 13-October 03
From: Michigan, USA
Member No.: 181
Using LabVIEW Since:1993
LV:8.5 ,. ,.
Australia United States Nothing Selected My Blog


QUOTE (MartinGreil @ May 2 2008, 11:30 AM) *
Compare the upper loop with the lower loop.

I like it smile.gif I think it's initially going to be a little unintuative (with a tunnel build having the possibility of fewer elements than the iteration count) but I think it's a good idea. thumbup1.gif

--------------------


Tags
This content has not been tagged yet
Go to the top of the page
+Quote Post
ooth
post May 2 2008, 06:54 PM
Post #5


More Active
**

Member
Posts: 25
Joined: 19-October 04
Member No.: 858
Using LabVIEW Since:2000
LV:8.5 ,6.1 ,.
United States Nothing Selected Nothing Selected


I love that idea. I'm so sick of constantly making that case structure with the build array in it. It always takes up too much space in my diagrams.


Tags
This content has not been tagged yet
Go to the top of the page
+Quote Post
MartinGreil
post May 2 2008, 07:28 PM
Post #6


I want a LabVIEW icon under my name!


Member
Posts: 3
Joined: 23-April 07
Member No.: 8399
Using LabVIEW Since:1997
LV:8.2.1 ,. ,.
Germany Nothing Selected Nothing Selected


QUOTE (neB @ May 2 2008, 05:56 PM) *
... that is now availabe in the For Loop under LabVIEW 8.5 plus.

sorry, I have only LV8.2.1 installed.

(I had this idea in december 2006, and found that vi today on my old computer. As far as i know it was sent to NI but never got a reply.)

In the meantime, i tried out the "Evaluate LabVIEW 8.5 Online" : The Conditional Terminal of the FOR-Loop in LabVIEW 8.5 is completely different to my design. My FOR-Loop will stil run 100 loops, but on some loops the random numbers are not collected in the array.

greetings

This post has been edited by MartinGreil: May 2 2008, 07:56 PM


Tags
This content has not been tagged yet
Go to the top of the page
+Quote Post
pdc
post May 2 2008, 08:23 PM
Post #7


More Active
**

Member
Posts: 43
Joined: 2-November 06
Member No.: 6703
Using LabVIEW Since:1997
LV:8.5.1 ,8.2.1 ,6.1
Canada ca_quebec Nothing Selected


Just a quick idea for the discussion...

Attached Image

Attached File  ConditionalAppend.vi ( 12.29K ) Number of downloads: 84


Tags
This content has not been tagged yet
Go to the top of the page
+Quote Post
MartinGreil
post May 2 2008, 09:43 PM
Post #8


I want a LabVIEW icon under my name!


Member
Posts: 3
Joined: 23-April 07
Member No.: 8399
Using LabVIEW Since:1997
LV:8.2.1 ,. ,.
Germany Nothing Selected Nothing Selected


Sure, a SubVI is a solution - but keep in mind there are hundreds of types possible. The DBL was just used to make an example.
So finally your code has to deal with variant data type and set the SubVI to re-entrant enabled.

Option "re-entrant enabled" will lead to waste lot of memory when using lot of instances and big arrays.
And of course passing data to the SubVI is less efficient than having the data in the local vi.

You could improve your VI by passing the Loop's "N" to your SubVI. Then (only in the last iteration) give the array to the output. I don't know if LabVIEW can release the allocated memory during the loop of the last call.

The LabVIEW generated code would be much more efficient than using a SubVI.


Tags
This content has not been tagged yet
Go to the top of the page
+Quote Post
T_Schott
post May 4 2008, 09:55 AM
Post #9


Active
*

Member
Posts: 15
Joined: 13-February 08
From: Germany
Member No.: 10755
Using LabVIEW Since:2005
LV:7.0 ,. ,.
Germany Nothing Selected Nothing Selected


like this idea
control the data that will be indexed...


Tags
This content has not been tagged yet
Go to the top of the page
+Quote Post
rolfk
post May 4 2008, 12:34 PM
Post #10


Extremely Active
****

Premium Member
Posts: 976
Joined: 9-April 04
From: Rotterdam
Member No.: 349
Using LabVIEW Since:1992
LV:8.5.1 ,8.2.1 ,7.1.1
Netherlands Switzerland Nothing Selected


QUOTE (MartinGreil @ May 2 2008, 10:30 AM) *
Compare the upper loop with the lower loop.
Take a close look at the loop exit.



greetings from
martin


It would mean that every autoindexing output tunnel in a loop has an (optional) boolean.

Interesting idea but Ohhhh so unintuitive! One more of those features even LabVIEW cracks would only discover by accident after years of programming.


Rolf Kalbermatter


Tags
This content has not been tagged yet
Go to the top of the page
+Quote Post
Jim Kring
post May 4 2008, 05:02 PM
Post #11


Changing the world, one VI at a time.
*****

Premium Member
Posts: 1665
Joined: 22-October 02
From: San Francisco, CA
Member No.: 17
Using LabVIEW Since:1995
LV:8.2.1 ,8.5 ,7.1.1
United States us_california Nothing Selected My Blog My Gallery


QUOTE (MartinGreil @ May 2 2008, 08:30 AM) *
Compare the upper loop with the lower loop.
Take a close look at the loop exit.



greetings from
martin


That's a great idea. In fact, OpenG already has such a function called Conditional Auto-Indexing Tunnel.



This function started as an item on my LabVIEW wish-list, many years ago smile.gif

-Jim

PS -- Come on crelf and rolfk! Don't tell me that you guys don't know about this OpenG function wink.gif

--------------------
-----------------------------------------------------------------------------------------------------
| Book | OpenG | LAVA | Champion | VIPM | Builder | Blog | JKI |
-----------------------------------------------------------------------------------------------------


Tags
This content has not been tagged yet
Go to the top of the page
+Quote Post
crelf
post May 4 2008, 06:25 PM
Post #12


I'm a LAVA, not a fighter.
******

V I Engineering, Inc.
Posts: 3635
Joined: 13-October 03
From: Michigan, USA
Member No.: 181
Using LabVIEW Since:1993
LV:8.5 ,. ,.
Australia United States Nothing Selected My Blog


QUOTE (Jim Kring @ May 4 2008, 01:02 PM) *
PS -- Come on crelf and rolfk! Don't tell me that you guys don't know about this OpenG function


Ummm, errr, sure I do...

--------------------


Tags
This content has not been tagged yet
Go to the top of the page
+Quote Post
rolfk
post May 4 2008, 08:06 PM
Post #13


Extremely Active
****

Premium Member
Posts: 976
Joined: 9-April 04
From: Rotterdam
Member No.: 349
Using LabVIEW Since:1992
LV:8.5.1 ,8.2.1 ,7.1.1
Netherlands Switzerland Nothing Selected


QUOTE (Jim Kring @ May 4 2008, 01:02 PM) *
PS -- Come on crelf and rolfk! Don't tell me that you guys don't know about this OpenG function wink.gif


Actually I do but never used it so far. Reason for me is that it is in fact still unoptimized since you first create the entire array and then build it into the really desired array although this last step is happening rather optimal. In a lot of cases I end up doing more complex algorithmes anyhow that avoid the data memory fragmentation caused by the Build Array inside the case structure altogether.

Happened to help me reduce the runtime of a particular function at some point from about 50 seconds to far less than 1 second at one time. Of course writing that function took me also a bit more than the inverse proportional time of what the first approach with simple Build Array in a case structure had taken me. rolleyes.gif But considering that my customer has probably saved in this way I don't know how many hours of waiting for the calculation result since, I feel this was well invested development time and it was fun and educational too to do it.

The OpenG function would likely have been only slightly slower but would have taken up temporarely more than double the memory of my approach and that was at that time not unconsiderable in relation to the available physical memory.

Whenever I hear someone swear at how bad the speed of programs written in LabVIEW is I just smile and think about this. It's not that LabVIEW is slower than C in most cases or that it is that much harder to write well performing algorithmes in LabVIEW but the simple fact that it is a lot easier to write an algorithme in LabVIEW at all. Sometimes those algorithmes end up in a way that a C programmer would not even think about to do because he needs to deal with every memory allocation anyhow so is likely to look for an algorithme where he does not need do this all over in his code over and over again.

But the build in feature as suggested by the OP would be even more optimal than the OpenG function although of course not as optimal as the unconditional For loop auto indexing.

If I would be a LabVIEW engineer I would make that conditional auto indexing generate the same machine code as what is used for while loops. There the intermediate array is started of with some intial size and then whenever it gets to small the currently allocated size is doubled. At the end of the loop the array memory is resized to its really used size once more. This is the most optimal approach in terms of memory (re)allocations and data copying for generic situations where you do not know the finally needed size beforehand.

And one last note: I wonder when there will be a patent filed by NI for exactly this shifty.gif . From my understanding of patents it would not be valid since this idea has been published here prior to such a patent filing but who would be going to court with this?

Rolf Kalbermatter


Tags
This content has not been tagged yet
Go to the top of the page
+Quote Post
Aristos Queue
post May 5 2008, 01:36 AM
Post #14


LV R&D Envoy
*****

NI
Posts: 1188
Joined: 15-August 06
From: Austin, TX
Member No.: 5877
Using LabVIEW Since:2000
LV:8.5.1 ,. ,.
United States Nothing Selected Nothing Selected My Gallery


QUOTE (MartinGreil @ May 2 2008, 04:43 PM) *
Option "re-entrant enabled" will lead to waste lot of memory when using lot of instances and big arrays.
And of course passing data to the SubVI is less efficient than having the data in the local vi.
<snip>
QUOTE
The LabVIEW generated code would be much more efficient than using a SubVI.
The above assertions can all be said to be "sort of" true insofar as it depends greatly upon how the subVI is written. They are not true of all subVIs, even all reentrant subVIs, under all conditions. Specifically, I'm not convinced they would have to apply to the specific subVI under discussion if it were written correctly.
Attached Image

--------------------
"A VI outside a class is a gun without a safety. Data outside a class is a target."
--- A message from LabVOOP R&D


Tags
This content has not been tagged yet
Go to the top of the page
+Quote Post
TobyD
post May 5 2008, 03:51 PM
Post #15


Extremely Active
****

Premium Member
Posts: 366
Joined: 19-June 07
From: Everett, WA
Member No.: 8758
Using LabVIEW Since:2007
LV:8.5 ,8.2.1 ,.
United States Italy Nothing Selected


QUOTE (rolfk @ May 4 2008, 05:34 AM) *
Interesting idea but Ohhhh so unintuitive!



I don't think it is any more unintuitive than shift registers, conditional stop terminals on for loops, the "concatenate inputs" option on a build array node, feedback nodes, or auto indexing in general. I could go on. These are all features of LabVIEW that make life much easier/faster to use, but to a new wire worker looking at a block diagram they might not immediately make sense.

That said, once you understand how these features work, it quickly becomes second nature to implement them in your code.


Tags
This content has not been tagged yet
Go to the top of the page
+Quote Post

Collapse

> Similar Topics

    Topic Title Replies Topic Starter Views Last Action
No New Posts   1 David Boyd 1644 20th September 2007 - 01:11 PM
Last post by: Aristos Queue