Available online at www.sciencedirect.com
ScienceDirect SoftwareX (
)
– www.elsevier.com/locate/softx
MOOSE2—A toolbox for least-costly application-oriented input design Mariette Annergren a,∗ , Christian A. Larsson b a Department of Automatic Control, KTH Royal Institute of Technology, 100 44 Stockholm, Sweden b Driver Assistance Controls Group, Systems Development, Scania CV AB, 151 87 S¨odert¨alje, Sweden
Received 23 December 2015; received in revised form 12 May 2016; accepted 17 May 2016
Abstract R MOOSE2 is a MATLAB⃝ -based toolbox for solving least-costly application-oriented input design problems in system identification. MOOSE2 provides the spectrum of the input signal to be used in the identification experiment made to estimate a linear parametric model of the system. The objective is to find a spectrum that minimizes experiment cost while fulfilling constraints imposed in the experiment and on the obtained model. The constraints considered by MOOSE2 are: frequency or power constraints on the signal spectra in the experiment, and application or quality specifications on the obtained model. c 2016 The Author(s). Published by Elsevier B.V. This is an open access article under the CC BY license (http://creativecommons.org/licenses/ ⃝ by/4.0/).
R Keywords: Input design; System identification; MATLAB⃝
Code metadata Current code version Permanent link to code/repository used for this code version Legal Code License Code versioning system used Software code languages, tools, and services used Compilation requirements, operating environments & dependencies If available Link to developer documentation/manual Support email for questions
v1 https://github.com/ElsevierSoftwareX/SOFTX-D-16-00002 MIT None R MATLAB⃝ 2014a, YALMIP, SDPT3 https://github.com/ElsevierSoftwareX/SOFTX-D-1600002/blob/master/Notes/userguide.pdf
[email protected]
1. Motivation and significance Mathematical models play an important role in numerous applications, both in our day-to-day lives and in industry. For example, they appear in cruise control of a car and in the controller of a distillation column in chemical production. The models are used to design controllers that are used to regulate a process for good performance. The definition of good performance is determined by the user of the process and it is highly dependent on the type of process under consideration. The models are found using various methods. A common approach is to combine prior knowledge of the system with data ∗ Corresponding author.
E-mail address:
[email protected] (M. Annergren).
measured in an experiment to estimate the model. More specifically, we will use the phrase identification experiment to mean that we excite the system by using an input signal to provoke a response. The input signal and the response are then measured. The estimation process is often expensive and time consuming. In [1] the author claims that 75% of the cost related to industrial control projects is dedicated to model estimation. This means that, significant savings can be made if the estimation process is cheaper. 1.1. Background The concept of optimal input design first appeared within the field of statistics in the early 1900s. See, for example, [2] for an overview of the research made within this field. The optimal input design framework developed in statistics was applied to
http://dx.doi.org/10.1016/j.softx.2016.05.003 c 2016 The Author(s). Published by Elsevier B.V. This is an open access article under the CC BY license (http://creativecommons.org/licenses/by/4. 2352-7110/⃝ 0/).
2
M. Annergren, C.A. Larsson / SoftwareX (
)
–
Table 1 Phases of estimation process. Phase
Description
Software
Dependencies
1
MOOSE2
R MATLAB⃝ [11], YALMIP [12], SDPT3 [13]
2 3
Get spectrum of input signal to use in identification experiment Perform identification experiment Estimate model based on data
– R MATLAB⃝ [11]
4
Validate model based on data
Hardware dependent System identification toolbox [14], UNIT [15], FDIDENT [16] System identification toolbox [14], UNIT [15], FDIDENT [16]
parameter estimation in system theory in the 1970s, see [3] and [4]. So far the objective of the input design was to minimize the error of the estimated parameters, but in paper [5] from 1986 the objective changed. The intended use of the model was, for the first time, included in the design. It was included by minimizing a scalar measure of performance degradation caused by errors in the transfer function estimates. In [6], the concept of least-costly identification experiment for control was introduced. The concept was further formalized in [7]. Here, the cost of the experiment was minimized while performance degradation was constrained to be below a specific level. The least-costly framework was expanded further in [8], where the notion of cost of complexity was introduced. The least-costly application-oriented input design addressed by MOOSE2 is based on the framework of [7] and [8], and the concepts in [9]. 1.2. Least-costly application-oriented input design Least-costly application-oriented input design is a framework that minimizes the cost of identifying a model (leastcostly) while ensuring that the model gives acceptable performance (application-oriented) (for example, see [7,8]). The framework is based on results and methods from the theory of system identification. We assume that the model is linear, its structure is known, and the values of the parameters in the structure can be estimated using the prediction error method (PEM) or maximum likelihood method (MLM). For a rigorous overview of these methods and system identification in general, see for example [10]. A common choice of the cost of identifying a model is the power of the input signal used in the experiment. The notion of performance has to be defined by the user as a scalarvalued non-negative function called application cost. A higher value of the cost means that the performance has degraded. An upper bound on the application cost, which corresponds to the highest level of acceptable performance degradation, must also be defined. The application cost, and its upper bound, are then used in the design of the input spectrum. The design is formulated as a convex optimization problem where the cost of identifying the model is minimized while guaranteeing that the identified model gives acceptable performance with high probability. For a rigorous overview and mathematical description of the concepts we refer the reader to [7,8] and the references therein. The estimation process consists of four phases. First, a design of the experiment is made. We use the least-costly
R MATLAB⃝ [11]
application-oriented input design framework for this purpose, which provides the user with the input spectrum. Second, the user applies the input signal corresponding to the spectrum to the system. That is, an identification experiment is made. Third, the measured output signal, along with the input signal and model structure, is used with PEM or MLM to estimate the model. Fourth, the estimated model is validated to ensure that it is an adequate model. The different phases and examples of corresponding software are shown in Table 1. In the design of the input spectrum, we can take relevant information about the system and its application into account. For example, if the system has resonance peaks or input power constraints; or if the model is used in a model predictive controller or for tuning of a proportional controller. The information used affects the design of the input spectrum, which in turn affects the estimated model. 1.3. MOOSE2 R MOOSE2 is a MATLAB⃝ -based toolbox for solving leastcostly application-oriented input design problems and is used in the first phase of the estimation process, see Table 1. The main feature of the toolbox is its ability to perform application-oriented input design. As long as the user can define an application cost, MOOSE2 provides an easy-to-use environment where the corresponding input design problem can be defined and solved. In addition, MOOSE2 supports classical experiment design criteria such as A-, E- and D-optimality. That is, the minimization of trace, maximal eigenvalue or determinant of the covariance matrix of the estimated parameters, respectively. Using the toolbox requires little knowledge of the underlying theory and numerical methods of system identification. MOOSE2 has a predecessor, MOOSE [17]. MOOSE2 has a different implementation structure and user interface than MOOSE. These differences make MOOSE2 much easier to maintain, develop and use than MOOSE. Moreover, many of the building blocks of MOOSE and MOOSE2 had previously been used in numerous research publications of the research group at KTH [18] to construct simulation examples and obtain numerical results (for example, see [9,19–22]). The MOOSE toolbox was applied in an industrial setting at Boliden Garpenberg within the EU-funded project Autoprofit [23]. The objective was to identify a zinc flotation plant, and MOOSE was used in the input spectrum design. Although MOOSE2 is primarily intended for researchers working on least-costly application-oriented input design, we
M. Annergren, C.A. Larsson / SoftwareX (
)
–
3
Table 2 R Sample code written in MATLAB⃝ .
Fig. 1. The structure of MOOSE2. The user interacts with the top layer through functions. The lower layers of MOOSE2 are used to define and store the input design problem. MOOSE2 relies on YALMIP and any solver supported by YALMIP to solve the optimization problem. The default solver is set to SDPT3.
believe that the toolbox can also facilitate communication of research, since it provides a user-friendly framework for investigating and replicating results. Moreover, MOOSE2 should be helpful for the interested novice who wants to gain knowledge about the basic concepts of least-costly applicationoriented input design. 2. Software description The implementation of MOOSE2 uses the object-oriented R programming capabilities of MATLAB⃝ . The structure of MOOSE2 is shown in Fig. 1. The user interacts with MOOSE2 through a set of functions. The central part is the class
oidProblem where the input design problem is stored. Every instance of oidProblem contains model-, spectrum-, and constraint-instances. Abstract classes are used for the model, spectrum and constraint classes to define interfaces. This allows for easy implementation of new models, spectra and constraint classes. The models are specified as transfer functions. There is no optimization implemented in MOOSE2. Instead the toolbox relies on external solvers for solving the input design problem. MOOSE2 is based on YALMIP [12], a toolbox for modeling R and optimization in MATLAB⃝ . MOOSE2 can handle any solvers supported by YALMIP. The default solver is set to SDPT3 [13]. 3. Illustrative example Consider input design for the system y(t) = θ1 u(t − 1) + θ2 u(t − 2) + e(t), where y ∈ R, u ∈ R and e ∈ R are the output, input and noise signal, respectively; t is the time; and θ = (θ1 , θ2 ) ∈ R2 are the parameters to be identified. We have that: the experiment cost is the power of the input signal; the application of the model requires a more accurate estimate of θ2 than of θ1 ; and the estimated model must perform acceptably with probability R of 0.95. A MATLAB⃝ -implementation of the problem using MOOSE2 is shown in Table 2. The four blocks of code are:
4
M. Annergren, C.A. Larsson / SoftwareX (
Fig. 2. Estimates of θ . The shaded region between the two red lines contains those values of θ with acceptable performance. The cyan circle is the 95% confidence level ellipsoid of the estimates of θ centered at the true values of θ . The black crosses are the estimates of θ . The estimation process is repeated 100 times. Three estimates do not give acceptable performance.
• SYSTEM: The true model is set, along with its noise variance and sampling time. • APPLICATION REGION: The ellipsoidal region of parameters giving acceptable performance is defined, along with the confidence level α of the performance degradation. The application cost is defined via the Vapp-function at the bottom of Table 2. • IDENTIFICATION MODEL: The model to be estimated is defined and the number of data samples to use in the identification experiment is given. • OPTIMAL INPUT DESIGN PROBLEM: Functions from MOOSE2 are used to set-up and solve the input design problem. The first line creates an instance (prob) of the input design problem. The input spectrum is of FIR-type with 20 lags. The second line adds the performance requirement to the problem prob. The third line solves the problem prob with the objective function set to input power. The optimal spectral factor optH is given which can be used to realize an input signal.
)
–
to the best knowledge of the authors, the only toolbox available that addresses these problems. MOOSE2 provides users with commands that, when combined and executed, can solve highly complex input design problems. Thus, MOOSE2 lowers the threshold of formalizing and investigating research problems. In addition, MOOSE2 is a tool for communicating research results and spreading knowledge about least-costly applicationoriented input design to users that are not familiar with the concept. MOOSE2 is a collection of numerical methods used within the research group at KTH [18] ranging over more than a decade. For example, in [25] a framework for reformulating a specific class of input design problems into tractable convex optimization problems is presented, [8] introduces an ellipsoidal approach of dealing with the application specifications and in [26] a scenario-based approach is presented as an alternative to the ellipsoidal one. For more references, we refer the reader to MOOSE2’s user guide. The objective is to have a coherent toolbox that contains all the knowledge and experiences obtained so far. The development of MOOSE2 has led to the development of more robust numerical methods. It has also brought to light areas where more work is needed to broaden the range of problems that the toolbox can handle. MOOSE2 is a source of the most up-to-date collection of numerical methods within least-costly application-oriented input design. As such, the toolbox serves as a reference for experienced users and as a guide for novice ones. The potential of MOOSE2 was highlighted during the project Autoprofit [23]. The project addressed advanced autonomous model-based operation of industrial process systems. Least-costly application-oriented input design was used to identify the necessary models (for example, see [27, 28]). MOOSE2, or parts of it, can be used in such schemes as the ones developed in Autoprofit. MOOSE2 and specific parts of it are used within the research group at KTH [18]. The intention of the authors is to spread the toolbox outside its intended user group as a mean to spread awareness of the least-costly application-oriented input design framework. 5. Conclusions
R Note that the MATLAB⃝ -package “Adaptive Robust Numerical Differentiation” created by [24] is used to numerically determine the Hessian of the application cost. In this example we could just as well have provided an analytical expression, but there are cases when such expressions cannot be obtained. For more details, see MOOSE2’s user guide. Fig. 2 shows the resulting estimates after 100 applications of the estimation process described in Table 1 together with the code in Table 2. We see that 97 out of 100 estimates give acceptable performance of the application, as required.
R MOOSE2 is a MATLAB⃝ -based toolbox for solving leastcostly application-oriented input design problems. MOOSE2 provides users with the spectrum of the input signal to be used in the identification experiment. MOOSE2 greatly simplifies the process of setting up and solving input design problems. The architecture of MOOSE2 makes the toolbox easy to extend, in terms of models, spectra and constraints possible to handle. R MOOSE2 is open source and requires MATLAB⃝ 2014a, YALMIP and SDPT3. MOOSE2 is distributed under the MIT license.
4. Impact
Acknowledgments
MOOSE2 is a framework for configuring and solving leastcostly application-oriented input design problems. MOOSE2 is,
The research leading up to this work was partly funded by the Swedish Research Council under contract
M. Annergren, C.A. Larsson / SoftwareX (
621-2009-4017, the European Union’s Seventh Framework Programme (FP7/2007–2013) under grant agreement no 257059 (Autoprofit), and the European Research Council under the advanced grant LEARN, contract 267381. The authors would also like to thank Henrik Jansson (Ph.D.) and M¨arta Barenthin Sydberg (Ph.D.) for their research and collection R of MATLAB⃝ -functions that served as an initial step in the creation of MOOSE2. References [1] Hussain MA. Review of the applications of neural networks in chemical process control—simulation and online implementation. Artif Intelli Eng 1999;13(1):55–68. [2] Atkinson AC, Donev AN. Optimum experimental designs. New York: Oxford University Press; 1992. [3] Mehra RK. Optimal input signals for parameter estimation in dynamic systems–survey and new results. IEEE Trans Automat Control 1974; 19(6):753–68. [4] Goodwin GC, Payne RL. Dynamic system identification: experiment design and data analysis, no. 2. New York: Academic Press; 1977. [5] Gevers M, Ljung L. Optimal experiment designs with respect to the intended model application. Automatica 1986;22(5):543–54. [6] Bombois X, Scorletti G, Van Den Hof PMJ, Gevers M, Least costly identification experiment for control: A solution based on a high-order model approximation, in: Proceedings of the American control conference 2004, pp. 2818–2823. [7] Bombois X, Scorletti G, Gevers M, Van den Hof PMJ, Hildebrand R. Least Costly Identification Experiment for Control. Automatica 2006;42: 1651–62. [8] Hjalmarsson H. System identification of complex and structured systems. Eur J Control 2009;15(3–4):275–310. [9] Jansson H. Experiment design with applications in identification for control [Ph.D. thesis]. KTH Royal Institute of Technology; 2004. [10] Ljung L. System identification: Theory for the user. 2nd ed. New Jersey: Prentice Hall, Upper Saddle River; 1999. [11] MATLAB Release 2014a. The Mathworks, Inc., Natick, Massachusetts, United States; 2015. [12] L¨ofberg J, YALMIP: A toolbox for modeling and optimization in MATLAB. In: Proceedings of the CACSD conference, Taipei, Taiwan; 2004.
)
–
5
[13] Toh KC, Todd MJ, Tutuncu RH. SDPT3—a MATLAB software package for semidefinite programming. Optim Methods Softw 1999;11:545–81. [14] MATLAB and System Identification Toolbox Release 2014a. The Mathworks, Inc., Natick, Massachusetts, United States; 2015. [15] Ninness B, Wills A, Mills A. UNIT: A freely available system identification toolbox. IFAC Control Eng Pract 2013;21(5):631–44. [16] Koll´ar I. Frequency domain system identification toolbox for MATLAB. Hungary: Budapest; 2004–2014. [17] Annergren M, Larsson CA. MOOSE: a model based optimal input design toolbox. In: Proceedings of the IFAC symposium on system identification. Belgium: Brussels; 2012. p. 1535–40. [18] Department of Automatic Control, KTH Royal Institute of Technology. [19] Barenthin Syberg M. Complexity issues validation and input design for control in system identification [Ph.D. thesis]. KTH Royal Institute of Technology; 2008. [20] Wahlberg B, Hjalmarsson H, Annergren M, On optimal input design in system identification for control. In: proceedings of the conference on decision and control, Atlanta, USA, 2010, pp. 5548–5553. [21] Larsson CA, Annergren M, Hjalmarsson H, On optimal input design for model predictive control. In: proceedings ieee conference on decision and control, Orlando, Florida, 2011. [22] Annergren M, Larsson CA, Hjalmarsson H, Bombois X, Wahlberg B, Application-Oriented Input Design in System Identification – Optimal input design for control, Submitted to Control System Magazine, May, 2016. [23] European Union’s Seventh Framework Programme (FP7/2007-2013) under grant agreement no 257059 (Autoprofit), www.fp7-autoprofit.eu. [24] D’Errico J, Adaptive robust numerical differentiation, http://www.mathworks.com/matlabcentral/fileexchange/13490-adaptiverobust-numerical-differentiation (Jun. 2011). [25] Jansson H, Hjalmarsson H. Input design via lmis admitting frequencywise model specifications in confidence regions. IEEE Trans Automat Control 2005;50(10):1534–49. [26] Larsson CA, Rojas CR, Hjalmarsson H, MPC oriented experiment design. In: Proceedings of the 18th IFAC world congress, Milano; 2011. [27] Mesbah A, Bombois X, Forgione M, Hjalmarsson H, den Hof PMJV. Least costly closed-loop performance diagnosis and plant reidentification. Internat J Control 2015;88(11):2264–76. ¨ [28] Annergren M, Kauven D, Larsson CA, Potters MG, Tran Q, Ozkan L On the way to autonomous model predictive control: A distillation column simulation study, in: 10th IFAC Symposium on Dynamics and Control of Process Systems, DYCOPS 2013:no. PART 1 in IFAC Proceedings Volumes (IFAC-PapersOnline), IFAC Secretariat, 2013, p. 713–20.