LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Message 1 of 16
(8,193 Views)
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.

 

0 Kudos
Message 2 of 16
(8,159 Views)
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
Message 3 of 16
(8,090 Views)

Sweet!  That's going to be very useful.


Thanks,

Message 4 of 16
(7,940 Views)

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
Message 5 of 16
(7,753 Views)
Not carrying several KB's of debug into the EXE is going to be nice. A definite advantage over using App.Kind property.
Richard






0 Kudos
Message 6 of 16
(7,670 Views)

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 ǝɥʇ'


0 Kudos
Message 7 of 16
(7,575 Views)

Thanks Darren.

 

This is good to know.

 

0 Kudos
Message 8 of 16
(7,559 Views)

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
Message 9 of 16
(7,511 Views)

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.)

 

0 Kudos
Message 10 of 16
(7,030 Views)