LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Case study: "Large?" labview programs flooded with different VIT's

I have learned to generally only use INI files for basic environment settings, not for storing true configuration information, like what hardware to use or what data to log. The LabVIEW INI Configuration API is very nice to use at first, but it doesn't scale well, especially when you need some type of hierarchy in your system.

 

XML is a nice format, but the LabVIEW XML DOM functions have a learning curve, and really seems to require having some tools built on top of it for basic navigation and editing. And these functions don't work on RT. The LabVIEW XML Schema for flattening arbitrary objects to XML is dead-simple, but the XML isn't always very human-friendly, and doesn't have much advantage over a binary file in my opinion.

 

If you want to make the investment to add additional tools on top of the LabVIEW XML Dom Parser or some equivalent XML library, it will suit you very well as your application expands, but this is a significant investment. I would recommend starting with simple binary configuration files and a simple library to access the data inside them.

 

 

Jarrod S.
National Instruments
0 Kudos
Message 11 of 22
(1,108 Views)

Thank you all for responses. Here are some thoughts:

 

Ben: Yup after what Ive seen LVOOP is the way to go. Im just beginning learning it in spare time. at first all thoes huge phyton snakelike wires scared me a bit tho Smiley Very Happy . Are there any types of standard Labview projects out here where OOP wouldnt fit inThe plugin structure using OOP I must look into. Wel the reson is that when updating one plugin that uses some newer version of a VI, the other would malfunction. I do not wish to let customers update all plugins (gets a lot of CD's and stuff to send) each time I update the main library.but perhaps this cant be avoided?

 

Second, thanks for testing all thoes VITs and running them. Now the thing Ive noticed is the following:

 

When trying to launch to many VITs simultaiously youll get miracusly loss. Now why I dont know, but lets say that in this case the cpu booms up becaurse the VIT starts running its init procedure right away. The how the init case is built will decide the heavyness. the CPU could boom up, and Ive seen it goes slower and slower.. Youll end up somehow having lesser items in memory than youve called for (without getting any errors). if you autonummerate the names you can see where. To solve this I needed to do a sequential start up - knowing when each is getting started and let it reply when done. The same yields for stopping all VITs (by queue) at the same time. (using a for loop or something). Actually some of the VITs simply wont shut down, as like nothing had been recieved at their queue input. Since my CPU also boomed here, I took it as that created a dataloss sometimes. Instead, again, same as starting them, stopping them in sequence did the trick. Smiley Tongue Instead of using queus perhaps this should not happen with an user-event? (but then you lose the opportunity to shut down a single VIT, and still I think at my computer the cpu gets bananas) Smiley Surprised

0 Kudos
Message 12 of 22
(1,084 Views)

F. Schubert wrote:
You can use the property AllVIsInMemory to get the clones. Thus you might (see Ben's observation on a 780 limit) be able to count them.
Using the names in the VI Server should also allow you to access the state to see wether it's still running.

Felix

In one CGI project I did this so that the server administrator could take control of a VIT in memory and its user interface (and also for kicking out people) and seeing their status - in case of some operator goes bananas controlling stuff or something hehe. But the procedure here using this for a health monitor would be to get out the names, take out the names that are the VITs (by checing the VI names in the array) and then check towards a plugin if someone is missing, or also, if a VI hasnt been cleared from memory, but is has been stopped somehow, knowing the status of all VITs in memory. hmm, first thought would be this could be a quite recourcefull task? I'll give it a shot and try to look at the recources Smiley Wink

0 Kudos
Message 13 of 22
(1,084 Views)

Two updates:

 

I was wrong re: not being able to run 1000 instance of the code I linked to earlier. NI has confirmed that it does run.

 

Using LVOOP

 

Parents have no knowledge of thier children so new children can be deployed to be used in an executable with any changes to the parents. THat means new stuff can be added to an exe without changing the exe.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 14 of 22
(1,065 Views)

Ben wrote:

Two updates:

 

I was wrong re: not being able to run 1000 instance of the code I linked to earlier. NI has confirmed that it does run.

 

Using LVOOP

 

Parents have no knowledge of thier children so new children can be deployed to be used in an executable with any changes to the parents. THat means new stuff can be added to an exe without changing the exe.

 

Ben


Thanks for the help, Ben. Then Ill be looking at a good and nice rewriting to LVOOP this year and get my mind on that. The software could need some repainting at some early stages in the hierarchy so this is just going to be a hell of a lot fun! Smiley Tongue

0 Kudos
Message 15 of 22
(1,062 Views)

If you are like me, it will take a couple of re-groups to get to the other side of teh paradigm shift. But now that I have taken the plunge I find myself LVOOPing all over the place.

 

So expect to have to re-write some stuff when you discover new features of LVOOP.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 16 of 22
(1,050 Views)

Just began LVOOPing here 😛 still trying it out , but is it normal that you end up with a lot of VIs or am I doing stuff all wrong? im getting pretty many, hehe, very juicy thoes automated create VI functions you can set on your class, am flooding out a lot of them - and even the Icon gets updated!!!! only thing you need to add is text!! 😛 😛

 

And you can even customize the wire!! Have now everything from rattlesnakes to fat boa's in here. looking good 😛

 

just started on a hobby project instead of starting to redo all software without having any OOP experience hehe: LabStein 3D - the sequel to wolfenstein 3D, based on UDP multiplayer (no AI or anything). If it is going to succeed - I dont know. If yes, Ill post it, but it is prob. going to look pretty bad.. am still feeling theres lots more to explore in the OOP world..

Message 17 of 22
(982 Views)

Corny wrote:

Just began LVOOPing here 😛 still trying it out , but is it normal that you end up with a lot of VIs or am I doing stuff all wrong? im getting pretty many, hehe, very juicy thoes automated create VI functions you can set on your class, am flooding out a lot of them - and even the Icon gets updated!!!! only thing you need to add is text!! 😛 😛

 

And you can even customize the wire!! Have now everything from rattlesnakes to fat boa's in here. looking good 😛

 

just started on a hobby project instead of starting to redo all software without having any OOP experience hehe: LabStein 3D - the sequel to wolfenstein 3D, based on UDP multiplayer (no AI or anything). If it is going to succeed - I dont know. If yes, Ill post it, but it is prob. going to look pretty bad.. am still feeling theres lots more to explore in the OOP world..


When people tell me "I wrote a app with over 3000 VI's!" I reply "Was it LVOOP?"

 

Part of the discipline that VLOOP enforces results in a lot of accessor* methods for all of the private data.

 

At first I thought this was needless and a bit of a pain. But the tools (as you observed) are great at creating teh accoessor methods so not much of an issue there.

 

The formal rule (not really formal unless it is written down huh?) enforced to protect the private class data ends up being a real asset as the Class structure grows and allows for robustness. Let's see if I can outline the contrast.

 

In tradional LV:

 

We can carry our data around in a cluster wire (no diff there) and can bundle or unbundle as we choose. No need to use a sub-VI to get at the data.

 

In LVOOP

 

WE still carry our data around in a cluster but it is a special cluster that can hold any type of data we want (big benefit! allows same code support many needs) but we can't just bundle and unbundle willy-nilly. We have to use accessors to get at the data in the wire.

 

So at this point the two approaches are mostly the same but LVOOP makes you create and use accessor VIs. So this looks like extra over-head "why bother?".

 

Dynamic Dispatching!

 

DD is LVOOP doing at run time what Polymorphic VIs let you do at development time. THe sub-VI that are called can and will change depending on the actuall Class type running through the wires. So rather than coidng up multiple version of a VI to handle different conditions, LVOOP will call the sub-VI (method) that is appropriate for the Class.

 

Enough of that!

 

You are doing a wise thing by trying this out on something safe where nobody will get hurt. LVOOP is shaping up to be a valuable tool that is currently only limited by my ability to weild this weapon.

 

Have fun!

 

Ben

 

 

*Accessor - In LVOOP we are not allowed to directly touch the private class* data. An Accessor in LVOOP is a sub-VI that accepts Class data as an input and bundles or unbundles the data in the Class data.

 

** Private Class data is a formal term for the data inside the cluster used to hold the data required for the Class. Private Class data for any Class consist of the data described by it's cluster plus the private data of all of it ancestors. Unlike normal cluster in LV, private data does not have to have any fields in it. Example: A "Tab_Delimited" spreadsheet file class that inherits from a "Text_File" Class can use file reference in the Text_File" Class by uisng the accessors availabel in the "Text-File" Class. THe code to access open close the file ref can all be the same.

 

*** Class is a library that has a cluster that defines the private data and a collection of sub-VIs that realize the methods the Class exposes.

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 18 of 22
(943 Views)

Ben wrote: 

Dynamic Dispatching!

 

DD is LVOOP doing at run time what Polymorphic VIs let you do at development time. THe sub-VI that are called can and will change depending on the actuall Class type running through the wires. So rather than coidng up multiple version of a VI to handle different conditions, LVOOP will call the sub-VI (method) that is appropriate for the Class.

 

Enough of that!



Dont stop! (and thanks a lot for the help!)

 

I must read more on Dynamic Dispatching, this sounded pretty amazing!

 

Today (besides taking the CLAD exam 😛 - time to get some certification, CLD is next up, and hopefully the CLA after that) I wrote the start of LabStein 3D. I focus on the least CPU time that is needed due to I havent really found out how much recources the 3D environment is going to take, so I only use "-1" on timeouts whereever I can and change them rather dynamically. (thought this was the easiest)

 

Now Ive a mixture of good old programming style and classes in here (it looks like a zoo atm. (not spagetti, but more to many big wires to class references, havent really found out how to avoid this))

 

What I did is the following:

 

1 - Event state machine for user controls: "mouse down"; "mouse up"; "key down", "key up" and ofcourse "mouse postion change".This part will also initialize the 3D environment (loading) and shutdown.

 

2 - Queue state machine for handling the configured movement controls and calculating new X and Y positions on the map, depending on the angle of the mouse and where the person is looking

 

3 - Queue state machine for handling mouse buttons (primary fire or secondary fire) and adding recoil on the mouse Y position if button is not released (depending on the configured weapon speed and recoil amplitude (simple sinewave).)

 

But Im not sure if I have choosen the right approuch to my classes.

 

Here are the folling classes I untill now have created:

 

1 - Person class. Holds the calculated X,Y coordinate of the person and what angles it is currently looking (Y angle goes from -PI/2 to PI/2 and X angle from 0 to 2PI) It also holds the currently equiped weapon (not yet created). Z position is not yet linked up due to that this is decided by the 3D environment (and from there calculated by the X and Y positions)

2 - Controls class: Holds the configuration of the movement keys. I found out that I needed to use the ScanCode to do this, so I know what button is realesed (otherwise it wont support multiple buttons pressed together and knowing what buttons are realeased from time to time).

3 -  Person config class: Holds the configured mouse sensitivity for X direction and one for Y direction. Also holds currently movement speed multiplier 

4 - Main class. Now normally all my references to queues, notifiers and userevents are put in a functional global. But now Ive put it in the cluster in the class. Is this a correct way of doing it?? its still a mix between a lot of stuff in here you see 😛

5 - Weapon class: what weapon that is selected. holds currently only primary fire rate, secondary fire rate, primary recoil multiplier, secondary recoil multiplier

 

Do you have any tips if Im on the right path and am using thoes classes correctly and for the right purpose (still in learning progress here!!)? I have no idea, but its getting a bit mixed up all together here. Otherwise it all works like a charm, I can move around correctly in the right direction, and aim in the right direction (well, by looking at all the numbers, the 3D part am I beginning on now, trying to import some 3D files (and hoping it wont be slow) so I can link up on edges and Z position, and atleast move around using farward/backward/strafe left/strafe right and use to mouse for turing and looking, atleast in a 3D environment.

 

One other thing, if anyone read this far - this program is going to consist of a lot of syncronized stuff and parralelism (thats why I choose this hobby project to learn and train OOP), how can I easy share data between all these program parts using LVOOP ?!? what is the best solution if there is any?(am hoping for a turbowild OOP solution 😛 )

 

(To put it this way, on other programs where there are a lot of numbers Ive never been fond of putting them in arrays of clusters, and rather make functional globals for divided arrays of one datatype, where the indexes hang together, but in LVOOP your stuck to using "clusters"? will that affect data efficiency in larger stuctures? (like an "array" of an class or something).

 

 

 

 

0 Kudos
Message 19 of 22
(921 Views)

Breakthrough:

 

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

** Private Class data is a formal term for the data inside the cluster used to hold the data required for the Class. Private Class data for any Class consist of the data described by it's cluster plus the private data of all of it ancestors. Unlike normal cluster in LV, private data does not have to have any fields in it. Example: A "Tab_Delimited" spreadsheet file class that inherits from a "Text_File" Class can use file reference in the Text_File" Class by uisng the accessors availabel in the "Text-File" Class. THe code to access open close the file ref can all be the same.

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

 

Well, havent yet lookup up on the dynamic dispatching stuff, but I finally saw the great advantage. think Ill need to re-think my classes, and look some more into all that inherite stuff. perhaps draw something, so i can make them all link together. but this still doesnt really solve my thing about getting the same class over into syncronized paralell tasks "OOP-ish" and that can change data somewhere in the "bloodline" of the class inheritage, and that this inheritage also is updated in another paralell task? (weird sentence 🙂 ) Ther ewill be here in this case only one writer per object in the "bloodline" - but several readers. (still hoping for a unknown OOP solution)

Message Edited by Corny on 01-26-2010 07:19 PM
0 Kudos
Message 20 of 22
(916 Views)