Community Nugget Series: Applicatio​n Developmen​t- Installmen​t 1

Installment 1: Code by intention and basic code components
In
this Nugget series we will discuss application development, the
different ways we use to access data and information, develop a GUI that
has Controls, Indicators and other front panel objects accessable from
sub.vi's in multiple ways and explore a software developers approach to
LabVIEW without OO but exposing OO concepts. I'll be starting with
basics and moving to a real-world app designed specifically for Test
Automation.  Many of the concepts have wide ranging application but as
this is my first "Nugget" and "Series" I'll chose to speak from my
strengths.  I hope you all forgive me.
So lets show how to start:  I do it thusly
NOTE:
The vi hasn't even been saved yet!  The FP and BD are blank (OK - Use a
template if you want to save time but for this demo I'm starting from
scratch)
This is where software starts, with the end
user(s) firmly in mind!  <Sea Story> I grew up as an Electronics
Technician.  One day a test instrument rep demo'd a new o'scope with
advanced math functions.  We were impressed with the capabitities -
untill it took 5+ minutes to perform the operations.  Automate that!
[prompt user "please wait while device X does some math.  Ensure
sliptick oil resivour remains above "critical.""]   We called it "Same
Day Display."  The instrument MFG did not think about the end uses for
the product when archetecting the system.  <
Let's not do that here.  
Overall Achietecture: 4 main interlocking Queued P-C loop vi's
defined as: (If I may borrow from a business case to aid visualization)
Corporate Communications ( CC or GUI):
Executive:
Operations:
Accounting:
Each of these loops Consumes exactly 1 Queued loop:
1:
CC is primarrilly an Event Loop. After initialization it responds to FP
events.  These events can be caused by direct user action or by
indirect actions when something in the application generates an event
the GUI needs to respond to. It produces the "Executive" Queue and may
generate events.  It keeps the user informed and happy.   It is the
primary abstraction layer between the developer and the user.  If the
user can do it CC needs to respond - If the developer expects the user
to do something it Must be intuitive or explained by Tip Stips and / or
on screen instructions.
2: Executive is a QSM
(Queued State Machine) it consumes the "Executive" Queue, generates the
"Operations queue, and may generate events for CC.  This is the main
abstraction layer between the developer and the application
enviornment.  In this demo we will perform "Tests" defined as a sequence
of things do much like the tasks your manager asks you to take to
acomplish an objective.  Its the manager scheduling how when and what to
do and has a really great Admin department that knows the business,
what can be done by the Ops dept and has a list of activities that
should be performed to satisfy the customers (yep! sequence files!)
We'll get to those in another nugget in the series!
3:
Operations is another QSM it consumes the "Operations"
Queue, generates the "Accounting" queue, and may generate events for CC
.  This is the main abstraction layer between the developer and the
system components or HAL (Hardware Abstraction Layer).  All interaction
between the application and other resources (except the file system and
KVM) takes place here.  Again- we'll save that for another nugget.
4:
Accounting is another QSM it consumes the "Accounting"
Queue, generates "Executive" queue, and may generate events for CC . 
Its job is to let the Executive know what the result of the operations
are so managemant can make an informed desicion on what to do next. And
it files reports in whatever format the Admin assistant's policy says to
do it in.
Each of these four main functions exist in all applications and all LabVIEW code.  Here is CC GUI A.vi after saving 
the
GUI responds to user clicks of "stop"(Tip Strip Val ="Press to stop
this vi ") and the vi changes state on the next loop iteration.
Executive
functions are encapsulated in the while loop itself Management is
simple: "Unless the last operation was True do the same thing again" (and the constant 10 is our admin assistant!!!! change it and the app behaves different)
Operations
"list of things the vi knows how to do" is limited to Update i, Wait
(n)mSec and (AN,D not then, no data dependancy so we are multitasking!)
read Stop
Accounting is in the condition terminal reporting the value of
stop- and we chose not to report anything- could have reported Array of
Stop, Last i, or any of the values we see either to the FP, any file
whatever!  just illustrating a point.
Our requirements a a bit more detailed and we'll get back to the GUI next nugget:GUI FP object encapsulation.
Jeff

F. Schubert wrote:
Thanks for this nugget. The business case model looks interesting. I'm looking forward to see how this will evolve.
As a side note, I always like graphical sketches. So the basic idea of the interaction between the business entities could be drawn using boxes and arrows.
Felix
As ususal you and I are on the same page.
These images ...
and
appear im the documents I posted in this thread where I talked about doing the design first (consistancy).
The high level organizational, interaction diagrams are what I try to sketch up mentally during kick-off meetings. I use a variety of methods to get the information I need for these diagrams depending on what I know going in and the nature of the customer but... I don't let the meeting end until i have a picture tht models a system that meet the neeeds.
The diagrams doc what the customer wants, splits up the work into clean concise chunks, establishes responsibilities, needs, and the chararcter of each. In short they go a long way toward defining the design.
And for those apps you only up-date every three or four years...
There ain't nothing like those diagrams to gt you back into the same frame of mind you where when you designed it.
Ben
Ben Rayner
I am currently active on.. MainStream Preppers
Rayner's Ridge is under construction

Similar Messages

  • Certification Nugget Series Tracking Thread (No Discussion)

    Many of you have noticed a few "Certification Nugget: Threads reciently.
    What are they?
    The Certification Nugget Series is a community led initiative to enhance the NI Certification program by providing Certification specific advice from professionals who have earned the certifications and are currently using them to earn a living.  Our aim is to encourage potential certification candidates to make the certification attempt and provide personal accounts of methods employed that enabled current certified professionals to achieve NI Certifications.
    Why are we doing this?
    Each member of the "Certification Nuggeteers" community group has their own reasons for contributing.  However, some common ideas appear to show up.  A "Teaching Spirit" and a desire to see larger numbers of sucessful candidates are two common themes.
    Can I write a nugget?
    Of COURSE you can!   The NI Forums are free and open and no Certification Nuggeteer would choose to change that.  We do have some resources available that would help maximize the impact of your nugget so hey, give us a shout out and we can work together.
    How do I join the Nuggeteers?
    Contact any group owner
    Jeff·Þ·Bohrer
    crossrulz
    Hooovahh
    By Forum Private Messaging
    OR Contact Jeff Bohrer via By Phone, E-mail, Snail mail, or just drop on by 8-Ball Consulting
    (Follow the link for contact information- Trolls infest the forums and I get on enough spam-bot lists)

    Nugget #3 CLAD can be found here

  • Community Nugget 2-19-2007 "Stacked Sequence Exterminator"

    I am sure everyone with even casual familiarity of LabVIEW has run across older (or newer) code that is just peppered with ...
    Stacked Sequences from Hell.
    Stacked sequences (especially the one's containing sequence locals) are the hallmarks of confusing, unreadable and unmaintainable code. Data flows in all directions (mostly right-to-left), a large percentage of code is hidden at any given time, and it is almost impossible to debug and follow what going on. Often there is clear data dependency (or execution order does not matter), so the sequence serves no purpose. Better programmers don't use stacked sequences at all and even keep flat sequences at a minimum.
    Here is an example:
    Since the code seems to work "sort of", and trying to rewire things manually will probably lead to accidental errors, we have no choice than to leave things in place...
    ... or do we???
    If we try to right-click on the sequence, we can only remove individual frames, breaking everything in the process. No go! A dead end!  Sigh!
    But let's not give up just now.... We can easily convert the stacked sequence to a flat sequence, so lets do that as a first step:
    At this point, we can remove the flat sequence and all connections remain in place. Now we can just cleanup the elements and wires and everything look much better. Ahhh!!!
    In summary:
    An easy two-step procedure allows us to exterminate unnecessary stacked sequences without any danger of breaking the code. This method should lower the fear to remove these monstrosities. Try it today!
    This is a Community Nugget. If you want to contribute, please sign up here: http://forums.ni.com/ni/board/message?board.id=BreakPoint&message.id=3379#M3379
    Message Edited by altenbach on 02-18-2007 10:43 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    SeqToFlat.gif ‏15 KB
    SeqStackedA.gif ‏10 KB
    CannotRemove.gif ‏12 KB

    Tomi,
    Aren't you asking for a good reason to use a "bad" construct?
    Your suggested code construct would look like this.
    After wondering how to make it faster, you would concider this.
    But the revised version is not possible with a stacked seq. With a State Diagram you have a lot more flexibility, and you have it now.
    Now don't get me started because the next thing you know I will be talking about the SDE* and this thread is about exterminating Stacked Sequences..
    Wait, I think I just did.
    Ben
    * With a State Diagram you have a lot more flexibility, and you have it now. If you use the SDE the graphic documentaiton comes along for the ride.
    Message Edited by Ben on 02-19-2007 07:59 PM
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction
    Attachments:
    Stacked Seq.JPG ‏20 KB
    Stacked Seq Rev1.JPG ‏23 KB

  • Community Nugget 05/27/2009

    On occasion, you may wish to measure the amount of time a certain piece of code takes to execute.
    What many people do is something like one of these options:
    But this annoying to rewrite every time. If you're good, you probably have a merge VI or use VIs such as the OpenG VIs shown here to save some time on writing this code.
    Well, there is a faster way:
    The timed sequence has an output terminal which tells you how long it takes to execute. You can simply drop one and select that terminal.
    Caveats:
    I believe they're only available on Windows and RT.
    They take too much space (but then, so does the alternative).
    If you're running your code in parallel with other code (which you should not be doing), they might get higher priority, thus skewing the results. I don't know enough about this to give a good answer.
    When you drop one, it has terminals on the inside. You have to select to hide them if you don't want them.
    For a list of past nuggets, see here.
    Try to take over the world!

    In the first pic (flat
    sequence), the inputs of the substract-prim needs to be swapped (as in
    the code using OpenG)
    Actually,
    in both cases the earlier time is correctly substracted from the later
    time. It's just arranged differently (and I agree it can be confusing.
    Another reason to do this, although personally I don't time my code very
    often, so I don't actually use this).
    Sequences always make me nervous...
    So I prefer negative times for two reasons:
    * Something odd is on my BD
    * Rewind the time ASAP before the moment I dropped the sequence
    Felix
    www.aescusoft.de
    My latest community nugget on producer/consumer design
    My current blog: A journey through uml

  • An increase in community nuggets!

    Hi Everyone,
    On the LabVIEW board I've noticed we've got a number of new community nuggets!  I think this is great and I wonder if there's something I can do to help. I was thinking about taking turns linking to the nuggets via the announcements. Thoughts?
    Thanks!
    Laura

    Darin.K wrote:
    Kidding aside, if there were any way to make Kudos counts more accessible/sortable/searchable that would go much, much farther in sifting posts than an announcement.  If you could search for say a user's posts on the LV board with 4+ Kudos you are bound to find some true nuggets.  Trust me, I get that info the hard way and it is worth it.  (Enough beating that dead horse, for now).
    Ditto that!
    Note: Please take off your "moderator-keep-the-hit-count-high" hat for a second.
    Speaking from ove tens years of watching this forum...
    The high post count and traffic is both a curse and a blessing. The high traffic keeps it interesting and lively. There are many very insightful posts that buble up to beat back the question flow. But with the flood of info it can be challenging to sepearte the floatsum from the jetsum (I'll bet that I had to spell at lest one of those words wrong).
    Similar to a bear swiping at salmon as they swim past, the good or bad can be picked out one by one as they pass by.
    So as long as I stand on the bank and keep my eye on the information flow, I can goolbe up even the smallest nuggets.
    But trying to catch-up!
    I used to be able to do it back in the early days of the forums but not anymore. Too much info too fast and there are precious few clues to even attempt it.
    The best clues end up being the Kudos.
    Threads with high Kudos counts either indicate a "golden nugget hidden at the bottom of a pile of fluff"* or the gang has found a worthless thread to exploit. Both of which I want to read.
    Another approach still depends on the Kudos and that is to check out who is the Kudos leader for the day or week. if a name shows up that I don't expect I can that person down to see what earned them their new found fame or I look for a frequently flyer with higher than normal counts.
    So... getting to the point...
    maybe the default should be "weeK' instead of "Month".
    Another idea... that would require help from the web-team...
    How about a "post of the week" "month" poll where we can nomimate and vote for the top or three posts?
    Those polls/and supporting thread could serve as index to the top posts and allow for catch-up when we return to the forum after a period of time.
    Ben
    * First use of the word Nugget in connection with a choice piece of LV info.
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Community Nugget 4/08/2007 Action Engines

    Action Engines, What are They?
    “An action engine is Ben's term for a functional global which includes extra actions other than just holding the data.”
     (tst , 03-13-2007 01:18 PM)
    In a nut shell tst has nailed it except for the “Ben’s term” part. I was originally exposed to the term "Action Engine"
    by reading the book ""LabVIEW Applications Development A Course on Advanced LabVIEW Programming Techniques*”.  But
    before I get into details of the Action Engine (AE), I will attempt to clarify some terminology.
    Functional Globals
    Functional Globals (FG) are VIs that are functionally equivalent to LabVIEW globals. Functional Globals store
    information. You can read them or write them and that is it. No fancy stuff. Functional Globals are also referred to as
    LV2 globals because LV2 did not have globals but it did support Un-initialized Shift Registers (USRs). The USR is the
    entity that stores the information.
    USR.jpg
    USR’s
    Shift Registers (SR) come in two varieties “Initialized” and “un-initialized”. The presence or absence of a wire
    feeding the SR from outside the loop distinguishes how LabVIEW will implement the SR. If there is NO wire feeding a
    shift register (A), then the SR is not initialized. This is called an “Un-Initialized Shift Register”. The USR variety
    is implemented as static buffer that is re-used from call to call. The values written to the USR in and earlier call
    persist for access (B) in latter calls**. A Functional Global exploits this behavior by implementing two methods of
    interacting with the contents of the USR.
    Functional Global.JPG
    In the “Write” action (not shown) the value of “Numeric in” is placed in the USR. In the “Read” action the contents of
    the USR are returned via Numeric out.
    Action Engines
    An Action Engine (AE) can be thought of as a machine (Engine) that performs some useful task (action) often on
    something (typically but not limited to data in a USR). Functional Globals are very specific type of Action Engine.
    They have two actions “Write” and “Read”. They operate on the data stored in the USR either by replacing or using the
    contents of the USR. So AE’s are a superset of Functional Globals. In many documents the terms AE and FG are
    interchangeable. A recent poll on LAVA has indicated that Functional Global is the most popular term. Since this Nugget
    was prompted by answering the question “what is an AE?” in the remainder of this document you will find that I will
    generally use the term AE.
    Do What to What?
    AE design revolves around the ways the shared resource must be accessed manipulated or monitored. In a Functional
    Global, the actions “Write” and “Read” are appropriate. That is not necessarily the case for AEs. AEs can have entirely
    different set of actions depending on the interaction requirements for the information stored in the USR. A short list
    follows.
     A Configuration AE could allow for multiple processes to share a single copy of the system configuration (in a USR) by
    providing actions like “Set Device ID”, Set Device ON-Line…
    A hardware device can be realized as an AE that presents actions appropriate to the physical phenomenon being measured
    or controlled.
    A DO Port Controller AE could store a reference to the physical device in one SR and the port status in another SR and
    have action like: Set Main Motor On”, “E-Stop”, …
    An Instrument can be implemented to store the device name and settings with actions like “Set Input ON” “Auto-Scale Y”
    and “Get Trace”,…
    Screen Stacks can be implemented by using control references in one USR and maintain a screen view stack in another
    then implementing actions like “Set Config Screen”, “Set Login Screen”, “Back”…
    Users can be managed using an AE with action such as “Add New User” “Set Password”, “Disable User”…
    The list goes on and is limited only by our imagination. Here is an example that shows how a running average can be
    maintained.
    Running_Average_Example.jpg
    Running Average Example
    The Running Average Example shown above shows how a running average can be maintained using an AE. The AE is
    initialized before the While Loop executes. On each iteration of the loop the simulated measurement value (random
    number) is used to update the history of all measurements (Add Number(s)) and the mean is calculated (Calc Mean).
    Please note that although the buffer of all measurements is affected in every step of this example, the buffer (USR in
    the sub-VI) contents are never part of this VI’s diagram. Since the history is stored in the sub-VI, the history can be
    acted on from more than one thread as shown below.
    Parallel_Loops.jpg
    In the parallel Loops Example the history is initialized and then two loops run in parallel with one updating the
    history and the other plotting the average. Since the History resides inside the USR of the sub-VI the two while loops
    are effectively sharing the same block of memory, the block used to store the USR. The Sub-VI was implemented as shown
    in the following sequence of images.
    Init.jpg
    As was the case with Functional Globals, the actions are implemented as a type def’d enum***** driven case structure.
    Appropriate code is present in each case to realize the intended actions. In the “Init” case, contents of “Array in”
    are used to initialize the history. In our example above we did not pass an initial array value. Therefore the “Init”
    resets the history (cleared the array).
    Add Num.JPG
    The operation of the AE when the “Add Number(s)” action is called varies depending on its usage. If the caller passes a
    non-empty array, it is appended to the array. Alternatively, passing a value via the Numeric in” control, and leaving
    the “Array in” un-wired adds a single element to the history. We used the Numeric In input so we were continually
    building our history one value at a time.
    Calc_Mean.JPG
    When the “Calc Mean” action is invoked, the average is calculated and returned.
    This Nugget is continued in the next post
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction
    Solved!
    Go to Solution.

    Nugget continued
    The Traffic Cop Behind the Scenes
    A detail I have not mentioned up until now is that AEs should be implemented as VIs that are not reentrant***. VIs that are not reentrant can only be executing in one context at a time. LabVIEW will ensure that if there is ever a situation were two contexts are attempting to act on the same AE at the same time, LabVIEW will schedule the first and the subsequent will wait until the first call completes. This is similar to a traffic cop preventing more than one vehicle from entering an intersection at the same time. The Traffic Cop is illustrated in the following timing diagram were we look at how the processing of two threads is affected by using a single AE.
    Execution_Timeline.JPG
    In the figure above the processing time of two processes “P1” and “P2” are illustrated by a red or blue solid arrow respectively. In the parallel loops example shown earlier, P1 could be the “Calc Mean” loop and P2 could be the “Add Number(s)” loop.
     t0 - t1
    Both processes are executable and run their assigned tasks. Neither process is accessing the AE.
    t1 – t2
    P2 continues to run while P1 calls the AE. Since the AE is idle it is available to run so P1 continues execution running inside the AE until all work inside the AE completes. The dotted arrow shows that the thread for P1 is executing in the data space allocated for the AE.
    t2 –t3
    At t2 the AE terminates and both process run as in t0 – t1.
    t3 – t4
    This time segment is similar to t1 – t2 with P2 running in the AE.
    t4 – t5
    Similar to t2 – t3 the AE terminates and both process run.
    t5 – t6
    Similar to t1 – t2. P1 take control of the AE.
    t6 - t7
    At t6 P2 attempts to call the AE. Since the AE is not idle it is not available to run. P2 is placed in a resource wait state (it is NOT running) waiting for the resource to become available. The dotted horizontal arrow indicates the process is not executing.
    t7 –t8
    At t7 the call of the AE by P1 that started at t5 completes and P1 continues to execute outside of the AE. When the call by P1 completes the AE becomes available. The process P2 is marked as executable. The scheduler includes P2 in its executable threads and the AE is available. P2 then executes inside the AE until the call completes.
    The Beauty of the AE
    This behavior of a non-reentrant VI is a wonderful feature we can exploit to eliminate race conditions. Race conditions are the nemesis of many a developer. In hardware this was solved with clocked enabled logic. In LV we solve race conditions with Queues, Semaphores, Rendezvous, Occurrences, and Action Engines!AEs can eliminate race conditions when all operations involving updates of the data stored in the USR are done INSIDE the AE. A very simple illustration of how the encapsulation of USR manipulation is shown in the following set of examples.
    Port_With_Global.jpg
    This VI is intended to demonstrate how two bits of an eight-bit port can be used to control the running state of two pumps. To illustrate the control process, one pump will be set running at start-up and then every half second the state of both pumps will be toggled to simulate switching of the supply. This example uses globals and fails miserably.
    Port_With_Global.jpg
    In this example we start out by initializing a global variable so that bit “1” (zero based) is the only bit set in an array of eight bits. This turns on Pump 2 to start. Then the “Port Update” and a “State Change” loops run in parallel. In the “Port Update” loop the state of the port is read from the global and used to update the GUI.
    In the “State Change” loop, the port status is read and the first Boolean is inverted before being written back to the global. Similarly for the second Boolean. Since the read of the globals both occur before the subsequent data processing, one of the threads will be processing old data.
    Port_With_Action_Engine.jpg
    The Action Engine version codes up the same way as the global version but now all of the data manipulation of the port states are encapsulated in the Action Engine  “Port Controller”. This encapsulation ensures all operations involving the data in the USR are forced to happen sequentially even though we did not have to implement any code to achieve this affect.
    The key point to take away from this example is a shared resource (the port status in the case) when implemented as AEs come with resource contention resolution built in provided that all manipulation of the shared resource takes place inside the AE.
    Action Engines to the rescue!
    Action Engines are not a replacement for Queues, Rendezvous and the other synchronization techniques. They are typically called for when your design dictates that a single resource must be shared by more than one parallel process and none of the LabVIEW provided techniques are sufficient. They require a design of their own to ensure they work correctly. They also have to be developed and supported.
    This Nugget is continued in the next post
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Community Nugget 5-Mar-2007

    Type Definitions Let You See Your Application in a Different Way
    “THE ESSENCE OF TYPE DEFINITIONS IS THAT IF THE TYPE DEFINITION IS CHANGED ALL "MEMBERS" WILL CHANGE THE SAME WAY.” (Albert Geven LabVIEW Champion )
    Type definitions are a wonderful yet under utilized feature of LabVIEW. They allow you to manage the data types of your application in controlled manner.
    Type_Defs.png
     In large applications they can save you hours of work. I have had the opportunity to work on large applications developed without type definitions. These opportunities are seldom quick and easy to change. I have found it to be well worth the time and effort (both of which were considerable) to introduce type definitions as the first step in modifying an existing application. If your application has more than one sub-VI, your application will probably benefit from the use of type definitions.
    Type definitions (type def’s) are implemented in LabVIEW as custom controls. Type def’s allow you define the data types*** used by your application. Once a type def is defined and used on a front panel or block diagram, LabVIEW will ensure that all instances of that type def remain consistent with the definition. This means that if you edit a typed definition and save the changes, every place where that type def is used will be updated automatically. This is particularly useful in the case of enums when they are used to drive action engines**** or state machines.
    Through the use of clusters, you can establish a hierarchy for your data if appropriate. As shown in Hierarchy1.png the hierarchy screen offers a button to control the visibility of type definitions used by your application. By using Type definitions consistently throughout an application a developer can easily determine which VI’s will be affected by a change to one of them.
    Hierarchy1.png
    In the case of the Demo shown above, we can see that the top level VI “Demo” needs to know about changes to the action provided by the sub-VI “Caller”. We also see that changes to the “Chan Name” (Channel Name) data type affect the definition of the “Chan Info” (Channel Information) type definition as well as the “Caller” but they do not affect the top level VI “Demo”.
    We can determine all of the above without ever opening up the diagrams of any of the VI’s or type definitions. This is made more descriptive by editing the icons of the type definitions. The process is quick and easy.
    You start by opening the control editor
    Customize.PNG
    ... and choosing “type def” before saving the control as a unique name.
    You can then open the default icon and select most of the default icon’s image
    Select existing image.PNG
    And slide it down to the left.
    Slide down n left.PNG
    Which gives me plenty of room to add text.
    Structure Name.png
    Since the icons retain the native LabVIEW look it is clear which objects on the hierarchy screen are type definitions. I have for the largest applications taken the time to add graphic that represent the data defined by the type def. This becomes very helpful to pick out the data type you are after from hundreds of VI on the screen.
    View Data Hierarchy.png
    In the application hierarchy screen snippet above I have illustrated how type definitions are very helpful when investigating how a possible type definition change can affect an application. The VI hierarchy screen, when used with type def’s becomes a “data definition hierarchy screen”. Looking at all of the VI in a type def’s hierarchy tells you which high level functions could be affected by changes. The callers tell you the VI’s that need special attention and will adapt to changes in the typed definition. In the case above, we can see (well I can because I can do a little scrolling) that of the 700+ VI used by the application, there are only 10 that use the definition (I shudder at the thought of trying to do this same analysis without type def’s.  ).
    To get the hierarchy snippet I presented above I located** a top-level type def. By “top Level type def” I mean a type def that is not a member of any other type def. Once I located the icon for Equipment Group type def, I was able to right-click and choose Show VI Hierarchy
    Show VI Hierachy.PNG
    Followed by a right-click Highlight connections
    Highlight Connections.PNG
    Summary
    Type definitions allow data structures to be defined and maintained across an application. Enums and clusters use benefit from being used as type def’s. The VI Hierarchy screen includes the option to view or omit type definitons. Consistent icon usage for type def’s makes it easier to find them in large applications. The hierarchy of type def’s define data dependencies.
    Closing
    I hope the above observations on type definition creation, use, and their power to be useful. I’d also love to hear about
    1) How you have used type def’s to your advantage?
    2) How you go about organizing your data structures?
    3) What features of type def’s have I omitted?
    If you have a Nugget you would like to present please post here to reserve your week!
    A list of all Nuggets can be found here .
     Ben
    Notes
    * Warning: changes to application containing hundreds of VI and were not developed using type def’s should be left to professionals. This kind of work has lot in common trying to remodel a house of cards. Every move must be done with great care and you should be not surprised if the entire enterprise comes crashing to the floor. In short, do NOT try this trick at home.
    ** You will find that if you use type definition s in your applications they will end up decorating the bottom edges of your hierarchy.
    *** Type def’s define the data type and not the default values. You cannot use type def’s to establish default values. If you modify a type def that is used as constant on a diagram, all instances of that type def will be replaced with new instances. Default values that were saved in the block diagram will be lost when the constant is replaced with the new definition. This is by design. The method I suggest for establishing a default value is to use a sub-VI to explicitly define the value. In the case of clusters use a bundle by name node to set the fields as required. In the attached 7.1 example you will find
    Type_defd_Constants
    Where I have illustrate the use of sub-VI’s to establish default values. In the example, there are two sets of default values of the type definition “Chan Info” (Channel Information) denoted by the green and grayed-out icons.
    Documented_Constants
    The sub-VI documentation also helps future developers of the application pick-out the proper default settings.
    **** The attached example includes a simple example of an action engine. Stay tuned for a future Nugget where we may discuss action engines.
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction
    Attachments:
    Code.zip ‏109 KB

    My recent project involving TypeDefs and 'constant' VIs is about XML creation:
    Where the red 'dot' is a formatter constant with the following content:
    <%1$s>
    %2$s
    </%1$s>
    By using a enum for the XML-tag I can avoid mistypes since XML is case sensitive
    Using 1$s allows me to reuse the first input twice
    And if I need to change the tag-creation I can edit my constant VI.
    Ton
    Message Edited by TonP on 03-05-2007 09:13 AM
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!
    Attachments:
    ChartLocations.xctl_KML_Core.png ‏1 KB

  • Community nugget: Code Capture Tool 2.0

    When the snippet feature was introduced in 2009, some people thought that this would be the end of the Code Capture Tool (CCT).
    Well, they were wrong. It's back. Bigger, better and cooler.
    For those who don't know the CCT, it's a small utility which you can use to make screenshots of LabVIEW code, either for sharing or for documentation. You can see here  for more details.
    For those who already know it, now's the time to introduce the new features. The following video shows them nicely, but to recap:
    The CCT now supports creating snippets (in any version from 7.0 and up).
    The snippets themselves will only be usable in LV 2009 or later.
    You can now add annotations and sketches in the preview window.
    This will allow you to draw attention to specific parts of the code.
    Here's a video demonstrating the new (version 2.0) features: the video might take a while to load but it's worth the time
    You can download the Code Capture Tool 2.0 at LAVA.
    Here are a series of videos on the CCT (1.0 and 2.0).
    Have fun,
    Yair and Ton
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!

    Here are some captures with these version, showing both the annotations and snippet features:
     A capture with LabVIEW 2009 with an annotation.
    A capture (no snippet) with annotations and arrow pointers
    A capture created with  LabVIEW 7.0
    A snippet with annotation.
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!

  • Community Nugget, 05/27/2007

    Today, a useful tip:
    On occasion, it could be very useful to have a VI know whether one of its inputs was wired or not.
    For example:
    You could have a VI which will accept a path, or pop up a file selection dialog if you haven't wired the path input.
    You could have a LV2 style global which would execute its Write case automatically if you wired something into it.
    You could have a utility VI which will operate on the VI calling it unless a reference to another VI was given to it.
    The possibilities are endless.
    LabVIEW does not currently expose a way of letting us know whether an input was wired in the calling VI or not, but there is a workaround. When you don't wire a value into an input control, that control uses its default value. For many datatypes, you can determine as default a special value which would be considered invalid and then check if the control is equal to that value and assume that the input control was not wired if is equal to that value.
    Consider the following code, for instance:
    If a VI reference was wired, the VI will control the defer property for that VI. If no reference was wired, it will control the defer property for the caller, so to control the defer property in your VI, you just have to drop it in the block diagram of your VI.
    Common invalid values include -
    NaN for floating point values
    an empty (invalid) reference for references (VIs, controls, etc.)
    negative numbers for numbers which should only be positive
    a special invalid value for enums.
    Now go out and be creative.
    P.S. You should note that it is important to choose a correct invalid value.
    NaN, for instance, can be achieved through calculation (e.g. through dividing by zero).
    For a list of past nuggets, see here.
    If you want to write nuggets yourself, see here.
    Try to take over the world!
    Attachments:
    Defer Updates.png ‏7 KB
    Defer Updates.vi ‏37 KB

    Just a point I noticed about that (very quick) example - the Defer Updates input should probably be a required input and in any case should not be T by default, because that would make the FP get stuck.
    Attached is a simple example demonstrating its use. When the OK button is changed, the updates are defered for several iterations.
    Try to take over the world!
    Attachments:
    Defer Example.llb ‏52 KB

  • Community Nugget 02/05/07

    This week we are going to have some fun with dials.
    A dial can be a very useful thing. You pop one on your front panel...
    and you're ready to display your data in a nice way.
    However, there can be much more to dials than that.
    Let's start by placing the cursor over either end of the scale. You should see the rotate icon -
    Clicking and dragging will now allow you to play with the scale. Grabbing at the low end value will rotate the dial, as seen on the left side of the image below. Grabbing the high end value allows you to change the shape of the scale, as seen on the right side.
    So with very little effort we've created a dial which looks different and can make our application more interesting.
    But wait, there's more. By right clicking the dial and selecting "Text Labels", you can have your scale made up of text labels. You can edit these labels by right clicking the dial after changing to text mode.
    This could be useful for any number of things, like compasses or other dials with labels and can be done with other numeric controls, like slides and meters. You could use a slide, for instance, to make a single-selection control, like radio buttons.
    This is not all. There are other things you can do, like making the ramp visible or making the labels appear on the outer part of the control instead of the inner one or adding needles to the dial, not to mention the things you can do with control customizations. I suggest you go and play.
    P.S. These are all just simple examples. You can make your application look much better and more interesting by customizing controls and playing with all kinds of options.
    For a list of past nuggets, see here.
    Try to take over the world!
    Attachments:
    TextDial.PNG ‏6 KB

    Nice tips!  I only just learned some of those things a few weeks ago when I posed a very similar question on the LAVA forums.  Specifically, by placing the cursor at the "Max" end of the scale, you can drag it around until it coincides with the "Min" end.  The usefulness is for displaying the position of a rotary encoder on a spinning shaft.  Now that I know how to remove the gap between 360 and 0 points, it's very easy to indicate a spinning shaft.  I just read the (scaled) encoder angle out of DAQmx, perform a modulus with 360 deg, and wire to the guage.  Now the needle spins around continuously, just like the shaft it indicates.
    BTW, I haven't found out how to control the amount that the whole dial gets rotated.  I would typically want my 0 position to be at either N,W,E, or W but I've had to rely on touch to try to get it there by mouse alone.  I didn't see a setting when I right-clicked for the properties pages.  (Admittedly, I haven't yet scoured all the object properties using a block diagram property node.)
    -Kevin P.

  • Community Nugget 02/25/2007

    The native LabVIEW controls were designed to be readable and easy to use, but they are also quite boring.
    There are many ways in which you can change the appearance of your application, ranging from changing the colors of your controls to using system colors and controls to customizing controls to look more interesting.
    Today I'm going to discuss another option which most people are not aware of - using external resources while customizing.
    Basically, every control is made up of several parts. Some of these pieces have limited options for customization, but the other pieces are usually just images which you can replace with anything you want.
    Let's start with Office. LV graphics are vector based graphics, so you can resize them and they will always look sharp. Office graphics are also vector based, so you can copy images created in Word or PowerPoint into LV and your controls will scale nicely. There are probably other programs which can do this, but Office is the one I have most readily available.
    An example might be in order. Continuing with the dials theme from my previous nugget, here are two dials where the housing part was replaced with two gradient filled circles created in PowerPoint. As you can see, this can make your front panel look different and much more appealing and should also resize nicely.
    Note - at least in LV versions in which I've tried this, the internal LV clipboard does not get the image when you copy it in Office. You need to paste it when you edit your control in customize mode and then right click it and select Copy to Clipboard.
    Here's another example, also inspired by something shown in the dials nugget.
    On the left you can see how you can create a classic looking clock by using an appropriate background image and replacing the housing of a dial with a square frame (taken from the decorations palette).
    In the middle you can see how this can be abused by placing a clown nose on a granite background. It is very important to NOT OVERUSE THIS. A user interface becomes extremely unusable if it is filled with distracting and conflicting colors.
    On the right you can see another nice thing - Office images support alpha channel transparency and this is transferred into LV. As you can see in both this picture and the next, this doesn't look too well on my computer, but maybe newer versions of Office\LV handle this better. Also, be careful - LV will usually be much slower when drawing overlapping controls, since it redraws them every single time instead of being smart and only drawing them when needed.
    On the same note, you can use transparent GIFs and PNGs to have images with irregular shapes.
    Another thing that this image shows (other than the partial transparency) is the reshaping of a numeric control by making the numeric text background transparent and replacing the frame with a shaped image
    Attached are three VIs:
    One shows the clocks with a couple of numeric controls with irregular shapes and partial transparency.
    The second shows using an image created in Office and copied into LV to create a Star-Trek like animation.
    The third shows a VI from the NI site which shows using animated GIFs inside custom controls.
    I would like to state this again - this should be used wisely. It is extremely easy to make a front panel too crowded. Remember that your users eventually need to use the program and that is the most important thing. These tricks should be used to make the user interface more usable or more appealing, but they should not come at the expense of usability.
    To learn the basics of control customization, see this page from the LabVIEW help.
    For a list of past nuggets, see here.
    If you want to write nuggets yourself, see here.
    Try to take over the world!
    Attachments:
    GIFAnimatedControls.vi ‏295 KB
    Clocks.vi ‏823 KB
    Flow 61.vi ‏39 KB

    Great nugget.
    For LabVIEW 8.20 users it might be worth mentioning that it now supports direct background images, similar to the windows desktop. You can easily expand the selection in the list by placing other images into "...\resource\backgrounds" of your LabVIEW folder (On windows: C:\Program Files\National Instruments\LabVIEW 8.2\resource\backgrounds).
    For example you could place the woodgrain background image from your clock display, then simply select to "tile, stretch, or center" the image in the pane background.
    Typically you would choose a small "atomic" image that nicely autorepeats a given pattern when tiled. The advantage is that the background will always fill the window, no matter how you size it.
    The following menu can be reached by right-clicking on the scroll-bar and selecting "properties" (LabVIEW 8.20 only!).
    Message Edited by altenbach on 02-26-2007 12:47 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    FP-Background.png ‏71 KB

  • Installing NI-DAQmx 9.7.0 Applicatio​n Developmen​t Support

    Hello,
    I am currently trying to install Labview 2009 (my former copy was lost when my former computer's motherboard overheated). The installation has gone fine, I think, and I am able to create new projects etc.
    When I downloaded NI-DAQmx 9.7 (the full installer), I seem to be unable to install several pieces of software - please see the error-file attached. I am not worried about the NI I/O Trace 3.0.2, NI MAX 5.4, or NI Network Browser 5.4.0, as I believe the higher editions I have are backwards-compatible.
    With the NI-DAQmx 9.7.0 Application Development Support however, I cannot install this due to incompatible products. Do you know what kind of products this error is referring to? I am at a loss, as I also do not know what the symbol shown in screenshot means (I've accessed this window through trying a custom installation, but I cannot change to a tick/cross).
    Thank you in advance!
    Carl
    Solved!
    Go to Solution.
    Attachments:
    error-file.pdf ‏19 KB
    Screenshot.png ‏184 KB

    Hi Carl,
    Is it possible you are able to post your MAX System Information, so we can see in depth if there are any conflicts on your system. DAQmx 9.7.0 is supported by LabVIEW 2009, so I am unsure of what the exact issue is at this time.
    In NI-MAX, if you could: Right click on My System >> Create Report >> Select My System, and select Simple Report. Generate the report, then please upload it so I can see.
    Best Wishes,
    James Kent
    James Kent | Applications Engineer | National Instruments UK & Ireland
    w: uk.ni.com | ireland.ni.com

  • Download FREE NI TestStand Toolkit for Large Applicatio​n Developmen​t at NI Labs!

    In hopes of giving you a sneak peek of what we're
    thinking about adding to NI TestStand in the future, we have added the NI TestStand Toolkit for Large Application Development to NI Labs! The toolkit currently includes two features with more planned for the future:
    NI TestStand Type Differ - compares and merges differences between types and helps you
    manage type conflicts easily
    NI TestStand Batch Type Differ - automates the process of using the NI TestStand Type Differ on multiple master and updated files
    Again, we are considering adding these features
    to NI TestStand and want to get your feedback. Download the toolkit at NI Labs and tell us what you think!
    Regards,
    James M.

    Hi It looks interesting. But what about putting a little effort in the "View > Sequence File > Display File Hierarchy" that I think is a cool small tool. But When you print the hierarchy, the legend i missing. Alternative is to include the names of the sequence files in the hierarcy view. /Christian  

  • Problem Regarding Duration of Test(Elapsed timer)

    Hi All,
    I am doing positive negative pressure cycle test in which positive negative cycle going on continously & shown on graph.
    I have to show duration of test as cycle starts in HH/MM/SS format continously as test is going on upto a fixed no. of cycles.
    I have taken elapsed time express vi in my  main loop for showing this. As in my program there are various loops one inside another in main loop.
    So my problem is this timer is not showing elapsed time in continous updating mode but it shows elapsed time when i press exit button. I know why it is not showing because it is going into another loop in my main loop.
    Can anybody suggest me how to show my duration of test in continous updating mode?
    Thanks & Regards,
    Vipin Ahuja

    A slightly more robust elapsed test timer than the previously linked FGV was presented as a small part of the community nugget series on application development.  Once initiallized with a refnum to the GUI's elapsed time indicator, this Resouce Module can be called from anywhere or everywhere in the application to update the GUI.  
    A modification of the vi was also presented HERE as a GUI Element Resource Module, GERM, in a nugget I co-authored with Richard Sorrellis (AKA Broken Arrow)
    Jeff
    Attachments:
    Format Rel Time (STR).vi ‏12 KB
    Exec Timer Meth.ctl ‏11 KB
    Execution Timer.vi ‏29 KB

  • Live Chat with Yvette Nicole Brown (Shirley) from NBC's Community

    Check out the live chat transcript here!
    Attention fans of NBC's Community TV series.
    Join us for a Live Chat with Actor Yvette Nicole Brown who plays the part of Shirley on NBC's Community TV series!
    The Chat will take place this Thursday, May 17th from 9:30 - 10:30 CST, the same day the season 3 finale airs!  This is your chance to ask Yvette all about her role in the show and get one last taste of Community as the season closes out.
    All questions are moderated and answered in a queued format on a first-in, first-out basis so be ready when the chat starts!
    Bookmark this page as we will update it with info on how to join the chat when it goes live on Thursday!
    http://www.nbc.com/community/
    Buy Community Season 1 & Season 2 on BestBuy.com
    Pre-order Community Season 3 on BestBuy.com
    Community synopsis
    From Dan Harmon ("The Sarah Silverman Program") and Emmy Award winners Joe and Anthony Russo ("Arrested Development") comes "Community," a smart comedy series about a band of misfits who attend Greendale Community College. At the center of the group is Jeff Winger (Joel McHale, "The Soup"), a fast-talking lawyer whose degree has been revoked. With some help from his fellow classmates, Winger forms a study group that eventually learns more about themselves than their course work.
    Also among the series stars who comprise the group are comedy legend Chevy Chase ("Chuck") as Pierce, a man whose life experience has brought him infinite wisdom; Gillian Jacobs ("The Book of Daniel") as Britta, the 20-something dropout with something to prove; Yvette Nicole Brown ("Rules of Engagement") as Shirley, a sassy middle-aged divorcée; Danny Pudi ("Greek") as Abed, a pop culture junkie; Alison Brie ("Mad Men") as Annie, a high-strung perfectionist; Donald Glover ("30 Rock") as Troy, a former high school football star trying to find his way, and Ken Jeong ("The Hangover") as Señor Chang.
    YVETTE NICOLE BROWN
    One word best describes the unfolding of
    Yvette Nicole Brown's career, and it is:
    serendipity (noun)
    1. an aptitude for making desirable discoveries by accident.
    2. good fortune; luck; blessing.
    Yvette landed her first television role - - a two-episode gig playing Toni Childs' sister, Sherri, on GIRLFRIENDS - - by chance. Casting director Robi Reed called her in to audition from a post card submission. Yvette had no credits and no agent. That stroke of serendipity at the beginning of her career, taught Yvette that you never know how God is going to move in your life and career. Booking a series regular role two months later, on the first pilot she auditioned for further proved the point. That show, ABC's THE BIG HOUSE, only lasted a few episodes; but that experience proved to be a blessing as well. Through it, Yvette learned the transient nature of the business and to always "travel light".
    Yvette has since appeared (and often recurred) on shows as varied as ENTOURAGE, CURB YOUR ENTHUSIASM, THE OFFICE, THAT'S SO RAVEN, HALF & HALF, SLEEPER CELL, HOUSE, TWO AND A HALF MEN, THAT 70'S SHOW and BOSTON LEGAL - - where she got to perform "Big, Blonde & Beautiful" from Hairspray. It was a bit of a homecoming because Yvette is no stranger to singing. She was managed by Michael Bivins (of New Edition and BBD) and signed to Motown Records when she was just a teen.
    Younger viewers may know Yvette from her recurring role on Nickelodeon's "DRAKE & JOSH," where she played movie theater manager, Helen Ophelia Dubois.  Landing that role was another serendipitous experience. The role of Helen was to be a one-time role; one that Yvette auditioned for while on hiatus from THE BIG HOUSE. That one-time role turned into four years of employment and introduced Yvette and her silliness to the best group of fans in the world...kids!  The cast of DRAKE & JOSH recently reunited in 2008 for the holiday movie, "Merry Christmas: Drake & Josh," a film that broke Nickelodeon viewership records when it was seen by over 8 million viewers the night it debuted. It has since gone on to become an annual holiday favorite.
    Yvette is also the voice of the tough, sassy and smart Cookie on The HUB’s “Pound Puppies” which begins its second season in June, 2012.  The “Pound Puppies” are a team of fearless dogs whose sworn mission is to find homes for lonely puppies.  They only look like regular dogs.  In fact these pooches are dogs of action who match up pups with loving families while they keep the humans at Shelter 17 clueless.
    Yvette has also had a successful career in commercials. She's appeared in over 40 national spots. You may have seen her in ads for BIG LOTS, PINE SOL, CITIBANK, FIBER ONE YOGURT, DAIRY QUEEN, HAMBURGER HELPER, ARROWHEAD WATER, HOME DEPOT, COMCAST, LG and DiGIORNO'S PIZZA to name a few.  Yvette has also been immortalized in puppet form as "Mrs. Lewis, from downstairs" in a series of NIKE spots alongside puppet versions of Kobe Bryant and LeBron James.
    In addition to her commercial and television work, Yvette also has a burgeoning film career. She made her film debut in the romantic comedy, "Little Black Book," working alongside Brittany Murphy and Oscar winners, Holly Hunter and Kathy Bates. Her next film, Michael Bay's futuristic thriller, "The Island" put her on the set with Ewan McGregor and Scarlett Johansson. Supporting roles in other films including "Dreamgirls" and "The Kid and I," - - where she first met and worked with one of her childhood heroes, Henry Winkler - - soon followed.  In 2008, she was in the box office hit, "Tropic Thunder" (directed by Ben Stiller) where she worked with Matthew McConaughey; as well as the family film, "Meet Dave" where she realized a childhood dream by sharing the screen with Eddie Murphy.
    In 2009 and 2010, Yvette could be seen on the big screen again in the family film, "Hotel for Dogs" starring Emma Roberts and Don Cheadle, the romantic comedy, "The Ugly Truth" starring Katherine Heigl and Gerard Butler, the indie hit, "(500) Days of Summer" starring Zooey Deschanel and Joseph Gordon-Levitt; as well as the action thriller, "Repo Men" where she played against type and shared the screen with Jude Law and Oscar winner, Forest Whitaker.
    Currently, you can catch Yvette every week on the single-camera comedy, COMMUNITY, which airs Thursdays at 8pm/7c on NBC. The same Thursday 8pm timeslot that was once home to the hit NBC comedies: FRIENDS and THE COSBY SHOW...how's that for blessed? 
    In addition to her work on Community, Yvette can also be heard as the voice of "Cookie" on the NEW animated series, POUND PUPPIES; which airs weekly on the HUB Network (formerly Discovery Kids).
    A proud native of East Cleveland Ohio, Yvette currently resides in Los Angeles California.

    Here ya go!
    http://bit.ly/CommChat
    If not try this link.

Maybe you are looking for

  • Mini DisplayPort to VGA in Boot Camp

    Hi all! So I'm looking to unload my old G4 laptop and get a new MacBook or MacBook Pro. But there's something... scaring me. I do a lot of video mixing through projectors or TVs, often in situations where s-video is the only available option (I usual

  • S-Video or Composite video input

    I need to connect a camcorder to my iMac but it has no digital output. Only s-video (which I prefer) and composite. I know there exists converters which can convert this stuff to USB or Firewire but the ones I found are really expensive. $300-$500 I

  • Roman numerals not importing from Word

    The last page of my document uses roman numerals in the footnotes. The Roman numerals show up in the word document, but turn into regular numbers when imported or copied inot Indesign. Does anyone have a suggestion as to how to get the roman numerals

  • Missing user folder from Workspace and FR studio

    Hi All, Recently we upgraded the workspace and applications... Initially there were all the folders, but i noticed that user folder from workspace and FR studio was missing... If anyone have come across this issue please let me know how to solve it.

  • Span div problem on flow layout

    i want to use flow layout for my page. if there is any component that includes div tag it causes new line on html page. i use page fragments in my page. if there is any fragment that includes div tag next component appears on new line. i want to plac