LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Micro-Nuggets !!! ~~~~ Post 'em if you got 'em


@altenbach wrote:

Can you elaborate on your diagram comment for the need of two FOR loops. Since your are indexing over the same array, shouldn't the iterations always match?


Argh! Smiley Mad Thanks Altenbach. That was a modified older file. It "works" so I didn't think twice after I ran it then decided to post it. There were a few things missing in the old one as well.

 

Let's try again....

 

Preview New.png 

 

 

 

.

Richard






Message 61 of 361
(10,630 Views)

Here's a more complete list which was generated using a private method. It looks like there are ~280 classes in total and about 140 of those are BD classes. The BD classes seem to occupy the upper bit of an I16.

 

Classes.png


___________________
Try to take over the world!
0 Kudos
Message 62 of 361
(10,598 Views)

What I was trying to provide was a way to view the ClassID, the ClassName, and a picture of the item in question. Below is a representation of what I was trying to achieve by placing the items directly on the BD.

 

There are some surprises in there....  Is it intuitive that "GenClassTagRefConstant" is the ClassName for for the System Host?

 

Why is an Expression node just "Node"?

 

Decimate 1D Array = "Bundler"

 

Array To Cluster = "ArrayToCluster" but...Cluster To Array = ""Function" Smiley Mad

 

BD List with Pics.png

 

Richard






0 Kudos
Message 63 of 361
(10,560 Views)

Nice.  You're probably better off using Traverse for GObjects though, which will recurse into any structures.

 

 

 

Also, there are some Class IDs which can have multiple Class Names - for example, all the Express Nodes and XNodes have the same ID but different names (at the moment, your list of Names and IDs might not be the same length, or match up properly).

Message 64 of 361
(10,523 Views)

I see the question of stopping multiple loops posted a lot. Here is the most recent example - stop button do not work.

 

This micro nugget has the following goals:

 

  1. Demonstrate the usage of libraries and access scope
  2. Demonstrate the usage of Functional Global wrapper VIs
  3. Demonstrate usage of these concepts to create a simple API to shut down multiple loops

The assumption of this micro nugget is that the behavior of an uninitialized shift register is understood. I will not attempt to outdo Ben on his Community Nugget. If a novice LabVIEW user is getting to the point to where he or she needs multiple loops, this is a good time to learn about the concepts presented.

 

There are a lot of methods to signal loop shutdown and this is probably not the best. But it is probably the most simple acceptable way. It uses a Boolean Functional Global Variable. It also demonstrates how I like to privately scope FGVs in a library with public wrappers for the API.

 

Privately scoped items can only be used by other items in the library. In this example the FGV is only available to the wrapper functions which are Publicly scoped. You can modify the private items any way you want. After testing the public API you can redeploy the library and your applications that use it will work. If the applications directly use the FGV they would break if you modify it or remove it.

 

To change access scope you right click on a library item and select Access Scope. There are three - Public, Private and Community. Community scope will not be discussed here.

 

In a real application I would probably use a shutdown message with a notifier or queue instead. But I wanted to demonstrate this particular technique. I also want you to understand that since the FGV is private it could be removed and replaced with a notifier or other technique without breaking the applications which use the library. You can modify the inner workings of the API but the inputs and outputs stay the same.

 

I always call any privately scoped FGV or Action Engine "core.vi". The actions for this one are:

 

  • Initialize - sets the global stop to false
  • stop - sets the global stop to true
  • check - returns the global stop value

I always set the command enum to input required. Here is the Global Stop core.vi

 

Global Stop.lvlib_Core_BD.png

 

I created three wrapper VIs - one for each action. I do this for several reasons.

 

  • I do not like the command constant to be publicly exposed
  • It is easy to accidentally modify the constant when moving it if you use the autotool
  • I do not want to see the command constant. i would rather have an icon indicate the function
  • I do not want the constant taking up valuable space on the block diagram. I am a real neat freak when it comes to the block diagram!
  • I like to have only the inputs and outputs of the function that are needed for that function. A complex action engine can have several terminals while the individual functions only need one or two.
  • And most importantly I want to be able to change how the functionality is implemented and know that I only have to test the wrapper VIs. I could change this to use a notifier instead of a FGV sometime in the future. My applications will be none the wiser.

Here are the three wrappers.

 

Initialize

 

Global Stop.lvlib_Initialize_BD.png

 

Stop

 

Global Stop.lvlib_Stop_BD.png

 

Check

 

Global Stop.lvlib_Check_BD.png

 

I have a test VI to demonstrate the use of this library.

 

Test Global Stop_BD.png

 

Attached is a project containing the Test Global Stop VI and the Global Stop library along with the two SubVIs in LabVIEW 8.2 format.

 

=====================
LabVIEW 2012