Keywords

1 Introduction

An industrial process is a set of operations to: obtain, transform or transport primary products [1]; the control of industrial processes allows to keep a desired amount in the dynamic variables such as flow, pressure and temperature. This increases the production, productivity and efficiency [2].

To learn about process control, there are teaching systems (industrial plants) that allow students to acquire skills and abilities when they develop laboratory practices [3], these didactic systems for the control of the variables: pressure, level, temperature, flow, etc. They allow to set up a system of closed-loop control, integrating the three fundamental components such as controller, sensor and the actuator. The tasks to be developed to perform the closed-loop control of the aforementioned processes are obtaining the mathematical model of the process, optimal controller design (analytical method) and implementation and validation of the control algorithm in the plant.

The didactic systems of commercial brands used for the learning of process control are very expensive because of the industrial components that comprise it (sensors, transmitters, actuators, etc.), this price makes it difficult for some institutions to acquire these systems for teaching of process control. Nowadays, there is a lower cost alternative known as “Hardware-in-the-loop” that allows to simulate plants or control systems in real time, together with real elements of sensors or actuators [4,5,6,7].

Several scientific works have been developed in this area of research, in [8] explain how HIL can be used effectively to reinforce the theoretical concepts in control systems, in [9]. It is developed a system of simulation of a photovoltaic plant for the analysis of intelligent networks, using Simulink and Arduino. It is explained that the best result is obtained from the implementation of the entire system in a simulator in real time. In [10] develop the simulation using the technique of Hardware-in-the-loop of a Buck Converter. Good results are obtained from the simulation, and the data are compared for verifying that the system works efficiently when is implemented in an FPGA; in [11], a control system for a plant embedded in FPGA is developed. In this research, they implement a first-order temperature system in an FPGA. At the same time, they develop the PID controller programming in the LabVIEW software, and the communication between the two applications is made using the RS-232 serial interface. It is observed that the limitation that exists is the resolution of sending and the receiving information to 8 bits. The obtained results indicate the correct functioning of the implemented system.

In this context, a simulation of a plant is presented for the flow control. In the design of the visualisation interface, the LabVIEW software is used, and the simulation of the plant is embedded in a card myRIO that contains a FPGA. This system includes the simulation of a sensor (0–5 v) and an actuator (0–5 v) for the interaction with the different controllers on the market. The structure of the system is presented in Fig. 1.

Fig. 1
figure 1

Diagram of the proposed system

2 Development of the HIL

2.1 The Flow Plant Design

The design of the flow plant is considered to be a didactic system as indicated in [12]. The process is a flow feedback system, which has a detailed flow sensor (FE). It sends a 0–5 Vdc voltage signal to a flow controller (FIC). In this controller, the PID control algorithm is performed. Finally, the control signal CV (0–5 Vdc) is sent to the final control element (SC). In Fig. 2, the design of the pipe and instrumentation diagram (P and ID) is presented. It is used as a reference for the development of the virtual environment.

Fig. 2
figure 2

Piping and instrumentation diagram of the plant flow to be implemented

2.2 Implementation of the Flow Plant

The embedded system (myRIO) is used. It is composed of an FPGA. The design of the visualisation interface is developed in LabVIEW software. The LabVIEW FPGA module converts the designed programming in the FPGA VI to the FPGA hardware, through the compilation and generation of files for FPGA programming (bit file). The developed interface HIL consists of a flat sequence with three stages:

First stage (A). It allows initialising the variables of the myRIO.

Second stage (B). The execution of the program is developed in parallel due to the characteristics of the FPGA. It is made up of two While loop:

  1. 1.

    While Loop #1. It allows the simulation of the transmitter and the actuator, generating and receiving electrical signals (0–5 Vdc), prior to the configuration of analogue inputs and outputs of the myRIO card.

  2. 2.

    While Loop #2. It allows the simulation of the flow plant. The mathematical model implemented corresponds to a first-order model with dead time, as shown below:

$$G\left( S \right) = \frac{1.1211}{1 + 1.12168s}*e^{ - 0.7023s}$$
(1)

Third stage (C). Close the connection with myRIO.

The programming is presented in Fig. 3.

Fig. 3
figure 3

Programming “HIL” of the flow plant, a front panel, b block diagram

3 Controller Design

To check the operation of the HIL system in closed loop, two types of controllers were designed and implemented: (i) a continuous controller is implemented in a PLC and (ii) a discrete controller is implemented in LabVIEW.

3.1 Design of the Continuous PID Controller

For the design of the continuous controller, the analytical method is used. The mathematical model of the HIL system of the flow plant is obtained.

$$G\left( S \right) = \frac{{K_{m} }}{{1 + T_{m} s}}*e^{{ - \tau_{m} s}}$$
(2)
$$G\left( S \right) = \frac{1.1205}{1 + 1.1648s}*e^{ - 0.7557s}$$
(3)

The calculation of PID tuning constants is performed by LAMBDA method.

$$K = \frac{1}{{K_{m} }}.\frac{{\frac{{\tau_{m} }}{2} + T_{m} }}{{\frac{{\tau_{m} }}{2} + T_{\text{cl}} }} ;\;\;{\text{where}}\,\,T_{cl} = 3T_{m}$$
(4)
$$T_{i} = T_{m} + \frac{{\tau_{m} }}{2}$$
(5)
$$T_{d} = \frac{{T_{m} \tau_{m} }}{{\tau_{m} + 2T_{m} }}$$
(6)

The PID obtained constants are \(K = 0.3555\), \(T_{i} = 1.5427\) and \(T_{d} = 0.1\).

The PID continuous control algorithm designed is

$${\text{PID}}\left( s \right) = 0.3555\left( {1 + \frac{1}{1.5427s} + 0.1s} \right)$$
(7)

3.2 Design of the Discrete PID Controller

The action of the implemented digital controller is given by the following expression:

$${\text{PID}}\left( {\text{kh}} \right) = P\left( {\text{kh}} \right) + I\left( {\text{kh}} \right) + D\left( {\text{kh}} \right)$$
(8)
$${\text{PID}}\left( {\text{kh}} \right) = K_{p} E\left( {\text{kh}} \right) + K_{i} {\text{hE}}\left( {\text{kh}} \right) + I\left( {\left( {k - 1} \right)h} \right) + \frac{{K_{d} }}{h}[E\left( {\text{kh}} \right) - E\left( {\left( {k - 1} \right)h} \right)$$
(9)

To obtain the tuning constants and the sampling time, the auto-tuning tool is used. The constants obtained are \(k_{p} = 0.6\), \(K_{i} = 0.5\), \(K_{d} = 0.26\) and \({\text{d}}t\left( s \right) = 0.1\).

4 Tests and Results

4.1 Tests

The procedure used for the tests of the system consists of performing a manual and automatic control, using a computer that has LabVIEW software installed and a Siemens S7-1200 PLC. There are three types of tests, which allow to verify the operation of the Hardware-in-the-Loop system, and this tests are described below:

  1. 1.

    Transmitter and actuator simulation offlow. Tests are done in open loop with random samples of variation of the transmitter and the actuator to verify the error of the implemented system.

  2. 2.

    Automatic control of the flow plant using continuous control. Through the programmable logic controller (PLC), the continuous PID control, designed in paragraph (3.1), is implemented.

  3. 3.

    Automatic control of the plant using discreet control flow. Through LabVIEW and data acquisition (DAQ 6008) produced by National Instruments, the discrete PID control, designed in paragraph (3.2), is implemented.

4.2 Results

The obtained results from the HIL system are presented:

  1. 1.

    Test performed in open loop.

The obtained measurements from the simulated instruments are presented in Tables 1 and 2.

Table 1 Measurements of the simulated flow transmitter, determination of the error
Table 2 Verification of the actuator working, determination of the error
  1. 2.

    Operation of the system Hardware-in-the-loop of the flow plant.

The interface of the flow plant in operation is presented in Fig. 4. The animation in the pipes provides a realistic environment for the flow of water through the pipes, and as well as the amounts of the transmitter and actuator are displayed in real time.

Fig. 4
figure 4

HIL system in operation

  1. 3.

    Response of the implemented continuous PID control for the control of the HIL system.

Figure 5 shows how the implemented continued PID controller in the PLC responds to a consignment signal and how the process variable stabilises at the 14 s and not presents overshoot.

Fig. 5
figure 5

Response of the continuous PID control implemented in PLC for the control of “HIL” flow plant

  1. 4.

    Response of the discrete PID control implemented in LabVIEW software.

Figure 6 shows how the discrete PID controller implemented in LabVIEW software responds to consignment signal and how the process variable stabilises at the 9 s and does not present overshoots.

Fig. 6
figure 6

Response of the discreet control implemented in LabVIEW, for the control of “HIL” flow plant

5 Conclusions

The implemented HIL system provides performance animation similar to a flow plant. Its response is in real time with two types of implemented controllers (continuous controller and discrete controller).

The HIL system is a low-cost proposal for teaching process control. It allows students to design continuous and discrete controllers.

Finally, as future work, a Hardware-in-the-loop system could be developed for advanced and multivariable control.