Example Code

Build A Web App for Your Test System in 30 Minutes Webinar Example Code - Using the SystemLink API and LabVIEW NXG Web Module

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW
  • LabVIEW NXG
  • LabVIEW NXG Web Module
  • Measurement Studio

    Operating System

  • Windows

    Programming Language

  • C Sharp
  • LabVIEW G

Code and Documents

Attachment

Description

Didn't get a chance to see the webinar? View it On-Demand!

 

This example is the finished example created during the "Build a Web App for your Test System in 30 Minutes" webinar. It includes the following examples

- Test System Code Modified with the SystemLink API

  • LabVIEW Test System
  • C# Test System

- Web App (WebVI) Example Code

 

In the webinar, we talked about how to build a modern, flexible web application for your LabVIEW 2014 + or C# test system in 30 minutes. We showed the step-by-step tutorial creating a WebVI for your existing LabVIEW application, and published on the web for all to see. WebVIs run entirely in the browser, don’t need extra installs, and adapt to any screen size. All you need to create WebVIs are your LabVIEW skills and the LabVIEW NXG Web Module, no web development knowledge required.

 

photo.jpg

 

 

 

 

 

 

 

 

 

 

How to Use

To run these examples you will need

 

Test System

-SystemLink API (Free)

  • LabVIEW SystemLink Toolkit
    • Download and install at NI.com or NIPM
    • Example Code Supports LabVIEW 2016+
  • C# SystemLink Client

Hosting

-SystemLink Cloud (Free Trial)

 

Web Client

-LabVIEW NXG

  • Download at NI.com or use NIPM

-LabVIEW NXG Web Module (Free Trial)

  • Download at NI.com or use NIPM
  • Purchase includes SystemLink Cloud access

 

General Instructions on Running the Examples

  • Test System Code
    1. Open the Test System code in either editor and load the example code
    2. Examine the addition of the SystemLink APIs
      • In the Measurement Studio code this is in lines 108, 119-148, and 166-212.
    3. Go to SystemLink Cloud and create a trial account.
    4. In SystemLink Cloud go to Manage Security and create a new API key (make sure to copy this to the clipboard!)
      • Replace the API key in the example code with your new API key 
    5. Run the Test System Code
      • The SystemLink APIs will automatically create new tags
      • Ensure these tags get created and are updating by going to SystemLink Cloud.com then >> Data >> Tags.

 

  • Web App (WebVI) Code
    1. Open LabVIEW NXG and load the example code associated with the Test System Example Code chosen
      • i.e., if you are using Measurement Studio, open the WebVI related to Measurement Studio
    2. Examine the Diagram of the WebVI and notice how the SystemLink API is used
    3. Create a Package of the WebVI by 
      1. In the left-hand Project Pane, right-click the .gcomp and select Create Package/Installer with item. This will create a .lvdist.
      2. In the right-hand Document Pane while the .lvdist is open, change the Output Type to Package
      3. Select Build in the right-hand Document Pane or select the hammer at the top toolbar to build the Package

 

  • Hosting on SystemLink Cloud
    1. Go to Systemlinkcloud.com
    2. Navigate to Visualizations >> WebVIs
    3. Select Upload in the upper right-hand corner. Upload the package you created in the previous steps
    4. Once the package is uploaded, you can choose your sharing permissions by selecting the 3 dots to the right of your package, and select Share. 
      • For this example and we recommend keeping it private, meaning only your account can access it
      • If you have specific people you want to share your WebVI with, add their email addresses to the list
      • If you'd like to make it public to anyone who has the link, type in "Everyone".
  • Running the Examples 
    1. Start the Test System Code. This produces new values to the various SystemLink Tags and Messages
    2. Open the WebVI you uploaded to SystemLink Cloud
    3. View the data coming in on the WebVI. Change the values on the WebVI to see those new limits change on the Test System code.
      • Try opening the WebVI on your mobile phone! 

 

 

 

 

 

 

 

 

 

 

 

Related Links

More LabVIEW NXG Web Module Examples

 

 

More Information on the LabVIEW NXG Web Module

 

 

 

 

 

 

 

 

Daniel Parrott
Software Product Marketing - Data Management & LabVIEW
National Instruments

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
gorkyshawnew
Member
Member
on

Thank you for the nice presentation and all the information.