Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
24 views

LabVIEW and Web Browser Based UIs

Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

LabVIEW and Web Browser Based UIs

Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 22

The New Standard LLC

The “New Standard” in engineering excellence.


Founded in Wiesbaden, Germany in 2014.

Relocated to USA in 2016.

About The National Instruments Alliance Partner since 2019.

New Standard 2 full-time employees with additional specialists


LLC available.

Specialize in all levels of automated testing engineered


for reusability.
• Requirement and Test Case Development
• Equipment Specification
• Test Development and Execution
• Result Analysis and Debug
LabVIEW and Web
Browser Based UIs
#OurGiantsAreFemale

Dr. Gladys Mae West and


American mathematician

• Bachelor of Science in
Mathematics (1952) and Master
of Mathematics (1955) from
Virginia State College.
• Precise calculations to module
the shape of the Earth became
the basis for the Global
Positioning System (GPS).
• Was inducted into the United
States Air Force Hall of Fame in
2018.
• Available since before LabVIEW 7.1
(2004).

• True no HTML knowledge required.

Remote Front • Able to configure for SubVIs.

Panel • Tried to use on a large UI for a manual


HIL and it was unusable. Large delays in
response time and frequent lost of
connection.

• Requires NPAPI plugins which are not


supported by the modern browser.
• Built on the NXG platform and will be a
standalone product in LabVIEW 2021.

• Runs in any web browser.


LabVIEW
NXG Web • Can be hosted locally on a Windows or
Linux RT target and globally via
Module SystemLink Cloud or a 3rd party server.

• Extendable through standard HTML


code like CSS, Iframe, and JSLI.
• Securely access, monitor, and interact
with applications.

• Capable of Web VI hosting, user access


control, and UI development
(Dashboards).
SystemLink
Cloud • Tag and message data services through
SystemLink API.

• Built-in support for multiple simultaneous


users.

• Included with LabVIEW NXG Web Module.


Use Case: Raspberry Pi UI
• LabVIEW runs on the Raspberry Pi without Front
Panels like on a Linux RT targets.

• LabVIEW NXG Web Module is included in the


LabVIEW Community edition.

• Platform independent UI as it runs in a web


browser.

• Source code:
https://github.com/wiltdavi/Simple-Pi-WebVI-Web
Sockets

• Note: Though, this example is running on a


Raspberry Pi this same concept can be used with
any VI.
Web Communication Basics
• Web communication is a client-server model.
• Client - NXG Web VI
• Server - LabVIEW 2020 VI

• Web API
• RESTful API – Stateless and uni-directional; a new TCP connection is initiated
for each command. For occasional communication or a scenario with lots of
getting requests.
• WebSocket API – Stateful and bi-directional; maintains the TCP connection for
the life of the web socket connection. For real-time high load applications.
JSON Data
• JSON (JavaScript Object Notation) – An
open standard file format that uses human-
readable text to store and transmit data
objects.

• JSON strings are commonly used for


transmitting data in web applications.

• JKI-JSON-Serialization package was used


due to the variant input which allows for
greater development of reusable code.
The Server – LabVIEW 2020 VI
• Basic JKI State Machine with the follow
categories:
• TCP – Listening for an incoming WebSocket session
• WebSocket – Handling of the WebSocket session
• Pi – Raspberry Pi functionality
• Project – Generic functionality
• Command – Handling of incoming messages
• SystemLink – Handling of SystemLink functionality

• The WebSocket and SystemLink functionality


mirror each other with Initialize, Read, Write, and
Close cases.
Establishing a WebSocket Connection

• TCP: Initialize – Create a TCP listener


• TCP: Listen – Check for TCP connection
• TCP: Close – Cleanup the TCP listener
• WebSocket: Initialize – Upgrade to a WebSocket connection
Configurating SystemLink Tags and
Messages
• SystemLink connection is
validated with an API key.

• The SystemLink API utilizes


the REST API so the SytemLink
Objects are just referencing to
the connection information.

• All messages share one Object


while each tag gets its own
Object.
Sending Data

• Items which use this functionality:


• Pi: Get PI OS Time
• Pi: Get LabVIEW OS Time
• Project: Get LabVIEW Time
• Project: Initialize from Web UI
• Project: Sync Web UI
• Command: Process Boolean
The Client – NXG Web VI
• Basic JKI State Machine with the follow
categories:
• WebSocket – Handling of the WebSocket session
• Project – Generic functionality
• SystemLink – Handling of SystemLink functionality

• The WebSocket and SystemLink functionality


mirror each other with Initialize, Read and Write
cases.

• Close cases are missing as everything is destroyed


when the web browser is closed.
NXG Web VI Debug
• The Standard runtime LabVIEW debug tools are not supported, currently.

• For the top-level VI, additional indicators can be created.

• For the any VI the HTML console log can be used.


• Write to System Log – String message and numeric severity input. Same VI which
is used to write to nierrlog system log on non-web applications.
• Debug Log – String prefix and variant value input. The variant is converted to a
JSON string.
• The console is a log so writing to it should only be used for debug and not left in
the final code as it will cause memory usage to grow depending on how often the
console is written to.
Hosting a NXG Web VI on SystemLink
Cloud

• Create a Package
• Right-click on WebVI gcomp (an NXG library) and select Create
Package/Installer with this item.
• Change the Output type to Package.

• Upload to SystemLink Cloud and Share if required.


• Develop LabVIEW VI
• Test locally through LabVIEW IDE
• Test deployed with remote UI
Development
Strategy • Develop NXG Web VI
• Test locally though NXG IDE
• Test deployed
Additional Thoughts
• LabVIEW NXG being discontinued
• There is no hope in ever combining into one project.
• Who is going to continue to develop/support NXG code which can be used by
the NXG Web VI?

• NXG compare not compatible with Web VIs.

• SystemLink Cloud provides benefits that you don’t have to code; web
VI hosting, security, and simultaneous multiple user access but …
Beyond NI
• Since you need to learn something new, what other options are
available?

• Node-Red – A open-source graphical programming language build to ease


connecting and automating IoT enabled devices, APIs, and web-servers.

• Google App Script – Could SystemLink tags could easily be duplicated with a
spreadsheet?

• What else are you familiar with?


Questions?
David Wilt
LabVIEW Certified Developer

Contact Owner, Chief Engineer


Information (586) 275-7711
david.wilt@tns-eta.com
www.tns-eta.com

You might also like