labvieW Real-Time Deployment
Deploying a LabVIEW real-time project as a startup executable
LabVIEW real-time projects can be run directly out of LabVIEW (for development purposes) or compiled into an executable. The executable can be deployed on a real-time target such as the National Instrument cRIO. A cRIO could for example be used to control an industrial plant (e.g. battery management, servo drive control), with the startup executable loaded each time the real time system (cRIO) reboots.
Running the executable on the real-time target does not require a LabVIEW license. This hence provides a convenient way of providing a packaged solution to a client, how does not need a LabVIEW license to run the final real-time application.
This blog provides a step-by-step guide to deploying a LabVIEW real-time project as a startup application. The interface to the LabVIEW front panel is via a simple web browser interface.
Our starting point for this blog is that you have created a LabVIEW project, with a real-time target added. The target added in our project is the cRIO-9038, but many other targets would work in a very similar way. Our cRIO-9038 runs a real-time Linux Operating System. We have two modules added, an analog output module (NI9263) and an analog input module (NI9221). These are not required on your end, and only serve as an example application here.
We then create a simple real-time application, using a 1ms RT loop. In this loop, as sine wave is written to one of the NI9263 outputs. This output is then in hardware (two wires) connected to the input of the NI9221. The input of the NI9221 is then also read in the real-time loop. A second non real-time loop handles writing the input data to a scope. We prefer using non real-time while loops for anything that is not strictly real-time – see this blog for some explanation.
We can now simply press run and execute this simple example project from within LabVIEW.
To deploy the project as a startup executable, accessed via a web browser, we first need to enable the front panel. The default setting for a LabVIEW project is that the remote front panel server is disabled. Right mouse click on our real-time target (in the project explorer) and bring up properties. Go to the Web Server settings and check the box to “Enable Remote Panel Server” as shown below.
With the Remote Panel Server enabled, we can add a .html file to access our front panel via a web browser. Open the web publishing tool
Follow the on-screen instructions, making sure that you tick “Request control when connection is established”. This gives you full access to buttons, edit boxes etc. via the browser interface.
Click next, and rename your .html file to something convenient (and place this file somewhere in your project directory).
Finally, save to disk (no need to start the web server here).
Next, add a real-time application to your project under Build Specifications.
Go to the properties of the newly created application, and edit the Source Files as follows
This includes your main VI as the startup VI, and the .html file we just created as a file that is always included in the project. Next, go to Destinations, and add (plus button) a new destination “www” with path “/var/local/natinst/labview/www”. This is the default RT Linux directory for your .html file.
Under Source File Settings, select the .html file you created, and change the destination to “www”. This ensures that the .html file is copied into the correct directory when the project is deployed.
All other real-time application settings can remain at their default value. You can now build your application.
Once “Build”, as press “Set as startup” and “Run as startup” under the same drop down menu. The final step will reboot the cRIO, asking for your usual username and password.
Start up a web-browser (like it or not, Internet Explorer work best, Firefox, Chrome and Edge all struggle to some extend). First go to http://crio_ip:8000 to check that the NI web server is running.
If this page does not come up as above, check (via NI Measurement and Automation Explorer, MAX) if the NI Application Web Server, and the Remote Panel Sever for LabVIEW RT are installed. With all components correctly installed, you can now go to the .html file created earlier.
That’s it – hopefully all steps worked out for you. Contact us if you need help.