Monday 19 November 2012

Creating LabVIEW Classes - LabVIEW 2011 Help - National Instruments

Creating LabVIEW Classes - LabVIEW 2011 Help - National Instruments:


'via Blog this'

Community: LabVIEW Development Best Practices: When Should You Use LabVIEW Classes?

Community: LabVIEW Development Best Practices: When Should You Use LabVIEW Classes?:


Now, you might be thinking to yourself, "Can't I just use a cluster?"  The answer is generally 'yes.'   In fact, if you've recently begun developing an application that relies upon a large, complex cluster that you're passing around your application, it may be an excellent candidate for replacing with a class.  This is especially true if you're passing around an array of clusters that are used to represent items that your program needs to be able to communicate and interact with. Making the switch from a cluster to a class offers several benefits - I want to highlight the following (although there are many more):

  1. Inheritance - so far, I've described explained that you can define a class of objects and give it properties and methods.  What makes this even more powerful is the ability to define children of that class, which have the same properties and methods, as well as some of their own.  They may also want to override the methods or properties of their parent class.  In my list of examples, I mentioned 'vehicles.'  As you can imagine, there are many different types of vehicles, some of which have very unique properties and things that they can do.  If you consider 'pickup truck,' as an example, one of it's properties might be 'bed size,' which wouldn't make any sense when applied to a car or a motorcycle.  
  2. Dynamic dispatching - If we have an array of similar objects, they likely share methods and properties.  In LabVIEW, we create wrappers using VIs to access and modify these values.  If we want the wrapper VI for a specific child class to do something different, we can create a VI to override the parent VI automatically.  LabVIEW will automatically run the version of the VI that is appropriate for the current class.  To put it simply, LabVIEW dynamically runs the VI based upon the class of the object supplied to it - this assumes that the object is a child of the generic class.

As a software engineer, it's important to be able to recognize the potential benefits and when the use of classes may make more sense.  LabVIEW is almost always used to interface with hardware, so the I/O in your application may be the perfect place to start.  Consider these examples:

  1. Hardware Abstraction Layers - This white paper on hardware abstraction layers illustrates some excellent examples of the benefits of classes and how they can be used to mitigate the risk of hardware obsolescence.  Classes have been defined for certain subsets of functionality (ie: a generic Scope).  When a specific instrument is connected or added, it inherits the properties and methods of the parent class, but may add additional functionality (ie: an Agilent Scope could be replaced with an NI Scope, or visa versa).
  2. Devices Under Test - Consider the task of testing a large number of very similar, yet slightly different devices such as cell phones.  One production line may be responsible for testing a variety of different types of phones, but they almost certainly all have similar properties.  The code can be written using a generic cell-phone class, but the method to execute a specific operation may require slightly different commands be sent to the test executive.  This can easily be added later on without major modifications to the code through the creation of a child-class.



'via Blog this'

Saturday 17 November 2012

Interactive DaqMx simulation interface ... (Popup panels for simulated hardware) ... Or better, DaqMx Simulation API for process simulation ... - NI Discussion Forums

Interactive DaqMx simulation interface ... (Popup panels for simulated hardware) ... Or better, DaqMx Simulation API for process simulation ... - NI Discussion Forums:



Hello,

How often you have build Labview applications using simulated DaqMx boards ...
And how often you were limited by the default behaviour of simulated boards ... ( Sinewave for analogic inputs, Counter square signal for digital inputs ... )

It would be nice to integrate in DaqMx simulated boards, the abilty to modify the default behaviour of simulated inputs ... thru dedicated popups

It would be nice, for each task linked to a simulated daqMx board, to launch a popup window ...

  • For digital input, give the abilty to modify for each configured channel , the current binary value.
  • For analog input, give the ability to choose between a fixed value, a sine wave, a square signal ... white noise ...
  • For digital output, give the ability to view the current setted values
  • For analog output, give the ability to view the current simulated output value on a waveform chart ...

A more powerfull tool could also integrate a simulated channels switching mechanism ... A simulated output could be linked to a simulated input 

This feature could be a good way to create an application which could simulate a complete process ... this application could be used to validate a complete system
(such a kind of SIL architecture)

Other idea .... A complete daqMx simulation API ...

  • Creation of an API which could instanciate a simulated daqMx board (Wich could be seen via MAX)
    • Takes place of the actual limited daqMx simulated board
  • This device could then be accessed by other application thru daqMx
  • This API could have access to all channels of this simulated device.
  • This API could force, programmatically, the value of the simulated input channels according to a realistic process model


'via Blog this'

Thursday 15 November 2012

Audio Output Using LabVIEW's "Play Waveform" Express VI

Audio Output Using LabVIEW's "Play Waveform" Express VI:

'via Blog this'

Songs for the LabVIEW Programmer (songs about LV and the dataflow experience) - NI Discussion Forums

Songs for the LabVIEW Programmer (songs about LV and the dataflow experience) - NI Discussion Forums:




Songs for the LabVIEW Programmer (songs about LV and the dataflow experience)


Last year at the LAVA BBQ here at NI Week, several users -- after a bit of drinking -- discussed the need for some LabVIEW drinking songs. Since NI tries to be responsive to user needs, I started creating songs to meet that need, and pulled on other R&D team members to help out. I already had a couple of children's songs for teaching LV to kids. So for the LAVA BBQ last night, I released Songs For The LabVIEW Programmer. There were only paper print outs available last night. Today I'm posting the songs for everyone to enjoy.

===================================
Songs For The LabVIEW Programmer
  • Drinking Songs: Songs for singing in groups, particularly while drunk, celebrating LabVIEW.
  • Teaching Songs: Songs for young children, just learning LabVIEW for the first time.
  • Emotional Songs: The angst, the joy, and all the other emotions that programming LabVIEW may raise within the soul.

The Debugging Tune*
(to the tune of The Itsy Bitsy Spider**)

The execution highlight
goes down the wire route.
All along the way,
probes may call the data out.
If it hits a breakpoint then
                there it will remain
until the Pause button
lets the highlight move again!

* because spiders are good at removing bugs
** feel free to adapt the original’s hand gestures!

There Was An Old Lady Who Wrote A VI
(to the tune of There Was An Old Lady Who Swallowed A Fly)

There was an old lady who wrote a VI.
I don’t know why she wrote the VI – it’s a blank VI!

There was an old lady who dropped “Simulate Signal.”
I don’t know why she needed the signal
– perhaps she just likes a noisy signal?
She needed the signal to start the VI.
I don’t know why she wrote the VI – perhaps she’s high?

There was an old lady who dropped “Power Spectrum.”
I don’t know why she needed the spectrum
– perhaps she just pulled it out of her rectum?
She needed the spectrum to filter the signal.
She needed the signal to start the VI.
I don’t know why she wrote the VI – it’s a trivial VI.

There was an old lady who dropped a graph.
I don’t know why she needed the graph
– perhaps she did it just for a laugh?
She needed the graph to display the spectrum.
She needed the spectrum to filter the signal.
She needed the signal to start the VI.
I don’t know why she wrote the VI – to impress a guy?

There was an old lady who dropped a while loop.
I don’t know why she needed a loop, why she needed a loop, why she needed a loop, why she – *SLAP*. (Oh, thanks…)
She needed the loop to repeat the graph.
She needed the graph to display the spectrum.
She needed the spectrum to filter the signal.
She needed the signal to start the VI.
I don’t know why she wrote the VI – it’s a broken VI.

There was an old lady who created a button.
I don’t know why she created the button
– I’d ask her but she told me not to butt in.
 She needed the button to stop the loop.
She needed the loop to repeat the graph.
She needed the graph to display the spectrum.
She needed the spectrum to filter the signal.
She needed the signal to start the VI.
I don’t know why she wrote the VI – it’s a familiar VI.

There was an old lady who wrote Acquire-Analyze-Present.
And now we know why she wrote the VI: She works for NI!



What Do You Do With A Broken Wire?
(to the tune of What Do You Do With A Drunken Sailor?)

CHORUS:
What do you do with a broken wire?
What do you do with a broken wire?
What do you do with a broken wire to fix a broken VI?

Verse 1:
Change one of its ends to an indicator!
Change one of its ends to an indicator!
Change one of its ends to an indicator!
That’ll fix the VI!

Verse 2:
Insert a node to convert the source type!
That’ll fix the VI!

Verse 3:
Check all ends connect to terminals!
That’ll fix the VI!

Verse 4:
Use control-B and just remove it!
That’ll fix the VI!

Verse 5:
Do whatever the Error Window tells ya!
That’ll fix the VI!

Trusted Enthusiast
AristosQueue
Posts: 2,149

Re: Songs for the LabVIEW Programmer (songs about LV and the dataflow experience)

Mary Had A Block Diagram
(to the tune of Mary Had A Little Lamb)

Mary had a block diagram
                     block diagram
                     block diagram
Mary had a block diagram
     and she kept adding nodes.

It grew larger than the screen one day
                                         screen one day
                                         screen one day
It grew larger than the screen one day
     which was against the rule.

So Mary created subVIs
                              subVIs
                              subVIs
So Mary created subVIs
     with “Convert To SubVI” tool!


LabInterruptedVIEW
(to the tune of An Austrian Went Yodeling)

Ohhh, a programmer launched LabVIEW, a new project begun,
When along came a power spike, interrupting the fun.  L

Ohhhhhhhhh (lots of pounding on the table)
New Class! New V-I! Control+Space! Wire Click! Noooo! (howls)

Oh, a programmer launched LabVIEW, a new project begun,
When along came a manager, interrupting the fun.  L

Ohhhhhhhhh (lots of pounding on the table)
New Class! New V-I! Control+Space! Wire Click!
“That would be greaaaat.” Noooo!

Oh, a programmer launched LabVIEW, a new project begun,
When along came a forced reboot, interrupting the fun.  L

Ohhhhhhhhh (lots of pounding on the table)
New Class! New V-I! Control+Space! Wire Click!
Dum-du-du-du-duuum! (MS Windows launch sound)
“That would be greaaaat.” Noooo!

<and so on, each verse adding another sound or phrase>

LAST VERSE:
Oh, a programmer launched LabVIEW, a new project begun,
When along came some spare time, and now the VI does run!


The Event Structure
(to the tune of Pop Goes The Weasel)

All around the front panel
                the user clicked the mouse
And as it moved or clicked or dragged…
                POP went the events!



Unbreak My VIs by Akash Bhakta
(to the tune of Unbreak My Heart by Toni Braxton)

Un-break my VI
Say you can run it again
Undo this break that you caused
When I broke something else
That does not affect my VI
Un-open this error list
I scrolled so many times
Un-break my VI
My VI...



LabVIEW Rhapsody (by Stephen Mercer, Christina Rogers, & Jeff Boettcher)
(to the tune of Bohemian Rhapsody -- this song is loosely based on a new hire on the LV R&D team breaking LabVIEW.exe when he submits his first feature into the code base. There are a couple of internal terms you should know. "Bowling" is our term for submitting code to Perforce. The "trolls" are project managers who control which developers can submit to Perforce at what times -- they ask questions like, "Have you tested the code? Did you get someone to review it?" AppLibs is the build for the lvrt.dll and InTheDark is the build for LabVIEW RealTime.)

Is this my real job?
Is this just fantasy?
Working on LabVIEW,
Can’t believe they just hired me.
Open VIs
Look at diagrams in G…
We can do better, we need no C routine
Because it’s graphical, data flow,
Down the wires, into nodes,
Every way the code flows, that’s what really matters, in G, in G

Manager, just broke the build.
Used Perforce, synch’d to head,
Hit submit, and now it’s dead.
Manager, the test suite used to run,
But now I’ve gone and blown it all away.
Manager, oooo,
Didn’t mean to make you cry.
I’ll have it fixed again this time tomorrow!
Carry on, carry on, (as if deadlines really matter…)

Too late, release has come
Sends shivers down my spine
CAR list growing all the time.
OK, everybody, I’ve got to bowl,
Just can’t spend any more time to test the code.
Mama, oooo, (anyway the code bowls)
I don’t want to bowl…
I sometimes wish they’d ne’er filed this CAR at all…

The build machine syncs all the files that it can,
Incredibuild, Incredibuild – can you make it build faster?
InTheDark and Applibs – did you build the realtime?  No!
LabVIEW linking, LabVIEW linking,
LabVIEW linking, LabVIEW linking,
LabVIEW linking, here we go – log files show…

I’m just a newbie, nobody told me!
He’s just a new grad from college recently…
He’ll bring in donuts for this bowl travesty.
Easy bug, easy fix – will you let me bowl?
Broken Build! No, we will not let you bowl! Let him bowl!
Broken Build! We will not let you bowl! Let him bowl!
Broken Build! We will not let you bowl! Let me bowl!
We will not let you bowl! Let me bowl! Never!
Never let you bowl! Let me bowl!
Never let you bowl! Oooo
No, no, no, no, no, no, YES  -
Oh mama mia, mama mia, mama mia I can bowl!
The manager has given troll permission to me
yes me
yes me!

So you think you can submit without testing real time?
So you think you can bowl and then leave for a while?
Oh, baby – can’t do this to our baby.
Just back it all out, just back that change right outta here.

Ooh yeah, ooh yeah
LabVIEW really matters.
Anyone can see
LabVIEW really matters – LabVIEW really matters to me

In this way the code bowls…

Trusted Enthusiast
aeastet
Posts: 2,174

Re: Songs for the LabVIEW Programmer (songs about LV and the dataflow experience)

We did this one in another thread Knight mares: Ben has one there too.

(John lenon Imagine)

Imagine there's no Visual Basic
It's easy if you try
Only Labview for coding
Around us only wires
Imagine all the people
Living for a day

Imagine there's only blockdiagrams
It isn't hard to do
Nothing to kill or die for
And event structures too
Imagine all the people
Living life in GUI

You may say that I'm a dreamer
But I'm not the only one
I hope someday you'll join us
And the world will program as one

Imagine written code
I wonder if you can
No need for probes
A brotherhood of man
Imagine all the people
Sharing all the code

You may say that I'm a dreamer
But I'm not the only one
I hope someday you'll join us
And the world will program as one
Tim
Johnson Controls
Holland Michigan
Trusted Enthusiast
Jeff·Þ·Bohrer
Posts: 4,373

Re: Songs for the LabVIEW Programmer (songs about LV and the dataflow experience)

As originally presented here

(too, the tune of...."Mary Poppin's" song "Supercalifragilisitexpalidous" )

BE.. cause I was afraid to post when I was new to Lab(VIEW)
and Ben, he gave my code a tweak, and told me that I had,(Two)
used a local varible that made my VI bad.(oooh)
Then Ravens Fan explained to me what I really had(Whoo!)

Ohhhh...

Altenbach, smercurio and nugget for the week...
Altenbach, smercurio and nugget for the week...
Altenbach, smercurio and nugget for the week...
Super class of LVOOP and now my code's not weak!

Hummmm..LabVIEW.ini  Hummmmm ditty I  
Hummmm..LabVIEW.ini  Hummmmm ditty I 

SO.. as you'll see I'm soon to be an NI gifted Knight
And all my LabVIEW code will be just so completely right
I'll never miss a single trick my postings are all tight
And when I send an app to you it'll sing the bugs goodnight!

OHHHH

Altenbach, smercurio and nugget for the week...
Altenbach, smercurio and nugget for the week...
Altenbach, smercurio and nugget for the week...
Super class of LVOOP and now my code's not weak! ..

(Dick VanDyke- eat your heart out! )

 

"All shall be well and all shall be well and all manner of things shall be well" -Julian
Member
RyanP
Posts: 11

Re: Songs for the LabVIEW Programmer (songs about LV and the dataflow experience)

aka ... "Songs in the Key of G"? :robotvery-happy:

Oh yes ... I went there :-)
Active Participant
Henrik_Volkers
Posts: 1,608

Re: Songs for the LabVIEW Programmer (songs about LV and the dataflow experience)

I remember that 'in the old days' the LabVIEW Zone had a Fun section with a song 'Write in G' (Org. 'Let it be', Beatles)....
Can't find it on the first try...
Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'
Proven Zealot
Ray.R
Posts: 9,455

to the music of Sound of Silence (Simon - Garfunkel)

Hello dark screen, my old friend
I've come to type to you again
Because algorithms are softly creeping
Written in my head while I was sleeping
And the code that was planted in my brain
Still remains
Within the sound of of typing

In front of my keyboard I code alone
Till I get distracted by my phone
'Neath the glow of my desk lamp
Fever's burning and I feel damp
When my eyes were stinging of dryness and constant light
both day and night
And touched the sound of coding

And in the diode light I saw
Ten thousand comments, maybe more
Code description without speaking
Commands executed without listening
Coders writing software that will never share
And no one dared
Disturb the sound of coding

"Fools", said I, "You do not know
coding, like a cancer grows
Hear my words that I might teach you
Take my diagrams that I might show you"
But my keys, like silent raindrops fell
And echoed
In the wells of coding

And the people reviewed my code
they were nasty and bold
And the code missed out on warning
In the code that was developing
And the note said, "The words of the Architect are written in the software specs
Just read the specs"
And whispered in the sounds of coding
===========  =========== * ===========  ==============
(starting to) See Life in a brand new way...

b* ^ )
Active Participant
RobCole
Posts: 568
Kudos

Re: to the music of Sound of Silence (Simon - Garfunkel)

A while ago, Enrique posted two songs that he recorded called I Code In LabVIEW and G Freak.

The link to the page in the forums is Here for the music.

Hmmm. I decided to test the links and found they're not working. I have them downloaded - I wonder if I can/should upload them.

     Rob
Trusted Enthusiast
SteveChandler
Posts: 2,230

Re: Songs for the LabVIEW Programmer (songs about LV and the dataflow experience)

I already posted this already in it's own thread so sorry if you already seen it. But Jeff told me about this dedicated thread.

Capture.PNG
=====================
LabVIEW 2011

Certified LabVIEW Developer


'via Blog this'