Saturday, September 25, 2010

Developing Interactive Simulations with the LabVIEW Player

Introduction to the LabVIEW Player

The LabVIEW Player allows LabVIEW VIs to be posted online for interactive execution within a web page with the look and feel of a Flash TM [link] or Java TM [link] applet. The LabVIEW graphical development environment, with built in drag and drop front panel, is ideal for rapid development of interactive simulations with intuitive GUIs. Scientists and engineers find the multitude of mathematical libraries, numerical solvers, and visualization tools ideal for designing and instrumenting simple and complex algorithms. These interactive, GUI-based programs lend themselves well to parameter exploration and hands-on exploratory learning.

Interactive Simulations

Creation of interactive simulations now takes only a matter of minutes or hours instead of days or months. Programmers no longer need to be familiar with the syntax of the programming environment to create web based simulations. Once a VI is written, it is compiled into a customized development distribution and posted online. A few lines of HTML inside the web page source bring the simulation to life once the user has downloaded and installed the free LabVIEW Runtime Engine and activated the LabVIEW Player functionality. Further instructions for enabling the LabVIEW Player can be found by navigating to the following URL: Installation Procedure for the Connexions LabVIEW Browser Plug-in

Examples Using the LabVIEW Player

The following modules are examples of using the LabVIEW Player to provide interactive simulations.

Creating and Posting Your own LabVIEW Player VIs

Design suggestions and steps are provided for posting the LabVIEW VI in a Connexions module for interactive execution. The steps below are outlined in detail to ensure your success. The design suggesions are very important in allowing others to make the most of your simulation.

Design and test your LabVIEW VI within LabVIEW

  • Typically when programming a VI for use with the LabVIEW Player, the code on the block diagram is placed in a WHILE loop so that it will run until the Stop button is pressed.
  • Placing a time delay, such as the Wait function with an update time of 100ms, will allow the VI thread to go to sleep between iterations. This will prevent your GUI from saturating the processor, thus allowing other applicatons to run smoothly.
  • Size the Front Panel window to the appropriate size by dragging the lower right corner (usually just big enough that you can see everything.)
    • Suggested VI window size is 800 pixels by 600 pixels or smaller
  • Use the Appearance tab of the File>>VI Properties menu to remove the scroll bars or change the window appearance.

Configure the properties of your VI

This ensures proper execution and formatting when the VI is running within the web page.
  • Select File » VI Properties
  • Category: Executionand select “ Run VI when opened
Figure 1
Figure 1 (Graphic1.png)
  • Category: Window Size and select “Set to Current Window Size”

    NOTE: 

    Write down the current Width and Height of the window (you will need this later.)
  • Select OK
  • Save the VI. File » Save

Create a new project, add your VI, & build an .llb

  • Select File » New Project
    • LabVIEW will ask “There are currently VIs open... Do you want to add them to the new project?”
  • Select Add
    • The Project Explorer window will open and your VI will show up in the list.
  • Right Click on “ Dependencies” and choose “ Refresh” from the list.
    • LabVIEW will search for SubVIs referenced by your VI and its subVIs.
  • Save the project and all SubVIs by selecting File » Save All
  • Right Click on “ Build Specifications” and choose New » Source Distribution.
  • The “My Source Distribution Properties” window will appear. Several settings will need to be configured.
    • Build Specification Name: {select a name for your build script}
    • Packaging Option: Custom
    • Exclude vi.llb: uncheck
    • Exclude instr.llb: uncheck
    • Exclude user.llb uncheck
  • Destination Path: {select a save location & name your “.llb” library}
    • Destination is LLB: check
    • .llb will be added to the end of the file name if you did not add it already
    • A dialog will appear prompting you to confirm that the build is an LLB. Select “ Yes”.
Figure 2
Figure 2 (Graphic2.png)
  • Select Build.
    • This process can take a few minutes depending on the VI complexity
  • Save your LabVIEW Project File » Save All
  • Configure the .llb in the LabVIEW LLB Manager to set the Top Level VI
    • Select Tools » LLB Manager
    • The LLB manager will open
    • Select File » Open Folder
    • Browse to the folder your llb is located in
    • Select Current Folder
    • Select your LLB from the list
    • Navigate to the top level VI (main VI you want the user to run)
    • Right click on the VI and select Top Level
    • Close the LLB Manager window with File » Close
    • Close LabVIEW File » Exit

Posting the VI Simulation on Connexions – Server Side

Upload your file to your Connexions module using the File tab in Connexions. You may add the files as either .llb or .vi.
If the VI was created in LabVIEW 8.2, create a new paragraph with the following cnXML code:
<media type="application/x-labviewrpvi82" src="LLB_Name.llb">
<param name="lvfppviname" value=" VI_Name.vi">
<param name="width" value="850">
<param name="height" value=" 575">
</media>

NOTE: 

Emphasized items should be customized to your VI.
If the VI was created in LabVIEW 8.0, create a new paragraph with the following cnXML code:
<media type="application/x-labviewrpvi80" src=" LLB_Name.llb">
<param name="lvfppviname" value=" VI_Name.vi">
<param name="width" value=" 850">
<param name="height" value=" 575">
</media>

NOTE: 

Emphasized items should be customized to your VI.
Save your changes
Use online preview to test the simulation
  1. Flash is a Trademark of Macromedia Inc.
  2. Java is a Trademark of Sun Microsystems Inc.

Content actions

GIVE FEEDBACK:

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...

Popular Projects

My Blog List

Give support

Give support
Encourage Me through Comments & Followers

Followers