Simulation in LabVIEW

Hans-Petter Halvorsen

Delivery  

Introduction

Video: LabVIEW in Automation - Simulation in LabVIEW

Prerequisites: Basic LabVIEW Programming. It is an advantage if you know what a differential equation is.

 

Simulation in LabVIEW

LabVIEW is a powerful tool for simulations. You can simulate dynamic systems (differential equations) in many different ways in LabVIEW. Some examples are:

Below we see an example where we simulate a process in LabVIEW. Instead of the real process we make a model of the real process based on the differential equation of the system. In addition, in this example we control the model using a PID controller.

Below you get an overview of Simulations in LabVIEW.

Simulation in LabVIEW (Video)

PowerPoint (used in the video)

 

 

LabVIEW Formula Node

LabVIEW is a graphical programming language, but sometimes it is more convenient to use text-based syntax. We will learn how to do this within the LabVIEW environment using the Formula Node. LabVIEW also includes also MathScript Node and MATLAB Node. In the  Formula Node we use ordinary C syntax, while in the MathScript Node and MATLAB we use MATLAB syntax.

 

LabVIEW Formula Node Video (YouTube)

LabVIEW Formula Node Tutorial

LabVIEW Formula Node Exercises

 

 

LabVIEW Control Design and Simulation Module

LabVIEW Control Design and Simulation Module is an add-on to LabVIEW where you can do simulations and create control systems within the LabVIEW environment. You find more information here.

Below we see an example where we simulate a process in LabVIEW using the features in LabVIEW Control Design and Simulation Module. Instead of the real process we make a model of the real process based on the differential equation of the system.

Download Software:

LabVIEW Control Design and Simulation Module (32-bit)

 

Simulation in LabVIEW using LabVIEW Control Design and Simulation Module (Video)

PowerPoint (used in the video)

Exercises

 

 

LabVIEW MathScript Module

LabVIEW MathScript RT Module is an add-on to LabVIEW where you can create program with MATLAB syntax. You could say it is a miniature version of MATLAB and you can also integrate MATLAB code into your LabVIEW applications using the MATLAB Node. You find more information here.

MathScript is a high-level, text- based programming language. MathScript includes more than 800 built-in functions and the syntax is similar to MATLAB. You may also create custom-made m-file like you do in MATLAB.

MathScript is an add-on module to LabVIEW but you don’t need to know LabVIEW programming in order to use MathScript.

 

If you want to integrate MathScript functions (built-in or custom-made m-files) as part of a LabVIEW application and combine graphical and textual programming, you can work with the MathScript Node.

 

Download Software:

LabVIEW MathScript Module (32-bit)

 

When necessary software is installed, start MathScript by open LabVIEW:

In the Getting Started window, select Tools -> MathScript Window...

LabVIEW MathScript Video (YouTube)

LabVIEW MathScript Module Tutorial - with Examples and Exercises

 

Tutorial: MathScript and Formula Nodes (from National Instruments)

 

 

Simulation in LabVIEW | Examples and Exercises

Below you find different LabVIEW Simulation Examples and Exercises using LabVIEW Control Design and Simulation Module, the Formula Node in labVIEW, and the LabVIEW MathScript RT Module including MathScript and the MathScript Node.

Simulation in LabVIEW Tutorial with Examples and Exercises

You should follow the examples and exercises within and do them step by step as explained. These exercises will be the foundation for solving the Delivery part below. You should also try to add some value to the simplified examples, in that way you learn so much more.

 

 

LabVIEW Programming Guidelines

Typically engineers often create simple LabVIEW VIs that eventually grow out of control, because they don't have the proper structure and best practices. The solution to this problem is organizing your code and data in a way that enables modularity, readability, and reuse.

Some examples are:

For more details, see the video below.

Video: LabVIEW Programming Guidelines

PowerPoint used in the Video

 

LabVIEW Programming using State Machine

Video: LabVIEW State Machine

Tutorial

Download Code

 

 

 

Delivery

Simulate the Air Heater System in LabVIEW. Use 3 different methods:

The code should be well structured and intuitive. It should contain basic LabVIEW features like While Loop, Case Structure, SubVIs, Arrays, Property Nodes and Clusters, etc. You should use the Project Explorer.

Please follow the "LabVIEW Programming Guidelines" as shown and explained in this video: LabVIEW Programming Guidelines.

 

Note! You should only simulate the process (using the mathematical model). Typically you simulate the system by applying a step in the control signal u=1 at t=0s (a so-called Step Response) and then you plot the results. You shall not create a Control System (with a PID controller), thats the topic in the next Module.

 

Tip! Here you see Simulation Examples of these 3 different approaches/alternatives. Just replace the differential equation in these examples with the differential equation for the Air Heater System.

 

Air Heater System

 

Discretization of Air Heater System:



Submission: Document your LabVIEW Applications (both GUI and code) and deliver a PDF (e.g, 5-8 pages). Here you find a Word Report Template you can use for your report. You can use another template if you prefer. Make sure you fulfill all items in this Checklist before you deliver your Report.

Where should you deliver? Canvas

What should you deliver? Only PDF File - No LabVIEW Code

The text should primarily be reflective and not descriptive. The text should not merely describe what has been done, but also why and how and what the results are. The outcome needs to be put into relevant context.

The document (pdf) can be built up as follows (the so-called IMRaD model):

  1. Introduction: This documentation can start with a brief introduction, i.e. describe what you have made, what is the purpose with the program, etc. Typically, you should also include a System Sketch. A System sketch is an illustration/figure of your system, the different parts the system consists of, and how they relate to each other.
  2. Methods and Results (Overview of the Work that has been done and the Results): Include one or more images of the User Interface (Front Panel) and Code (Block Diagram). These should also be briefly described in the text.
  3. Discussions and Conclusion/Summary: Discuss your Results. Finally, a brief summary/conclusion of your work. Does you program work as expected? Why/Why Not, any improvements that needs to be made with your program, etc.

Write Technical Reports in Microsoft Word - Here you learn the basic structure of a Technical Report, how to insert Figure Captions and refer to those in the text, how to insert Equations and refer to those in the text, how to add References, etc.

More information about IMRaD.

Make sure to insert Figures, Tables and Equations correctly, please see the video Equations in Word and PowerPoint.

Referencing: If you have used external sources, you need to use referencing. In scientific documents we typically use the IEEE standard, see Kildekompasset for details. Citation and Referencing with Microsoft Word (YouTube)

Remember to have focus on the technical work that has been done (as you have learned that technical/ professional documentation should be written), i.e., you should NOT tell how much you have learned, that the assignment was interesting and such things. Pretend that you write this documentation for a Customer that have asked you to make this program and document the Methods used and the Results achieved.