Hardware-in-the-Loop (HIL)

HIL Simulation and Testing

1 Introduction

Introduction (Video) + Assignment (PDF)

In this assignment we will use something called Hardware-in-the-Loop Simulations and Testing. It may be very useful to test that a controller is working with a simulated process before the controller is applied to the real (physical) process. If the mathematical model used in the simulator is an accurate representation of the real process, you may even tune the controller parameters (e.g. the PID parameters) using the simulator. More Videos.

We will use a Fuji PXG5 Industrial PID Controller as our "Hardware" in the Loop device. Here you find the Instruction Manual (which must be read carefully!). In addition, we will use the Air Heater System as our process. Blackbox Models and Code Examples are found here.

 

1.1 Topics

The following topics are covered in this assignment:

 

1.2 Hardware

You will need the following hardware:

 

1.3 Software

You need the following software:

 

 

2 Fuji PID controller

Fuji PXG5 PID is an industrial PID Controller typically used in the process industry.

Below you see one of the Industrial PID Controllers we have in the laboratory.

 

Resources:

Fuji PXG5 PID Controller Overview (YouTube) + PowerPoint (PDF)

 

 

3 LabVIEW

LabVIEW is a graphical programming language, and it has powerful features for simulation, control and DAQ applications.

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:

 

Resources:

Basic LabVIEW Programming (Website)

LabVIEW Programming Guidelines (YouTube) + PowerPoint (PDF)

LabVIEW State Machine (YouTube) + PowerPoint (PDF) + Download Code

LabVIEW in Automation (Website)

 

 

4 Simulation and Control

LabVIEW is a powerful tool for simulations and control. 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.

Resources:

Simulation in LabVIEW (YouTube) + PowerPoint (PDF)

Here you see some basic Simulation Examples (PowerPoint) where 3 different approaches/alternatives are used.

 

4.1 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)

 

4.2 Control Systems

Videos explaining the fundamentals regarding Control Systems:

Understanding Control Systems - Feedback Control Systems (MathWorks)

Understanding PID Control - What is PID Control? (MathWorks)

 

Example of Control System created with LabVIEW:

 

 

5 Data Acquisition (DAQ)

LabVIEW has good support for Hardware and DAQ.

 

Resources:

DAQ with LabVIEW (YouTube) + PowerPoint (PDF)

 

5.1 USB-6008

The National Instruments USB-6008 is a low-cost, multifunction data acquisition device (DAQ). It has 8 analog inputs, 2 analog outputs, and 12 digital input/outputs. The digital channels are divided into two ports. When one or more channels on each port is set to either input or output, the port is locked into that particular mode.

To use the USB-6008 DAQ from National Instruments, you need to install the NI-DAQmx driver.

Make sure to read the User Guide and Specifications for USB-6008 and USB-6008 Pinout.

 

Multimeter

When testing Analog Out (or Digital Out) you can e.g., connect the USB-6008 to a multimeter to test if the signal is as expected.

 

Loop-back Test

When testing Analog In/Out Pins (or Digital In/Out) you can also use a so-called "Loop-back" Test. here you just wire the input and out put together as illustrated.

Resources:

LabVIEW and USB-6008 (YouTube) + PowerPoint (PDF)

 

5.2 Lowpass Filter

In Measurement systems and Control Systems we typically need to deal with noise. Noise is something we typically don’t want. Noise is high-frequency signals. Low-pass Filters are used to remove noise from the measured signals.

 

Resources:

Low-pass Filter Overview (Tutorial)

Read Temperature Data with Lowpass Filter in LabVIEW (Video) + PowerPoint (PDF)

 

5.3 Logging to Text Files

When acquiring data from a DAQ device or an I/O Module you typically want to store the data to either a File, a Database or an OPC Server Here we will use the “Write To Measurement File” in LabVIEW as an example If you don’t have a DAQ device or an I/O Module you can create a simple Simulator as exemplified later in this Tutorial.

 

Resources:

Logging Temperature Data to Text File in LabVIEW (Video) + PowerPoint (PDF)

Tutorials:

Logging to Text Files in LabVIEW (Tutorial)

Logging Data from Multiple Sensors to Text File in LabVIEW (Tutorial)

 

 

6 HIL Simulation and Testing

Hardware-in-the-Loop (HIL) Simulation is a technique that is used for testing Control Systems, Embedded Systems, etc. Carrying out a HIL Simulation to Test the Control System, Embedded System, etc. is called HIL Testing.

The machine or physical part of the system (which we call the plant) is normally connected with the control system, through actuators and sensors. With HIL testing the plant is replaced by a simulation of the plant (which we call the HIL simulator). If the HIL simulator is designed well, it will accurately mimic the plant, and can be used to test the control system.

 

Resources:

Fuji PXG5 PID Controller Overview (YouTube) + PowerPoint (PDF)

Hardware in the Loop (HIL) Simulation and Testing (YouTube) + PowerPoint (PDF)

Download Blackbox Models and Example Code (ZIP) + Video (YouTube)

Fuji PXG5 PID Autotuning Simulator (YouTube) + PowerPoint (PDF)