LAVA Forums Buy cool LAVA gear Forums RSS Feed

Welcome Guest ( Log In | Register )

> Related links

Check out our VI Scripting Code Repository Files and visit the LabVIEW Wiki VI Scripting article


Tags
(This content has not been tagged yet)
2 Pages V   1 2 >  
Reply to this topic Start new topic
> Automatic Recursion, Recursive Brat
Norm Kirchner
post Oct 13 2006, 03:07 PM
Post #1


Extremely Active
****

NI
Posts: 607
Joined: 8-December 03
From: Dallas, Texas
Member No.: 208
Using LabVIEW Since:2000
LV:8.6 ,8.2.1 ,7.1.1
United States us_texas us_ohio My Gallery


I just had one of those eureka! moments when pondering the implementation of recursive calls.

I know that it does not take much effor to recurse a VI
Attached Image

But what about a vi that automates the process for you and wraps it up into a neat little sub-vi

here is my vision which I don't have time to complete but I belive that the community could easily wrap their wires around

Create a VI that when dropped into a BD will do the following
  1. Create a sub-vi in the same location as the parent w/ some special namespacing
  2. drop the necessary blocks for recursion: see picture above
  3. determine the parents connector pane and set the sub-vi's pane to the same along w/ the static pane reference
  4. Copy the parents icon and do a glyph edit to mark as recursive
  5. then do a replace on the parents BD of the dropped recursion vi w/ the one just created
So I belive what would happen is the parent BD would have a sub-vi which looked almost identical which allowed for recursive calls!!!!

whatdaya think!!!

--------------------
Norman J. Kirchner Jr.
Automation Software Engineer

~,~ The Captain Was Here
Premium Blend


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
Ad
post Oct 13 2006, 03:07 PM
Post #















Tags
(This content has not been tagged yet)
Go to the top of the page
Quote Post
crelf
post Oct 13 2006, 03:46 PM
Post #2


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

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


That's just crazy enough to work!

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


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
Norm Kirchner
post Oct 13 2006, 03:52 PM
Post #3


Extremely Active
****

NI
Posts: 607
Joined: 8-December 03
From: Dallas, Texas
Member No.: 208
Using LabVIEW Since:2000
LV:8.6 ,8.2.1 ,7.1.1
United States us_texas us_ohio My Gallery


I'm thinking also that we could use express technology to accomplish this because it does the creation of a sub-vi for you w/out needing to make new files.

For those of you who are savvy to the express world. We have the ability to modify the source when running the configure vi. So when the express is configured (either automatically when dropped or when told so by the user) would be to modify the source VI to have the same inputs as the caller and drop the vi-server recursion fuctions in the guts.

oooooh I'm liking this.

--------------------
Norman J. Kirchner Jr.
Automation Software Engineer

~,~ The Captain Was Here
Premium Blend


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
robijn
post Oct 13 2006, 04:08 PM
Post #4


Very Active
***

Member
Posts: 165
Joined: 9-February 05
From: region Eindhoven, the Netherlands
Member No.: 1555
Using LabVIEW Since:2008
LV:7.1.1 ,8.5.1 ,8.2.1
Netherlands Nothing Selected Nothing Selected


QUOTE (njkirchner @ Oct 13 2006, 05:52 PM) *
For those of you who are savvy to the express world. We have the ability to modify the source when running the configure vi. So when the express is configured (either automatically when dropped or when told so by the user) would be to modify the source VI to have the same inputs as the caller and drop the vi-server recursion fuctions in the guts.

Hey that sounds very interesting ! So you can create the correct connector pane constant ! I've been waiting for that for quite some time...
Can you create such a constant given a non-typed VI ref ?

Joris


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
PJM_labview
post Oct 13 2006, 04:18 PM
Post #5


Extremely Active
****

JKI
Posts: 624
Joined: 19-June 03
From: Bay Area, CA (USA)
Member No.: 121
Using LabVIEW Since:1998
LV:8.5.1 ,8.6 ,8.2.1
United States France Nothing Selected My Blog


QUOTE (njkirchner @ Oct 13 2006, 08:52 AM) *
I'm thinking also that we could use express technology to accomplish this because it does the creation of a sub-vi for you w/out needing to make new files.

For those of you who are savvy to the express world. We have the ability to modify the source when running the configure vi. So when the express is configured (either automatically when dropped or when told so by the user) would be to modify the source VI to have the same inputs as the caller and drop the vi-server recursion fuctions in the guts.

oooooh I'm liking this.
I think an externalNode (XNode) will be better for that, because, as you modify the connector pane of the parent, the connector pane of the child (the recursive call subVI) should modify itself as well.

Edit: Another benefit is that you would not even need to create a SubVI in your project folder. The code would be right there behind the XNode.

PJM

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

Got VIPM?

JKI . VIPM . EasyXML . OpenG . LAVA . Builder . Blog



Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
Michael_Aivaliot...
post Oct 14 2006, 02:48 AM
Post #6


Confucius say: Crowded elevator always smell different to midget
Group Icon
*****

Admin
Posts: 2402
Joined: 13-October 02
From: Planet Earth
Member No.: 2
Using LabVIEW Since:1994
LV:8.5 ,8.2.1 ,7.1.1
Greece Canada United States My Blog My Gallery


QUOTE (njkirchner @ Oct 13 2006, 08:07 AM) *
whatdaya think!!!
Sounds great! Show me the code.

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


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
Jim Kring
post Oct 15 2006, 01:40 AM
Post #7


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

JKI
Posts: 1717
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 (PJM_labview @ Oct 13 2006, 09:18 AM) *
I think an externalNode (XNode) will be better for that, because, as you modify the connector pane of the parent, the connector pane of the child (the recursive call subVI) should modify itself as well.

Edit: Another benefit is that you would not even need to create a SubVI in your project folder. The code would be right there behind the XNode.

PJM


I like this idea!

--------------------
-----------------------------------------------------------------------------------------------------
| 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
Aristos Queue
post Oct 15 2006, 02:28 AM
Post #8


LV R&D Envoy
*****

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


QUOTE (PJM_labview @ Oct 13 2006, 11:18 AM) *
I think an externalNode (XNode) will be better for that

Quick safety tip for all you who seek to peek under the skirts of LV: external nodes and XNodes are not the same thing, though they both serve the same goal. External nodes were LabVIEW R&D's first attempt at nodes that script themselves. They have issues and have been supplanted by XNodes, our second attempt. XNodes are better, in theory*.

*"In theory", from the Latin "en theos" meaning "with God" or, more specifically, "assuming He Who Built The System doesn't change His mind." smile.gif

--------------------
"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
Norm Kirchner
post Oct 15 2006, 10:15 PM
Post #9


Extremely Active
****

NI
Posts: 607
Joined: 8-December 03
From: Dallas, Texas
Member No.: 208
Using LabVIEW Since:2000
LV:8.6 ,8.2.1 ,7.1.1
United States us_texas us_ohio My Gallery


QUOTE (robijn @ Oct 13 2006, 11:08 AM) *
Hey that sounds very interesting ! So you can create the correct connector pane constant ! I've been waiting for that for quite some time...
Can you create such a constant given a non-typed VI ref ?



I would find it hard to beilve that w/ all the scripting tools out there that it would be impossible... although I have not specifically tried yet.

anyone.... Bueller?....Bueller??

--------------------
Norman J. Kirchner Jr.
Automation Software Engineer

~,~ The Captain Was Here
Premium Blend


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
AdamRofer
post Oct 23 2006, 07:46 PM
Post #10


More Active
Group Icon
**

WIKI Moderator
Posts: 47
Joined: 29-June 05
From: Santa Cruz, CA
Member No.: 2496
Using LabVIEW Since:2000
LV:8.5 ,6.1 ,7.1.1
United States us_california Nothing Selected


Bueller here.
http://xnodes.lavag.org/externalnodes/recursion.html

I desire any and all feedback, this was a quick-as-possible venture that turned out to be quite nasty.

Source code is open for all of those curious, especially since the source code directly touts my abilities as a scripter.

Bonus features:

- Manual construction of a constant by typedef number array (that stupid ref is *not* an object creatable by the Create Object function!)
- Icon tweaking (a shadowed "R" -- which is fully customizable)
- Manual internal reconstruction upon double click (if necessary, which I don't think it should be)

Basically it's all that was talked about...just the code looks impossibly arbitrary because it took me a lot of trial and error to find out what LabVIEW would let me do.

Now if only I could convert this VI directly into beer_mug.gif

thumbup1.gif

- Adam Rofer

--------------------
Adam Rofer


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
Mike Ashe
post Oct 23 2006, 10:18 PM
Post #11


Instant Human, just add coffee
****

Premium Member
Posts: 889
Joined: 31-January 03
From: Waterford, CT USA
Member No.: 45
Using LabVIEW Since:1992
LV:8.2.1 ,7.1 ,8.0.1
United States us_connecticut us_washington


Nice idea. I think your example of factorial might take a second look. Maybe I did something simply wrong, but I built your example, exactly as shown and it returns an answer of 0. Makes sense, you keep subtracting one each time, til you get to zero, then pass out the eventual zero result and multiply. What am I missing here?

--------------------
*************************************************************
"Always listen to the experts, they'll tell you what can't be done, and why.
Then go do it."
~The Notebooks of Lazarus Long (by Robert Heinlein)
*************************************************************


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
AdamRofer
post Oct 23 2006, 10:22 PM
Post #12


More Active
Group Icon
**

WIKI Moderator
Posts: 47
Joined: 29-June 05
From: Santa Cruz, CA
Member No.: 2496
Using LabVIEW Since:2000
LV:8.5 ,6.1 ,7.1.1
United States us_california Nothing Selected


One thing I've noticed is that frames sometimes don't refresh properly, so if you have a problem finding my previously referenced item (and you've been to my documentation site before) you can simply go here:

http://xnodes.lavag.org/externalnodes/recursion.html


QUOTE (Mike Ashe @ Oct 23 2006, 03:18 PM) *
Nice idea. I think your example of factorial might take a second look. Maybe I did something simply wrong, but I built your example, exactly as shown and it returns an answer of 0. Makes sense, you keep subtracting one each time, til you get to zero, then pass out the eventual zero result and multiply. What am I missing here?


I took the code directly from NI's example:
http://zone.ni.com/devzone/cda/epd/p/id/1827

Check a few things, like if your VI is re-entrant. That needs to be the case or else my recursion thingy won't do anything but send back the default values for whatever outputs.

- Adam Rofer

This post has been edited by AdamRofer: Jan 2 2008, 11:01 PM

--------------------
Adam Rofer


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
Mike Ashe
post Oct 23 2006, 10:35 PM
Post #13


Instant Human, just add coffee
****

Premium Member
Posts: 889
Joined: 31-January 03
From: Waterford, CT USA
Member No.: 45
Using LabVIEW Since:1992
LV:8.2.1 ,7.1 ,8.0.1
United States us_connecticut us_washington