Summary: This document explains how authors can create LabVIEW demos and use them in Connexions documents.
One can use LabVIEW 7 to create interactive or animated demonstrations for use in a Connexions document. These demonstrations are known as LabVIEW Virtual Instruments or VIs. These demonstrations currently run outside of the browser and require the user to have two extra tools: the LabVIEW 7 Run-Time Engine and the Connexions virunner helper application. Another document instructs users on how to obtain these tools for their platform.
Here is one such LabVIEW demonstration. It lets the user see the effects of the amplitude, complex frequency, and phase on the complex exponential.
Create a VI using LabVIEW 7 on your favorite platform. If you create and use sub VIs in your demonstration, then package these dynamic VIs with the top-level VI into an LLB file. A convenient way of doing this is by choosing Save with Options from the File menu. You can then choose Development Distribution, and when prompted, enter a name for an LLB file in which to save the VIs.
When the VI has the desired functionality, you will want to ensure that it behaves the way a user will expect. There should be a convenient way of choosing to close the front panel when the VI has served its purpose. The appearance of the window should also be that of a demonstration applet. You can set the window appearance by choosing VI Properties from the File menu and selecting the Window Appearance category. Choose to customize the appearance, and deselect the following items:
Once you have put the finishing touches on the VI, you will need to build executables for each supported targets. Connexions currently supports Windows, Linux (x86), and Solaris (Sparc) platforms. If you do not have the LabVIEW 7 Professional, then you may need an add-on that provides the application-building functionality. You will need access to LabVIEW on each of the supported platforms because we do not currently have an automated build process.
On each platform, choose Build Application or Shared Library
from the Tools menu. The VIs must not be in memory when you
build them. LabVIEW will warn you if they are. Specify a
target file name for the compiled VI. On Windows, this should
end in .exe. Linux and Solaris do not require
specific extensions for executables, so you may want to append
_linux or _solaris as appropriate to
avoid file name conflicts. Choose a destination directory and
specify the same directory as the support file
directory. Choose the Source Files tab and add the top-level
VI and any dynamic VIs to the list. If you are using dynamic
VIs, then all of your VIs are likely located in an LLB file.
Click the Build button to build the executable. LabVIEW will place the executable and any shared libraries it calls in the destination directory. You may save the build options in a build script so that the process will be easier next time you create an executable from this VI. To load a saved build script, click the Load button.
Once you have created the executables, anyone with LabVIEW or the Run-Time Engine on those platforms can run them. But making the VI Connexions-friendly requires a couple of other small steps.
You must take all of the files created when you built the executables, as well as the source VI or LLB file, and add them to this document. The ID of this document is m11601. To improve the user's experience, we provide only one link for running the VI. The virunner helper app then reads the file pointed to by this link, downloads the platform-specific files, and runs the VI. The file read by virunner is known as a VI Information File (viinfo file) and is a simple XML file, which indicates the locations of the necessary files for each platform. For the Connexions project we prefer that these files reside in this document you are currently viewing. The viinfo file should then point to files inside of this document.
Once the files are all in document m11601, you must create the viinfo file. The FORMAT file included with the virunner source describes the format of the viinfo file. You can access the virunner source via the CVS web interface at http://mountainbunker.org/cgi-bin/viewcvs.cgi/software/virunner/. Here is a sample viinfo file:
<viinfo>
<binary>
<platform>windows</platform>
<main>
http://cnx.rice.edu/content/m11601/latest/common_distributions.exe
</main>
<subordinate>
http://cnx.rice.edu/content/m11601/latest/lvanlys.dll
</subordinate>
</binary>
<binary>
<platform>linux</platform>
<main>
http://cnx.rice.edu/content/m11601/latest/common_distributions_linux
</main>
<subordinate>
http://cnx.rice.edu/content/m11601/latest/lvanlys.so
</subordinate>
</binary>
<binary>
<platform>solaris</platform>
<main>
http://cnx.rice.edu/content/m11601/latest/common_distributions_solaris
</main>
<subordinate>
http://cnx.rice.edu/content/m11601/latest/lvanlys.so
</subordinate>
</binary>
<source>
<main>
http://cnx.rice.edu/content/m11601/latest/Common_Distributions.vi
</main>
</source>
</viinfo>
After adding a demonstration to Connexions, you can use it in a Connexions document. You will need to add the source VI or LLB file as well as the viinfo file to the document. You can then then use an example and media tag to present a LabVIEW demonstration example element.
To produce the following example,
Here is one such LabVIEW demonstration. It lets the user see the effects of the amplitude, complex frequency, and phase on the complex exponential.
use this CNXML code:
<example id="example_id">
<para id="para_id">
Here is a sample LabVIEW demonstration. It lets the user
look at various probability distributions and see the
effects of the parameters.
</para>
<media type="application/x-labview-vi" src="Common_Distributions.vi">
<param name="viinfo" value="common_distributions.viinfo"/>
</media>
</example>