NI Home > Community > NI Discussion Forums
Reply
Trusted Enthusiast
Darren
Posts: 2,794

Darren's Weekly Nugget 11/09/2009

(Today's nugget comes to us from gmart, who knows a thing or two about App Builder.)

 

The Conditional Disable Structure will execute code depending on various conditions. A new condition was added in LabVIEW 2009 called RUN_TIME_ENGINE:

 

nugget.jpg

 

This symbol specifies whether code in a subdiagram executes when you create a LabVIEW stand-alone application or shared library that uses the LabVIEW Run-Time Engine.  While the same functional behavior could be achieved by using the App.Kind property of the Application class, the conditional disable symbol goes further by not even including the code in the application.  By using this symbol, you can have debug code execute while developing in the LabVIEW environment, and effectively comment it out in a built application. The symbol is not applicable to outputs of source distributions since that code is generally called from another LabVIEW environment.

Darren Nattinger, CLA
LabVIEW Artisan and Nugget Penman
Trusted Enthusiast
GregFreeman
Posts: 2,290
0 Kudos

Re: Darren's Weekly Nugget 11/09/2009

Pretty nifty! Now a question that somewhat relates to that, as I am not very familiar with this structure. Is it a good structure to use when setting up code so you can have a "real-time" and a "sim" mode? For instance, using it to disable code around connection (serial or tcp) reads and writes so you don't get connection errors when in sim mode and are reading in a datalog file to simulate a RT environment instead? Or is a simple case structure with a "real time/sim mode" boolean more reasonable? I may get some mixed responses or "depends on the situation" answers, but I figured this was a good place to follow up.

 



CLA, LabVIEW Versions 2010-2013



Active Participant
gmart
Posts: 333

Re: Darren's Weekly Nugget 11/09/2009

There is another symbol - TARGET_TYPE. One of the entries is "RT". So you should be able to use the build in symbol when loading the VI on an RT target. You can also define your own custom symbols. These are defined in the Project Properties dialog box.
George M
National Instruments
Active Participant
Jim_Kring
Posts: 1,742

Re: Darren's Weekly Nugget 11/09/2009

Sweet!  That's going to be very useful.


Thanks,

Thinking in G
Active Participant
waldemar.hersacher
Posts: 1,120

Re: Darren's Weekly Nugget 11/09/2009

[ Edited ]

for(imstuck),

 

before we got the conditional disable structure we are using a simple case. Building a demo version and sending to a customer causes always to install the drivers. The VIs were part of the exe and are loading the external DLLs although they where never used, e. g. the DAQmx VIs.

 

With this structure and custom symbols like "DAQ-Not-Present" we are able to leave the DAQmx VIs out of the demo and therefore have no need to install the drivers. Copying the runtime to the same folder as the application we were able to run directly from CD/DVD.

 

For us this is not a "depends on the situation".

Message Edited by waldemar.hersacher on 11-12-2009 09:03 PM
Waldemar

Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
Don't forget to give Kudos to good answers and/or questions
Active Participant
Broken_Arrow
Posts: 1,845
0 Kudos

Re: Darren's Weekly Nugget 11/09/2009

Not carrying several KB's of debug into the EXE is going to be nice. A definite advantage over using App.Kind property.
Richard





Trusted Enthusiast
Henrik_Volkers
Posts: 2,105
0 Kudos

Re: Darren's Weekly Nugget 11/09/2009

Waldemar,

 

is it still possible to run a driver less lv.exe without a runtime installation on a windows system?  I did that with lv 4 ... but I thought with the current versions it's not possible anymore. 

What will files be needed?  I remember lvrt.ddl,  however that was many years in the past ;-)   

 

 

Sorry for hitchhiking

 

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 ǝɥʇ'
Knight of NI
Ray.R
Posts: 10,438
0 Kudos

Re: Darren's Weekly Nugget 11/09/2009

Thanks Darren.

 

This is good to know.

 

______________________________________________________________________
Kudos!!!! Gimme Kudos!!!! It's that little golden star on the left below my avatar... :smileyhappy:
Active Participant
waldemar.hersacher
Posts: 1,120

Re: Darren's Weekly Nugget 11/09/2009

Henrik,

 

additional to your exe you need the files from National Instruments\Shared\LabVIEW Run-Time  and then the correct LV version. You may try to delete the one or other DLL, e.g. lvpng.dll is only needed when you are reading or writing png graphics files. Also you can delete files in model (controls you don't use) and script.

 

There is one LV 8.x version (I don't know which from my head) where you needed to copy a ini-file from the Windows folder to the application.

 

As a result to a Windows crash where I lost parts of the registry I need to unplug a harddisk to have a system I can use again. On this disk I have all those versions available. If you are interested in more details contact me per email on buero at hersacher.de.

Waldemar

Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
Don't forget to give Kudos to good answers and/or questions
Member D*
Member
D*
Posts: 59
0 Kudos

Re: Darren's Weekly Nugget 11/09/2009

Your nugget encouraged me to start playing around with the Conditional Disable, but I ran into a bug where it executed the wrong code when the VI was a subVI (see attached).  Things were "repaired" if I recompile everything, or have the subVI's front panel open, but it leaves me wondering how bullet proof the Conditional Disable is.  Are these structures safe in mission critical apps?

 

(P.S. - You will only see the bug in LV 8.6, 8.6.1.    If you open it in LV 2009, it will force a recompile and you will not see the bug.)