Deploying the HVAC Example with Application Builder
2. Stop the example by clicking the Exit button. Switch to the diagram and examine the code. You have to be familiar with the application design in order to successfully build an executable. The HVAC example has some specifics we need to take into account:
* Note the case structure on the left. Browse to frame 0. The SCADA configuration file HVAC.scf is loaded dynamically. It is expected to be in the subfolder called HVAC SubVIs, relative to the executable. The Application Builder needs to be explicitly directed to include this "support" file in the build and put it in the HVAC SubVIs subfolder.

* Note in frame 1 the HVAC - Simulation.vi is also loaded dynamically. Look at the diagram closely. You can see there are a few more VIs loaded dynamically, as well as the help file. The Application Builder will not include them in the build automatically. We have to direct the builder to do so.
Note: You can open your Windows Explorer and browse the example folder (LabVIEW\examples\lvdsc\apps\Hvac). There you will find the top-level VI (HVAC.vi) and the HVAC SubVIs directory that stores all the SubVIs, SCADA configuration file (HVAC.scf), and other support files.

* All other VIs are included in the standard way - as subVIs. These VIs are statically linked to the top-level VI. This static link makes the VIs visible for the Application Builder and they will be automatically included in the build with no action required. However, it is beneficial to understand that there are generally three types of statically linked VIs, based on their origin:
-- LabVIEW VIs - These VIs are installed by LabVIEW, LabVIEW add-on toolkits, or drivers. All these VIs are located in the VI.LIB folder. They will be automatically included in the build.
-- LabVIEW DSC module VIs - These VIs are installed by the LabVIEW Datalogging and Supervisory Control (DSC) module. These VIs won't be included in the build, even if they are statically linked. These VIs are installed by the LabVIEW DSC module Run-Time System, so there is no need to deploy them. All LabVIEW DSC module VIs have a special attribute set, so the Application Builder knows not to include them in the build. We need only to make sure that the LabVIEW DSC module Run-Time System is installed on the target computer.
3. Modify the example. This example needs a small modification in order to run on a run-time machine. This modification is related to a different relative path the VIs have on the development and run-time machines. A VI can be either saved as a bare VI, in a library, or in an executable (built with Application Builder).

On a run-time computer, the LabVIEW Current VI Path LabVIEW function (used in several places in HVAC.vi) includes the executable name in the returned value. On the development machine, the VI returns ....\HVAC.vi. On a run-time machine it returns ....\HVAC.exe\HVAC.vi. A modified version of the Current VI Path is shown below. This VI checks whether the application is loaded on the run-time machine. If so, it excludes the .exe file from the path.

Not all occurrences need to be replaced with the modified version. In fact there are only two to replace in the HVAC.vi: the one on the left (loads the SCF file) and the one in the true case in the middle of the while loop (loads the help file).
Note: At this point you might be worried about the dynamically loaded VIs. Check the diagram closely and notice the dynamically loaded VIs were expected on the run-time system in a directory that is not valid. All dynamically loaded VIs will be included directly in the built executable. This guarantees the application will always find them.
4. Proceed in building the application. Close all open VIs. It is necessary to close all VIs that are part of the example. They have to be unloaded from memory in order to build the application.
5. Open a new VI and launch the Application Builder from the Tools menu, by selecting Build Application or Shared Library (DLL).
6. Fill the Target property page according to the following picture.

Consider the following when filling in this information:
* The Destination directory is the local directory, where the executable will be created. The Support file directory is the directory to which all support files will be copied. All the HVAC support files have to be located in the HVAC SubVIs.
* Build Options: you can either create a single executable that contains both the statically and dynamically linked subVIs, or you can create a small executable and a *.llb library (the library will only contain the statically linked VIs). The second option gives you a chance to open the LLB and check which VIs were included in the build. This might be a helpful troubleshooting step. However, there are applications that are sensitive to the way the application is built. The HVAC application is one of them. Remember only statically linked VIs are stored in the library, while dynamically linked VIs are always stored in the executable. Sometimes all VIs are expected to be in the same place (same directory). For example the Zoomed View.vi (HVAC.vi's subVI = statically linked)

uses VI Server to dynamically launch a VI. Assume we choose to build a small executable (HVAC.exe) and a library (data.llb). While the Zoomed View.vi would be placed in the library (because it is statically linked), the dynamically loaded VIs would be placed in the executable. The code in the Zoomed View.vi that was supposed to dynamically load the VI would point to a wrong place:

The 'Current VI's Path' would return: ....\data.llb\Zoomed View.vi, which will result into ....\data.llb\<dynamicaly_called_vi>, but the correct path was ....\HVAC.exe\<dynamically_called_vi>, because all dynamic VIs are stored in the executable.
Your application has to be either ready for such challenges (use similar technique we used above - conditional execution base of the RTS/development environment) or build a single executable that stores both dynamically and statically liked VIs.
7. Switch to the Source Files tab
Using Add Top-level VI add the LabVIEW 6\examples\lvdsc\apps\Hvac\HVAC.vi
Using Add Dynamic VI add following VIs: HVAC - 1st cooler.vi, HVAC - 2nd cooler.vi, HVAC - trends.vi and HVAC - Simulation.vi. All are located in the HVAC SubVIs folder.
Using Add Support File add HVAC.scf and HVAC.hlp.

8. Switch to the Installer Settings tab
Fill the property page according to the image:

The Default installation directory is the directory where the LabVIEW DSC module Run-Time System is installed on the target machine. You have to deploy your application to the Run-Time System folder: C:\Program Files\National Instruments\DSC Run-Time\6.0.2 (due to a smaller size the edit box above does not show the complete path).
Click the Advanced button and make sure the Install LabVIEW Run-Time Engine is deselected. Remember the LabVIEW DSC module Run-Time System installs the LabVIEW Engine. There is no need to include it into your application.

9. Save your Application Builder settings to a build file.
Next time you start the builder you can load the setting from the file. Click Save button at the bottom and save the file to your hard drive. Next time you start the builder you can restore the configuration by loading the file (Load button). This example build file is attached to this document.
10. Click the Build button and build the application
11. Move the generated installer to your target machine. The installer was created in the Installer directory you specified in the last tab (C:\project\installer in image above). Make sure the same version of the LabVIEW DSC module Run-Time System is installed on the target machine.
12. Run the setup.exe on the target machine. Follow the prompts. Launch your application after the installation is finished.
Important: If you are trying to deploy and run the application on a machine that also has a development system, make sure you exit it before running the application.
Check the related links for more information:
Related Links:
Building Applications Created with the LabVIEW DSC Module
Support Files to Include when Building a DSC Application
KnowledgeBase: Application Builder for LabVIEW
Reader Comments | Submit a comment »
This document uses the example that's
stated as being found at the following
path:
LabVIEW\examples\lvdsc\apps\Hvac\HVAC.vi,
In LabVIEW 7.1 I did not find that path on
my computer, there is a folder named
Application instead of apps under lvdsc,
but I did not find a HVAC folder. This
document could probably use an update.
- Dec 22, 2004
Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).
