key: cord-0047234-76mqye3p authors: Benner, Peter; Werner, Steffen W. R. title: MORLAB – A Model Order Reduction Framework in MATLAB and Octave date: 2020-06-06 journal: Mathematical Software - ICMS 2020 DOI: 10.1007/978-3-030-52200-1_43 sha: e3bade344f4c1b660078931e9ab7e5f9c350b8a2 doc_id: 47234 cord_uid: 76mqye3p When synthesizing feedback controllers for large-scale dynamical systems, often a reduction of the plant model by model order reduction is required. This is a typical task in computer-aided control system design environments. Therefore, in the last years, model order reduction became an essential tool for the practical use of mathematical models in engineering processes. For the integration of established model order reduction methods into those processes, software solutions are needed. In this paper, we describe the MORLAB (Model Order Reduction LABoratory) toolbox as such a software solution in MathWorks MATLAB(®) and GNU Octave, and its featured integration into established software tools used in simulations and controller design. We give benchmark examples for two important extensions of the toolbox. Dynamical input-output systems are a usual way of modeling natural phenomena as, e.g., fluid dynamics, mechanical systems or the behavior of electrical circuits. In general, they are described by differential and algebraic equations G : 0 = f (x(t), Dx(t), . . . , D k x(t), u(t)), where the inputs, u(t) ∈ R m , are used to influence the internal states, x(t) ∈ R n , to get the desired outputs, y(t) ∈ R p . Nowadays, dynamical systems (1) are an essential tool in simulation and the design of controllers. But due to the use of highly accurate models, involving a large number of differential equations in (1), the demand for computational resources, e.g., time and memory, is often too high for a practical usage. The aim of model order reduction is the construction of a surrogate model G, with a much smaller number of internal states,x(t) ∈ R r , and differential equations, r n, which approximates the input-to-output behavior of (1), i.e., for an appropriately defined norm and all admissible inputs u, whereŷ denotes the outputs of the reduced-order model. For the integration into established engineering processes, software solutions for the model reduction problem are needed. One such software solution, compatible with MathWorks MATLAB R and GNU Octave, is the MORLAB (Model Order Reduction LABoratory) toolbox [6, 8] . As a free and open source software, the main aim of the toolbox is the model order reduction of linear, mediumscale dynamical systems. In Sect. 2, we will briefly describe the fundamentals of the MORLAB toolbox and afterwards, in Sect. 3, provide the ideas behind the integration of MORLAB in other MATLAB and Octave software, also presenting some numerical examples. The MORLAB toolbox originated in [2] as a repository of MATLAB codes for model order reduction of linear standard systems. The current version [6] comes with 10 different model reduction techniques for continuous-and discrete-time standard, descriptor and second-order systems. The implementation of the toolbox is based on spectral projection methods, like the matrix sign function [11] and the right matrix pencil disk function [3] , which are used for the solution of underlying matrix equations. Therefore, the toolbox comes with many different solvers for different types of matrix equations, e.g., for continuous-and discretetime algebraic Riccati or Lyapunov equations. To support the work with linear dynamical systems, the toolbox also implements a number of system-theoretic subroutines, e.g., the additive decomposition of dynamical systems, and evaluation tools for the time and frequency domain with support for the different implemented system structures. An overview of the basic principles of the MORLAB toolbox can be found in [8] and is also given in the following: General Public License v3.0 and is freely available on the project website and Zenodo. Based on the spectral projection methods, the toolbox can outperform other available model reduction and system-theoretic software. All model reduction routines share the same interface and allow for quick exchange and easy comparison between the methods. All routines can be configured separately using option structs. Each subroutine can be called on its own by the user to be used and combined in various ways. No binary extensions are required, which allows for running the toolbox with bare MATLAB or Octave installations. The toolbox comes with an extensive documentation for every function in HTML and MAT-LAB inline format. MATLAB (≥ 2012b), Octave (≥ 4.0.0). See [8] for a more detailed discussion of the toolbox structure, implementational details and overviews about the currently supported system classes. An important point for the design decisions in MORLAB was the compatibility with other highly-used system-theoretic software tools. Two of the most important ones are Simulink R and the Control System Toolbox TM in MATLAB. In the following, we describe first the integration of MORLAB into those toolboxes using the state-space object and give then an overview of the extensions that MORLAB introduces itself. The numerical experiments, used here for illustration, have been executed on a machine with 2 Intel(R) Xeon(R) Silver 4110 CPU processors running at 2.10 GHz and equipped with 192 GB total main memory. The computer runs on CentOS Linux release 7.5.1804 (Core) with MATLAB 9.7.0.1190202 (R2019b). The system class corresponding to state-space models as (1), which is fully supported in MATLAB, are standard linear time-invariant systems, e.g., in the continuous-time case with A ∈ R n×n , B ∈ R n×m , C ∈ R p×n and D ∈ R p×m . The way in MATLAB to efficiently deal with (2) are so-called state-space model objects (ss objects). Those objects are, in principle, a collection of the most important properties of (2), e.g., the matrices A, B, C, D, corresponding measured data, units of the state variables and so forth. The Control System Toolbox is the main toolbox for dealing with dynamical systems in MATLAB. It provides a lot of important system-theoretic routines for the analysis and simulation of (2). The toolbox uses the ss object as its main interface. On the other hand, Simulink is a modeling toolkit for hierarchical system design and numerical experiments using graphical blocks. Complete dynamical processes are usually modeled here, especially embedding LTI system blocks, which correspond to (2) and use the ss object in its backend. Now, the task is the integration of model order reduction into the computeraided control system design workflow. Concerning the model order reduction of (2), the reduced-order surrogate model reads aŝ with A ∈ R r×r , B ∈ R r×m , C ∈ R p×r and D ∈ R p×m , which belongs to the same system class as (2) . Therefore, MORLAB provides consistent interfaces for the model order reduction routines, i.e., the reduced-order models will be of the same data type as the original models. Besides an interface for the single matrices of (2) and one using structs, MORLAB fully supports ss objects. An example of the resulting workflow is given in Fig. 1 . Let sys be the original ss object, e.g., in a Simulink LTI system block. This object can be directly put into a MORLAB routine (here ml ct ss bt), which produces a new ss object, namely rom. Due to the consistent data type of rom, the reduced-order model can now directly replace the original sys object for the acceleration of the surrounding process. The important point here is that the model reduction with MORLAB only concerns the ss object to be exchanged but the surrounding process is untouched. The example function used in Fig. 1 can be replaced by any model order reduction routine of choice from MORLAB. Overviews about supported methods for (2) can be found in [4, 8] . Remark 1. Parts of the Control System Toolbox are also available in Octave implemented in the 'control' package. There, the same interfaces and integration options are provided as for the MATLAB software. Due to the lack of systemtheoretic subroutines in Octave, MORLAB additionally provides analysis and simulation tools that are compatible with MATLAB and Octave, which highly extend the functionality of Octave for dynamical systems in its current state. (2), the ss object supports discrete-time linear time-invariant standard systems, which are also implemented in the MORLAB toolbox with appropriate model reduction routines. It should be noted that also the default MATLAB toolboxes provide some model reduction routines for small-scale dense standard systems in the Control System Toolbox and the Robust Control Toolbox TM . In comparison, MORLAB can be applied to way larger systems due to its efficient underlying spectral projection routines, which also often allow MORLAB to outperform the routines from the default MATLAB toolboxes by far. Also, the variety of the MOR-LAB model order reduction routines is so far not known to be matched by any other comparable model order reduction software for any of the provided system classes. Especially, the following two sections describe significant extensions of the MORLAB toolbox, which, in large parts, cannot be found in any other published model reduction software. The first extension of the standard MATLAB functionality for linear dynamical systems that was done in MORLAB are descriptor systems, e.g., in the continuous-time case with E ∈ R n×n and A, B, C, D as in (2) . In principle, the ss object supports general E matrices but most of the routines in the system-theoretic toolboxes reformulate (3) as (2) by explicitly inverting the E matrix to the right. Beside explicit inversion often has a negative influence on numerical accuracy, in case of differential-algebraic equations describing the system dynamics, the E matrix might not be invertible anymore. In that case, a lot of the routines in the Control System Toolbox and Simulink are unusable. But MORLAB supports this case in corresponding model reduction and system-theoretic routines by proper handling of possible algebraic system parts. The idea of model order reduction of descriptor systems with MORLAB can be found in [5] and the underlying additive decomposition of descriptor systems also in [8] . In many cases, the use of the MORLAB toolbox makes the integration of descriptor system models into other MATLAB software possible as we will see in the following example. We consider the model of an RLC circuit described by cascaded PI-circuits from [9] . The chosen S40PI n benchmark system has the form (3) with n = 2 182, m = 1 and p = 1 and we apply an α-shift with α = 10 −4 as in [10] to stabilize the system. By construction, the E matrix is not invertible and the overall system has a complicated nested structure of differential-algebraic equations. For this system, we are going to use the balanced truncation method for descriptor systems as it is implemented in MORLAB by where sys contains the original model as ss object, opts is an option struct that could be used to adjust parameters of the subroutines, rom is again the reduced-order model and info contains information about the subroutines and the full-and reduced-order systems. First, we take a closer look at the resulting info struct. Here, we can see the resulting sizes of additive decomposed system parts. The matrix pencil λE − A of the original model had n f = 2 028 finite eigenvalues in the left open half-plane and n ∞ = 154 infinite eigenvalues, which correspond to the algebraic equations of the system. The reduced-order model instead has r = 262 states, where the matrix pencil λÊ − has only finite stable eigenvalues left, i.e., theÊ matrix is now invertible and the reduced-order system can be treated as (2) . In other words, the reduced-order model generated by MORLAB can now be used in all the system-theoretic routines in MATLAB, which was not possible for the original descriptor system. To analyze the quality of the resulting reduced-order model, we plotted the frequency response and the absolute error of the original and reduced-order system using the ml sigmaplot function from MORLAB. The results can be seen in Fig. 2 . The two transfer functions are indistinguishable in the eye ball norm and the absolute error shows the good approximation behavior of the reduced-order model. Additionally, we added the absolute error bound to the plot that was provided in the info struct. Remark 3. As for the standard system case, MORLAB supports discrete-time descriptor systems with appropriate model reduction methods. A very important but currently unsupported system class in the Control System Toolbox and Simulink are linear systems involving second-order time derivatives Those systems usually arise in the modeling process of mechanical or electro-mechanical systems. In principle, every second-order system (4) can be rewritten as a first-order system (3), e.g., by introducing an extended state vector q(t) = x(t) T ,ẋ(t) T T . The drawback of this process is the resulting first-order system of order 2n, for which most computational methods ignore the internal second-order structure. This makes computations with second-order systems potentially more expensive than they need to be. This can be avoided by directly working on the secondorder system structure (4). In MORLAB, the struct data type "soss" is used to handle second-order system objects. Appropriate evaluation tools for the time and frequency evaluation that work directly with the second-order structure are implemented in the toolbox to give, as addition to established software, the opportunity to efficiently work with second-order systems. Corresponding to the direct use of the second-order structure in analysis and evaluation of dynamical systems, the application of model order reduction should preserve the system structure, i.e., it is beneficial if a reduced-order model of (4) has the same structure with M, E, K ∈ R r×r , B u ∈ R r×m , C p , C v ∈ R p×r , D ∈ R p×m . This not only allows to use (5) tools as (4) but usually a structure-preserving approximation is more accurate than an unstructured one and also might allow for interesting re-interpretations of the reduced-order system quantities. MORLAB provides several structurepreserving model reduction methods for (4). As example, we take a look at the benchmark model [13] , describing the movement of an artificial fishtail designed for autonomous underwater vehicles. The model has a mechanical second-order structure (4) with C v = 0, D = 0 and n = 779 232, m = 1, p = 3. It is crucial to employ the second-order structure since the corresponding first-order realization would be of order ≈ 1.5 · 10 6 . Due to the size of the model, the dense model reduction methods from MORLAB cannot be applied directly to the system. Therefore, we use the same approach as in [7, 12] by applying a structure-preserving pre-reduction following the theory from [1] with the same setup as in [7] . The second-order frequencylimited balanced truncation method (ml ct soss flbt) was then applied to the pre-reduced model of order 100 for the frequency interval [0, 20] Hz. As this MORLAB routine allows for computing several reduced-order models at once, we created reduced-order models for the 8 different balancing formulas from [7] . Independent of the balancing formula, the reduced-order models were of order 1 and stable. To test the results, the original system and one of the reduced-order models, namely the one created by the so formula (see [7] for details), were simulated with the input signal u(t) = 2500(sin(10π(t − 1.35)) + 1) using the MORLAB function ml ct soss simulate ss22. Figure 3 shows the second output entry with the displacement of the fishtail tip in y-direction. In the simulation, no difference between the full-and reduced-order models is visible. To compare, the simulation of the full-order model took around 4 h. The main computational work for the model order reduction was the intermediate model, which took 21 h followed by the computation of the final reduced-order models with 0.45 s. The simulation of the reduced-order model took then 0.06 s using the same time discretization scheme as for the original model, i.e., the reduced-order model allows now for real time simulations, which could be even implemented on an onboard chip in a fish drone. Interpolatory projection methods for structurepreserving model reduction A MATLAB repository for model reduction based on spectral projection Disk functions and their relationship to the matrix sign function Balancing related model reduction with the MORLAB toolbox Model reduction of descriptor systems with the MORLAB toolbox MORLAB -Model Order Reduction LABoratory Frequency-and time-limited balanced truncation for large-scale second-order systems MORLAB -The Model Order Reduction LABoratory. e-print Reducedorder transfer matrices from RLC network descriptor models of electric power grids Gramian-based reduction method applied to large sparse power system descriptor models Linear model reduction and solution of the algebraic Riccati equation by use of the sign function A comparison of second-order model order reduction methods for an artificial fishtail Matrices for an artificial fishtail. Hosted at MORwiki -Model Order Reduction Wiki