# Explicit model predictive control accuracy analysis

###### Abstract

Model Predictive Control (MPC) can efficiently control constrained systems in real-time applications. MPC feedback law for a linear system with linear inequality constraints can be explicitly computed off-line, which results in an off-line partition of the state space into non-overlapped convex regions, with affine control laws associated to each region of the partition. An actual implementation of this explicit MPC in low cost micro-controllers requires the data to be “quantized”, i.e. represented with a small number of memory bits. An aggressive quantization decreases the number of bits and the controller manufacturing costs, and may increase the speed of the controller, but reduces accuracy of the control input computation. We derive upper bounds for the absolute error in the control depending on the number of quantization bits and system parameters. The bounds can be used to determine how many quantization bits are needed in order to guarantee a specific level of accuracy in the control input.

## I Introduction

Model predictive control (MPC) [1] is an efficient method for control design of multivariable constrained systems in chemical and process control, automotive, aerospace, and factory automation [2, 3, 4]. MPC solves a constrained optimal control problem in real time (on-line).

Explicit MPC (EMPC) [5, 6] may reduce on-line computational costs and code complexity by pre-computing the MPC feedback law as a state feedback, thus making it viable for fast applications with limited computational capabilities [7, 8, 9, 10]. In particular, for linear systems subject to linear constraints and cost function based on -norm, -norm, or squared -norm, the EMPC results in a polyhedral piecewise affine (PWA) feedback law. Thus, during the on-line execution, the EMPC controller first identifies which polyhedral region contains the current state, and then computes the control action by evaluating the corresponding affine control law. The identification of the polyhedral region is referred to as the point location problem [11], which can be solved by sequential search and binary search tree see, e.g., [12, 13]. Due to the exponential increase of the number of regions with respect to the number of constraints in the MPC problems, techniques for reducing complexity of the EMPC feedback law while maintaining its most important properties have been proposed, see, e.g., [14, 15, 16] and references therein.

In practice, the data of EMPC have to be typically stored in a micro-controller hardware memory, so that every stored number is represented by a small fixed number of bits for every number in the data. In other words, the data cannot be stored exactly and hence a precision loss occurs. We call this reduction of precision “quantization” and the reduced precision data “quantized” data. The method for quantization can be as simple as rounding. Aggressive quantization has the advantage of decreasing memory requirements and increasing the speed of the control input evaluation, at the price of introducing inaccuracy in the computation of the control input. If the quantization precision is too small, the controller can fail to accurately determine the region for the current state of the controlled system, and thus, the control. For example, by quantizing the state measurement/estimate data the quantized state may jump to a different region.

The effect of quantization has been investigated for implicit MPC for instance in [17, 18]. We investigate the resulting accuracy in the control input computation in EMPC as a consequence of different quantization precisions, so that we can determine how many bits need to be used to guarantee a desired level of accuracy in the control input. A brief overview of our approach and results is in Section II.

In Section III, we provide a mathematical accuracy analysis, depending on mutual positions of the exact and the quantized system states. When the quantization does not affect the system state region, so that the same feedback law applies to both the exact and the quantized system states, an error bound is easy to establish. A difficult case for analysis, leading to a much larger possible controller inaccuracy, is where the quantization makes the system state to jump over a region facet to a different region. In this case, bounding the accuracy of the control requires taking into account not only quantization precision for the system state, but also quantization effects of the region facets and of the feedback laws in different regions. We derive two kinds of upper bounds on the accuracy of the control input computation in Section III. Bounds without knowledge of the quantized data, describing the worst case scenario, for that reason are called “a priori.” After a quantized implementation of the controller is determined, the a priori bounds are improved, using the already known off-line quantized data, in addition to the original data. The resulting tighter “a posteriori bounds” depend on the quantization precision of the current state. We show how our bounds can be improved by exploiting a rescaling technique that makes the system state space evenly sized in all spacial directions.

We validate the bounds numerically in Section IV.

## Ii Brief overview

Throughout this paper, denotes the set of real numbers, , , and denote -norm, -norm, and -norm, respectively. denotes the transpose of

The control is a continuous PWA function determined by the EMPC control law

(1) |

where , the gains and offsets and denotes the number of regions

with and

The controller determines on-line, i.e. in real time, which region contains the given state . This is typically the most time consuming operation, for large and , requiring computing numerous matrix-vector products . If the state is in the region , then the corresponding control law (1) is used to compute the control input . All the controller “true” data, determining the regions, and control law (1) are computed off-line, typically in the double precision computer arithmetic, and then are quantized and stored in a memory of the controller as quantized data.

The reduction of the precision of the data used by the controller decreases the number of bits stored by the controller and increases the speed of the control, but reduces the accuracy of the on-line execution of the controller. The target accuracy of the controller can be based on the accuracy of the sensor for sensing, or of the estimator for estimating the current state of the system. The state of the controlled system determined with quantized data deviates from the state of the controlled system determined with the true data within the limits depending on the control law, the data representing the system, and the precisions of the quantization. Thus, for any reduction of the precision of the quantized data, it is possible to determine off-line bounds for a maximal deviation of the state of the controlled system caused by that reduction. Using these bounds, different reductions in the precision, compared to the true precision, can be tested, and the maximal reduction of the quantization satisfying the accuracy requirement of the control can be selected.

It may also be advantageous to use different quantization precisions for various data. For example, the EMPC control law is evaluated only once on-line, for the determined index , so the gains and offsets can be quantized in high precision and stored in a slow-access memory without noticeably affecting the controller speed. Moreover, different facets can benefit from using different numbers of bits in their quantized format to represent the same level of accuracy in the control, while speeding up the computationally challenging point location on-line search.

However, in some bounds below, for simplicity of presentation we suppose that all data are quantized using the same scalar quantization function , assuming that , where and , aiming at a fixed point quantization, rather than a floating point rounding. From the true state , we obtain the quantized state , and, similarly, where for . We commonly use the symbol “hat” to denote the data after the quantization, and the symbol “” for the quantization error.

## Iii Accuracy analysis

In this section, we focus on accuracy analysis of the control input computation. The control input depends on the location of the state vector, thus, to analyze the accuracy of the control input computation we have to examine how the state changes and which region it falls into before and after the quantization. When it falls into the region with the same index, i.e. is in the region and is in the region , the absolute accuracy of the control input is measured by the maximum absolute changes between and , i.e., , and can be easily bounded above by the precisions of the quantization.

The control computation error is generally larger if the original state and the quantized state belong to different regions with large and different gains. We analyze the case where is in the region and is in the region , with , which means the state is in one of the regions, but after quantization the state gets into another region, so the accuracy of the control input is , as illustrated in Fig. 1, where Fig. 1 shows that the change in the slope (gain) when the state jumps over the hyperplane (a point in Fig. 1 , since ) can increase the control computation error.

However, the jump can only happen if a distance from the state vector to the facet separating the two regions is small, and the PWA control function is continuous, which allows us to bound the error even in the case of the jump.

The sharp upper bound of is

We derive an analytic bound for a pair and under simplifying assumptions, e.g., that and share a facet. We start with analyzing the accuracy of the hyperplane representation, where the data are quantized.

###### Lemma III.1

Let be a half-space. Let and with , , and for some . We have

(2) |

By direct calculation, we obtain

###### Corollary III.2

Let the hyperplane border two neighboring regions and , such that for and for Let the state , but after the quantization with . Then .

By Lemma III.1, . After quantization, falls into the region which means is out of region . So, . Therefore, we have Similarly, we can obtain that .

Corollary III.2 states that, as a result of the quantization, the state can jumps to the other side of a hyperplane only if the distance from the state to the hyperplane is less than , as illustrated in Fig. 2 for

We are now ready to prove our main result.

###### Theorem III.3

Let the hyperplane border two neighboring regions and , such that if and if . Let the state be in the region , the orthogonal projection of on the hyperplane be in a facet of , and . Then

where and further

(3) |

or, alternatively,

(4) |

By the triangle inequality, we have

We first bound above , where satisfies by Corollary III.2. Let denote the orthogonal projection of on the hyperplane , then where is the transpose of and is a scalar. We have Therefore, Since is a linear continuous affine function, we have , which is equivalent to Hence,

The second term in the triangle inequality is

Alternatively, we bound the second term as follows

Combining the inequalities above completes the proof.

Bound (III.3) uses the data obtained before and after quantization, therefore we call it a posteriori. In contrast, bound (III.3), called a priori, is more pessimistic, being based on the true data only, without the quantized data explicitly appearing.

In bounds (III.3) and (III.3) and in the expression for , the norms of the state vector can be further bounded, e.g., since , by the largest norm of any vector in the region . If it is not known which region the state belongs to, we can use as a universal upper bound the largest norm of any vector in the state space, assuming that the latter is bounded.

Theorem III.3 implies that the control error is significantly reduced if the gains and offsets are quantized with high precision. Theorem III.3 also suggests choosing different precisions for quantizing different facets maintaining a uniform level of control accuracy over the state space, e.g., if is small, the hyperplane can be quantized with low precision, without significantly affecting the control computation accuracy.

### Iii-a Rescaling

The accuracy of depends on how small and are. To make and small, one approach is to rescale the regions, , and , such that

where is a diagonal matrix with Let , , and be our new , , and , respectively. We have , , and . Our new is less than . The control law has the form , where Consequently,

where is taken, after rescaling, for the regions and is taken, after rescaling, for the input control.

Rescaling of the state is evidently equivalent to changing the units of the components of the state vector. The bounds show that it may be beneficial to choose the units in such a way that the state space is balanced in size in all components.

## Iv Test Results

In this section, we present tests for a double integrator

where

The state satisfies the constraints and the input satisfies the constraints

In our tests, we use a fixed point number format which has a specific number of bits reserved for the integer part and a specific number of bits reserved for the fractional part. We use the MATLAB function fi with -bit total word length, -bit for sign and -bit fraction length, such that, e.g.,

where for a vector . The quantization errors , , and are known, given the number of bits for the fractional part. Every component in , , and is bounded by

We generate a consistent uniformly distributed random state , and for every such a state compute the a priori and a posteriori bounds of absolute errors of as described in Theorem III.3, as well as the actual absolute error of obtained by a fixed point model of the controller. We eliminate the states with very small a posteriori bounds and actual errors (due to the fact that in some regions the gain is nearly zero), order the remaining states by sorting the a priori errors, and plot in Fig. 3 for two values of and .

In Fig. 3 top (bottom) panel for () and (), the maximal difference between our a priori bounds and actual errors is about (), the maximal difference between our a posteriori bounds and actual errors is about (), and the maximal actual error is about (), i.e., approximately () compared to the quantization error ().

We observe in Fig. 3 bottom panel that the bounds and the actual errors form clusters. These clusters correspond to different hyperplanes, demonstrating that it may be advantageous to quantize hyperplanes using a plurality of precisions aiming at a uniform behavior of the bounds and the actual errors of the control over the state space. Next, we specifically test the states near the common hyperplanes between some pairs of neighbor regions to classify these hyperplanes in terms of their sensitivity to the quantization.

The results are summarized in Table I. For example, the bounds and the real errors are less than if the state is in region or and after quantization the state jumps into region or Checking the controller data, we find that the gains in the regions and are nearly zero, thus, naturally, the control does not change if the state is in and , which is also well captured by our a posteriori bound, thus the hyperplane separating the regions and can be quantized with very low precision. We notice several other trivial pairs of the regions in Table I, identified by the small bounds and errors.

Neighboring | Maximal | Maximal |

regions | a posteriori bound | actual error |

1 and 9 | less than | less than |

2 and 8 | less than | less than |

3 and 5 | 0.19 | 0.15 |

3 and 12 | 0.25 | 0.12 |

4 and 7 | less than | less than |

5 and 6 | less than | less than |

6 and 9 | less than | less than |

7 and 8 | less than | less than |

7 and 13 | 0.21 | 0.12 |

10 and 13 | 0.26 | 0.13 |

Let us check closely one nontrivial pair, e.g., and . The maximal a posteriori bound is and the largest actual error is , if the state is in region or and after quantization the state jumps into region or Fig. 4 plots the a posteriori bounds and the actual errors for this case. We observe that our a posteriori bounds always bound above the actual errors and are reasonably sharp.

Another nontrivial example is the and pair. The maximal a posteriori bound is and the largest actual error is . Fig. 5 plots the a posteriori bounds and the actual errors for the and pair. Fig. 6 plots the similar data for the and pair, and Fig. 7 for the and pair. We observe in these figures that our a posteriori bounds overestimate the actual errors about two times.

We finally note that our bounds in all tests depend on the norm of the state, not on the state itself. Bounding above the norm of the state would make the bounds state-independent.

## Conclusions

EMPC data are quantized and stored in the memory of the controller. A state-of-the-art method for determining the precision of the operations in the controller uses a subjective decision based on an ad hoc educated guess of an engineer designing the controller for the given system. Such a subjective decision does not usually guarantee a specific level of accuracy of the control. The validity of the quantized data, representing the system in the controller is typically checked numerically versus the true data on randomly selected state vectors. The state space in true precision includes so many vectors that an exhaustive validation is impractical even off-line. Inaccurate on-line computation of the control can result in suboptimal control, system malfunctions, and failures.

The actual EMPC control errors can be much larger compared to the quantization error, if the state is near a hyperplane separating neighboring regions with large and different gains, requiring a special analysis. We propose restricting random state vectors to the neighborhoods of the region facets, dramatically decreasing the off-line computational time for numerically checking the control accuracy versus the true data. We analyze the EMPC control accuracy deriving upper bounds under an assumption on the quantization error, typical for a fixed point arithmetic, commonly used in controllers to improve on-line performance. An influence of a rescaling of the state space on the accuracy of the control computation is examined. Using our bounds, one can determine the required precision of the quantization and estimate the accuracy in the control input, designing the controller. It is shown that various EMPC data have different sensitivity with respect to the precision of the quantization, e.g., the gains and offsets are preferred to be stored with high precision. We discover that it may be advantageous to use different precisions quantizing various hyperplanes, where the data larger affecting the accuracy of the controller are stored with a greater precision, compared to the data less affecting the accuracy of the controller. Numerical tests for a simple double integrator system support our theory and conclusions. Our future work concerns probabilistic approaches, taking into account that the state vector may follow trajectories rather than filling the whole state space.

## References

- [1] J. B. Rawlings and D. Q. Mayne, Model predictive control: Theory and design. Nob Hill Pub., 2009.
- [2] S. J. Qin and T. A. Badgwell, “A survey of industrial model predictive control technology,” Control engineering practice, vol. 11, no. 7, pp. 733–764, 2003.
- [3] S. Di Cairano, “An industry perspective on mpc in large volumes applications: Potential benefits and open challenges,” in Proc. 4th IFAC Nonlinear Model Predictive Control Conference, 2012, pp. 52–59.
- [4] D. Hrovat, S. Di Cairano, H. Tseng, and I. Kolmanovsky, “The development of model predictive control in automotive industry: A survey,” in IEEE Conf. Control Applications, 2012, pp. 295–302.
- [5] A. Bemporad, F. Borrelli, and M. Morari, “Model predictive control based on linear programming - the explicit solution,” Automatic Control, IEEE Transactions on, vol. 47, no. 12, pp. 1974–1985, 2002.
- [6] A. Bemporad, M. Morari, V. Dua, and E. N. Pistikopoulos, “The explicit linear quadratic regulator for constrained systems,” Automatica, vol. 38, no. 1, pp. 3–20, Jan. 2002.
- [7] S. Di Cairano, D. Yanakiev, A. Bemporad, I. Kolmanovsky, and D. Hrovat, “Model predictive idle speed control: Design, analysis, and experimental evaluation,” vol. 20, no. 1, pp. 84 –97, 2012.
- [8] S. Di Cairano, J. Doering, I. Kolmanovsky, and D. Hrovat, “MPC-based control of engine deceleration with open torque converter,” 2012, pp. 3753–3758.
- [9] S. Di Cairano, H. Tseng, D. Bernardini, and A. Bemporad, “Vehicle yaw stability control by coordinated active front steering and differential braking in the tire sideslip angles domain,” vol. 21, no. 4, pp. 1236–1248, 2013.
- [10] S. Di Cairano, H. Park, and I. Kolmanovsky, “Model predictive control approach for guidance of spacecraft rendezvous and proximity maneuvering,” Int. J. Robust and Nonlinear Control, vol. 22, no. 12, pp. 1398–1427, 2012.
- [11] J. E. Goodman and J. O’Rourke, Eds., Handbook of Discrete and Computational Geometry. CRC Press, Inc., 1997.
- [12] P. Tøndel, T. A. Johansen, and A. Bemporad, “Evaluation of piecewise affine control via binary search tree,” Automatica, vol. 39, no. 5, pp. 945–950, 2003.
- [13] F. Bayat, T. A. Johansen, and A. A. Jalali, “Using hash tables to manage the time-storage complexity in a point location problem: Application to explicit model predictive control,” Automatica, vol. 47, no. 3, pp. 571–577, 2011.
- [14] T. Geyer, F. D. Torrisi, and M. Morari, “Optimal complexity reduction of piecewise affine models based on hyperplane arrangements,” in American Control Conference, 2004. Proceedings of the 2004, vol. 2. IEEE, 2004, pp. 1190–1195.
- [15] M. Kvasnica, J. Löfberg, and M. Fikar, “Stabilizing polynomial approximation of explicit mpc,” Automatica, vol. 47, no. 10, pp. 2292–2297, 2011.
- [16] M. Kvasnica and M. Fikar, “Clipping-based complexity reduction in explicit mpc,” Automatic Control, IEEE Transactions on, vol. 57, no. 7, pp. 1878–1883, 2012.
- [17] E. C. Kerrigan, J. L. Jerez, S. Longo, and G. A. Constantinides, “Number representation in predictive control,” in Proc. 4th IFAC Nonlinear Model Predictive Control Conference, 2012, pp. 60–67.
- [18] S. Longo, E. C. Kerrigan, and G. A. Constantinides, “Constrained lqr for low-precision data representation,” Automatica, vol. 50, no. 1, pp. 162–168, 2014.