Next Article in Journal
Enhancing the Performance of Software Authorship Attribution Using an Ensemble of Deep Autoencoders
Next Article in Special Issue
Dynamic Stability Measurement and Grey Relational Stability Sensitivity Analysis Methods for High-Speed Long-Span 4-1 Cable Robots
Previous Article in Journal
Mathematical Modeling and Short-Term Forecasting of the COVID-19 Epidemic in Bulgaria: SEIRS Model with Vaccination
Previous Article in Special Issue
Quasi-Linear Parameter Varying Modeling and Control of an Electromechanical Clutch Actuator
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

A New Software-Based Optimization Technique for Embedded Latency Improvement of a Constrained MIMO MPC

by
David Sotelo
1,
Antonio Favela-Contreras
1,*,
Alfonso Avila
1,
Arturo Pinto
1,
Francisco Beltran-Carbajal
2 and
Carlos Sotelo
1
1
Tecnologico de Monterrey, School of Engineering and Sciences, Ave. Eugenio Garza Sada 2501, Monterrey 64849, Mexico
2
Departamento de Energía, Universidad Autónoma Metropolitana, Unidad Azcapotzalco, Av. San Pablo No. 180, Col. Reynosa Tamaulipas, Mexico City 02200, Mexico
*
Author to whom correspondence should be addressed.
Mathematics 2022, 10(15), 2571; https://doi.org/10.3390/math10152571
Submission received: 9 June 2022 / Revised: 19 July 2022 / Accepted: 22 July 2022 / Published: 24 July 2022
(This article belongs to the Special Issue Advances in Dynamical System Modelling and Computer-Aided Design)

Abstract

:
Embedded controllers for multivariable processes have become a powerful tool in industrial implementations. Here, the Model Predictive Control offers higher performances than standard control methods. However, they face low computational resources, which reduces their processing capabilities. Based on pipelining concept, this paper presents a new embedded software-based implementation for a constrained Multi-Input-Multi-Output predictive control algorithm. The main goal of this work focuses on improving the timing performance and the resource usage of the control algorithm. Therefore, a profiling study of the baseline algorithm is developed, and the performance bottlenecks are identified. The functionality and effectiveness of the proposed implementation are validated in the NI myRIO 1900 platform using the simulation of a jet transport aircraft during cruise flight and a tape transport system. Numerical results for the study cases show that the latency and the processor usage are substantially reduced compared with the baseline algorithm, 4.6 × and 3.17 × respectively. Thus, efficient program execution is obtained which makes the proposed software-based implementation mainly suitable for embedded control systems.

1. Introduction

Most industrial processes are multivariable systems which often present strong interactions between the manipulated and the controlled variables. Here, the definition of a suitable control structure to regulate the system is not often trivial [1], especially when dealing with multiple-objective problems and dynamics complexity. In this scenario, even though diverse strategies are possible [2], Model Predictive Control (MPC) turned out to be among the most effective ones in fulfilling the aforementioned tasks [3,4,5]. Studies found in the recent literature exploit algorithms based on MPC methods applied to several process, in which online optimization problems are involved [6,7,8,9,10]. However, it is well known that MPC is more challenging than other control strategies [11,12]. The challenges and differences arise from the following main aspects:
  • The control action must be calculated in a receding horizon manner. MPC solves an optimal control problem at each sampling instant, where a sequence of control moves are optimized and only the first control move is injected into the system [13]. This process is repeated, which translate into a greater computational demand on control platforms [14].
  • MPC has been known as powerful tool to deal with system constraints [15].This control strategy addresses the state constraints and input saturations to obtain the manipulation that minimizes the proposed cost funcion [16]. Here, heavy execution load and communication resources are needed [17].
  • Use of weighting matrices in the cost function. In MPC approaches the value of the pondering matrices are set a priori, to penalize the large excursion of the tracking error and the deviation of the manipulation. This, to obtain the control action; thus, the optimization process that derives the best results can not usually sustain a low stable computation time [18].
Henceforth, these aspects limits the algorithms that can be used to solve the MPC strategy and has motivated the search for computationally efficient optimization algorithms for practical applications where the sampling period tends to be short [12]. In addition, embedded systems are a powerful tool in industrial implementations. In contrast to personal computer applications, they address low computational resources, but provides portability, low cost and low jitter because of the reduction of software interruptions from the operative systems. Thus; MPC is desirable for embedded applications with fast control cycles, such as bioengineering, aerospace, automotive, etc. These embedded applications require small and power-efficient controllers, capable to solve optimization problems at high sampling rates [19]. The first embedded implementation of an MPC algorithm is reported in [20], which consists of a constrained control strategy for a single-input single-output (SISO) system on a Field-Programmable Gate Array (FPGA). Nowadays, research efforts are focused on the development of embedded MPC implementations with low latency. Nevertheless, the computation complexity makes the multivariable MPC poorly efficient for high speed applications where the controller iteration must be executed in a few milliseconds or even in microseconds.
For this reason, recent research works address the computational load by software or hardware improvement. In [21], for multivariable processes, a relaxed performance index with the constraints implicitly defined in the weighting matrices is developed, which contributes to reduce the execution time. Moreover, in [22], the online latency is reduced, by converting the quadratic programming problem into an equivalent nonnegative lest-squares problem. On the other hand, in [23,24,25], the authors implement a constrained MIMO MPC on high resources processors of 1.6 GHz, 2.2 GHz and 1.25 GHz respectively. These implementations reach low latency due to the amount of resources on their embedded devices. However, the processors are not affordable. Furthermore, in [9], a constrained MIMO MPC is well implemented on a NI myRIO 677 MHz processor. Nevertheless, as it is mentioned, it is not recommended for fast applications. In [26], an MPC algorithm is implemented on a microprocessor of 216 MHz reaching low latency, but constraints are not considered. Additionally, a constrained MIMO MPC is implemented on a microprocessor of 96 MHz in [27], nevertheless, high latency is reported. In contrast to research efforts found in the literature, this work presents an embedded implementation of a constrained MIMO MPC algorithm (“Baseline”) and a new software-based optimization for the embedded control strategy (“Propose”). Thus, without affecting the tracking performance of the Baseline, the execution time and the processor usage are substantially reduced in the Propose. This makes the proposed software-based implementation mainly suitable for embedded control systems.
The paper is organized as follows. Section 2 presents the constrained MIMO predictive control algorithm. Section 3 describes the foundations of computational architecture used in this work. Section 5 presents a computational analysis of the MIMO predictive control algorithm and the proposed software-based implementation. Additionally, a jet transport aircraft as study case and the selected embedded platform are presented. Section 6 shows the performance, the execution time and the processor usage, of both implementations: the Baseline and the Propose. Finally, Section 7 discusses the conclusions.

2. Model Predictive Control Algorithm

This section presents a brief review of the MIMO predictive control algorithm. This MPC is based on discrete-time state space model, and it is proposed by Wang in [10]. In this previous work, considering the predictions of the states, the control action is obtained through the solution of a constrained optimization problem by using a cost function with a weighting matrix. At each sampling time, an optimal control problem is solved which demands high computational resource usage. The system dynamics is denoted by the discrete time Linear Time Invariant (LTI) State-Space Model taking the following structure:
x m ( k + 1 ) = A m x m ( k ) + B m u ( k ) , y ( k ) = C m x m ( k )
where x m ( k ) R n x is the state vector, u ( k ) R n u is the controlled input vector, y ( k ) R n y is the output vector, A m R n x × n x is the state matrix, B m R n x × n u is called the input matrix, C m R n y × n x is called the output matrix and k N denotes the sampling instant number.
The MPC strategy uses the Velocity Form Model (VFM) as offset-free method [10,28,29,30]. The VFM method is based on an augmented State-Space Model. Hence, from (1),
Δ x m ( k + 1 ) = A m Δ x m ( k ) + B m Δ u ( k ) Δ y ( k + 1 ) = C m A m Δ x m ( k ) + C m B m Δ u ( k )
where Δ x m ( k + 1 ) = x m ( k + 1 ) x m ( k ) , Δ x m ( k ) = x m ( k ) x m ( k 1 ) , Δ u ( k ) = u ( k ) u ( k 1 ) and Δ y ( k + 1 ) = y ( k + 1 ) y ( k ) , the VFM takes the following structure:
x ( k + 1 ) = A x ( k ) + B Δ u ( k ) y ( k ) = C x ( k )
where
A = A m 0 n x × n y C m A m I n y × n y B = B m C m B m C = 0 n y × n x I n y × n y
and x ( k ) R n x + n y is the new state vector:
x ( k ) = Δ x m ( k ) y ( k )
As in [10], the state predictions for the consecutive sampling instants are:
x ( k + 1 ) = A x ( k ) + B Δ u ( k ) x ( k + 2 ) = A x ( k + 1 ) + B Δ u ( k + 1 ) = A 2 x ( k ) + A B Δ u ( k ) + B Δ u ( k + 1 ) x ( k + N p ) = A N p x ( k ) + A N p 1 B Δ u ( k ) + + A N p N c B Δ u ( k + N p 1 )
where N p stands for prediction horizon and N c corresponds to control horizon. Then, from (3) and (6), the predicted outputs can be formulated using the following vector-matrix notation:
Y = Ψ x ( k ) + Φ Δ U
where
Ψ = ( C A ) T ( C A 2 ) T ( C A N p ) T T Φ = C B 0 n y × n u 0 n y × n u C A B C B 0 n y × n u C A N p 1 B C A N p 2 B C A N p N c B
and Y R N p · n y is the whole predicted outputs of y = y 1 y 2 y n y T , and Δ U R N c · n u concatenates the future control trajectory of Δ u = Δ u 1 Δ u 2 Δ u n u T :
Y = y ( k + 1 ) T y ( k + 2 ) T y ( k + N p ) T T Δ U = Δ u ( k ) T Δ u ( k + 1 ) T Δ u ( k + N c 1 ) T T
The definition of the cost function is one of the key elements in MPC strategy to define the desired system behavior [11,12]. The cost function J Δ U | Y , R s used to find the best sequence of control action over the prediction horizon k , k + N p is defined as follows:
J = R s Y T R s Y + Δ U T R u Δ U
where, the first element considers the error e R N p · n y between the whole predicted outputs denoted by Y R N p · n y and the reference R s R N p · n y of the vector r s = r 1 r 2 r n y T . Furthermore, as in [31], the second term stands to penalize the rate excursion of the control vector; here, the weighting matrix R u represents a direct influence on the performance of the system [11]. Hence, when a low pondering matrix R u R N c · n u × N c · n u value is used, the first element of the cost function is interpreted as the primary situation to be minimized. The reference R s vector is expressed as follows:
R s = r s ( k + 1 ) T r s ( k + 2 ) T r s ( k + N p ) T T
Substituting (7) in the first element of (10), the cost function is expressed in state-space representation:
J = R s Ψ x ( k ) Φ Δ U T R s Ψ x ( k ) Φ Δ U + Δ U T R u Δ U
Thus, to obtain the control law, the performance index (12) is rewritten in the following compact form:
J = 1 2 Δ U T E Δ U + F 1 x ( k ) + F 2 R s T Δ U + Cst
where
E = 2 Φ T Φ + R u F 1 = 2 Φ T Ψ F 2 = 2 Φ T Cst = ( R s Ψ x ( k ) ) T ( R s Ψ x ( k ) )
subject to the following inequality constraints:
M Δ U γ ( k )
where
M = L u T L u T I u I u Φ T Φ T T γ ( k ) = U max I 1 u ( k 1 ) U min + I 1 u ( k 1 ) Δ U max Δ U min Y max Ψ x ( k ) Y min + Ψ x ( k )
then, M R ( 4 · N c · n u + 2 · N p · n y ) × N c · n u is a matrix reflecting the constraints, and γ ( k ) R 4 · N c · n u + 2 · N p · n y contains the maximum and minimum values allowed in u, Δ u , and y. Moreover, I u R N c · n u × N c · n u is a identity matrix, additionally L u R N c · n u × N c · n u is a lower triangular matrix and I 1 R N c · n u is a vector-matrix whose elements are I R n u × n u .
As in [32], the sequence of the future actions Δ U cannot be freely chosen in R N c · n u . The constraints have to be taken into account giving the following optimization problem  P ( x ( k ) ) :
P ( x ( k ) ) : min Δ u R N c n u J Δ U | x ( k ) s . t . g Δ U | x ( k ) 0
The cost function J Δ U | x ( k ) is minimized considering the constraints arranged in g Δ U | x ( k ) , and the first action of the best sequence control action Δ U is used. Nevertheless, solving the optimization problem of the baseline algorithm involves a high number of decision variables and high number of constraints which demands high computational resources.

3. Computer Optimization

An algorithm is a set of sequential calculations where tasks execution may depend on a different task product. Due to these dependencies, bottlenecks are carried out. This section introduces two concepts to break down the bottlenecks: software pipelining and one-step ahead prediction.

3.1. Software Pipelining Technique

The set of tasks executed in one iteration is called Single-Cycle Iteration (SCI). Figure 1a shows the SCIs carried out in sequence, according to N instructions. The instructions are labeled as I i n , where n { 1 , 2 , , N } is the instruction number and i { 0 , 1 , , } is the SCI number. Each instruction has its own latency, and the sum of the N latencies n = 1 N n from the same SCI corresponds to the SCI latency SCI .
The pipelining technique is used to divide the instructions of an SCI in multiple steps. Thus, some dependencies are broken and instructions from different SCIs are overlapped during runtime. Figure 1b shows the pipeline technique. The instructions from a SCI are divided, hence, there are not dependencies inside the new-bundled iteration. This new iteration is called Pipelined Iteration (PI) with a new latency equal to max { 1 , 2 , , N } .
The implementation of the pipelining technique provides two main advantages: Parallelization and delivery time. The parallelization can be reached due to the broken dependencies that allows the execution of more than one instruction at the same time. As it is shown in Figure 1b, the instructions of the same column can be executed in parallel as long as hardware capability. The delivery time with nonpipeling technique of a SCI is n = 1 N n while the execution time with pipelining implementation is PI , here, only the first SCI execution time takes N · PI to be delivered.

3.2. One-Step Ahead Prediction

The MPC approach assumes that with the system information been collected at each sampling instant y ( k ) , γ ( k ) , x ( k ) , u ( k 1 ) , the control action u ( k ) can be calculated instantaneously. However, the real-time implementation of this approach is mainly limited due to the optimization problem to be solved.
In the proposed algorithm, the controller parameters optimized from the previous sampling interval is used to calculate the current control action u ( k 1 ) . By minimizing (10), Δ U ( k ) , (9), is obtained subject to the constraints. Hence, the first vector corresponds to Δ u ( k ) ; thus, the current manipulation u ( k ) can be computed as follows: u ( k ) = Δ u ( k ) + u ( k 1 ) . This breaks the bottleneck due to the dependencies carried out by the variables computed at the same iteration.

4. Study Cases

The present work and the MPC strategy in [10] are developed using the same computational platform. The study cases consider the following state-space models in continuous time, where A c R n x × n x is the state matrix, B c R n x × n u stands for the input matrix and C c R n x × n y corresponds to the output matrix. Hence, the systems are discretized to be represented according to (1).

4.1. Study Case 1— Jet Transport Aircraft

From [21,33,34], a Jet Transport Aircraft Boeing 747 is obtained. In high-lift configuration, it addresses complex geometries and physical phenomena that make the controller design a difficult process. Figure 2 illustrates the Jet Transport Aircraft with its components and variables involved such as the angles β and ϕ and the angular velocities ψ and θ .
Although the physical model of the Boeing 747 is lengthy, in (18), the simplified state-space model during cruise flight at MATCH = 0.8 and H = 40,000 ft is presented in continuous time:
x ˙ ( t ) = A c x ( t ) + B c u ( t ) , y ( t ) = C c x ( t ) ,
where
A c = 0.0558 0.9968 0.0802 0.0415 0.598 0.115 0.0318 0 3.05 0.388 0.465 0 0 0.0805 1 0 B c = 0.0729 0 4.75 0.775 0.153 14.3 0 0 C c = 0 1 0 0 0 0 0 1
The model has four states, x = β ψ θ ϕ T , where β is the sideslip angle, ϕ stands for the bank angle, and meanwhile ψ and θ represent the yaw and roll rate, respectively. Herein, all the angles are in rad and the angular velocities in rad/s. The system has two inputs u = u 1 u 2 T : the rudder and the aileron deflections, and two outputs y = y 1 y 2 T the yaw rate ψ and the bank angle ϕ . Then, using a sampling time τ = 0.2 s, the system is discretized and executed under the constraints described in Table 1.

4.2. Study Case 2—Tape Transport System

The tape drive system consists of two reels to supply and file data. Here, the data transfer rate is proportional to the tape transport speed.Thus, the tape drive mechanism must be able to rapidly transport a fragile tape with an accurate tension regulation. Figure 3 shows the schematic of a tape transport system where its components and variables involved are the tape stiffness and the damping denoted by K and D, the reel radii and the inertia represented as r and J, the motor torque constant K t , and the viscous friction coefficient denoted by β .
Assuming there is no force loss across the head, the tape tension T = T 1 = T 2  [35]. Although the physical model of the process contains nonlinearities, in (19), a simplified state-space model is presented in continuous time [21,35,36,37]:
x ˙ ( t ) = A c x ( t ) + B c u ( t ) , y ( t ) = C c x ( t ) ,
where
A c = D r 1 2 J 1 + r 2 2 J 2 D β r 1 J 1 K r 1 K r 2 D β r 2 J 2 r 1 J 1 β J 1 0 r 2 J 2 0 β J 2 B c = D K t r 1 J 1 D K t r 2 J 2 K t J 1 0 0 K t J 2 C c = 0 r 1 2 r 2 2 1 0 0
The model has three states, x = T ω 1 ω 2 T , where T is the tension tape in N; meanwhile, ω 1 and ω 2 represent the supply and take-up reel in rad/s, respectively. Moreover, the system has two inputs u = u 1 u 2 T that represent the voltages applied to the reel motors in volts, and two outputs y = y 1 y 2 T which stand for the tape speed v r w at the read-write head in m/s and the tape tension T, respectively. The control strategy described in the present work is simulated using parameters from the tested tape system described in [35,38,39], whose parameters are summarized in Table 2.
Considering that the motors are nominally identical, for both motors, it is used as the same motor torque constant K t and viscous friction coefficient β  [38,39]. Thus, using a sampling time τ = 0.1 s, the system (19) is discretized and executed under the constraints expressed in Table 3.

5. Proposed Software-Based Implementation

5.1. Profile Analysis

The profiling analysis is performed on a NI myRIO 1900, illustrated in Figure 4, from National Instruments [40]. The NI myRIO is a portable reconfigurable I/O (RIO) device that can be used to design control, robotics, and mechatronics systems. The NI myRIO contains a Xilinx Z-7010 System-on-Chip (SoC), working at a frequency of 650 MHz.
The Xilinx Z-7010 SoC has an architecture divided in two parts: a processing system (PS) and a programmable logic. The PS includes 256 KB on-chip memory, 8 Direct Memory Access (DMA) channels, external memory interfaces, and multiple I/O peripherals. The main component of the PS is the application processor unit (APU) which contains a dual-core ARM Cortex-A9 for running the application software. The ARM cores use the ARMv7 architecture.
Although the NI myRIO can be considered a high-speed processing device compared to the microprocessor in [22,26,27]. In contrast with those with acceptable implementation for high speed applications [23,24,25], it can still be considered as a low resources processor.
The process flow diagram of the baseline MPC algorithm is shown in Figure 5. As it can be seen, it is composed of two types of functions: offline and online. The offline functions are one-time executed, while the online functions are executed each sampling time. Table 4 and Table 5 shows the description of each function and the latency according to the study case 1.

5.2. Software-Based Implementation Development

To improve the computing performance, a proposed software-based implementation is developed based on the profiling analysis of the online functions (Table 5) and the computer architecture concepts described in Section 3. Thus, the following improvements are implemented: efficient calculation of the optimization algorithm, implementing pipelining. This work apply three different methods to achieve a better performance. In Table 5, it can be seen that the Optim function has the highest latency. Thus, the present research work first proposes to speed it up by modifying the Hildreth’s algorithm. Then, the concept of pipelining is applied, and the optim function is parallelized with the rest of the functions. However, a problem shows up through the implementation. Therefore, the prediction idea is carried out to solve this problem.

5.2.1. Optimization Algorithm

The baseline algorithm uses the Hildreth’s Quadratic Programming Solver (qpSolver), shown in Algorithm 1, to minimized the objective function. Nevertheless, there are two weaknesses that increase the execution time of the Optim function: the operations recurrence and the operation of array elements. The operational recurrence was solved by reusing the previously calculated data. The calculation of the inverse of the E matrix should be highlighted, as it is mentioned in [41]. The E matrix is not modified during the execution, following this, the inverse operation can be calculated once. For this reason, the new algorithm requires the E 1 as an input, and the inversion operation is calculated in the MPC Offline function. The operation of arrays elements was boosted using optimized functions that works directly with arrays instead of the elements. The modified algorithm can be seen in Algorithm 2. A new profile analysis was performed, with these modifications, thus, the latency of the Optim function is reduced from 1290.78   μ s to 226.75   μ s for the study case 1 and from 3491 μ s to 394 μ s for the study case 2.
Algorithm 1: Hildreth’s QP Solver (Original)
Mathematics 10 02571 i001
Algorithm 2: Hildreth’s QP Solver (Improved)
Mathematics 10 02571 i002

5.2.2. Pipelining

The Online functions from every SCI, shown in Table 5, can be arranged in 3 bundles. Bundle 1 (Latency: 233.938   μ s ) packs functions RDSen, SPGen, Obs, Fcalc, and γ Calc. Bundle 2 (Latency: 226.75   μ s ) include the modified Optim function. Bundle 3 (Latency: 76.670   μ s ) packs functions WRAct and Graph. The concept of pipelining, Section 3.1 can be extrapolated to work with bundles instead of instructions for both study cases. Figure 6 uses the notation B k n to indicate the bundle n of the SCI k. As show in Figure 6a, the execution is performed running a bundle per step. In Figure 6b, Bundle 1 and 3 are executed in the same step, in order to balance the time execution between step 1 ( 310.608   μ s ) and 2 ( 226.750   μ s ). Currently, the bundles B k 1 , B k 1 2 , B k 1 3 are run within the same PI.

5.2.3. Synchronization Error Troubleshooting

Using the Figure 5 as reference, a synchronization error can be noticed in node A of the Figure 6a,b. In Figure 6b, B k 1 (Function Obs and γ Calc) and B k 1 3 (Function WRAct and Graph) needs u ( k 1 ) as input, but they are receiving u ( k 2 ) . The bundle B k 2 represent the Optim function that can be seen in Algorithm 3. The Optim function calculates u ( k ) based on the iteration data F ( k ) , γ ( k ) . A modification of the algorithm Optim can take place. The Algorithm 4, shows a new Optim function called Optim+. The Optim+ function takes advantage of the QP Solver definition to compute the optimal u ( k ) based on the previous iteration data F ( k 1 ) and γ ( k 1 ) . In Figure 6c, the B k 2 + (Optim+ function) is implemented to solve the synchronization error.
Algorithm 3: Optim function
Mathematics 10 02571 i003
Algorithm 4: Optim+ function
Mathematics 10 02571 i004
Finally, the implementation proposed to the MPC algorithm (Figure 5) can be observed in Figure 7.

6. Results

The present work and the baseline algorithm VFM in [10] are developed using the same computational platform for the study cases described in Section 4. These implementations are analyzed considering: the speedup and the processor performance.
The speedup factor is described using (20).
S p e e d u p = Old New
where Old is the latency of the reference algorithm, and New is the latency of the proposed algorithm. On the other hand, the processor performance is evaluated considering the processor usage.

6.1. Study Case 1—Results

Considering a prediction horizon N p = 20 , N c = 15 and a R u = I 30 × 30 , the simulation results are shown in Figure 8, the controlled variable, the manipulated variables, and the incremental variable are plotted for both: the present work and the baseline algorithm.
Both implementations execute 1000 iterations, and a profile analysis is executed. The results from the profile analysis is shown in Table 6.
First, an enhancement is obtained by the implementation of the improvements to the Hildreth’s Algorithm. This reduces its latency from 1290.78   μ s to 226.75   μ s . Reducing the execution time by 1064 μ s . Then, the strategy of pipelining is implemented making an additional reduction of 1037 μ s . Thus, the total execution time is reduced 2101 μ s . Additionally, the speedup factor is calculated according to the execution times average presented in Table 6. Here, the speedup factor is 4.6 × , ( 50.64 % by the Hildreth’s modification and 49.35 % by the pipeline implementation).
Furthermore, considering that both implementations are run in multicore execution, the processor utilization is evaluated, Table 7.
As it can be seen, with the present research work, the processor usage was released 35.93 % for CPU 0 (from 79.22 % to 43.29 % ) and 15.59 % for CPU 1 (from 56.07 % to 40.48 % ).

6.2. Study Case 2—Results

Considering a prediction horizon N p = 20 , N c = 15 and a R u = I 30 × 30 , the simulation results are shown in Figure 9, the controlled variable, the manipulated variables, and the incremental variable are plotted for both: the present work and the baseline algorithm.
Both implementations execute 1000 iterations, and a profile analysis is executed. The results from the profile analysis is shown in Table 8.
According to the implementation of the modified Hildreth’s Algorithm, latency is considerably reduced from 3491 μ s to 394 μ s . Thus, the execution time is reduced 3097 μ s . Additionally, when the strategy of pipelining is implemented making an additional reduction of 914.1 μ s . Thus, the total execution time is reduced 4011 μ s . Additionally, the speedup factor is calculated according to the execution times average presented in Table 8. Here, the speedup factor is 3.17 × , ( 72.21 % by the Hildreth’s modification and 22.79 % by the pipeline implementation).
Furthermore, considering that both implementations are run in multicore execution, the processor utilization is evaluated, Table 9.
As it can be seen, with the present research work, the processor usage was released 29.01 % for CPU 0 (from 82.50 % to 53.49 % ) and 13.56 % for CPU 1 (from 70.40 % to 56.84 % ).

7. Conclusions

This paper proposes a new software-based implementation for a constrained Multi-Input-Multi-Output predictive control algorithm embedded in the NI myRIO 1900 using NI LabVIEW Real-Time Module. Based on the computer architecture concepts, a software-based implementation is proposed. Thus, as an evaluation case, the proposed implementation is used to control a jet transport aircraft during cruise flight.
Experimental results shows that the new software-based implementation has a good performance regardless the computational modification effected. Additionally, compared with the baseline algorithm implementations, there is a significant improvement on the execution time without affecting the tracking performance for both study cases. The proposed software-based implementation reaches a speedup factor up to 4.6 × for the jet transport aircraft and 3.17 × for the tape transport system with respect to the baseline implementation. In addition, the processor usage was released for both study cases, 35.93 % and 29.01 % in CPU 0 and 15.59 % and 13.56 % in CPU 1, respectively. Thus, the obtained results do benefit the implementation of MIMO MPC techniques by reducing the execution time and the computational load.

Author Contributions

Conceptualization, A.F.-C. and A.A.; methodology, A.F.-C., A.A. and A.P.; validation, A.F.-C., D.S., C.S., A.A. and F.B.-C.; investigation, A.F.-C., A.A., A.P., F.B.-C., C.S., and D.S.; resources, A.F.-C., C.S., D.S. and A.P.; writing—original draft, A.P., D.S. and C.S.; writing—review and editing, A.F.-C., D.S., C.S., A.A. and F.B.-C.; supervision, A.F.-C. and A.A.; project administration, A.F.-C.; funding acquisition, C.S. and D.S. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

Data is contained within the article.

Acknowledgments

The authors would like to thank Consejo Nacional de Ciencia y Tecnología (CONACyT) and Tecnológico de Monterrey for the financial support for conducting the present research. Thanks also to the Nanosensors and Devices and Robotics Research Groups from the School of Engineering and Sciences of Tecnológico de Monterrey for the support given for the development of this work. Finally, thank students Juan Carlos Triana Vela and Ian De La Garza for their fruitful discussions, figures and tables editing, and especially for the analysis of the simulation results.

Conflicts of Interest

The author declares no conflict of interest.

References

  1. Jeng, J.C.; Chang, Y.J.; Lee, M.W. Novel design of dynamic matrix control with enhanced decoupling control performance. In Computer Aided Chemical Engineering; Elsevier B.V.: Amsterdam, The Netherlands, 2018; Volume 44, pp. 541–546. [Google Scholar] [CrossRef]
  2. Abro, G.E.M.; Zulkifli, S.A.B.; Ali, Z.A.; Asirvadam, V.S.; Chowdhry, B.S. Fuzzy Based Backstepping Control Design for Stabilizing an Underactuated Quadrotor Craft under Unmodelled Dynamic Factors. Electronics 2022, 11, 999. [Google Scholar] [CrossRef]
  3. Musa, A.; Pipicelli, M.; Spano, M.; Tufano, F.; De Nola, F.; Di Blasio, G.; Gimelli, A.; Misul, D.A.; Toscano, G. A Review of Model Predictive Controls Applied to Advanced Driver-Assistance Systems. Energies 2021, 14, 7974. [Google Scholar] [CrossRef]
  4. Liu, F.; Li, H.; Liu, L.; Zou, R.; Liu, K. A control method for IPMSM based on active disturbance rejection control and model predictive control. Mathematics 2021, 9, 760. [Google Scholar] [CrossRef]
  5. Bécsi, T. Quasi-Linear Parameter Varying Modeling and Control of an Electromechanical Clutch Actuator. Mathematics 2022, 10, 1473. [Google Scholar] [CrossRef]
  6. awryńczuk, M.; Marusak, P.M.; Chaber, P.; Seredyński, D. Initialisation of Optimisation Solvers for Nonlinear Model Predictive Control: Classical vs. Hybrid Methods. Energies 2022, 15, 2483. [Google Scholar] [CrossRef]
  7. Zavitsanou, S.; Chakrabarty, A.; Dassau, E.; Doyle, F.J. Embedded control in wearable medical devices: Application to the artificial pancreas. Processes 2016, 4, 35. [Google Scholar] [CrossRef] [Green Version]
  8. Baca, T.; Loianno, G.; Saska, M. Embedded Model Predictive Control of Unmanned Micro Aerial Vehicles. In Proceedings of the 2016 21st International Conference on Methods and Models in Automation and Robotics (MMAR), Miedzyzdroje, Poland, 29 August–1 September 2016; pp. 992–997. [Google Scholar] [CrossRef]
  9. Ibañez, C.; Ocampo-Martinez, C.; Gonzalez, B. Embedded optimization-based controllers for industrial processes. In Proceedings of the 2017 IEEE 3rd Colombian Conference on Automatic Control (CCAC), Cartagena, Colombia, 18–20 October 2017; pp. 1–6. [Google Scholar] [CrossRef] [Green Version]
  10. Wang, L. Model Predictive Control System Design and Implementation Using MATLAB, 1st ed.; Springer: Perth, Australia, 2009. [Google Scholar] [CrossRef]
  11. Vazquez, S.; Rodriguez, J.; Rivera, M.; Franquelo, L.G.; Norambuena, M. Model predictive control for power converters and drives: Advances and trends. IEEE Trans. Ind. Electron. 2016, 64, 935–947. [Google Scholar] [CrossRef] [Green Version]
  12. Karamanakos, P.; Geyer, T. Guidelines for the design of finite control set model predictive controllers. IEEE Trans. Power Electron. 2019, 35, 7434–7450. [Google Scholar] [CrossRef]
  13. Hu, J.; Ding, B. One-step ahead robust MPC for LPV model with bounded disturbance. Eur. J. Control 2020, 52, 59–66. [Google Scholar] [CrossRef]
  14. Zafra, E.; Vazquez, S.; Guzman Miranda, H.; Sanchez, J.A.; Marquez, A.; Leon, J.I.; Franquelo, L.G. Efficient FPSoc prototyping of FCS-MPC for three-phase voltage source inverters. Energies 2020, 13, 1074. [Google Scholar] [CrossRef] [Green Version]
  15. Luo, Q.; Nguyen, A.T.; Fleming, J.; Zhang, H. Unknown input observer based approach for distributed tube-based model predictive control of heterogeneous vehicle platoons. IEEE Trans. Veh. Technol. 2021, 70, 2930–2944. [Google Scholar] [CrossRef]
  16. Ju, Z.; Zhang, H.; Tan, Y. Distributed stochastic model predictive control for heterogeneous vehicle platoons subject to modeling uncertainties. IEEE Intell. Transp. Syst. Mag. 2021, 14, 25–40. [Google Scholar] [CrossRef]
  17. Pang, H.; Liu, M.; Hu, C.; Liu, N. Practical Nonlinear Model Predictive Controller Design for Trajectory Tracking of Unmanned Vehicles. Electronics 2022, 11, 1110. [Google Scholar] [CrossRef]
  18. Lee, T.; Kang, Y. Performance Analysis of Deep Neural Network Controller for Autonomous Driving Learning from a Nonlinear Model Predictive Control Method. Electronics 2021, 10, 767. [Google Scholar] [CrossRef]
  19. Richter, S.; Jones, C.N.; Morari, M. Real-time input-constrained MPC using fast gradient methods. In Proceedings of the IEEE Conference on Decision and Control, Shanghai, China, 15–18 December 2009. [Google Scholar] [CrossRef] [Green Version]
  20. He, M.; Ling, K.V. Model Predictive Control On A Chip. In Proceedings of the 2005 International Conference on Control and Automation, Budapest, Hungary, 26–29 June 2005; pp. 528–532. [Google Scholar] [CrossRef]
  21. Sotelo, D.; Favela-Contreras, A.; Kalashnikov, V.V.; Sotelo, C. Model Predictive Control with a Relaxed Cost Function for Constrained Linear Systems. Math. Probl. Eng. 2020, 2020, 7485865. [Google Scholar] [CrossRef]
  22. Bang, H.; Lee, Y.S. Embedded Model Predictive Control for Enhancing Tracking Performance of a Ball-and-Plate System. IEEE Access 2019, 7, 39652–39659. [Google Scholar] [CrossRef]
  23. Hýl, R.; Wagnerová, R. Design and Realization of Embedded Model Predictive Controller with Software Support. In Proceedings of the 2016 17th International Carpathian Control Conference (ICCC), Tatranska Lomnica, Slovakia, 29 May 2016–1 June 2016; pp. 259–264. [Google Scholar] [CrossRef]
  24. Yu, L.; Goldsmith, A.; Di Cairano, S. Efficient convex optimization on GPUs for embedded model predictive control. In Proceedings of the General Purpose GPUs, GPGPU-10 2017, Austin, TX, USA, 4–8 February 2017; pp. 12–21. [Google Scholar] [CrossRef]
  25. Cimini, G.; Bernardini, D.; Levijoki, S.; Bemporad, A. Embedded Model Predictive Control With Certified Real-Time Optimization for Synchronous Motors. IEEE Trans. Control Syst. Technol. 2020. [Google Scholar] [CrossRef]
  26. Boshkovski, G.; Stojanovski, G.; Stankovski, M. Development of embedded model predictive controller. In Proceedings of the 2017 13th IEEE International Conference on Control & Automation (ICCA), Ohrid, Macedonia, 3–6 July 2017; pp. 76–81. [Google Scholar] [CrossRef]
  27. Nermin, H.; Prljaca, N. An Implementation and Evaluation of Fast Embedded Model Predictive Control. In Proceedings of the 2020 19th International Symposium INFOTEH-JAHORINA (INFOTEH), East Sarajevo, Bosnia and Herzegovina, 18–20 March 2020. [Google Scholar]
  28. Wang, W.C.; Liu, T.H.; Syaifudin, Y. Model Predictive Controller for a Micro-PMSM-Based Five-Finger Control System. IEEE Trans. Ind. Electron. 2016, 63, 3666–3676. [Google Scholar] [CrossRef]
  29. Guzman, R.; De Vicuna, L.G.; Camacho, A.; Miret, J.; Rey, J.M. Receding-Horizon Model-Predictive Control for a Three-Phase VSI with an LCL Filter. IEEE Trans. Ind. Electron. 2019, 66, 6671–6680. [Google Scholar] [CrossRef] [Green Version]
  30. Pannocchia, G.; Gabiccini, M.; Artoni, A. Offset-free MPC explained: Novelties, subtleties, and applications. IFAC-PapersOnLine 2015, 48, 342–351. [Google Scholar] [CrossRef]
  31. Sotelo, C.; Favela-Contreras, A.; Beltrán-Carbajal, F.; Dieck-Assad, G.; Rodríguez-Cañedo, P.; Sotelo, D. A Novel Discrete-time Nonlinear Model Predictive Control Based on State Space Model. Int. J. Control. Autom. Syst. 2018, 16, 2688–2696. [Google Scholar] [CrossRef]
  32. Alamir, M. A Pragmatic Story of Model Predictive Control: Self-Contained Algorithms and Case-Studies; CreateSpace Independent Publishing Platform: Scotts Valley, CA, USA, 2013. [Google Scholar]
  33. Singh, S.; Murthy, T.V.R. Simulation of sensor failure accommodation in flight control system of transport aircraft a modular approach. World J. Model. Simul. 2015, 11, 55–68. [Google Scholar]
  34. Singh, S.; Rama Murthy, T. Design of an optimal yaw damper for 747 jet aircraft model. In Emerging Research in Electronics, Computer Science and Technology; Springer: Berlin/Heidelberg, Germany, 2014; pp. 801–810. [Google Scholar]
  35. Mathur, P.D.; Messner, W.C. Controller development for a prototype high-speed low-tension tape transport. IEEE Trans. Control Syst. Technol. 1998, 6, 534–542. [Google Scholar] [CrossRef]
  36. Lu, Y.; Messner, W.C. Robust servo design for tape transport. In Proceedings of the 2001 IEEE International Conference on Control Applications (CCA’01) (Cat. No. 01CH37204), Mexico City, Mexico, 7 September 2001; pp. 1014–1019. [Google Scholar]
  37. Tenne, D.; Singh, T. Robust feed-forward/feedback design for tape transport. In Proceedings of the AIAA Guidance, Navigation, and Control Conference and Exhibit, Providence, RI, USA, 16–19 August 2004; p. 5119. [Google Scholar]
  38. Baumgart, M.D.; Pao, L.Y. Robust control of nonlinear tape transport systems with and without tension sensors. J. Dyn. Sys. Meas. Control. 2007, 129, 41–55. [Google Scholar] [CrossRef] [Green Version]
  39. Baumgart, M.D.; Pao, L.Y. Robust control of tape transport systems with no tension sensor. In Proceedings of the 2004 43rd IEEE Conference on Decision and Control (CDC) (IEEE Cat. No. 04CH37601), Nassau, Bahamas, 14–17 December 2004; Volume 4, pp. 4342–4349. [Google Scholar]
  40. National Instruments. NI myRIO-1900. User Guide and Specifications; Technical report; National Instruments: Austin, TX, USA, 2013. [Google Scholar]
  41. Zhu, Q.; Onori, S.; Prucka, R. Pattern recognition technique based active set QP strategy applied to MPC for a driving cycle test. In Proceedings of the American Control Conference, Chicago, IL, USA, 1–3 July 2015; pp. 4935–4940. [Google Scholar] [CrossRef]
Figure 1. Execution techniques: (a) Nonpipeling. (b) Pipelining.
Figure 1. Execution techniques: (a) Nonpipeling. (b) Pipelining.
Mathematics 10 02571 g001
Figure 2. Jet transport aircraft.
Figure 2. Jet transport aircraft.
Mathematics 10 02571 g002
Figure 3. Tape transport system.
Figure 3. Tape transport system.
Mathematics 10 02571 g003
Figure 4. NI myRIO 1900.
Figure 4. NI myRIO 1900.
Mathematics 10 02571 g004
Figure 5. Process flow diagram of the MPC algorithm.
Figure 5. Process flow diagram of the MPC algorithm.
Mathematics 10 02571 g005
Figure 6. Optimization methodology: (a) Executing a bundle per step. (b) Executing Bundle 1 and Bundle 3 in the same step. (c) Executing Bundle 1 and Bundle 3 in the same step, and implementing Optim+Function.
Figure 6. Optimization methodology: (a) Executing a bundle per step. (b) Executing Bundle 1 and Bundle 3 in the same step. (c) Executing Bundle 1 and Bundle 3 in the same step, and implementing Optim+Function.
Mathematics 10 02571 g006
Figure 7. Proposed process flow diagram of the MPC algorithm.
Figure 7. Proposed process flow diagram of the MPC algorithm.
Mathematics 10 02571 g007
Figure 8. Results for the jet transport aircraft under VFM and Approach: (a) Yaw rate. (b) Bank angle. (c) Rudder deflection. (d) Aileron deflection. (e) Incremental rudder deflection. (f) Incremental aileron deflection.
Figure 8. Results for the jet transport aircraft under VFM and Approach: (a) Yaw rate. (b) Bank angle. (c) Rudder deflection. (d) Aileron deflection. (e) Incremental rudder deflection. (f) Incremental aileron deflection.
Mathematics 10 02571 g008
Figure 9. Results for the tape transport system under VFM and Approach: (a) Tape speed. (b) Tape tension. (c) Motor voltage supply reel. (d) Motor voltage take-up reel. (e) Incremental motor voltage supply reel. (f) Incremental motor voltage take-up reel.
Figure 9. Results for the tape transport system under VFM and Approach: (a) Tape speed. (b) Tape tension. (c) Motor voltage supply reel. (d) Motor voltage take-up reel. (e) Incremental motor voltage supply reel. (f) Incremental motor voltage take-up reel.
Mathematics 10 02571 g009
Table 1. Jet transport aircraft constraints.
Table 1. Jet transport aircraft constraints.
OutputInputInput Increment
YawBankRudderAileronIncremental RudderIncremental Aileron
RateAngleDeflectionDeflectionDeflectionDeflection
Maximum114411
Minimum−1−1−4−4−1−1
Table 2. Tape transport system parameters.
Table 2. Tape transport system parameters.
SymbolParameterValue
KTape stiffness 2 × 10 3 N/m
DDamping2 N s/m 2
r 1 Radius of supply reel 21.2 × 10 3 m
r 2 Radius of take-up reel 9.75 × 10 3 m
J 1 Moment of inertia of the supply reel 14.2 × 10 6 kg m 2
J 2 Moment of inertia of take-up reel 10.35 × 10 6 kg m 2
K t Motor torque constant 24.8 × 10 3 N m/V
β Viscous friction coefficient 1.03 × 10 4 N m s/rad
Table 3. Tape transport system constraints.
Table 3. Tape transport system constraints.
OutputInputInput Increment
TapeTapeMotorMotorIncremental MotorIncremental Motor
SpeedTensionVoltageVoltageVoltageVoltage
Maximum30.820.411
Minimum00−1−0.1−1−1
Table 4. Offline functions.
Table 4. Offline functions.
FunctionDescriptionLatency
MPC OfflineIt contains the matrices of the State-Space Model and the VFM, the sampling time, the prediction and control horizon, the constraints and the matrices E , F 1 , F 2 , M , I 1 , Ψ and Φ . 4183.580 μ s
InitIt initializes the control vector u k 86,718.800 μ s
Table 5. Online functions.
Table 5. Online functions.
FunctionDescriptionLatency
RDSenIt reads the controlled variable y ( k ) .22.532 μ s
SPGenIt generates the setpoint r s ( k ) . 14.509 μ s
ObsIt measures the current x(k) vector. 52.378 μ s
FCalcIt computes the vector F ( k ) = F 1 x ( k ) + F 2 R s . 80.698 μ s
γ CalcIt computes the vector γ ( k ) . 63.821 μ s
OptimIt computes the optimal manipulated variable u ( k ) . 1290.780 μ s
WRActIt applies the manipulated variable u ( k ) . 39.202 μ s
GraphIt plots the variables y ( k ) , u ( k ) , Δ u and the constraints. 37.468 μ s
Table 6. Execution time comparison.
Table 6. Execution time comparison.
VFMApproach
Performance 372.603 Hz 1713.920 Hz
Average2684 μ s 583 μ s
Variance ( s 2 ) 802.83 × 10 9 8.19 × 10 9
Maximum7634 μ s1517 μ s
Table 7. Processor usage comparison.
Table 7. Processor usage comparison.
VFMApproach
CPU 0 79.22 % 43.29 %
CPU 1 56.07 % 40.48 %
Table 8. Execution time comparison.
Table 8. Execution time comparison.
VFMApproach
Performance 170.736 Hz 541.7118 Hz
Average5857 μ s 1846 μ s
Variance ( s 2 ) 5.46 × 10 20 2.08 × 10 19
Maximum 39,660 μ s 27,093 μ s
Table 9. Processor usage comparison.
Table 9. Processor usage comparison.
VFMApproach
CPU 0 82.50 % 53.49 %
CPU 1 70.40 % 56.84 %
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Sotelo, D.; Favela-Contreras, A.; Avila, A.; Pinto, A.; Beltran-Carbajal, F.; Sotelo, C. A New Software-Based Optimization Technique for Embedded Latency Improvement of a Constrained MIMO MPC. Mathematics 2022, 10, 2571. https://doi.org/10.3390/math10152571

AMA Style

Sotelo D, Favela-Contreras A, Avila A, Pinto A, Beltran-Carbajal F, Sotelo C. A New Software-Based Optimization Technique for Embedded Latency Improvement of a Constrained MIMO MPC. Mathematics. 2022; 10(15):2571. https://doi.org/10.3390/math10152571

Chicago/Turabian Style

Sotelo, David, Antonio Favela-Contreras, Alfonso Avila, Arturo Pinto, Francisco Beltran-Carbajal, and Carlos Sotelo. 2022. "A New Software-Based Optimization Technique for Embedded Latency Improvement of a Constrained MIMO MPC" Mathematics 10, no. 15: 2571. https://doi.org/10.3390/math10152571

APA Style

Sotelo, D., Favela-Contreras, A., Avila, A., Pinto, A., Beltran-Carbajal, F., & Sotelo, C. (2022). A New Software-Based Optimization Technique for Embedded Latency Improvement of a Constrained MIMO MPC. Mathematics, 10(15), 2571. https://doi.org/10.3390/math10152571

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop