LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Nugget - Using control references



@Ben wrote:

Mike Porter and I spoke off-line about how this technique can also act as front end to a DB (Is anyone shocked MP would like this idea Smiley Wink ) ?


.... to almost quote tst ...

Shocked??  Absolutely NOT!!.  I can't get that thought out of my mind..  I never dared share it fearing I would be stoned..  (as in getting rocks thrown at me..)

As a matter of fact, I am tempted to create not just the front end, but also the engine for a... DB.    Many years ago, during a summer job, I had to write a DB program.  That was before the DB program became popular from Borland  (now that has to trigger memories with old timers).  Ah... the good ol' days!  No MSuff crap..  Didn't need 2GB of RAM to run a program.. let alone load an OS. 

😄 😄 😄

OK let's see the spin-off potential nuggets from this one. 

- Using XML as an alternative to ini files

- Using HDF5 as an alternative to ini / config files  (and now why not DB??)

- Creating a database (engine) with LV  (probably already exists... I'm not talking about linking to SQL or Oracle or the such)

 

Now... isn't LabVIEW fun??!!!???  Can even use it to control robots!  and toy robots!!

LOL!  😄

Message 41 of 67
(4,372 Views)
I was playing around with some of the ideas presented in this thread and decided I try to write a object-oriented version of the control value < ---- > text file conversion. I currently have written a small framework that's capable of converting any control based on I32, DBL, Boolean, String, Array and Cluster to an XML. The XML parsing part need still to be done. I'll try to post the example here later when I've come up with the simplest way to implement the XML parsing.

Tomi
--
Tomi Maila
Message 42 of 67
(4,357 Views)
tst wrote "P.S. I did do a quick check on 8.5 and it seemed to work, but I wouldn't really expect it not to. "
 
Oh thank you so much!
 
Since the array read-write technique used is not very common, I fear that this technique (trick) could break in the process of upgrading LV. I would expect it to break durring a major update but there is always the possibility it will break in a minor update.
 
Tomi,
 
I'll be watching for your xml version. BTW: I am still studying OOP in the hopes that some day I will be able to appreciate all of your LVOOP work.
 
Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 43 of 67
(4,347 Views)
Ben,

On Figure 18 you make a recursive call by opening a VI reference in a loop. The performance will improve if you open the VI reference outside the loop and reuse the same instance in the loop, avoiding the overhead of the VI instance creation/destruction. You could also avoid recursion by pushing nested data in a queue and iterate until the queue is empty (but recursion so cool...)


Message Edited by JeanPierre on 08-28-2007 01:37 PM



LabVIEW, C'est LabVIEW

Message 44 of 67
(4,343 Views)

JPD wrote


On Figure 18 you make a recursive call by opening a VI reference in a loop. The performance will improve if you open the VI reference outside the loop and reuse the same instance in the loop, avoiding the overhead of the VI instance creation/destruction.


 

Well I may be confused because this is the first time I did re-cursive calls for anything other than just experimenting.

One thing that I never was clear on was if the instance of the VI opened with the re-entrant switch (8) create a new instance for every "call by reference".

So its sounds like it is the Call by reference that actually creates the unique data space.

I will have to think more about this.

Thank you,

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 45 of 67
(4,331 Views)
(Edit time is over...)
You can also Defer Panel Update on the VI Owner of the control to avoid to display array flickering when resizing displayed elements on changing the displayed element.


LabVIEW, C'est LabVIEW

Message 46 of 67
(4,347 Views)


@Ben wrote:
....

Well I may be confused because this is the first time I did re-cursive calls for anything other than just experimenting.

One thing that I never was clear on was if the instance of the VI opened with the re-entrant switch (8) create a new instance for every "call by reference".

So its sounds like it is the Call by reference that actually creates the unique data space.

I will have to think more about this.

Thank you,

Ben




The option 8 on Open VI Reference is useful only if you intend to use a reentrant VI using the Run VI method.

Dataspace of a reentrant VI is allocated with Open VI Reference and deallocated with Close Reference.

Message Edited by JeanPierre on 08-28-2007 02:09 PM



LabVIEW, C'est LabVIEW

Message 47 of 67
(4,344 Views)

THank you for the replies JPD!

So if I have a data structre like

Cluster

       array of cluster

              with nested cluster inside it

I would envision my call chain as

 

Cluster_VI >>> Array_VI >>> Cluster_VI >>> Cluster_VI

So would just openeing one instance of the "Cluster_VI" sitll work?

JPD,

THank you for pointing out the "defer FP" to stop the flicker. The uberNugget was already to large when I concidered mentioning that point.

BTW: You should not feel obligated to reply (unless you really want to ).

If someone else can clear this up I would be very happy. Smiley Very Happy

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 48 of 67
(4,337 Views)


@Ben wrote:

THank you for the replies JPD!

So if I have a data structre like

Cluster

       array of cluster

              with nested cluster inside it

I would envision my call chain as

 

Cluster_VI >>> Array_VI >>> Cluster_VI >>> Cluster_VI

So would just openeing one instance of the "Cluster_VI" sitll work?

````

No you have to open a new VI reference at each recursion depth.
And unfortunately, the last time I checked the recursion chain A_VI >> B_VI >> A_VI is not allowed, only A_VI >> A_VI >> A_VI is possible.
The workaround is to code the functionality of A_VI and B_VI into a single VI AB_VI with some logic to select which code to execute.


LabVIEW, C'est LabVIEW

Message 49 of 67
(4,325 Views)

Thank you once again JPD.

You wrote;


And unfortunately, the last time I checked the recursion chain A_VI >> B_VI >> A_VI is not allowed, only A_VI >> A_VI >> A_VI is possible.


Well I did not know that, so I did exactly that in the example I posted (provided the data structure calls for it).

I have also tested doing A >>> B >>> A >>> B as far I was willing to test it.

I have single stepped it through those calls (in LV 8.2.1) to verify it is doing exactly that.

Warning:

Do NOT abort a VI while single stepping into recursive calls. LV will hang forever if you do. Better to get out of the calls and then abort.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 50 of 67
(4,321 Views)