원시데이터 수집 시스템
선정목록으로

A Physical Model-Based Observer Framework for Nonlinear Constrained State Estimation Applied to Battery State Estimation

관련 수소연료전지 · (5) 연료전지용 수분제어장치(가습기)

기본 정보

저자
  1. Jonathan Brembeck — Institute of System Dynamics and Control, Robotics and Mechatronics Center, German Aerospace Center (DLR), 82234 Weßling, Germany
DOI
10.3390/s19204402
저널
Sensors
발행년도
2019
발행기관
Multidisciplinary Digital Publishing Institute
피인용수
17
라이선스
cc-by
논문 유형
–
언어
–
원문 페이지
https://doi.org/10.3390/s19204402
토픽
Electric and Hybrid Vehicle Technologies
OpenAlex ID
W2980090171

평가 내용

관련도
관련
사업분야
수소연료전지 · (5) 연료전지용 수분제어장치(가습기)
부 분야
–
R&D 측면
–
확신도
–
근거 용어
–
판단 근거
임베딩 유사도 기반 평가로 '수소연료전지 > 연료전지용 수분제어장치(가습기)' 분야에 선정된 논문입니다.
R&D 활용 포인트
–
평가 입력
–

초록

Future electrified autonomous vehicles demand higly accurate knowledge of their system states to guarantee a high-fidelity and reliable control. This constitutes a challenging task-firstly, due to rising complexity and operational safeness, and secondly, due to the need for embedded service oriented architecture which demands a continuous development of new functionalities. Based on this, a novel model based Kalman filter framework is outlined in this publication, which enables the automatic incorporation of multiphysical Modelica models into discrete-time estimation algorithms. Additionally, these estimation algorithms are extended with nonlinear inequality constraint handling functionalities. The proposed framework is applied to a constrained nonlinear state of charge lithium-ion cell observer and is validated with experimental data.

본문 90,757자

본문 펼치기
# _sensors_ _Article_ ## A Physical Model-Based Observer Framework for Nonlinear Constrained State Estimation Applied to Battery State Estimation Jonathan Brembeck Institute of System Dynamics and Control, Robotics and Mechatronics Center, German Aerospace Center (DLR), 82234 Weßling, Germany; jonathan.brembeck@dlr.de; Tel.: +49-8153-28-2472 Received: 7 August 2019; Accepted: 1 October 2019; Published: 11 October 2019 [���������](http://www.mdpi.com/1424-8220/19/20/4402?type=check_update&version=1) [�������](http://www.mdpi.com/1424-8220/19/20/4402?type=check_update&version=1) Abstract: Future electrified autonomous vehicles demand higly accurate knowledge of their system states to guarantee a high-fidelity and reliable control. This constitutes a challenging task—firstly, due to rising complexity and operational safeness, and secondly, due to the need for embedded service oriented architecture which demands a continuous development of new functionalities. Based on this, a novel model based Kalman filter framework is outlined in this publication, which enables the automatic incorporation of multiphysical Modelica models into discrete-time estimation algorithms. Additionally, these estimation algorithms are extended with nonlinear inequality constraint handling functionalities. The proposed framework is applied to a constrained nonlinear state of charge lithium-ion cell observer and is validated with experimental data. Keywords: nonlinear observer; kalman filter; constrained estimation; state of charge estimation; lithium-ion cell; hybrid simulation; functional mockup interface; modelica; AUTOSAR 1. Introduction The robotic electric research plattfom DLR ROboMObil [1] enables many highly demanding control techniques, for example, for a parametric path following control or nonlinear optimization based control allocation (e.g., [2]). For implemtation and testing in a real-world experiment, all these approaches require precise and reliable knowledge of vehicle system states. Some of these states cannot be sensored directly, since an adequate sensor principle for the searched quantity is not available (e.g., determination of the state of charge (SOC) of a battery) or the sensor is expensive and therefore it is desirable to economize it (e.g., vehicle over ground velocity). The goal of this research is to develop a complete toolchain to assist the control systems engineer in the development of complex, continuous-time formulated prediction models for estimation purposes. These should be applied to discrete-time state estimation algorithms and the automatically generated code should afterwards be easily downloadable to an embedded microcontroller target. In this work, a novel framework for state estimation using detailed multiphysical continuous-time models designed in Modelica [3] is developed. It employs an intelligent separation of the model (encapsulated in a standardized FMI (Functional Mockup Interface) 2.0 for co-simulation [4,5]) and the estimation algorithm by utilizing modern computer technologies and recent developments in the Modelica language, which enable automated discretization, integration and derivative calculation of an object oriented, equation based prediction model. The Functional Mock-up Interface (or FMI) defines a standardized interface to be used in computer simulations to develop complex cyber-physical systems. The vision of FMI is to support this approach—if the real product is to be assembled from a wide range of parts interacting in complex ways, each controlled by a complex set of physical laws, then it should be possible to create a virtual product that can be assembled from a set of models that each represents a combination of _Sensors_ 2019, _19_ [, 4402; doi:10.3390/s19204402](http://dx.doi.org/10.3390/s19204402) [www.mdpi.com/journal/sensors](http://www.mdpi.com/journal/sensors) _Sensors_ 2019, _19_, 4402 2 of 26 parts, each a model of the physical laws as well as a model of the control systems (using electronics, hydraulics, digital software, etc.) assembled digitally [6]. Functional Mock-up Interface (FMI) is a tool independent standard to support both model exchange and co-simulation of dynamic models using a combination of XML-files and (compiled) C-code. FMI is supported by over 108 tools and is used by automotive, aerospace, robotics, and so forth, organizations throughout Europe, Asia and North America [3]. Beyond this, a direct usage of the state estimator on a cross platform embedded microcontroller target is also enabled. _1.1._ _State of the Art in Estimation Toolboxes Using Kalman Filter Techniques_ The textbooks [7–9] are excellent starting points for the theoretical background on Kalman filtering and optimal state estimation. For this reason, only the most important steps of discrete nonlinear estimation and their interface to the estimation framework are given in Chapter 2 to guarantee readability and comprehension. To the best of the author’s knowledge, the MATLAB toolbox EKF/UKF [10] and the ACADO toolkit [11] can be seen as the most advanced publicly available toolboxes for state estimation problems. Both require an analytically derived, by hand or via symbolic preprocessing, (time-discrete) prediction model provided by the user. This is nontrivial, error-prone and time-consuming to utilize for a concrete estimation application with a complex nonlinear model. In contrast, a Modelica [3] simulator, for example, Dymola, is able to analyze the structure of an acausal interconnected multiphysical model, to inline the discretization method and finally to transform it to an order reduced ordinary differential equation representation with analytic derivative calculation features. Another issue is that, in the case of the first toolbox [10], no functionality is provided to directly cross compile, that is, compile for an execution system different to that of the development system and download the result to a real-time target. In this work, a formulation and code generation framework is proposed that makes use of an estimation-problems-specific, extended FMU (Funtional Mockup Unit) 2.0 co-simulation interface [4], providing the possibility of formulating prediction model equations in continuous-time by means of the Modelica language. In addition to the implementation of the well-proven Kalman filter algorithms (e.g., in [8]), fast and reliable theory extensions for nonlinear constraint handling are given in Chapter 3. In [12] an approach is given that utilizes the older FMI 1.0 standard [4], which is not able to directly handle inline integration or model state events. This is similar to the approach in [13]; besides that, the authors of [12] use Python with PyFMI and not a Modelica environment, which facilitates the integration of the observer in combination with model based nonlinear inverse controllers or the Modelica Synchronous Control System Library in a single development environment [3]. _1.2._ _State of the Art in Battery Modelling and State Estimation_ The applied FMI-based framework estimates the state of charge in batteries of electric vehicles. The current state-of-art SOC estimation algorithms can be mainly classified into three categories [14]—model-based methods, algorithms relying on a battery’s physical model and data-driven approaches which assume the cell is a black box (not discussed here); cf. [15] for details. The interested reader can find a comprehensive overview of recent SOC estimation methods in [14]. Regarding the category of model-based methods, many research studies approach the SOC estimation problem using electrical circuit models for the lithium-ion cell dynamics in combination with (mainly) Kalman filter based estimation algorithms in different degrees of detail. The cell models based on equivalent circuit models are usually composed of one or two [16–19] resistor capacitor (RC) elements in parallel configuration, an additional resistor (R) in serial configuration and an SOC dependent open cell voltage (OCV) source. Their parameters and characteristics at different cell operation temperatures are fitted using optimization methods like recursive least squares [17] or multi-swarm particle optimization [20]. Moreover, promising results have been recently achieved, estimating the _Sensors_ 2019, _19_, 4402 3 of 26 remaining lifespan of a li-ion cell using a novel particle learning algorithm in combination with a non-physical motivated exponential model [21]. Similar achievements with a dual-scale particle filter for predicting the cell’s remaining amount of energy including a comprehensive assessment of five equivalent circuit cell prediction models are given in [15]. Details on the effects of cell degradation and its modelling over its life-time can be found, for example, in [22,23]. The constrained nonlinear battery observer application shown here emphasizes the constrained nonlinear estimation framework technology and shows its versatility and impact for current research on embedded estimation technology, without having the ambition to outperform the most recent achievements in SOC estimation. In this publication, according to the classification in [14], a model based estimation method is exemplified for the usage with the physical model-based observer framework. The estimation method, a modified and improved version of [24,25], is based on an equivalent circuit model using a recursive (Kalman Filter) approach. _1.3._ _Contributions and Focus of the Work_ This work presents a new highly automated framework for generating model based observers based on different types of Kalman filters extended with constraint handling algorithms for the use in embedded application which are explained in Chapter 2 and 3. The main contributions are the structutured approach from designing an object oriented acausal multi-physical model in the Modelica [3] language over to an automated equation sorting and a discretization process towards a ready to use nonlinear (constrained) Kalman filter that can be exported to a cross-platform target, for example, an AUTOSAR embedded controller. In Chapter 4, this approach is used to implement a lithium-ion battery state of charge (SOC) estimator application. Here, it can be highlighted that through the acausal formulation of the battery cell prediction model in continuous-time, it is easily possible to model the system in a hybrid combination of cell characteristic tables and state equations. In this way, it is possible to make various improvements and modifications to the cell prediction model while being able to automatically generate a discrete-time nonlinear observer algorithm. This provides a large benefit in comparison to the error-prone modelling approach with manual transformation from continuous to discrete-time (e.g., see [24,25]); it also enables a quick exchange of system models with different complexity, as discussed in [14,16–19]. The further extension of the model-based observer framework with a moving horizon estimation approach for compensating delayed measurements and improving the estimation, as well as its practical application to a state of the art vehicle position estimation problem formulation, is discussed in [26]. This article is an extended and improved version of these publications [13,27,28]. 2. Design of a Modelica Based Estimation Framework In this chapter, a method is developed to automatically generate nonlinear state estimators based on continuous-time Modelica models. The approach is based on an extended FMI 2.0 co-simulation interface [4] that interacts with the state estimation algorithms implemented in the DLR Kalman Filter Library [27]. With the raise of computational power in the last decades the possibility of implementing complex control strategies in real world applications has been enhanced tremendously. For most of them a good knowledge of the actual states is necessary. Often these are not directly measurable due to cost limitations or missing sensors. In the ITEA project MODRIO, one aim has been to develop state estimation technologies for plants that use the knowledge of complex models of the controlled system itself. These models are often designed, parameterized and optimized as multi-domain models in Modelica [3]. To reuse these models for estimation and control purposes, the FMI [4] turns out to be very helpful, since currently in Modelica it is not possible to directly call (e.g., integrate or state-manipulate) a model within a model. In the Chapters 2.2 and 2.3 a brief introduction to the most important estimation algorithms, the extended Kalman filter and unscented Kalman filter, is given and the steps are identified where _Sensors_ 2019, _19_, 4402 4 of 26 the model evaluations are necessary by means of the FMI. For time-discrete Kalman filter theory details, derivative-free methods and a numerical robust filter design using matrix decomposition and propagation, please inspect the appendix Chapter A in reference [2]. _2.1._ _Model Evaluations in State Estimation Algorithms_ For many control system tasks the plant model to be used in state estimation is naturally described as a nonlinear continuous-time state-space system: _x_ . = _f_ ( _x_, _u_ ), _y_ = _h_ ( _x_ ), _u_ ( _t_ ) ∈ R <sup>_n_</sup> <sup>_u_</sup>, _x_ ( _t_ ) ∈ R <sup>_n_</sup> <sup>_x_</sup>, _y_ ( _t_ ) ∈ R <sup>_n_</sup> <sup>_y_</sup>, _t_ ∈ R (1) where _t_ is the time, _u_ ( _t_ ) is the vector of inputs, _x_ ( _t_ ) is the vector of states and _y_ ( _t_ ) is the vector of outputs. Besides of manual, time-consuming and error-prone derivation of this representation, in this work the plant models are defined in Modelica and exported as a functional mockup unit (FMU) [4,5] using the Modelica simulator Dymola. Note that all the research results presented here are also valid if FMUs are generated by other tools and/or non-Modelica environments, as long as the FMU supports the extended FMI 2.0 co-simulation interface according to Table 1. Table 1. Model evaluations by means of the FMI for nonlinear state estimation. Model Evaluations _f_ ( _x_, _u_ _k_ −1) d _t_ Integration between two sample points: _f_ _k_ | _k_ −1 = _x_ _k_ −1 + _tk_ −1 - _tk_ Derivative evaluation: _x_ . = _f_ ( _x_, _u_ ) Output evaluation: _y_ = _h_ ( _x_ ) <u>∂</u> _<u>f</u>_ State Jacobian matrix (optional): ∂ _x_ <sup>(</sup> <sup>_x_</sup> <sup>,</sup> <sup>_u_</sup> <sup>)</sup> Output Jacobian matrix (optional): <u>∂∂</u> _<u>hx</u>_ <sup>(</sup> <sup>_x_</sup> <sup>)</sup> Derivative evaluation: In a sampled data system (e.g. a microcontroller) the continuous-time model representation in Equation (1) cannot be used directly. Instead a time-discrete representation is needed and therefore the time-discrete transformation of Equation (1) with additive Gaussian noise is used in the sequel: _x_ _k_ = _f_ _k_ | _k_ −1( _x_ _k_ −1, _u_ _k_ −1) + _w_ _k_ −1, _y_ _k_ = _h_ ( _x_ _k_ ) + _v_ _k_, _w_ _k_ ∼ _N_ (0, _Q_ _k_ ), _v_ _k_ ∼ _N_ (0, _R_ _k_ ). (2) here _tk_ is the _k_ -th sample time instant of a periodically sampled data system. We define _u_ _k_ = _u_ ( _tk_ ), _x_ _k_ = _x_ ( _tk_ ) and _y_ _k_ = _y_ ( _tk_ ) . The vectors _w_ _k_ and _v_ _k_ represent zero biased Gaussian white noise. The - covariance matrices _Q_ _k_ and _R_ _k_ are defined as E _w_ _k_ _w_ <sup>_T_</sup> _j_ = _Q_ _k_ δ _k_ - _j_ and E( _v_ _k_ _v_ <sup>_T_</sup> _j_ <sup>)</sup> <sup>=</sup> <sup>_R_</sup> <sup>_k_</sup> <sup>δ</sup> <sup>_k_</sup> <sup>−</sup> <sup>_j_</sup> <sup>, where δ</sup> <sup>_k_</sup> <sup>−</sup> <sup>_j_</sup> is the Kronecker delta function; that is, δ _k_ - _j_ = 1 if _k_ = _j_, and δ _k_ - _j_ = 0 if _k_ - _j_ . The operator E(·) calculates the expectation value of a random variable [8]. The notation _w_ _k_ ∼ _N_ (0, _Q_ _k_ ) indicates that _w_ _k_ is a Gaussian randon variable with a mean of 0 and a variance of _Q_ _k_ = spur�σ <sup>2</sup> 1.. _n_ _x_ -, with the standard _w_ _k_ _w_ <sup>_T_</sup> _j_ covariance matrices _Q_ _k_ and _R_ _k_ are defined as E _j_ = _Q_ _k_ δ _k_ - _j_ and E( _v_ _k_ _v_ <sup>_T_</sup> _j_ is a Gaussian randon variable with a mean of 0 and a variance of _Q_ _k_ = spur�σ <sup>2</sup> 1.. _n_ _x_ -, with the standard deviation σ . The following Equation (3) describes the discrete-time integration rule, like a Runge-Kutta or Euler integration method, and therefore must be integrated into the framework. - _tk_ �σ <sup>2</sup> 1.. _n_ _x_ _f_ _k_ | _k_ −1 = _x_ _k_ −1 + _tk_ −1 _f_ ( _x_ _k_ −1, _u_ _k_ −1) d _t_ . (3) _Sensors_ 2019, _19_, 4402 5 of 26 _2.2._ _The Extended Kalman Filter Calculation Steps_ For nonlinear model state estimation the widely used EKF (extended Kalman filter) algorithm is given as a pseudo code in Algorithm 1. Algorithm 1. EKF Algorithm with FMU evaluations Set _k_ = 1 ( _k_ ∈ N <sup>+</sup> ) and _x_ ˆ 0 <sup>+</sup> Set _P_ 0 <sup>+</sup> <sup>= E((</sup> <sup>_x_</sup> <sup>0 −</sup> <sup>_x_</sup> <sup>ˆ</sup> 0 <sup>+)(</sup> <sup>_x_</sup> <sup>0 −</sup> <sup>_x_</sup> <sup>ˆ</sup> 0 <sup>+)</sup> <sup>_T_</sup> <sup>)</sup> while (break==false) do Set _P_ 0 <sup>+</sup> 0 <sup>+</sup> <sup>= E(</sup> <sup>_x_</sup> <sup>0)</sup> _Predict estimation by means of the FMU:_ <sup>−</sup> _k_ <sup>=</sup> <sup>_f_</sup> <sup>_k_</sup> <sup>|</sup> <sup>_k_</sup> <sup>−1(</sup> <sup>_x_</sup> <sup>ˆ</sup> _k_ <sup>+</sup> _x_ ˆ <sup>−</sup> _k_ _x_ ˆ <sup>−</sup> _k_ <sup>=</sup> <sup>_f_</sup> <sup>_k_</sup> <sup>|</sup> <sup>_k_</sup> <sup>−1(</sup> <sup>_x_</sup> <sup>ˆ</sup> _k_ <sup>+</sup> −1 <sup>,</sup> <sup>_u_</sup> <sup>_k_</sup> <sup>−1)</sup> _F_ _k_ −1 = exp ( ∂ _f_ /∂ _x_ ��� _x_ ˆ + �∂������ _f_ /��∂ _x_ ��������� _x_ ˆ _k_ +−�1 - _Ts_ ) <sup>−</sup> _k_ <sup>=</sup> <sup>_F_</sup> <sup>_k_</sup> <sup>−1</sup> <sup>_P_</sup> _k_ <sup>+</sup> _J_ _k_ −1 _P_ <sup>−</sup> _k_ _k_ <sup>+</sup> −1 <sup>_F_</sup> _k_ <sup>_T_</sup> _P_ <sup>−</sup> _k_ <sup>=</sup> <sup>_F_</sup> <sup>_k_</sup> <sup>−1</sup> <sup>_P_</sup> _k_ <sup>+</sup> −1 <sup>_F_</sup> _k_ <sup>_T_</sup> −1 <sup>+</sup> <sup>_Q_</sup> _Correct estimation with current measurements:_ _H_ _k_ = ∂ _h_ /∂ _x_ | _x_ ˆ - _k_ _k_ _K_ _k_ = _P_ <sup>−</sup> _k_ <sup>_H_</sup> _k_ <sup>_T_</sup> <sup>· (</sup> <sup>−</sup> _k_ <sup>_H_</sup> _k_ <sup>_T_</sup> <sup>m</sup> _k_ <sup>−</sup> <sup>_h_</sup> <sup>(</sup> <sup>_x_</sup> <sup>ˆ</sup> _k_ <sup>−</sup> _k_ <sup>_T_</sup> <sup>+</sup> <sup>_R_</sup> <sup>)−1</sup> _x_ ˆ _k_ <sup>+</sup> <sup>−</sup> _k_ <sup>_H_</sup> _k_ <sup>_T_</sup> _k_ <sup>−</sup> <sup>+</sup> <sup>_K_</sup> <sup>_k_</sup> <sup>· (</sup> <sup>_y_</sup> <sup>m</sup> _k_ _k_ <sup>+</sup> <sup>=</sup> <sup>_x_</sup> <sup>ˆ</sup> _k_ <sup>−</sup> _k_ <sup>_T_</sup> <sup>· (</sup> <sup>_H_</sup> <sup>_k_</sup> <sup>_P_</sup> <sup>−</sup> _k_ _x_ ˆ _k_ <sup>+</sup> <sup>=</sup> <sup>_x_</sup> <sup>ˆ</sup> _k_ <sup>−</sup> <sup>+</sup> <sup>_K_</sup> <sup>_k_</sup> <sup>· (</sup> <sup>_y_</sup> <sup>m</sup> _k_ <sup>−</sup> <sup>_h_</sup> <sup>(</sup> <sup>_x_</sup> <sup>ˆ</sup> _k_ <sup>−))</sup> _P_ <sup>+</sup> _k_ <sup>= (</sup> <sup>_I_</sup> <sup>−</sup> <sup>_KK_</sup> <sup>·</sup> <sup>_H_</sup> <sup>_k_</sup> <sup>) ·</sup> <sup>_P_</sup> _k_ <sup>−</sup> <sup>+</sup> _k_ <sup>= (</sup> <sup>_I_</sup> <sup>−</sup> <sup>_KK_</sup> <sup>·</sup> <sup>_H_</sup> <sup>_k_</sup> <sup>) ·</sup> <sup>_P_</sup> _k_ <sup>−</sup> _k_ _k_ = _k_ + 1 end while The red marked sections—this holds for the following sections—indicate where the evaluation of the underlying system model equations, compare Equation (2), are necessary. The calculation of _x_ ˆ <sup>−</sup> _k_ <sup>is</sup> performed by integrating the prediction model Equation (1) from _tk_ −1 to _tk_ . _F_ _k_ −1 is the state-transitions matrix of _f_ with respect to _x_ at _x_ ˆ _k_ <sup>+</sup> −1 <sup>and</sup> <sup>_H_</sup> <sup>_k_</sup> <sup>is the partial derivative matrix of</sup> <sup>_h_</sup> <sup>with respect to</sup> <sup>_x_</sup> <sup>at</sup> <sup>_x_</sup> <sup>ˆ</sup> _k_ <sup>−</sup> <sup>.</sup> The additive Gaussian noise assumption in Equation (2) is handled by the user defined covariance matrices _Q_, _R_ (the index _k_ is removed since it is here time-invariant). The Jacobians _J_ _k_ −1 and _H_ _k_ must either be provided directly (according to the FMI 2.0 specification [5], this feature is optional), or they can be determined numerically, for example with a forward difference quotient as shown in pseudo-coode in Algorithm 2: Algorithm 2. Numerical di ff erential quotient determination 1. Set ∆ - <sup>~~√~~</sup> <u>ϵ</u> for _i_ = 1 to _n_ _x_ do ( _J_ _k_ −1):, _i_ = <sup>_<u>f</u>_</sup> <sup><u>(</u></sup> <sup>_<u>x</u>_</sup> <sup><u>ˆ</u></sup> <sup>_<u>k</u>_</sup> <sup>−1+∆</sup> <sup>_<u>e</u>_</sup> <sup>_<u>i</u>_</sup> <sup><u>,</u></sup> <sup>_<u>u</u>_</sup> <sup>_<u>k</u>_</sup> <sup>−</sup> ∆ <sup><u>1)−</u></sup> <sup>_<u>f</u>_</sup> <sup><u>(</u></sup> <sup>_<u>x</u>_</sup> <sup><u>ˆ</u></sup> <sup>_<u>k</u>_</sup> <sup>−1,</sup> <sup>_<u>u</u>_</sup> <sup>_<u>k</u>_</sup> <sup>−1)</sup> ∆ end for wherein ϵ is the machine precision of the particular computer architecture, ( _J_ ):, _i_ the i-th column of _J_ and _n_ _x_ the number of system states. _2.3._ _The Unscented Kalman Filter Sigma Point Prediction Step_ The so-called sigma point transformation (SPT) is based on the idea that it is easier to approximate a Gaussian distribution than it is to approximate an arbitrary nonlinear function or transformation; see [8,29], and appendix Chapter A.4 in reference [2]. The parts of the unscented Kalman filter (UKF) algorithm, in which model evaluations are necessary, are given in Algorithm 3. The selection of the sigma points in matrix _X_ is performed via a static scaling factor γ( _nx_, α, κ) and the matrix square-root of the posteriori covariance matrix. The parameter α is the spread around the last state value _x_ ˆ _k_ <sup>+</sup> −1 <sup>and</sup> _Sensors_ 2019, _19_, 4402 6 of 26 κ is the stochastic distribution assumption. In total 2 _n_ _x_ + 1 points must be created and then used as initial values for 2 _n_ _x_ + 1 simulations from _tk_ −1 to _tk_ to compute _X_ _k_ | _k_ −1 . Algorithm 3. UKF prediction step with FMU evaluations ~~<u>�</u>~~ _P_ _k_ <sup>+</sup> −1 <sup>,</sup> <sup>_X_</sup> <sup>ˆ</sup> <sup>_k_</sup> <sup>−1 −</sup> <sup>γ</sup> <u>�</u> _P_ <sup>+</sup> _k_ −1 <u>�</u> _P_ <sup>+</sup> <u>�</u> 1. _X_ _k_ −1 = <u>�</u> _x_ ˆ _k_ −1, _X_ <sup>ˆ</sup> _k_ −1 + γ ~~<u>�</u>~~ _P_ _k_ <sup>+</sup> for _i_ = 1 to 2 · _n_ _x_ + 1 do - _X_ _k_ | _k_ −1�:, _i_ <sup>=</sup> <sup>_f_</sup> <sup>_k_</sup> <sup>|</sup> <sup>_k_</sup> <sup>−1((</sup> end for for _i_ = 1 to 2 · _n_ _x_ + 1 do :, _i_ <sup>=</sup> <sup>_f_</sup> <sup>_k_</sup> <sup>|</sup> <sup>_k_</sup> <sup>−1((</sup> <sup>_X_</sup> <sup>_k_</sup> <sup>−1):,</sup> <sup>_i_</sup> <sup>,</sup> <sup>_u_</sup> <sup>_k_</sup> <sup>−1)</sup> _x_ ˆ <sup>−</sup> _k_ <sup>=</sup> 2· _n_ _i_ =0 _w_ <sup>m</sup> _i_ <sup>·</sup> <sup>_X_</sup> <sup>_k_</sup> <sup>|</sup> <sup>_k_</sup> <sup>−1,</sup> <sup>_i_</sup> - _T_ + _Q_ _P_ <sup>−</sup> _k_ <sup>=</sup> 2· _n_ _i_ =0 _w_ <sup>c</sup> _i_ <sup>·</sup> - _X_ _k_ | _k_ −1, _i_ - _x_ ˆ <sup>−</sup> _k_ - _X_ _k_ | _k_ −1, _i_ - _x_ ˆ <sup>−</sup> _k_ �� _X_ _k_ | _k_ −1, _i_ - _x_ ˆ <sup>−</sup> _k_ �� _X_ _k_ | _k_ −1, _i_ - _x_ ˆ <sup>−</sup> _k_ _k_ <sup>−</sup> <sup>+ γ</sup> _k_ <sup>−</sup> <sup>−</sup> <sup>γ</sup> _X_ ′ _k_ <sup>=</sup> - _x_ ˆ <sup>−</sup> _k_ <sup>−</sup> _k_ <sup>,</sup> <sup>_X_</sup> <sup>ˆ</sup> _k_ <sup>−</sup> - _P_ <sup>−</sup> _k_ - _P_ <sup>−</sup> _k_ <u>�</u> - _P_ <sup>−</sup> _k_ <sup>−</sup> _k_ <sup>,</sup> <sup>_X_</sup> <sup>ˆ</sup> _k_ <sup>−</sup> �� _X_ :, _i_ ( _Y_ _k_ ):, _i_ = _h_ ′ _k_ end for _y_ ˆ <sup>−</sup> _k_ <sup>=</sup> 2· _n_ _i_ =0 _w_ <sup>m</sup> _i_ <sup>·</sup> <sup>_Y_</sup> <sup>_k_</sup> <sup>,</sup> <sup>_i_</sup> The predicted values ˆ _x_ <sup>−</sup> _k_ <sup>−</sup> _k_ <sup>, ˆ</sup> <sup>_y_</sup> <sup>−</sup> _k_ <sup>−</sup> _k_ <sup>,</sup> <sup>_P_</sup> _k_ <sup>−</sup> The predicted values ˆ _x_ <sup>−</sup> _k_ <sup>, ˆ</sup> <sup>_y_</sup> <sup>−</sup> _k_ <sup>,</sup> <sup>_P_</sup> _k_ <sup>−</sup> <sup>are calculated via weighted sums with the predetermined weights</sup> _w_ <sup>c,m</sup> _i_ ( _n_ _x_, α, κ) . It is defined _X_ <sup>ˆ</sup> := [ _x_ ˆ, ˆ _x_, . . ., ˆ _x_ ] ∈ R <sup>_n_</sup> <sup>_x_</sup> <sup>×2</sup> <sup>_n_</sup> <sup>_x_</sup> <sup>+1</sup> and in the notation here a vector depending _w_ <sup>c,m</sup> _i_ ( _n_ _x_, α, κ) . It is defined _X_ <sup>ˆ</sup> := [ _x_ ˆ, ˆ _x_, . . ., ˆ _x_ ] ∈ R <sup>_n_</sup> <sup>_x_</sup> <sup>×2</sup> <sup>_n_</sup> <sup>_x_</sup> <sup>+1</sup> and in the notation here a vector depending function (e.g., _f_ _k_ | _k_ −1 or _h_ ) with a matrix argument returns a matrix with columns that are equal to the evaluated columns of the matrix argument. It can be shown that the nonlinear approximation accuracy of the UKF is at least twice higher than the EKF. This becomes an important feature in case of strong nonlinearities in the prediction model (for a detailed proof see [9]–app. A). In the following, a novel and automated procedure is introduced for incorporating Modelica [3] based models in nonlinear observer algorithms. The aim is to start from a given (continuous, usually nonlinear) Modelica model and automatically deduce a nonlinear observer for this model in form of a sampled data system. This task cannot be performed directly, because Modelica has no means to discretize a continuous model and to solve this discretized model with a user-defined method (that means integration and model update of the next state according to the observer equations). Note that it is insufficient to simply integrate the nonlinear models from the last to the new sample instant. Instead, the extended Kalman filter algorithm (cf. Algorithm 1) requires linearizing the model around _x_ ˆ _k_ <sup>+</sup> −1 <sup>for</sup> the state Jacobian matrix and around _x_ ˆ <sup>−</sup> _k_ <sup>for the output Jacobian matrix.</sup> <sup>On the contrary, the unscented</sup> Kalman filter (cf. Algorithm 3) requires integrating the model several times with disturbed states from the last to the new sample instant. Therefore, the basic approach is to export the Modelica model in the FMI-format, import it again in Modelica and during import, call the FMI-functions in such a way that the model is discretized and utilized in a nonlinear observer algorithm. The goal of the FMI technology is to describe input/output blocks of dynamic systems defined by differential, algebraic and discrete equations and to provide an interface to evaluate these equations as needed in different simulation environments, as well as in embedded control systems, with explicit or implicit integrators and fixed or variable step size. The FMI interface consists of a small set of standardized “C-functions” to evaluate the model equations and a XML-file that contains all _Sensors_ 2019, _19_, 4402 7 of 26 information that is not needed during execution, such as the variable definitions. Every variable has a handle (a 32 bit Integer) that is used to identify the variable in the C-function calls. The source and/or object code of the C-functions, as well as the XML-file and optionally other files, are stored in a zip-file with the extension “.fmu” for “Functional Mockup Unit.” _2.4._ _Utilizing an FMU in an Estimation Algorithm_ In Figure 1 the extended FMU 2.0 co-simulation interface embedded in the estimation framework is shown (compare Figure 10 in reference [5]). It provides the necessary interfaces for the discrete estimation algorithms to calculate the quantities described in Table 1. All non-standard FMU interfaces are indicated by dotted lines. <mark>EKF</mark> <mark>EKF SR</mark> <mark>EKF UD</mark> <mark>UKF</mark> <mark>UKF SR</mark> <mark>MHE</mark> <mark>…</mark> Discrete estimation algorithm ?0, ?0, ? initial values ??−1 time? ? discrete states (constant between events) ? parameters of type Real, Integer, Boolean, String ? inputs of type Real, Integer, Boolean, String ? all exposed variables ? continuous states (continuous between events) ? outputs of type Real, Integer, Boolean, String ? event indicators ? ? ? ? ? ? ? ? <u>??</u> ?? ??−1 ? continuous states (continuous between events) <u>?̇?</u> <u>??</u> ? ? ?̇, ? (Inline-) solver Advanced FMU 2.0 for co-simulation instance ??/?? <u>??/??</u> Figure 1. The extended FMI 2.0 for model co-simulation nested in a discrete estimation algorithm. Besides the already explained variables _t_, _u_, _x_, _y_ and the set of model parameters _p_ (e.g., the mass of a vehicle) the FMU has the internal variables _m_, _v_, _z_, which are now explained briefly. The discrete states _m_ are discrete-time variables with two values—the value of the variable from the previous event instant and the value of the variable at the actual event instant [5]. Since this work focuses on continuous-time formulated prediction models, these are not used in the prediction model FMUs. The vector _v_ denotes all model variables, that is, states or sub-system variables. The event indicator vector _z_ contains internal variables such as state events which give the (inline-) solver the information that an event (e.g., the fulfillment of another branch in an “if-else” statement—see for instance the vehicle’s standstill condition in [2]) occurred between the last model evaluation and the current integration step. Internally, this is handled by the (inline-) solver to guarantee a correct integration and output of the model variables. More information on this methodology can be found in Chapter 3 of [5]. The overall process of designing a state estimator in Modelica and (cross-) compiling it for embedded targets is illustrated in Figure 2. The process can be described as follows—an acausal multiphysical Modelica model is designed in a Modelica environment such as Dymola. To fullfill requirements like real-time capability it is up to the modelling expert to find appropriate approximations, for example, for friction or hysteresis effects and to ensure it is robust simulateable with a deterministic integration algorithm such as the Runge-Kutta method. After the design process the model is translated by the simulator, for example, Dymola which performs several measures such as inlining the integration algorithm, block lower transformation and equation sorting by means of Pantelides algorithm [30,31]. _Sensors_ 2019, _19_, 4402 8 of 26 Moreover, the tearing algorithm [31] is applied to reducing the size of algebraic loops to the order of one by means of substitution variables. Finally, the model is transformed in a causal first order ODE representation encapsulated in FMU 2.0 for co-simulation. This FMU is imported into the Modelica environment by extending a provided FMU interface package. For such an FMU package a set of application specific Kalman filter models is automatically generated, which makes use of the algorithmic part of the state estimator (e.g., a UKF). Finally, the individual filter model can be instantiated, parameterized or tuned in the user’s application model or can be cross compiled for an embedded target platform using the C-code sources from the FMU and a target dependent cross compiled numerical library of LAPACK (Linear Algebra PACKage, [32]), which is used for the matrix calculus operations. This process is currently under further development in the EMPHYSIS project to match the requirements (e.g., memory and word length limitations) of automotive (AUTOSAR compliant) embedded targets. Acausal multiphysical model Observer *.bin/*.elf (*.a2l) Block lower trafo. Pantelides algo. Tearing Inline integration Target interfacing Cross compile FMU 2.0 co-sim. (1.order ODE) C- & XML- Code FMU & Filter Modelica package xKF Algo. E.g. software Memory config. component Parameter file Figure 2. Overall model based observer generation process. The following estimation algorithms are implemented reliably and efficiently in the DLR Kalman Filter Library—EKF (extended Kalman filter), SR-EKF (square-root EKF), UD-EKF (UD-decomposition EKF), UKF (unscented Kalman filter), SR-UKF (square-root UKF) [7,29]. Additionally, there are modified algorithms for parameter estimation as well as an extension to nonlinear moving horizon estimation (MHE) using a fast nonlinear gradient descent search as it is presented in [26]. For details on the implementation of the DLR Kalman Filter Library in the Modelica language please refer to the appendix Chapter B in reference [2]. _2.5._ _Notes on Detectability and Observability_ The designed prediction model is normally nonlinear and in this work there is no deeper discussion of the determination of the observability of the system. In practical applications it is mostly sufficient if the model is detectable rather than completely observable, that is, all unobservable modes/states are stable. An analysis of these properties can be performed with the DLR Modelica LinearSystems2 library [3]. As a good rule of thumb it is helpful to make a detectability and observability analysis at the nominal operation points or in a grid of potential operation modes. _Sensors_ 2019, _19_, 4402 9 of 26 3. Kalman Filter Theory Extension with Inequality Constraints The so far presented estimation algorithms, based on the Kalman approach, are very well suited for a large bandwidth of observer problems. Besides the stochastic assumption of zero mean, Gaussian white noise processes, there are neither system state constraints nor delays in the data acquisition chain considered. In [33] a good and comprehensive overview of existing methods is given for incorporating (linear) constraints to Kalman filtering for linear and nonlinear systems. Some of these methods are not only applicable for linear constraints and they can also handle nonlinear constraints. Especially the estimation projection methods can be used for nonlinear constraints through a first or second order Taylor series expansion around the a priori state estimation _x_ ˆ <sup>−</sup> _k_ <sup>.</sup> <sup>For the approach of perfect</sup> measurements (PM) constraint handling, this linearization is repeatedly applied to the measurements to smoothly improve the estimation. This article focuses on the class of nonlinear inequality constraints for nonlinear state estimation, since for many estimation tasks the control design engineer needs to incorporate inequality constraints to the states, for example, the slider position state _s_ of an inverted pendulum is limited to the interval _s_ ∈ [ _s_ min, _s_ max] . Moreover, the constraints should be formulated (non-)linear by means of the Modelica language within the prediction model or in a separate FMU. Additionally, by reason of exchangeability and flexibility, the state constraint handling algorithms should be separable from the particular unconstrained Kalman filter algorithm. That is, the user can configure the estimation task with constraint handling features and then examine different Kalman filters (e.g. EKF or UKF) without the need to adopt the constraints to the particular estimation algorithm. For these reasons it has been decided to extend the posteriori estimation projection approach with an inequality constraints algorithm in a computationally efficient way to guarantee real-time capability. This is explained in the following subchapters. Table 2. Nonlinear constraint handling methods for nonlinear Kalman filters. Method Approach Description Nonlinear soft constraints by means of perfect measurements [33] are Nonlinear soft constraints shown in the application example of a battery state estimator in Chapter 4. Project the states on the constrained surface by solving the restrictive Nonlinear optimization based estimation projection Sigma point projection Nonlinear moving horizon estimation optimization problem min _x_ <sup>∥</sup> <sup>_x_</sup> <sup>−</sup> <sup>_x_</sup> <sup>ˆ</sup> _k_ <sup>+∥</sup> <sup>_W_</sup> s.t. _d_ ( _x_ ) = 0, _c_ ( _x_ ) ≤ 0 it can be solved by means of a nonlinear interior point solver or a sequential quadratic program (SQP) [34]. This is a special approach for UKF algorithms. The sigma points are projected on the borders of the constrained region and with these projected points the covariance update is calculated [35]. In [36] and [2] additionally the sigma point weights are scaled to improve the constrained covariance confidence. Similar methods are the two-step UKF and the unscented recursive nonlinear dynamic data reconciliation (URNDDR) which performs a MHE with a horizon size of one to the posteriori sigma points [33]. A nonlinear moving horizon estimator with a nonlinear gradient descent optimization which can handle equality and inequality constraints as well as delayed measurements is formulated [2]. Besides this, various other formulations, like the URNDDR, the constrained UKF [2] or the constrained real-time approach using the ACADO toolbox [15] can be found as examples for nonlinear moving horizon estimation. To the best knowledge of the author a new method for nonlinear estimation with nonlinear inequality constraints is given in the next chapter (i.e., computational simplified nonlinear inequality constraints handling for the case that one constraint is active) that is different to the algorithms in literature (see Table 2). The following proposed estimation projection method is appropriate for nonlinear inequality constraints of the form _c_ ( _x_ ) ≤ 0, with limits to the distinguished approximation. First, in Chapter 3.1 an efficient root-finding algorithm determines a linear scaling factor between the _Sensors_ 2019, _19_, 4402 10 of 26 vector distance _x_ ˆ _k_ <sup>+</sup> _k_ <sup>+</sup> <sup>_x_</sup> <sup>ˆ</sup> _k_ <sup>+</sup> vector distance _x_ ˆ _k_ <sup>+</sup> <sup>_x_</sup> <sup>ˆ</sup> _k_ <sup>+</sup> −1 <sup>to the point where the constraint gets active</sup> <sup>_c_</sup> <sup>(</sup> <sup>_x_</sup> <sup>) = 0 .</sup> <sup>Afterwards, a different</sup> method is proposed, with a Lagrange multiplier. This method determines a constrained estimate that lays closer to the border of the constrained surface _c_ ( _x_ ) = 0 . _3.1._ _The Formulation of State Constraints c_ ( _x_ ) ≤ 0 In the most common cases there exist a lot of known constraints to estimated states, for example, a limitation of the position due to physical stops in a mechanical system. These can be formulated as restrictions that fulfill a set of inequalities _c_ ( _x_ ) ≤ 0 . The main principal of the proposed algorithms is to change the state vector after the correction step _x_ ˆ _k_ <sup>+</sup> <sup>of the Kalman filter such that all restrictions are</sup> fulfilled. The optimization problem is defined as: (4) _x_ ˆ <sup>0</sup> _k_ <sup>0</sup> _k_ <sup>= argmin</sup> _x_ ∥ _x_ - _x_ ˆ _k_ <sup>+∥</sup> s.t. _c_ ( _x_ ) ≤ 0 It is assumed that the constraints _c_ ( _x_ ) ≤ 0 are neither contradictory nor redundant and only one constraint is active at the same time. In many cases this is valid, since the estimation step size is small and, for example, the constraints are designed as bands without complex overlap. Examples for this are road boundaries in a position estimation problem cf. [2]. In case of large step sizes and/or if multiple constraints are likely to be active, it is possible to handle these situations by an sequential quadratic program (SQP) formulation (see Table 2). An SQP approach can be seen as more general but also computationally more complex in comparison to the here proposed problem-specific approaches. This is justified by the necessity in the SQP algorithm of an iterative search to determine the Lagrange multiplier by solving QP sub-problems [34]. Moreover, the Hessian of the QP needs to be approximated, also in an iteratively manner, by means of a Broyden–Fletcher–Goldfarb–Shanno algorithm BFGS approach [37]. The BFGS algorithm is a quasi-Newton method which approximates the Hessian matrix using updates specified by evaluations of the gradient. The obvious way to handle the active constraint is to find the point _x_ ˆ <sup>0</sup> _k_ <sup>in the vector</sup> <sup>_x_</sup> <sup>ˆ</sup> _k_ <sup>+</sup> <sup>_x_</sup> <sup>ˆ</sup> _k_ <sup>+</sup> −1 <sup>where</sup> the violated constraint _c_ ( _x_ ) > 0 is no longer fulfilled (see Figure 3). This means the root α of _c_ ( _x_ (α)) = 0 has to be determined, such that <sup>0</sup> _k_ <sup>in the vector</sup> <sup>_x_</sup> <sup>ˆ</sup> _k_ <sup>+</sup> The obvious way to handle the active constraint is to find the point _x_ ˆ <sup>0</sup> _k_ _k_ <sup>+</sup> <sup>_x_</sup> <sup>ˆ</sup> _k_ <sup>+</sup> _k_ −1 <sup>0</sup> _k_ <sup>=</sup> <sup>_x_</sup> <sup>ˆ</sup> _k_ <sup>+</sup> _x_ ˆ <sup>0</sup> _k_ _k_ <sup>+</sup> −1 <sup>+ α ·</sup> - _x_ ˆ _k_ <sup>+</sup> _k_ <sup>+</sup> <sup>−</sup> <sup>_x_</sup> <sup>ˆ</sup> _k_ <sup>+</sup> -, α ∈ [0, 1] (5) ### ?(?) > 0 ?(?) < 0 +? ### ?̂+? ### Admissible state region ### Inadmissible state region ### ?̂0? ### ?̂+?−1 ?(?) = 0 Figure 3. Barrier violation in constrained state estimation. _Sensors_ 2019, _19_, 4402 11 of 26 This problem is solved with the derivative free root finding method of Brent [38]. This algorithm is available in the Modelica Standard Library (“Modelica.Math.Nonlinear. solveOneNonlinearEquation”) [3]. Once α is known, the Cholesky decomposition _C_ _P_ <sup>0</sup> _k_ <sup>of the covariance</sup> matrix can be calculated as: <sup>0</sup> _k_ <sup>= (1 −</sup> <sup>α) ·</sup> <sup>_C_</sup> <sup>_P_</sup> _k_ <sup>−</sup> _k_ <sup>+</sup> (6) _C_ _P_ <sup>0</sup> _k_ _k_ <sup>−</sup> <sup>+ α ·</sup> <sup>_C_</sup> <sup>_P_</sup> _k_ <sup>+</sup> The rudimentary way would be to use this solution for the estimation projection, but one can easily see in Figure 3 that it is not the closest estimate to the unconstrained solution _x_ ˆ _k_ <sup>+</sup> <sup>.</sup> <sup>Therefore,</sup> two approaches are discussed in the following that are intended to find a better approximation of the solution. _3.2._ _The Simplified Newton Descent Search Approach_ As a second approach, a more general method for incorporating inequality constraints is presented. Different to this a sigma point projection based algorithm (cf. Table 2), as proposed in [2] and [36], works fine with the SR-UKF as well as the SR-EKF algorithm, because in these cases the algorithm can directly use the Cholesky factorization of the a priori covariance matrix. For other algorithms that do not rely on square-root filtering [29], a computational costly Cholesky decomposition of the covariance matrix would have to be computed in every time instant when a constraint gets active. The here proposed algorithm is based on a simplified Newton descent search (i.e., without considering the second order derivative), that projects the posteriori estimation on the constrained surface. This opens up a more general use. The optimization objective is formulated as follows: _x_ ˆ <sup>P</sup> _k_ <sup>P</sup> _k_ <sup>=</sup> <sup>argmin</sup> ∥ _x_ - _x_ ˆ _k_ <sup>+∥</sup> _x_ s.t. _c_ ( _x_ ) = 0 The idea behind this algorithm is to perform a descent search along the gradient ∇ _c_ - _x_ ˆ <sup>+</sup> _k_ (7) calculated at the point _x_ ˆ _k_ <sup>+</sup> _k_ <sup>+</sup> <sup>until the constraint equation</sup> <sup>_c_</sup> <sup>(</sup> <sup>_x_</sup> <sup>ˆ</sup> _k_ <sup>P</sup> at the point _x_ ˆ _k_ <sup>+</sup> <sup>until the constraint equation</sup> <sup>_c_</sup> <sup>(</sup> <sup>_x_</sup> <sup>ˆ</sup> _k_ <sup>P) ≤</sup> <sup>0 holds again.</sup> <sup>Graphically this can be interpreted</sup> as shown in Figure 4. ### ?(?) < 0 ?̂P? ### ?̂+? ### ?(?) > 0 ### ?̂?? ### Contour line ?(?) = 0 ?̂+?−? Figure 4. Principle of the Newton descent search for state constraint handling. This optimization task can be formulated with the method of Lagrange multipliers. Equation (8) denotes the above formulated optimization objective in a general description: min ?( _x_, µ) = _f_ ( _x_ ) − µ · ( _g_ ( _x_ ) − _d_ ) (8) _Sensors_ 2019, _19_, 4402 12 of 26 Therefore, the optimal solution of this unrestricted minimization problem is denoted as follows: ∇ _x_,µ?( _x_, µ) = 0 (9) This approach is now applied to the estimation projection optimization problem Equation (7) and the searched restricted estimate _x_ ˆ <sup>P</sup> _k_ <sup>is calculated using the Lagrange multiplier µ and the gradient of</sup> the active constraint _c_ ( _x_ ) : <sup>_P_</sup> _k_ <sup>=</sup> <sup>_x_</sup> <sup>ˆ</sup> _k_ <sup>+</sup> _x_ ˆ <sup>_P_</sup> _k_ <sup>_x_</sup> <sup>ˆ</sup> _k_ <sup>+</sup> <sup>+ µ · ∇</sup> <sup>_c_</sup> <sup>(</sup> <sup>_x_</sup> <sup>) s.t.</sup> <sup>_c_</sup> <sup>(</sup> <sup>_x_</sup> <sup>) = 0</sup> - _c_ _x_ ˆ _k_ <sup>+</sup> <sup>+ µ · ∇</sup> <sup>_c_</sup> <sup>(</sup> <sup>_x_</sup> <sup>)</sup> = 0 - _x_ ˆ _k_ <sup>+</sup> _k_ <sup>+</sup> <sup>+ µ · ∇</sup> <sup>_c_</sup> <sup>(</sup> <sup>_x_</sup> <sup>)</sup> - (10) = 0 To fulfill Equation (10) the approach is formulated with a simplified Newton descent search algorithm by means of a scalar zero search F(µ) = 0 with respect to the Lagrange variable µ : ∇ _c_ ( _x_ ) ≈∇ _c_ ( _x_ ˆ _k_ <sup>+</sup> ∇ _c_ ( _x_ ) ≈∇ _c_ ( _x_ ˆ _k_ <sup>+)</sup> yields → F(µ) = _c_ ( _x_ ˆ _k_ <sup>+</sup> <sup>+ µ · ∇</sup> _k_ <sup>+))</sup> <sup>=!</sup> <sup>0</sup> (11) _k_ <sup>+</sup> <sup>+ µ · ∇</sup> <sup>_c_</sup> <sup>)</sup> <sup>_T_</sup> <sup>· ∇</sup> <sup>_c_</sup> <sup>(</sup> <sup>_x_</sup> <sup>ˆ</sup> _k_ <sup>+</sup> ∂µ∂F <sup>= ∇</sup> <sup>_c_</sup> <sup>(</sup> <sup>_x_</sup> <sup>ˆ</sup> _k_ <sup>+</sup> _k_ <sup>+</sup> <sup>+ µ · ∇</sup> <sup>_c_</sup> <sup>(</sup> <sup>_x_</sup> <sup>ˆ</sup> _k_ <sup>+</sup> _k_ <sup>+)</sup> <u>∂F</u> ∂µ ����µ=0 = ∇ _c_ ( _x_ ˆ _k_ + <sup>)</sup> <sup>_T_</sup> <sup>∇c(</sup> <sup>_x_</sup> <sup>ˆ</sup> _k_ <sup>+</sup> _k_ <sup>+)</sup> This can be implemented as an iterative search algorithm, which determines µ such that the condition F(µ) = 0 holds within a predefined ~~max~~ imum number of calculation steps. The pseudo code for the algorithm is given in Algorithm 4. Algorithm 4 . Simplified Newton descent search algorithm for constrained estimation projection. 1. Set µ _o_ = 0 and _k_ = −1 and _iter_ = 1 and _ma_ _x_ _ _iter_ = 30 _k_ <sup>~~+)~~</sup> <sup>_<u>T</u>_</sup> <sup>~~· ∇~~</sup> <sup>_~~c~~_</sup> <sup>~~(~~</sup> <sup>_~~x~~_</sup> <sup>~~ˆ~~</sup> _k_ <sup>~~+~~</sup> Set α ~~= (∇~~ _~~c~~_ ~~(~~ _~~x~~_ ~~ˆ~~ _k_ <sup>~~+~~</sup> _k_ <sup>~~+))~~</sup> −1 while ��� ~~α · c(~~ _~~x~~_ ~~ˆ~~ _k_ <u>+</u> <sup>~~+ µ~~</sup> <sup>k+1</sup> <sup>~~· ∇c(~~</sup> <sup>_~~x~~_</sup> <sup>~~ˆ~~</sup> _k_ <sup><u>+</u></sup> <sup>~~))~~</sup> <u>���</u> ~~≥~~ ~~ϵ~~ Newton ~~and~~ ~~iter~~ ~~<~~ ~~max_iter~~ ~~do~~ _k_ = _k_ + 1 ∆µ _k_ +1 = −α · _c_ ( _x_ ˆ _k_ <sup>+</sup> <sup>+ µ</sup> <sup>_k_</sup> <sup>· ∇</sup> <sup>_c_</sup> <sup>(</sup> <sup>_x_</sup> <sup>ˆ</sup> _k_ <sup>+))</sup> while ��� ~~α · c(~~ _~~x~~_ ~~ˆ~~ _k_ <u>+</u> <sup>~~+ µ~~</sup> <sup>k+1</sup> <sup>~~· ∇c(~~</sup> <sup>_~~x~~_</sup> <sup>~~ˆ~~</sup> _k_ <sup><u>+</u></sup> _k_ <sup><u>+</u></sup> <sup>~~))~~</sup> _k_ <sup>+</sup> <sup>+ µ</sup> <sup>_k_</sup> <sup>· ∇</sup> <sup>_c_</sup> <sup>(</sup> <sup>_x_</sup> <sup>ˆ</sup> _k_ <sup>+</sup> ∆µ _k_ +1 = −α · _c_ ( _x_ ˆ _k_ <sup>+</sup> <sup>+ µ</sup> <sup>_k_</sup> <sup>· ∇</sup> <sup>_c_</sup> <sup>(</sup> <sup>_x_</sup> <sup>ˆ</sup> _k_ <sup>+))</sup> µ _k_ +1 = µ _k_ + ∆µ _k_ +1 _iter_ = _iter_ + 1 end while _Solution:_ <sup>P</sup> _k_ <sup>=</sup> <sup>_x_</sup> <sup>ˆ</sup> _k_ <sup>+</sup> _k_ <sup>+)</sup> _x_ ˆ <sup>P</sup> _k_ _k_ <sup>+</sup> <sup>+ µ</sup> <sup>_k_</sup> <sup>+1 · ∇</sup> <sup>_c_</sup> <sup>(</sup> <sup>_x_</sup> <sup>ˆ</sup> _k_ <sup>+</sup> 4. A Constrained Nonlinear Battery Observer This section is an extended version of [13] and [28], which addresses the modeling of a lithium-ion cell for online monitoring and offline benchmarking purposes. It is based on a modified version of the enhanced self-correcting model (ESC) originally proposed by [24], which is an equivalent circuit model with one RC element in parallel and an additional hysteresis voltage source (compare Figure 2c in reference [39]). This physical lithium-ion cell model is combined with smoothly interpolated lookup table of cell characteristic information from laboratory tests. The model is fully parameterized and validated with the cell type used in the high voltage (HV) battery pack of the robotic battery electric vehicle DLR ROboMObil [1]. It benefits from automatic discretization with higher order solvers, lookup table interpolation, as well as derivative calculation and symbolic transformation by means of the Modelica simulator (cf. Chapter 2), as well as from the derivative-free unscented Kalman filter (Chapter 2.3) with inequality state constraints (Chapter 3). _Sensors_ 2019, _19_, 4402 13 of 26 _4.1._ _An Equations and Grid Table Combined Cell Model_ In the following section, a modified and enhanced version of the ESC model is developed, referred to as the modified enhanced self-correcting model (MESC). In contrast to the original approach the prediction model of the single lithium-ion cell is formulated in acausal continuous-time representation using Modelica. This mathematical description benefits from the automated discretization of the model, by means of a Modelica compiler. The generated prediction FMU can incorporate higher order real-time capable integrators, for example, a Runge-Kutta 4 method and therefore the accuracy as well as stability for a larger sample time _Ts_ can be significantly improved. The mathematical description of the MESC model in nonlinear state-space representation is formulated as follows: −ω · _f_ f1 + ω · _i_ cell ω · _f_ f1 − ω · _f_ f2 ω · _f_ f2 − ω · _f_ f3 <u>ω ·</u> _<u>f</u>_ ~~f3~~ <u>−</u> <u>ω ·</u> _<u>f</u>_ ~~f4~~ - <sup><u>ηAh·</u></sup> <sup>_<u>k</u>_</sup> <sup><u>i</u></sup>   - <sup><u>ηAh·</u></sup> <sup>_<u>k</u>_</sup> <sup><u>i</u></sup> _C_ N - _i_ cell <u>γ·ηAh·</u> _<u>k</u>_ <u>i</u> �� _<u>C</u>_ ~~N~~ - _<u>i</u>_ <u>cell��</u> - ( _<u>M</u>_ <u>ηAh·</u> _<u>k</u>_ <u>i</u> _<u>C</u>_ ~~N~~ - _<u>i</u>_ <u>cell��</u> - ( _<u>M</u>_ - _<u>h</u>_ ) <u></u> <u></u> . _<u>l</u>_ <u>.</u> _h_ . _f_ f <u></u> <u></u> =   (12) The differential equation for the SOC _l_ depends on the cell current _i_ cell, the nominal cell capacity _C_ N, the coulombic efficiency ηAh and a correction factor _k_ i . This factor takes the variation of the cell capacity into account due to the (dis)charging rate and the temperature, see Figure 5 The C-rate is a normalized measure of electric current, defined as the ratio of current _I(t)_ in Amperes, to a cell’s nominal capacity _CN_ in Ampere-hours [18]. Following [40] the correction factor is determined by: _ki_ = - _c_ i · _i_ cell + _k_ 0, ∀ _i_ cell - 0 (chrg.) (13) _e_ <sup>_c_</sup> <sup>i·</sup> <sup>_i_</sup> <sup>cell</sup> + ( _k_ 0 − 1), ∀ _i_ cell < 0 (dischrg.) wherein _ci_ is a positive constant leading into a straight line for positive cell current, which intersects the ordinate at _k_ 0 . For a negative cell current the correction factor is described by an exponential function. The parameters _c_ i and _k_ 0 are determined from capacity tests replacing the simple straight line with more accurate look-up tables. 45 40 30 20 10 0 50 40 30 20 10 0 -10 0 1 2 3 4 5 Figure 5. ROboMObil’s measured cell capacity in dependency of temp. and current _CRate_ = _CN_ / _l._ The hysteresis voltage _h_ (presented in the second differential equation in (12)) is described by a more complex equation considering the additional factors _M_ (polarization voltage) and γ (time _Sensors_ 2019, _19_, 4402 14 of 26 constant). It describes the dynamic influence of charging and discharging of the cell as depicted in Figure 7. Herein _M_ is half of the difference between the charge (blue) and discharge (red) line in dependency of the SOC, exemplified for _l_ = 0.2 . Especially for lithium-ion cell types with a very flat SOC/OCV curve characteristic (e.g., LiFePO4 cell chemistry) neglecting this dynamics may lead to a major model error. The remaining four differential equations describe an optimized fourth order critical damping current filter with only one remaining parameter ω and its states _f_ f _u_ cell = _U_ OCV( _l_ ) + _h_ - _R_ i · _f_ f4 (14) The output Equation (14) is similar to the original ESC model’s output equation but aggregates the influence of the cell current (ohmic loss and current filter) into one summand. The internal resistance _R_ i( _l_, _i_ cell, _T_ ) of the cell is one of the most important descriptive variables. It depends on the SOC, the cell current and the temperature resulting in a three dimensional look-up table. This relationship is visualized for room temperature ( _T_ = 25 <sup>◦</sup> C ) in Figure 6. Considering Equation (14) it is obvious that the resulting cell voltage _u_ cell varies highly in case of a low SOC and high current flow due to an internal resistance increase of the cell. In such cases the cell is in a demanding situation and can be damaged irreversibly, since the higher resistance causes intense internal cell heating. Another important cell variable is the open circuit voltage (OCV) _U_ OCV, whose characteristic curve incorporates the relationship between SOC and OCV, as shown in Figure 7. This figure also illustrates the hysteresis effects during charging and discharging of the cell. The blue and red curve are measured in a cell test bench experiment with very low currents applied to the cell terminals. 0.014 0.012 0.01 0.008 0.006 0.004 0.002 0 <mark>0</mark> <mark>-100</mark> <mark>0,2</mark> <mark>0,4</mark> <mark>0,6</mark> <mark>0,8</mark> <mark>1</mark> <mark>100</mark> <mark>0</mark> <mark>200</mark> Figure 6. Grid table of internal cell resistance for _T_ = _25_ <sup>◦</sup> _C._ Δ = 2 ⋅?(?) State of charge [-] Figure 7. Characteristic of the cell open circuit volt. and hysteresis at _T_ = − _10_ <sup>◦</sup> _C._ _Sensors_ 2019, _19_, 4402 15 of 26 This minimizes excitation of the cell dynamics so that the cell terminal voltage can be considered unloaded. In addition, the influence of the internal resistance is eliminated during the data analysis. The polarization voltage _M_ is defined as half of the difference between the two curves and therefore also depends on the OCV. Tests have shown that the polarization voltage depends on the actual cell temperature, whereas the highest effect of the considered lithium-ion cell type is for temperatures below 0 <sup>◦</sup> C . However, it is important to mention that the hysteresis effect at positive temperature might be more significant for other cell types (e.g., LiFePO4 or NiCoAl). This relation is presented graphically in Figure 8. Figure 8. Cell polarization voltage _M_ in dependency of temperature and state of charge. _4.2._ _Cell Model Parameter Derivation and Validation_ In the context of the ROboMObil project, it was possible to obtain a high performance cell from Li-Tec Battery GmbH “Li-Tec HEI40”. It has a nominal capacity of 40 Ah and with its safety features it is fully capable for series production. For details on technical specifications please refer to Appendix A. All cell measurements for parameterization, testing, and validations were done with a Vötsch “VT4011” environment simulator and a BaSyTec cell testing system. In Figure 9 the Modelica implementation of the MESC model is shown. The stationary grid table data SOC/OCV, SOC correction, Polar Voltage, and _R_ i have been derived offline with this experiment setup. The free model parameters in Equation (12), by name γ (hysteresis voltage change rate) and _f_ f1..4 (input current filter parameters) were determined by optimization with DLR MOPS (see [41] for more information) on the Linux cluster of the DLR SR institute. p n voltage SOC current MESC equation model T = const + A SOC/OCV table SOC corr. table Polar voltage table Ri table Figure 9. Modelica model of the MESC based on grid tables and equations. _Sensors_ 2019, _19_, 4402 16 of 26 _4.3._ _Kalman Filter Setup – Perfect Measurements_ The MESC model has one input, the cell current, and one output, the cell voltage. These two quantities can be measured directly with high accuracy even in embedded systems. The third quantity is the cell temperature. It is determined by the use of a thermocouple sensor on the cell surface. To achieve a better estimation performance, a second measurement equation is implemented. The main idea is to take constraints into account with a recursive Kalman filter. For this purpose, an additional fictitious measurement is introduced. It can be weighted through the tuning of the output covariance matrix of the Kalman filter. This method is known as perfect measurement (PM) in the literature [33]. In this way the output equation of the MESC model is extended to: (15) _y_ = - _u_ cell _l_ The first equation is identical to Equation (14) and the second one can be derived as follows: _u_ cell ≈ _U_ OCV( _l_ ) − _R_ i · _i_ cell ⇒ _U_ OCV( _l_ ) ≈ _u_ cell + _R_ i · _i_ cell ⇒ _l_ ≈ _l_ meas = _U_ OCV <sup>−1</sup> <sup>(</sup> <sup>_u_</sup> <sup>cell +</sup> <sup>_R_</sup> <sup>i ·</sup> <sup>_i_</sup> <sup>cell)</sup> (16) The measured SOC is calculated through the inverse of the OCV _U_ OCV <sup>−1</sup> <sup>lookup table in combination</sup> with a low pass filter to prevent peaks in the perfect measurement output due to rapid changes of the input current. This extension allows the Kalman filter to adjust the SOC directly and therefore to enforce a physically correct estimation. _4.4._ _Observer Configuration on an Embedded Microcontroller_ To exemplify the usage of a cell battery observer on an embedded microcontroller an AUTOSAR architecture has been chosen since it is subject of current research at DLR SR within the ITEA EMPHYSIS project and it is getting more and more important in the field of automotive. In the style of [42] a schematic configuration of an AUTOSAR layered microcontroller configuration is sketched in Figure 10. On the lowest layer, the microcontroller interacts with it’s I/Os and other controllers via a bus system, for example, via CAN, or receives electrical signals from sensors or gives electric commands to actuators, for example, via the power electronics of an electric machine. In the overlaying turquoise colored layer the AUTOSAR Basic Software layer is arranged. In this layer bit streams from the I/O are more and more abstracted by help of different modules and a real-time operation system (RTOS) in combination with various libraries. These represent an infrastructure for the execution of components on the top layer, the AUTOSAR Software application layer. Between these both lies a middle layer, the AUTOSAR run time environment, which provides all interfaces and in-/outputs, between the lower hardware abstraction and the top application layer. The exchange between these both is described by a *.arxml file. Details on this are given, for example, in [42]. By this separation of application and close to hardware programming it is possible to design novel model and FMI based algorithms without the need to have deep knowledge of the complex AUTOSAR architecture. In the application layer of Figure 10 an example configuration with different applications, which make use of the here-proposed battery observer, is shown. In this example, a sensor software component performs signal preconditioning such as scaling, faulty sensor detection and initialization. Then, by means of an FMI based observer algorithm the observer software component (subject of investigation in this project) calculates the complete set of (virtual) sensor signals that then can be used within a controller or diagnosis software component. _Sensors_ 2019, _19_, 4402 17 of 26 Application Layer - AUTOSAR Software (ASW) Controller Software Component AUTOSAR Interface Diagnosis Software Component AUTOSAR Interface Observer Software Component AUTOSAR Interface Sensor Software Component AUTOSAR Interface AUTOSAR Run Time Environment (RTE) AUTOSAR Basic Software (BSW) RTOS Libraries AUTOSAR Services Microcontroller Figure 10. Schematic of an AUTOSAR layered architecture with an observer software component. This observer software component should embed the extended Kalman filter algorithm with nested FMUs for the cell model (MESC) and perfect measurements (PM), that is, in this scenario the FMUs are not interconnect-able to other software components as it is proposed in [42] and are only available to the Kalman filter algorithm. In Figure 11 the battery observer control structure is schematically pictured with the signal flow between the components and the FMUs as well as the algorithmic evaluations in the Kalman filter steps according to Figure 1 and Algorithm 1. The inputs, that need to be provided by the RTE, are the measured battery current _Ik_ <sup>m</sup> −1 <sup>and</sup> <sup>cell</sup> <sup>terminal</sup> <sup>voltage</sup> <sup>_u_</sup> <sup>m</sup> _k_ <sup>.</sup> <sup>As</sup> <sup>outputs</sup> <sup>to</sup> <sup>the</sup> <sup>RTE</sup> the complete estimated state vector _x_ ˆ <sup>+</sup> _k_ <sup>(compare Equation (12)) and the corrected output vector</sup> <sup>_y_</sup> <sup>ˆ</sup> _k_ <sup>+</sup> (compare Equation (15)) are defined. After the initialization phase with user tune-able model and filter parameters of the EKF as well as the both FMUs (MESC and perfect measurements), all indicated with the lower index (·)0, the algorithm is cyclic executed with a predefined fixed cycle time _T_ s = _tk_ +1 − _tk_ . In the prediction step a forward integration with the previous state estimates _x_ ˆ _k_ −1 and the input _Ik_ <sup>m</sup> −1 <sup>is</sup> _k_ <sup>m</sup> −1 <sup>and</sup> <sup>cell</sup> <sup>terminal</sup> <sup>voltage</sup> <sup>_u_</sup> <sup>m</sup> _k_ <sup>+</sup> _k_ <sup>(compare Equation (12)) and the corrected output vector</sup> <sup>_y_</sup> <sup>ˆ</sup> _k_ <sup>+</sup> In the prediction step a forward integration with the previous state estimates _x_ ˆ _k_ −1 and the input _Ik_ <sup>m</sup> −1 <sup>is</sup> calculated by the FMU MESC. Moreover, the directional derivatives of the states and the FMU outputs are computed, to determine the covariance prediction _P_ <sup>−</sup> _k_ <sup>of the Kalman filter.</sup> <sup>In the second step the</sup> perfect measurement FMU is evaluated to calculate a value for the fictive measured SOC _l_ <sup>PM</sup> (Equation _k_ (16)) that can be incorporated in the correction step of the Kalman filter. The inputs to the FMU PM are { _l_ <sup>MESC</sup> <sup>m</sup> _k_ <sup>,</sup> <sup>_u_</sup> _k_ <sup>MESC</sup> - . It is also valid to use _u_ <sup>m</sup> _k_ <sup>m</sup> _k_ <sup>instead of</sup> <sup>_u_</sup> _k_ <sup>MESC</sup> <sup>MESC</sup>, _I_ <sup>m</sup> _k_ _k_ _k_ _l_ <sup>MESC</sup>, _I_ <sup>m</sup> . It is also valid to use _u_ <sup>m</sup>, but the predicted cell voltage is less noisy _k_ _k_ <sup>,</sup> <sup>_u_</sup> _k_ <sup>MESC</sup> _k_ <sup>instead of</sup> <sup>_u_</sup> _k_ <sup>MESC</sup> and therefore preferable to the sensor signal. In the third and final step the measurement update of the Kalman filter is computed. The measurement vector _y_ <sup>m</sup> _k_ <sup>is composed of the fictive SOC measurement</sup> _l_ <sup>PM</sup> and the actual measured cell terminal voltage _u_ <sup>m</sup> _k_ _k_ <sup>, the covariance matrix</sup> <sup>_P_</sup> _k_ <sup>+</sup> <sup>is updated and the</sup> corrected state vector _x_ ˆ _k_ <sup>+</sup> <sup>is computed.</sup> <sup>The latter two values are used in the next cycle</sup> <sup>_tk_</sup> <sup>+1</sup> <sup>of the time</sup> <sup>m</sup> _k_ <sup>, the covariance matrix</sup> <sup>_P_</sup> _k_ <sup>+</sup> _l_ <sup>PM</sup> and the actual measured cell terminal voltage _u_ <sup>m</sup> _k_ _k_ corrected state vector _x_ ˆ _k_ <sup>+</sup> <sup>is computed.</sup> <sup>The latter two values are used in the next cycle</sup> <sup>_tk_</sup> <sup>+1</sup> <sup>of the time</sup> update step as recursion measures. _Sensors_ 2019, _19_, 4402 18 of 26 Observer software component on a microcontroller EKF algorithm ?0,?0 = {?MESC0 },? init. val. <u>0+, ?+0̂</u> Time update (predict) ??−1 = ? <sup>(??−1⋅??)</sup> <u>?0+</u> ̂ +0̂ ?− = ??−1?+?−1 ??−1 + ? ?0,?0 = {?PM0 },? init. val. ??− +?−1???−1 <u>??</u> <u>??−1m</u> <u>??</u> <u>?̂+?−1</u> FMU MESC ??m FMU perfect meas. +?̂ Measurement update (correct) ?m? m? = <u>?+?̂</u> ?? ?? = ??−??? ⋅(????−??? + ?)−1 <u>{??PM, ??m</u> <u>}</u> ??m ?m −?(?̂−? ?−??? <u>?PM, ??m</u> <u>?m</u> <u>}</u> ??m +? = ?? = ??− ?̂?+ = ?̂?− + ?? ⋅(??m −?(?̂−? )) ??+ = (?−?? ⋅??) ⋅?−? ?? = ??−??? ⋅(????−??? + ?)−1 ?̂?+ = ?̂?− + ?? ⋅(??m −?(?̂−? )) ?+ = ?̂?− ?−??? ?− + ?? ⋅(??m ?̂+? ?? ⋅(????− −? <u>{??</u> ?(?̂+? ) ?+ = (?−?? ⋅??) ⋅?−? Figure 11. Schematic of the cell observer software component and it’s interaction with the FMUs. _4.5._ _Parameterization and Model Validation_ In this chapter the experimental results with the unconstrained battery observer are discussed. For the generation of the experiment data a FTP-75 driving cycle is used as driving demand for ROboMObil’s longitudinal dynamics powertrain model which is based on the DLR PowerTrain Library [3]. This model and its resulting power demand calculation have been validated on the DLR roller test rig in Stuttgart with the whole battery pack (cf. [1]). With this multiphysical model it is possible to convert the calculated electric power demand of the actuators into the current demand of one cell. In a next step this current demand (Figure 12) is used as stimuli data for a single cell test bench in a climate chamber. The voltage at the cell terminals, the surface temperature and the effective current flow are recorded during this test. Finally, they are used as input and measurement data for the nonlinear battery observer experiment setup, shown in Figure 11. In Figure 13 the experimental and the corrected results of the proposed FMI model based real-time observer are presented. The black reference curve is determined via precise testbench experiment with high fidelity current measurements. The red curve shows the SOC characteristic calculated via the perfect measurement. _Sensors_ 2019, _19_, 4402 19 of 26 40 20 0 -20 -40 -60 <u><mark>Drive cycle cu</mark></u> <u>rrent demand</u> -80 0 500 1000 1500 2000 Time [s] Figure 12. Calculated cell current demand based on FTP-75 drive cycle. 1.2 1.0 0.8 0.6 0.4 0.2 0.0 SOC (sim.) SOC (perf. meas.) SOC (SR-UKF) SOC (reference) -0.2 <u>0</u> ~~<u>2.0E3</u>~~ <u>4.0E3</u> <u>6.0E3</u> <u>8.0E3</u> <u>1.0E4</u> <u>1.2E4</u> <u>Time [s]</u> ~~Figure 13.~~ ~~Unconstrained observer based state of charge estimation.~~ It is very erratic and noisy, in spite of signal prefiltering. <u>This c</u> ~~<u>harac</u>~~ <u>teris</u> ~~<u>tic is qu</u>~~ <u>alitatively correct,</u> especially i ~~n comparison to the green curve, which represents the output of a pure model sim~~ ulation without observer correction. <u>The pure simulation yields a SOC that is less than zero at t</u> ~~<u>he</u>~~ <u>end of the</u> simulation which is physically impossible (cf. Figure 13, bottom right). In a real world automotive application, this would cause the SOC display to show incorrect information. In this case it would not be possible to drive on, although the battery is not yet exhausted. Through the nonlinear estimation algorithm, a better and smoother estimation of the SOC can be achieved that converges to zero at the end (blue curve). These observations are quantified by normalized root mean square error criteria (FIT) in the following table. The results of the SOC SR-UKF with an average deviation of ~2–3% SOC to the reference true value grant a good result of this estimator compared to recent developments in state of charge estimation as Figure 8 in reference [43] for LiNMC cell types (same chemistry as used here—see Appendix A). Further optimization of the Kalman filter parameters and reducing the sensor noise may also improve the results. Due to the efficient code for the prediction model provided by the extended FMI 2.0 co-simulation interface, this estimator runs with a real-time factor greater than 100 on standard desktop systems (Intel i7-4600U 2,7 GHz, 8 GB Ram, SSD). Thereby, it was possible to implement the observer on an embedded rapid prototyping controller of ROboMObil. _Sensors_ 2019, _19_, 4402 20 of 26 _4.6._ _Extension to Inequality Constraint SOC Estimation_ In this section the application of the proposed constraint handling mechanisms (see Chapter 3) for an one-step Kalman filter estimation algorithm is exemplified. Both approaches, a sigma point projection approach (cf. [2]) as well as the simplified Newton descent search (Chapter 3.2), can be <u>used here since a SR-UKF filter has been selected as the most appropriate method (cf.</u> <u>Table 3), which</u> <u>is stable in case of this estimation task.</u> <u>A common problem in battery state of charge estimation is</u> the limitation of the SOC to realistic values at least between zero and one. Misinterpreted values of the perfect measurement Equation (16) exceed the abovementioned boundary values and may cause wrong values of the available charge and therefore also of the power allocation budget. A simplified <u>approach to handle this is to limit the output value of the estimation, but this causes wrong values for</u> future SOC estimate since the state tends more and more in the inadmissible region. Table 3. State of charge estimation assessment by means of the FIT criterion. SOC Reference Compared to FIT SOC SR-UKF 90.3649% SOC SR-EKF 88.1267% SOC perf. measurement 83.3738% SOC simulation 47.5859% In Figure 14 the influence of the proposed constraining methods is shown. In this scenario a sensor failure is virtually generated that causes a static cell voltage measurement drop of ∆ _V_ = 0.6 _V_ at _T_ = 5 · 10 <sup>3</sup> _s_ (cf. Figure 15). Due to this the fictive SOC measurement calculated by the PM (cf. Chapter 4.3) drops immediately to zero (cf. Figure 14– _T_ = 8 · 10 <sup>3</sup> _s_ ). The estimated SOC follows this trend more smoothly until it reaches also a SOC of zero at _T_ = 1.1 × 10 <sup>3</sup> _s_, where it is limited by the constraining algorithm. In Figure 15 (red curve) it can be seen that not only the SOC is effected by constraining algorithm also the observer output cell voltage is limited to the end-of-discharge voltage of the cell. 0.6 0.4 0.2 0.0 SOC (SR-UKF cstr.) SOC (disturbed perf. meas.) SOC (reference) 6.0E3 8.0E3 1.0E4 1.2E4 Time [s] Figure 14. Constrained observer based state of charge estimation. _Sensors_ 2019, _19_, 4402 21 of 26 3.8 3.6 3.4 3.2 3.0 2.8 2.6 ~~Cell voltage (disturbed)~~ <u>Cell voltage (est. w. const. SR-UKF)</u> Cell voltage (reference) 2.4 6.0E3 8.0E3 1.0E4 1.2E4 Time [s] Time [s] Figure 15. Constrained observer based cell voltage. This simple example should give a motivation for the usage of the here proposed algorithms, in combination with a sensor fault detection system (cf. Figure 10) this methodology can help to prevent suddenly occurring faulty system states (i.e. immediately SOC drop to zero cf. Figure 14). Both state constraining methods have shown similar results in their temporal characteristics (see Table 4), the main difference could be found in the mean integration time _t_ k, where the sigma point projection methods outperforms the more general simplified Newton descent search approach. The experiment with a simulation period of 1.2 · 10 <sup>4</sup> s has been executed on a 64-bit Windows based system (Intel i7-4600U 2,7 GHz, 8 GB Ram, SSD). Table 4. Assessment of the average calculation time of the algorithms. <u>Algorithm</u> <u>Average Calculation Time Per Step</u> SR-UKF unconstrained 4, 08 _m_ s SR-EKF unconstrained 4, 27 _ms_ SR-UKF w. simplified Newton descent search 5, 93 _ms_ SR-UKF w. sigma point projection constraints 5, 19 _ms_ 5. Conclusions ¯ _<u>t</u>_ _~~<u>k</u>~~_ This work presented a new highly automated framework for generating model based observers for use in embedded applications. The benefits in comparison to conventionally manual and application-specific observer implementation can be summarized as follows: - Representation of a nonlinear acausal prediction model in an object oriented multi-physical modeling language (Modelica). - Automated, well proven and efficient equation sorting and discretization in a standardized format; - Direct integration in a library containing different types of nonlinear Kalman filter algorithms. - Formulation of nonlinear state constraints in the same way as the prediction model. - Proposal of a simplified approach for handling nonlinear state constraints. - Automated code generation for a cross-platform embedded target. Moreover, the observer framework along with the state constraint mechanism have been successfully applied to a battery electric vehicle state of charge estimation problem. The results and benefits of the nonlinear constrained cell observer can be concluded as follows: _Sensors_ 2019, _19_, 4402 22 of 26 - A continuous-time Modelica semi-physical cell model with state dependent characteristic mapping correlation has been automatically symbolically manipulated and discretized via Dymola and imported into the model based observer framework via the extended FMU 2.0 co-simulation interface. - This gives benefits in comparison to [24,25] by way of error-prone manual discretization, the capability to make use of higher order discretization methods as well as prediction model integrated efficient table interpolation. - The cell prediction model parameters and characteristics were derived from real world test bench experiments matching the cell type used in ROMO for the high voltage system. - An SR-UKF observer extended with a computional reliable method for state constraint handling has been designed and validated with experimental data from cell test bench investigations. 6. Outlook It is planned to release a commercial version of the DLR Kalman Filter Library as a Modelica Library as well as a MATLAB compliant version by the end of 2019. Ongoing research in the EMPHYSIS project will focus on an embedded platform specific version of the FMI standard, special numeric routines tailored to single precision computing and extended problem formulations such as NMPC or nonlinear dynamic inversion. Moreover, for future development it will be investigated, whether a software component design with a separation of the observer algorithm component and the underlying FMUs in different software components should be preferable (similar to [42]). Funding: The author’s thanks go to the DLR ROboMObil team, as well as Prof. Martin Otter, Dr. Andreas Pfeiffer and Dr. Ricardo de Castro for their help with questions of implementation, scientific writing and numerical routines. Moreover, the author’s special thanks go to the BMBF for supporting the research on the Modelica based observer framework in the ITEA project MODRIO (funded by BMBF grant number 01IS12022G) and the current research on the embedded FMI realization and standardization in the ITEA project EMPHYSIS (funded by BMBF grant number 01IS17023B). Conflicts of Interest: The author declares no conflict of interest. Abbreviations Formula symbol Unit Description _l_ [−] State of charge _h_ [V] Cell hysteresis voltage _ki_ [−] MESC model cell capacity correction factor _CN_ [Ah] Cell nominal capacity η _A_ _h_ [−] Coulombic cell efficiency _h_ [V] Transient cell hysteresis voltage _M_ [V] Cell polarization voltage depend from _l_, _T_ Nomenclature Explanation _e_ Lower case letter variable is a scalar _e_ Bold lower case letter variable is a vector _E_ Bold upper case letter variable is a matrix _e_ = { _e_ 1, _e_ 2} Equivalent vector notations = ( _e_ 1, _e_ 2) <sup>_T_</sup> Matrix notation _E_ = - _e_ 11 _e_ 12 _e_ 21 _e_ 22 ϵ Denotes the machine precision according to IEEE 754-2008 _Sensors_ 2019, _19_, 4402 23 of 26 Abbreviation Explanation AUTOSAR Automotive open system architecture BMS Battery management system CAN Controller area network—vehicle bus standard DLR German Aerospace Center DLR SR Insititute of System Dynamics and Control at DLR Dymola Modelica simulator from Dassault Systèmes EMPHYSIS Embedded systems with physical models in the production code software – ITEA 3 project EKF Extended Kalman filter ESC Enhanced self-correcting (model) FIT Normalized root mean square error criteria FMI Functional mockup interface FMU Functional mockup unit FTP-75 (Environmental Protection Agency) Federal Test Procedure (drivecycle) LAPACK Linear Algebra PACKage–software library for numerical linear algebra MATLAB MATrix LABoratory–numerical computing software from MathWorks Inc. MESC Modified enhanced self-correcting (model) MHE Moving horizon estimation/estimator Modelica Object oriented modeling language for multiphysical systems [1] MOPS Multi-Objective Parameter Synthesis–DLR optimization software MODRIO Model Driven Physical Systems Operation – ITEA 3 project NG Nonlinear gradient (descent search) NMPC Nonlinear model predictive control OCV Open circuit voltage PM Perfect measurement QP Quadratic program ROboMObil see ROMO ROMO short for ROboMObil—DLR’s robotic electric vehicle RTE Run time environment RTI Real-time iteration RTOS Real-time operation system SOC State of charge [−] ∈ [0, 1] SPT Sigma point transformation SQP Sequential quadratic program SR Square-root SR-EKF Square-root extended Kalman filter SR-UKF Square-root unscented Kalman filter UD-EKF UD-decomposition based extended Kalman filter UKF Unscented Kalman filter URNDDR Unscented recursive nonlinear dynamic data reconciliation XML Extensible markup langua Modelica Object oriented modeling language for multiphysical systems [1] MOPS Multi-Objective Parameter Synthesis – DLR optimization software NG Nonlinear gradient (descent search) NMPC Nonlinear model predictive control OCV Open circuit voltage PM Perfect measurement QP Quadratic program ROboMObil see ROMO ROMO short for ROboMObil – DLR’s robotic electric vehicle RTE Run time environment RTI Real-time iteration RTOS Real-time operation system SOC State of charge [−] ∈ [0, 1] _Sensors_ 2019, _19_, 4402 24 of 26 SPT Sigma point transformation SQP Sequential quadratic program SR Square-root SR-EKF Square-root extended Kalman filter SR-UKF Square-root unscented Kalman filter UD-EKF UD-decomposition based extended Kalman filter UKF Unscented Kalman filter URNDDR Unscented recursive nonlinear dynamic data reconciliation XML Extensible markup langua Appendix A. Cell Data Li-Tec HEI40 The lithium-ion cell under investigation is a pre-series production cell from Li-Tec Battery GmbH of the type ICS (Ion,Ceramic,Sheet Type) 12/203/245 (DIN IEC 61960). The main technical specificationas are given in the following: Characteristica Value Explanatory notes Nominal capacity _CN_ 40 [Ah] Charging end − voltage 4.2 [V] Nominal voltage 3.6 [V] Discharging end-voltage 3.0 [V] AC impedance < 0.7[mΩ] Gravimetric energy density 135 [Wh/kg] Volumetric energy density 241 [Wh/l] proprietary from Li-Tec Battery Electrolyte n.a. Seperator material Al2O3SiO2 GmbH–see German patent DE102009040562 ceramic separator – Evonic Separion© Anode material Graphite Evonic Litarion© Cathode material LiNi _x_ Mn _y_ Co _z_ O2 Evonic Litarion© References 1. Brembeck, J.; Ho, L.M.; Schaub, A.; Satzger, C.; Tobolar, J.; Bals, J.; Hirzinger, G. ROMO-The Robotic Electric Vehicle. In Proceeding of the 22nd IAVSD International Symposium on Dynamics of Vehicle on Roads and Tracks, Manchester Metropolitan University, 15 August 2011. 2. Brembeck, J. Model Based Energy Management and State Estimation for the Robotic Electric Vehicle ROboMObil. Doctoral Dissertation, Technical University of Munich, Munich, Germany, 2018. 3. Modelica Association. Modelica. Available online: [http://www.modelica.org](http://www.modelica.org) (accessed on 15 September 2019). 4. Blochwitz, T.; Otter, M.; Akesson, J.; Arnold, M.; Clauß, C.; Elmqvist, H.; Friedrich, M.; Junghanns, A.; Mauss, J.; Neumerkel, D.; et al. Functional Mockup Interface 2.0: The Standard for Tool independent Exchange of Simulation Models. In Proceedings of the 9th International Modelica Conference, Munich, Germany, 3–5 September 2012; pp. 173–184. 5. Modelica Association. Functional Mock-up Interface forModel Exchange and Co-Simulation. Specification document; Modelica. 2014. 6. WIKIPEDIDA. Functional Mock-up Interface. Available online: [https://en.wikipedia.org/wiki/Functional_](https://en.wikipedia.org/wiki/Functional_Mock-up_Interface) [Mock-up_Interface (accessed on 15 September 2019).](https://en.wikipedia.org/wiki/Functional_Mock-up_Interface) 7. Simon, D. _Optimal_ _State_ _Estimation:_ _Kalman,_ _H_ _Infinity,_ _and_ _Nonlinear_ _Approaches_, 1st ed.; Wiley & Sons: Cleveland, OH, USA, 2006. 8. Brembeck, J. Nonlinear Constrained Moving Horizon Estimation Applied to Vehicle Position Estimation. _Sensors_ 2019, _19_, 2276. [[CrossRef] [PubMed]](http://dx.doi.org/10.3390/s19102276) _Sensors_ 2019, _19_, 4402 25 of 26 9. Brembeck, J.; Pfeiffer, A.; Fleps-Dezasse, M.; Otter, M.; Wernersson, K.; Elmqvist, H. Nonlinear State Estimation with an Extended FMI 2.0 Co-Simulation Interface. In Proceedings of the 10th International Modelica Conference, Lund, Sweden, 10–12 March 2014; pp. 53–62. 10. Brembeck, J.; Wielgos, S. A real time capable battery model for electric mobility applications using optimal estimation methods. In Proceedings of the 8th International Modelica Conference, Dresden, Germany, 20–22 March 2011; pp. 398–405. 11. Brembeck, J.; Otter, M.; Zimmer, D. Nonlinear Observers based on the Functional Mockup Interface with Applications to Electric Vehicles. In Proceedings of the 8th International Modelica Conference, Dresden, Germany, 20–22 March 2011; pp. 474–483. 12. Grewal, M.S.; Andrews, A.P. _Kalman filtering:_ _theory and practice using MATLAB_, 4th ed.; John Wiley & Sons Inc.: Hoboken, NJ, USA, 2015. 13. Haykin, S. _Kalman Filtering and Neural Networks_, 1st ed.; Wiley-Interscience: New York, NY, USA, 2001. 14. Hartikainen, J.; Solin, A.; Särkkä, S. Optimal filtering with Kalman filters and smoothers - A Manual for Matlab toolbox EKF/UKF. Available online: [http://www.lce.hut.fi/research/mm/ekfukf/](http://www.lce.hut.fi/research/mm/ekfukf/) (accessed on 22 April 2017). 15. Houska, B.; Ferreau, H.J.; Diehl, M. ACADO toolkit-An open-source framework for automatic control and dynamic optimization. _Optim._ _Control Appl._ _Methods_ 2010, _32_, 298–312. [[CrossRef]](http://dx.doi.org/10.1002/oca.939) 16. Bonvini, M.; Wetter, M.; Sohn, M.D. An FMI-based Framework for State and Parameter Estimation. In Proceedings of the 10th International Modelica Conference, Lund, Sweden, 10–12 March 2014; pp. 647–656. 17. Xiong, R.; Cao, J.; Yu, Q.; He, H.; Sun, F. Critical Review on the Battery State of Charge Estimation Methods for Electric Vehicles. _IEEE Access_ 2018, _6_, 1832–1843. [[CrossRef]](http://dx.doi.org/10.1109/ACCESS.2017.2780258) 18. Xiong, R.; Zhang, Y.; He, H.; Zhou, X.; Pecht, M.G. A Double-Scale, Particle-Filtering, Energy State Prediction Algorithm for Lithium-Ion Batteries. _IEEE Trans._ _Ind._ _Electron._ 2018, _65_, 1526–1538. [[CrossRef]](http://dx.doi.org/10.1109/TIE.2017.2733475) 19. Jokic, I.; Zecevic, Z.; Krstajic, B. State-of-charge estimation of lithium-ion batteries using extended Kalman filter and unscented Kalman filter. In Proceedings of the 2018 23rd International Scientific-Professional Conference on Information Technology (IT), Zabljak, Montenegro, 19–24 Febulary 2018; pp. 1–4. 20. Tian, Y.; Li, D.; Tian, J.; Xia, B. An optimal nonlinear observer for state-of-charge estimation of lithium-ion batteries. In Proceedings of the 12th IEEE Conference on Industrial Electronics and Applications (ICIEA), Siem Reap, Cambodia, 18–20 June 2017; pp. 37–41. 21. Perez, H.E.; Hu, X.; Dey, S.; Moura, S.J. Optimal Charging of Li-Ion Batteries with Coupled Electro-Thermal-Aging Dynamics. _IEEE Trans._ _Veh._ _Technol._ 2017, _66_, 7761–7770. [[CrossRef]](http://dx.doi.org/10.1109/TVT.2017.2676044) 22. Shen, P.; Ouyang, M.; Lu, L.; Li, J.; Feng, X. The Co-estimation of State of Charge, State of Health, and State of Function for Lithium-Ion Batteries in Electric Vehicles. _IEEE Trans._ _Veh._ _Technol._ 2018, _67_, 92–103. [[CrossRef]](http://dx.doi.org/10.1109/TVT.2017.2751613) 23. Huang, C.; Wang, Z.; Zhao, Z.; Wang, L.; Lai, C.S.; Wang, D. Robustness Evaluation of Extended and Unscented Kalman Filter for Battery State of Charge Estimation. _IEEE Access_ 2018, _6_, 27617–27628. [[CrossRef]](http://dx.doi.org/10.1109/ACCESS.2018.2833858) 24. Liu, Z.; Sun, G.; Bu, S.; Han, J.; Tang, X.; Pecht, M. Particle Learning Framework for Estimating the Remaining Useful Life of Lithium-Ion Batteries. _IEEE Trans._ _Instrum._ _Meas._ 2017, _66_, 280–293. [[CrossRef]](http://dx.doi.org/10.1109/TIM.2016.2622838) 25. Panchal, S.; Mcgrory, J.; Kong, J.; Fraser, R.; Fowler, M.; Dincer, I.; Agelin-Chaab, M. Cycling degradation testing and analysis of a LiFePO 4 battery at actual conditions. _Int._ _J._ _Energy_ _Res._ 2017, _41_, 2565–2575. [[CrossRef]](http://dx.doi.org/10.1002/er.3837) 26. Panchal, S.; Rashid, M.; Long, F.; Mathew, M.; Fraser, R.; Fowler, M. Degradation Testing and Modeling of 200 Ah LiFePO 4 Battery. In Proceedings of the WCX World Congress Experience, Detroit, MI, USA, 10–12 April 2018. 27. Plett, G.L. High-performance battery-pack power estimation using a dynamic cell model. _IEEE_ _Trans._ _Veh. Technol._ 2004, _53_, 1586–1593. [[CrossRef]](http://dx.doi.org/10.1109/TVT.2004.832408) 28. Plett, G.L. Extended Kalman filtering for battery management systems of LiPB-based HEV battery packs: Part 1–3. _J. Power Sources_ 2004, _134_, 252–292. [[CrossRef]](http://dx.doi.org/10.1016/j.jpowsour.2004.02.031) 29. Van der Merwe, R. Sigma-Point Kalman Filters for Probabilistic Inference in Dynamic State-Space Models. Ph.D. Thesis, Oregon Health & Science University, Hillsboro Oregon, USA, April 2004. 30. Pantelides, C.C. The Consistent Initialization of Differential-Algebraic Systems. _SIAM J. Sci._ _and Stat._ _Comput._ 1988, _9_, 213–231. [[CrossRef]](http://dx.doi.org/10.1137/0909014) _Sensors_ 2019, _19_, 4402 26 of 26 31. Otter, M.; Elmqvist, H. Transformation of Differential Algebraic Array Equations to Index One Form. In Proceedings of the 12th International Modelica Conference, Prague, Czech Republic, 15–17 May2017; pp. 565–579. 32. Anderson, E.; Bai, Z.; Bischof, C.; Blackford, L.S.; Demmel, J.; Dongarra, J.J.; Croz, J.D.; Hammarling, S.; Greenbaum, A.; McKenney, A.; et al. _LAPACK_ _Users’_ _Guide_, 3rd ed.; Society for Industrial and Applied Mathematics: Philadelphia, PA, USA, 1999. 33. Simon, D. Kalman filtering with state constraints: a survey of linear and nonlinear algorithms. _Iet Control_ _Theory Appl._ 2010, _4_, 1303–1318. [[CrossRef]](http://dx.doi.org/10.1049/iet-cta.2009.0032) 34. Bazaraa, M.S.; Sherali, H.D.; Shetty, C.M. _Nonlinear Programming_, 3rd ed.; John Wiley & Sons, Inc.: Hoboken, NJ, USA, 2006. 35. Kandepu, R.; Imsland, L.; Foss, B.A. Constrained state estimation using the Unscented Kalman Filter. In Proceedings of the 16th Mediterranean Conference on Control and Automation, Ajaccio, France, 25–27 June 2008; pp. 1453–1458. 36. Schneider, P. Sigma-Punkt Kalman-Filter mit Ungleichungsnebenbedingungen. Ph.D. Thesis, Logos Verlag Berlin GmbH, Saarbrücken, Germany, 2011. 37. Curtis, F.E.; Que, X. A quasi-Newton algorithm for nonconvex, nonsmooth optimization with global convergence guarantees. _Math._ _Program._ _Comput._ 2015, _7_, 399–428. [[CrossRef]](http://dx.doi.org/10.1007/s12532-015-0086-2) 38. Brent, R.P. _Algorithms for Minimization Without Derivatives_ ; Dover Publications: Mineola, New York, NY, USA, 2013; pp. 58–59. 39. Zhang, F.; Rehman, M.M.U.; Wang, H.; Levron, Y.; Plett, G.; Zane, R.; Maksimovi´c, D. State-of-charge estimation based on microcontroller-implemented sigma-point Kalman filter in a modular cell balancing system for Lithium-Ion battery packs. In Proceedings of the 16th Workshop on Control and Modeling for Power Electronics (COMPEL), Vancouver, BC, Canada, 12–15 July 2015; pp. 1–7. 40. Graaf, R. Simulation hybrider Antriebskonzepte mit Kurzzeitspeicher für Kraftfahrzeuge. Ph.D. Thesis, RWTH Aachen, Aachen, Germany, 2010. 41. Pfeiffer, A. Optimization Library for Interactive Multi-Criteria Optimization Tasks. In Proceedings of the 9th International Modelica Conference, Munich, Germany, 3–5 September 2012; pp. 669–679. 42. Neudorfer, J.; Armugham, S.S.; Peter, M.; Mandipalli, N.; Ramachandran, K.; Bertsch, C.; Corral, I. FMI for Physics-Based Models on AUTOSAR Platforms. In Proceedings of the Symposium on International Automotive Technology (SIAT), Pune, India, 18–21 January 2017. 43. Yang, J.; Xia, B.; Shang, Y.; Huang, W.; Mi, C.C. Adaptive State-of-Charge Estimation Based on a Split Battery Model for Electric Vehicle Applications. _IEEE Trans._ _Veh._ _Technol._ 2017, _66_, 10889–10898. [[CrossRef]](http://dx.doi.org/10.1109/TVT.2017.2728806) © 2019 by the author. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution [(CC BY) license (http://creativecommons.org/licenses/by/4.0/).](http://creativecommons.org/licenses/by/4.0/.)

섹션 본문 111문단 · 71,116자

(제목 없음)

1Future electrified autonomous vehicles demand higly accurate knowledge of their system states to guarantee a high-fidelity and reliable control. This constitutes a challenging task-firstly, due to rising complexity and operational safeness, and secondly, due to the need for embedded service oriented architecture which demands a continuous development of new functionalities. Based on this, a novel model based Kalman filter framework is outlined in this publication, which enables the automatic incorporation of multiphysical Modelica models into discrete-time estimation algorithms. Additionally, these estimation algorithms are extended with nonlinear inequality constraint handling functionalities. The proposed framework is applied to a constrained nonlinear state of charge lithium-ion cell observer and is validated with experimental data.parts, each a model of the physical laws as well as a model of the control systems (using electronics, hydraulics, digital software, etc.) assembled digitally[6]. Functional Mock-up Interface (FMI) is a tool independent standard to support both model exchange and co-simulation of dynamic models using a combination of XML-files and (compiled) C-code. FMI is supported by over 108 tools and is used by automotive, aerospace, robotics, and so forth, organizations throughout Europe, Asia and North America[3].Beyond this, a direct usage of the state estimator on a cross platform embedded microcontroller target is also enabled.State of the Art in Estimation Toolboxes Using Kalman Filter TechniquesThe textbooks [7-9] are excellent starting points for the theoretical background on Kalman filtering and optimal state estimation. For this reason, only the most important steps of discrete nonlinear estimation and their interface to the estimation framework are given in Chapter 2 to guarantee readability and comprehension.To the best of the author's knowledge, the MATLAB toolbox EKF/UKF [10] and the ACADO toolkit[11]can be seen as the most advanced publicly available toolboxes for state estimation problems. Both require an analytically derived, by hand or via symbolic preprocessing, (time-discrete) prediction model provided by the user. This is nontrivial, error-prone and time-consuming to utilize for a concrete estimation application with a complex nonlinear model. In contrast, a Modelica [3] simulator, for example, Dymola, is able to analyze the structure of an acausal interconnected multiphysical model, to inline the discretization method and finally to transform it to an order reduced ordinary differential equation representation with analytic derivative calculation features. Another issue is that, in the case of the first toolbox [10], no functionality is provided to directly cross compile, that is, compile for an execution system different to that of the development system and download the result to a real-time target.In this work, a formulation and code generation framework is proposed that makes use of an estimation-problems-specific, extended FMU (Funtional Mockup Unit) 2.0 co-simulation interface [4], providing the possibility of formulating prediction model equations in continuous-time by means of the Modelica language. In addition to the implementation of the well-proven Kalman filter algorithms (e.g., in [8]), fast and reliable theory extensions for nonlinear constraint handling are given in Chapter 3.In[12]an approach is given that utilizes the older FMI 1.0 standard [4], which is not able to directly handle inline integration or model state events. This is similar to the approach in[13]; besides that, the authors of [12] use Python with PyFMI and not a Modelica environment, which facilitates the integration of the observer in combination with model based nonlinear inverse controllers or the Modelica Synchronous Control System Library in a single development environment [3].State of the Art in Battery Modelling and State EstimationThe applied FMI-based framework estimates the state of charge in batteries of electric vehicles. The current state-of-art SOC estimation algorithms can be mainly classified into three categories [14]-model-based methods, algorithms relying on a battery's physical model and data-driven approaches which assume the cell is a black box (not discussed here); cf.[15] for details. The interested reader can find a comprehensive overview of recent SOC estimation methods in[14].Regarding the category of model-based methods, many research studies approach the SOC estimation problem using electrical circuit models for the lithium-ion cell dynamics in combination with (mainly) Kalman filter based estimation algorithms in different degrees of detail. The cell models based on equivalent circuit models are usually composed of one or two[16][17][18][19]resistor capacitor (RC) elements in parallel configuration, an additional resistor (R) in serial configuration and an SOC dependent open cell voltage (OCV) source. Their parameters and characteristics at different cell operation temperatures are fitted using optimization methods like recursive least squares [17] or multi-swarm particle optimization[20]. Moreover, promising results have been recently achieved, estimating the

Introduction

2The robotic electric research plattfom DLR ROboMObil [1] enables many highly demanding control techniques, for example, for a parametric path following control or nonlinear optimization based control allocation (e.g., [2]). For implemtation and testing in a real-world experiment, all these approaches require precise and reliable knowledge of vehicle system states. Some of these states cannot be sensored directly, since an adequate sensor principle for the searched quantity is not available (e.g., determination of the state of charge (SOC) of a battery) or the sensor is expensive and therefore it is desirable to economize it (e.g., vehicle over ground velocity). The goal of this research is to develop a complete toolchain to assist the control systems engineer in the development of complex, continuous-time formulated prediction models for estimation purposes. These should be applied to discrete-time state estimation algorithms and the automatically generated code should afterwards be easily downloadable to an embedded microcontroller target. In this work, a novel framework for state estimation using detailed multiphysical continuous-time models designed in Modelica [3] is developed. It employs an intelligent separation of the model (encapsulated in a standardized FMI (Functional Mockup Interface) 2.0 for co-simulation [4,5]) and the estimation algorithm by utilizing modern computer technologies and recent developments in the Modelica language, which enable automated discretization, integration and derivative calculation of an object oriented, equation based prediction model. The Functional Mock-up Interface (or FMI) defines a standardized interface to be used in computer simulations to develop complex cyber-physical systems. The vision of FMI is to support this approach-if the real product is to be assembled from a wide range of parts interacting in complex ways, each controlled by a complex set of physical laws, then it should be possible to create a virtual product that can be assembled from a set of models that each represents a combination of remaining lifespan of a li-ion cell using a novel particle learning algorithm in combination with a non-physical motivated exponential model [21]. Similar achievements with a dual-scale particle filter for predicting the cell's remaining amount of energy including a comprehensive assessment of five equivalent circuit cell prediction models are given in [15]. Details on the effects of cell degradation and its modelling over its life-time can be found, for example, in [22,23].

3The constrained nonlinear battery observer application shown here emphasizes the constrained nonlinear estimation framework technology and shows its versatility and impact for current research on embedded estimation technology, without having the ambition to outperform the most recent achievements in SOC estimation. In this publication, according to the classification in [14], a model based estimation method is exemplified for the usage with the physical model-based observer framework. The estimation method, a modified and improved version of [24,25], is based on an equivalent circuit model using a recursive (Kalman Filter) approach.

Contributions and Focus of the Work

4This work presents a new highly automated framework for generating model based observers based on different types of Kalman filters extended with constraint handling algorithms for the use in embedded application which are explained in Chapter 2 and 3. The main contributions are the structutured approach from designing an object oriented acausal multi-physical model in the Modelica [3] language over to an automated equation sorting and a discretization process towards a ready to use nonlinear (constrained) Kalman filter that can be exported to a cross-platform target, for example, an AUTOSAR embedded controller. In Chapter 4, this approach is used to implement a lithium-ion battery state of charge (SOC) estimator application. Here, it can be highlighted that through the acausal formulation of the battery cell prediction model in continuous-time, it is easily possible to model the system in a hybrid combination of cell characteristic tables and state equations. In this way, it is possible to make various improvements and modifications to the cell prediction model while being able to automatically generate a discrete-time nonlinear observer algorithm. This provides a large benefit in comparison to the error-prone modelling approach with manual transformation from continuous to discrete-time (e.g., see [24,25]); it also enables a quick exchange of system models with different complexity, as discussed in [14,[16][17][18][19]. The further extension of the model-based observer framework with a moving horizon estimation approach for compensating delayed measurements and improving the estimation, as well as its practical application to a state of the art vehicle position estimation problem formulation, is discussed in [26]. This article is an extended and improved version of these publications [13,27,28].

Design of a Modelica Based Estimation Framework

5In this chapter, a method is developed to automatically generate nonlinear state estimators based on continuous-time Modelica models. The approach is based on an extended FMI 2.0 co-simulation interface [4] that interacts with the state estimation algorithms implemented in the DLR Kalman Filter Library [27].

6With the raise of computational power in the last decades the possibility of implementing complex control strategies in real world applications has been enhanced tremendously. For most of them a good knowledge of the actual states is necessary. Often these are not directly measurable due to cost limitations or missing sensors. In the ITEA project MODRIO, one aim has been to develop state estimation technologies for plants that use the knowledge of complex models of the controlled system itself. These models are often designed, parameterized and optimized as multi-domain models in Modelica [3]. To reuse these models for estimation and control purposes, the FMI [4] turns out to be very helpful, since currently in Modelica it is not possible to directly call (e.g., integrate or state-manipulate) a model within a model.

7In the Chapters 2.2 and 2.3 a brief introduction to the most important estimation algorithms, the extended Kalman filter and unscented Kalman filter, is given and the steps are identified where the model evaluations are necessary by means of the FMI. For time-discrete Kalman filter theory details, derivative-free methods and a numerical robust filter design using matrix decomposition and propagation, please inspect the appendix Chapter A in reference [2].

Model Evaluations in State Estimation Algorithms

8For many control system tasks the plant model to be used in state estimation is naturally described as a nonlinear continuous-time state-space system:

9where t is the time, u(t) is the vector of inputs, x(t) is the vector of states and y(t) is the vector of outputs. Besides of manual, time-consuming and error-prone derivation of this representation, in this work the plant models are defined in Modelica and exported as a functional mockup unit (FMU) [4,5] using the Modelica simulator Dymola. Note that all the research results presented here are also valid if FMUs are generated by other tools and/or non-Modelica environments, as long as the FMU supports the extended FMI 2.0 co-simulation interface according to Table 1.

Model Evaluations

10Integration between two sample points:

11Derivative evaluation:

12.

13In a sampled data system (e.g. a microcontroller) the continuous-time model representation in Equation (1) cannot be used directly. Instead a time-discrete representation is needed and therefore the time-discrete transformation of Equation (1) with additive Gaussian noise is used in the sequel:

14here t k is the k -th sample time instant of a periodically sampled data system. We define u k = u(t k ) , x k = x(t k ) and y k = y(t k ) . The vectors w k and v k represent zero biased Gaussian white noise. The covariance matrices Q k and R k are defined as E w k w T

15The operator E(·) calculates the expectation value of a random variable [8]. The notation w k ∼ N(0, Q k ) indicates that w k is a Gaussian randon variable with a mean of 0 and a variance of Q k = spur σ 2 1..n x , with the standard deviation σ .

16The following Equation (3) describes the discrete-time integration rule, like a Runge-Kutta or Euler integration method, and therefore must be integrated into the framework.

The Extended Kalman Filter Calculation Steps

17For nonlinear model state estimation the widely used EKF (extended Kalman filter) algorithm is given as a pseudo code in Algorithm 1.

Algorithm 1. EKF Algorithm with FMU evaluations

18Predict estimation by means of the FMU:

19The red marked sections-this holds for the following sections-indicate where the evaluation of the underlying system model equations, compare Equation (2), are necessary. The calculation ofx − k is performed by integrating the prediction model Equation (1) from t k−1 to t k . F k−1 is the state-transitions matrix of f with respect to x atx + k−1 and H k is the partial derivative matrix of h with respect to x atx − k . The additive Gaussian noise assumption in Equation (2) is handled by the user defined covariance matrices Q, R (the index k is removed since it is here time-invariant). The Jacobians J k−1 and H k must either be provided directly (according to the FMI 2.0 specification [5], this feature is optional), or they can be determined numerically, for example with a forward difference quotient as shown in pseudo-coode in Algorithm 2: Algorithm 2. Numerical differential quotient determination

20wherein is the machine precision of the particular computer architecture, (J) :,i the i-th column of J and n x the number of system states.

The Unscented Kalman Filter Sigma Point Prediction Step

21The so-called sigma point transformation (SPT) is based on the idea that it is easier to approximate a Gaussian distribution than it is to approximate an arbitrary nonlinear function or transformation; see [8,29], and appendix Chapter A.4 in reference [2]. The parts of the unscented Kalman filter (UKF) algorithm, in which model evaluations are necessary, are given in Algorithm 3. The selection of the sigma points in matrix X is performed via a static scaling factor γ(n x , α, κ) and the matrix square-root of the posteriori covariance matrix. The parameter α is the spread around the last state valuex + k−1 and κ is the stochastic distribution assumption. In total 2n x + 1 points must be created and then used as initial values for 2n x + 1 simulations from t k−1 to t k to compute X k|k−1 .

Algorithm 3. UKF prediction step with FMU evaluations

22The predicted valuesx − k ,ŷ − k , P − k are calculated via weighted sums with the predetermined weights w c,m i (n x , α, κ) . It is definedX := [x,x, . . . ,x] ∈ R n x ×2n x +1 and in the notation here a vector depending function (e.g., f k|k−1 or h ) with a matrix argument returns a matrix with columns that are equal to the evaluated columns of the matrix argument.

23It can be shown that the nonlinear approximation accuracy of the UKF is at least twice higher than the EKF. This becomes an important feature in case of strong nonlinearities in the prediction model (for a detailed proof see [9]-app. A).

24In the following, a novel and automated procedure is introduced for incorporating Modelica [3] based models in nonlinear observer algorithms. The aim is to start from a given (continuous, usually nonlinear) Modelica model and automatically deduce a nonlinear observer for this model in form of a sampled data system. This task cannot be performed directly, because Modelica has no means to discretize a continuous model and to solve this discretized model with a user-defined method (that means integration and model update of the next state according to the observer equations). Note that it is insufficient to simply integrate the nonlinear models from the last to the new sample instant. Instead, the extended Kalman filter algorithm (cf. Algorithm 1) requires linearizing the model aroundx + k−1 for the state Jacobian matrix and aroundx − k for the output Jacobian matrix. On the contrary, the unscented Kalman filter (cf. Algorithm 3) requires integrating the model several times with disturbed states from the last to the new sample instant. Therefore, the basic approach is to export the Modelica model in the FMI-format, import it again in Modelica and during import, call the FMI-functions in such a way that the model is discretized and utilized in a nonlinear observer algorithm.

25The goal of the FMI technology is to describe input/output blocks of dynamic systems defined by differential, algebraic and discrete equations and to provide an interface to evaluate these equations as needed in different simulation environments, as well as in embedded control systems, with explicit or implicit integrators and fixed or variable step size. The FMI interface consists of a small set of standardized "C-functions" to evaluate the model equations and a XML-file that contains all information that is not needed during execution, such as the variable definitions. Every variable has a handle (a 32 bit Integer) that is used to identify the variable in the C-function calls. The source and/or object code of the C-functions, as well as the XML-file and optionally other files, are stored in a zip-file with the extension ".fmu" for "Functional Mockup Unit."

Utilizing an FMU in an Estimation Algorithm

26In Figure 1 the extended FMU 2.0 co-simulation interface embedded in the estimation framework is shown (compare Figure 10 in reference [5]). It provides the necessary interfaces for the discrete estimation algorithms to calculate the quantities described in Table 1 source and/or object code of the C-functions, as well as the XML-file and optionally other files, are stored in a zip-file with the extension ".fmu" for "Functional Mockup Unit."

27In Figure 1 the extended FMU 2.0 co-simulation interface embedded in the estimation framework is shown (compare Figure 10 in reference [5]). It provides the necessary interfaces for the discrete estimation algorithms to calculate the quantities described in Table 1. All non-standard FMU interfaces are indicated by dotted lines. Besides the already explained variables , , , and the set of model parameters (e.g., the mass of a vehicle) the FMU has the internal variables , , , which are now explained briefly. The discrete states are discrete-time variables with two values-the value of the variable from the previous event instant and the value of the variable at the actual event instant [5]. Since this work focuses on continuous-time formulated prediction models, these are not used in the prediction model FMUs. The vector denotes all model variables, that is, states or sub-system variables. The event indicator vector contains internal variables such as state events which give the (inline-) solver the information that an event (e.g., the fulfillment of another branch in an "if-else" statement-see for instance the vehicle's standstill condition in [2]) occurred between the last model evaluation and the current integration step. Internally, this is handled by the (inline-) solver to guarantee a correct integration and output of the model variables. More information on this methodology can be found in Chapter 3 of [5]. Besides the already explained variables t, u, x, y and the set of model parameters p (e.g., the mass of a vehicle) the FMU has the internal variables m, v, z , which are now explained briefly. The discrete states m are discrete-time variables with two values-the value of the variable from the previous event instant and the value of the variable at the actual event instant [5]. Since this work focuses on continuous-time formulated prediction models, these are not used in the prediction model FMUs. The vector v denotes all model variables, that is, states or sub-system variables. The event indicator vector z contains internal variables such as state events which give the (inline-) solver the information that an event (e.g., the fulfillment of another branch in an "if-else" statement-see for instance the vehicle's standstill condition in [2]) occurred between the last model evaluation and the current integration step. Internally, this is handled by the (inline-) solver to guarantee a correct integration and output of the model variables. More information on this methodology can be found in Chapter 3 of [5].

28The overall process of designing a state estimator in Modelica and (cross-) compiling it for embedded targets is illustrated in Figure 2. The process can be described as follows-an acausal multiphysical Modelica model is designed in a Modelica environment such as Dymola. To fullfill requirements like real-time capability it is up to the modelling expert to find appropriate approximations, for example, for friction or hysteresis effects and to ensure it is robust simulateable with a deterministic integration algorithm such as the Runge-Kutta method. After the design process the model is translated by the simulator, for example, Dymola which performs several measures such as inlining the integration algorithm, block lower transformation and equation sorting by means of Pantelides algorithm [30,31].

29Moreover, the tearing algorithm [31] is applied to reducing the size of algebraic loops to the order of one by means of substitution variables. Finally, the model is transformed in a causal first order ODE representation encapsulated in FMU 2.0 for co-simulation. This FMU is imported into the Modelica environment by extending a provided FMU interface package. For such an FMU package a set of application specific Kalman filter models is automatically generated, which makes use of the algorithmic part of the state estimator (e.g., a UKF). Finally, the individual filter model can be instantiated, parameterized or tuned in the user's application model or can be cross compiled for an embedded target platform using the C-code sources from the FMU and a target dependent cross compiled numerical library of LAPACK (Linear Algebra PACKage, [32]), which is used for the matrix calculus operations. This process is currently under further development in the EMPHYSIS project to match the requirements (e.g., memory and word length limitations) of automotive (AUTOSAR compliant) embedded targets. The overall process of designing a state estimator in Modelica and (cross-) compiling it for embedded targets is illustrated in Figure 2. The process can be described as follows-an acausal multiphysical Modelica model is designed in a Modelica environment such as Dymola. To fullfill requirements like real-time capability it is up to the modelling expert to find appropriate approximations, for example, for friction or hysteresis effects and to ensure it is robust simulateable with a deterministic integration algorithm such as the Runge-Kutta method. After the design process the model is translated by the simulator, for example, Dymola which performs several measures such as inlining the integration algorithm, block lower transformation and equation sorting by means of Pantelides algorithm [30,31]. Moreover, the tearing algorithm [31] is applied to reducing the size of algebraic loops to the order of one by means of substitution variables. Finally, the model is transformed in a causal first order ODE representation encapsulated in FMU 2.0 for co-simulation. This FMU is imported into the Modelica environment by extending a provided FMU interface package. For such an FMU package a set of application specific Kalman filter models is automatically generated, which makes use of the algorithmic part of the state estimator (e.g., a UKF). Finally, the individual filter model can be instantiated, parameterized or tuned in the user's application model or can be cross compiled for an embedded target platform using the C-code sources from the FMU and a target dependent cross compiled numerical library of LAPACK (Linear Algebra PACKage, [32]), which is used for the matrix calculus operations. This process is currently under further development in the EMPHYSIS project to match the requirements (e.g., memory and word length limitations) of automotive (AUTOSAR compliant) embedded targets.

30The following estimation algorithms are implemented reliably and efficiently in the DLR Kalman Filter Library-EKF (extended Kalman filter), SR-EKF (square-root EKF), UD-EKF (UD-decomposition EKF), UKF (unscented Kalman filter), SR-UKF (square-root UKF) [7,29].

Block lower trafo.

31Pantelides algo. The following estimation algorithms are implemented reliably and efficiently in the DLR Kalman Filter Library-EKF (extended Kalman filter), SR-EKF (square-root EKF), UD-EKF (UD-decomposition EKF), UKF (unscented Kalman filter), SR-UKF (square-root UKF) [7,29]. Additionally, there are modified algorithms for parameter estimation as well as an extension to nonlinear moving horizon estimation (MHE) using a fast nonlinear gradient descent search as it is presented in [26]. For details on the implementation of the DLR Kalman Filter Library in the Modelica language please refer to the appendix Chapter B in reference [2].

Notes on Detectability and Observability

32The designed prediction model is normally nonlinear and in this work there is no deeper discussion of the determination of the observability of the system. In practical applications it is mostly sufficient if the model is detectable rather than completely observable, that is, all unobservable modes/states are stable. An analysis of these properties can be performed with the DLR Modelica LinearSystems2 library [3]. As a good rule of thumb it is helpful to make a detectability and observability analysis at the nominal operation points or in a grid of potential operation modes.

Kalman Filter Theory Extension with Inequality Constraints

33The so far presented estimation algorithms, based on the Kalman approach, are very well suited for a large bandwidth of observer problems. Besides the stochastic assumption of zero mean, Gaussian white noise processes, there are neither system state constraints nor delays in the data acquisition chain considered. In [33] a good and comprehensive overview of existing methods is given for incorporating (linear) constraints to Kalman filtering for linear and nonlinear systems. Some of these methods are not only applicable for linear constraints and they can also handle nonlinear constraints. Especially the estimation projection methods can be used for nonlinear constraints through a first or second order Taylor series expansion around the a priori state estimationx − k . For the approach of perfect measurements (PM) constraint handling, this linearization is repeatedly applied to the measurements to smoothly improve the estimation.

34This article focuses on the class of nonlinear inequality constraints for nonlinear state estimation, since for many estimation tasks the control design engineer needs to incorporate inequality constraints to the states, for example, the slider position state s of an inverted pendulum is limited to the interval s ∈ [s min , s max ] . Moreover, the constraints should be formulated (non-)linear by means of the Modelica language within the prediction model or in a separate FMU. Additionally, by reason of exchangeability and flexibility, the state constraint handling algorithms should be separable from the particular unconstrained Kalman filter algorithm.

35That is, the user can configure the estimation task with constraint handling features and then examine different Kalman filters (e.g. EKF or UKF) without the need to adopt the constraints to the particular estimation algorithm. For these reasons it has been decided to extend the posteriori estimation projection approach with an inequality constraints algorithm in a computationally efficient way to guarantee real-time capability. This is explained in the following subchapters.

Method Approach Description

36Nonlinear soft constraints Nonlinear soft constraints by means of perfect measurements [33] are shown in the application example of a battery state estimator in Chapter 4.

Nonlinear optimization based estimation projection

37Project the states on the constrained surface by solving the restrictive optimization problem min

38it can be solved by means of a nonlinear interior point solver or a sequential quadratic program (SQP) [34].

Sigma point projection

39This is a special approach for UKF algorithms. The sigma points are projected on the borders of the constrained region and with these projected points the covariance update is calculated [35]. In [36] and [2] additionally the sigma point weights are scaled to improve the constrained covariance confidence. Similar methods are the two-step UKF and the unscented recursive nonlinear dynamic data reconciliation (URNDDR) which performs a MHE with a horizon size of one to the posteriori sigma points [33].

Nonlinear moving horizon estimation

40A nonlinear moving horizon estimator with a nonlinear gradient descent optimization which can handle equality and inequality constraints as well as delayed measurements is formulated [2]. Besides this, various other formulations, like the URNDDR, the constrained UKF [2] or the constrained real-time approach using the ACADO toolbox [15] can be found as examples for nonlinear moving horizon estimation.

41To the best knowledge of the author a new method for nonlinear estimation with nonlinear inequality constraints is given in the next chapter (i.e., computational simplified nonlinear inequality constraints handling for the case that one constraint is active) that is different to the algorithms in literature (see Table 2). The following proposed estimation projection method is appropriate for nonlinear inequality constraints of the form c(x) ≤ 0 , with limits to the distinguished approximation. First, in Chapter 3.1 an efficient root-finding algorithm determines a linear scaling factor between the vector distancex + kx + k−1 to the point where the constraint gets active c(x) = 0 . Afterwards, a different method is proposed, with a Lagrange multiplier. This method determines a constrained estimate that lays closer to the border of the constrained surface c(x) = 0 .

The Formulation of State Constraints c(x) ≤ 0

42In the most common cases there exist a lot of known constraints to estimated states, for example, a limitation of the position due to physical stops in a mechanical system. These can be formulated as restrictions that fulfill a set of inequalities c(x) ≤ 0 . The main principal of the proposed algorithms is to change the state vector after the correction stepx + k of the Kalman filter such that all restrictions are fulfilled. The optimization problem is defined as:

43It is assumed that the constraints c(x) ≤ 0 are neither contradictory nor redundant and only one constraint is active at the same time. In many cases this is valid, since the estimation step size is small and, for example, the constraints are designed as bands without complex overlap. Examples for this are road boundaries in a position estimation problem cf. [2]. In case of large step sizes and/or if multiple constraints are likely to be active, it is possible to handle these situations by an sequential quadratic program (SQP) formulation (see Table 2). An SQP approach can be seen as more general but also computationally more complex in comparison to the here proposed problem-specific approaches. This is justified by the necessity in the SQP algorithm of an iterative search to determine the Lagrange multiplier by solving QP sub-problems [34]. Moreover, the Hessian of the QP needs to be approximated, also in an iteratively manner, by means of a Broyden-Fletcher-Goldfarb-Shanno algorithm BFGS approach [37]. The BFGS algorithm is a quasi-Newton method which approximates the Hessian matrix using updates specified by evaluations of the gradient.

44The obvious way to handle the active constraint is to find the pointx 0 k in the vectorx + kx + k−1 where the violated constraint c(x) > 0 is no longer fulfilled (see Figure 3). This means the root α of c(x(α)) = 0 has to be determined, such thatx The obvious way to handle the active constraint is to find the point ̂0 in the vector ̂+ ̂− 1 + ̅̅̅̅̅̅̅̅̅̅ where the violated constraint ( ) > 0 is no longer fulfilled (see Figure 3). This means the root of ( ( )) = 0 has to be determined, such that This problem is solved with the derivative free root finding method of Brent [38]. This algorithm is available in the Modelica Standard Library ("Modelica.Math.Nonlinear. solveOneNonlinearEquation") [3]. Once α is known, the Cholesky decomposition CP 0 k of the covariance matrix can be calculated as:

45The rudimentary way would be to use this solution for the estimation projection, but one can easily see in Figure 3 that it is not the closest estimate to the unconstrained solutionx + k . Therefore, two approaches are discussed in the following that are intended to find a better approximation of the solution.

The Simplified Newton Descent Search Approach

46As a second approach, a more general method for incorporating inequality constraints is presented. Different to this a sigma point projection based algorithm (cf. Table 2), as proposed in [2] and [36], works fine with the SR-UKF as well as the SR-EKF algorithm, because in these cases the algorithm can directly use the Cholesky factorization of the a priori covariance matrix. For other algorithms that do not rely on square-root filtering [29], a computational costly Cholesky decomposition of the covariance matrix would have to be computed in every time instant when a constraint gets active. The here proposed algorithm is based on a simplified Newton descent search (i.e., without considering the second order derivative), that projects the posteriori estimation on the constrained surface. This opens up a more general use. The optimization objective is formulated as follows:

47The idea behind this algorithm is to perform a descent search along the gradient ∇c x + k calculated at the pointx + k until the constraint equation c(x P k ) ≤ 0 holds again. Graphically this can be interpreted as shown in Figure 4.

48Therefore, the optimal solution of this unrestricted minimization problem is denoted as follows:

49This approach is now applied to the estimation projection optimization problem Equation (7

50Therefore, the optimal solution of this unrestricted minimization problem is denoted as follows: 355 , ( , ) = 0

51This approach is now applied to the estimation projection optimization problem Equation (7)

Contour line

52Therefore, the optimal solution of this unrestricted minimization problem is denoted as follows:

352

53This optimization task can be formulated with the method of Lagrange multipliers. Equation (8) 353 denotes the above formulated optimization objective in a general description: 354

54Therefore, the optimal solution of this unrestricted minimization problem is denoted as follows: 355 , ( , ) = 0

55This approach is now applied to the estimation projection optimization problem Equation (7)

56To fulfill Equation (10)

57This can be implemented as an iterative search algorithm, which determines such that the 361 condition Ϝ( ) = 0 holds within a predefined maximum number of calculation steps. The pseudo 362 code for the algorithm is given in Algorithm 4. 363 This approach is now applied to the estimation projection optimization problem Equation (7) and the searched restricted estimatex P k is calculated using the Lagrange multiplier µ and the gradient of the active constraint c(x) :

58To fulfill Equation (10) the approach is formulated with a simplified Newton descent search algorithm by means of a scalar zero search F(µ) = 0 with respect to the Lagrange variable µ :

59This can be implemented as an iterative search algorithm, which determines µ such that the condition F(µ) = 0 holds within a predefined maximum number of calculation steps. The pseudo code for the algorithm is given in Algorithm 4.

A Constrained Nonlinear Battery Observer

60This section is an extended version of [13] and [28], which addresses the modeling of a lithium-ion cell for online monitoring and offline benchmarking purposes. It is based on a modified version of the enhanced self-correcting model (ESC) originally proposed by [24], which is an equivalent circuit model with one RC element in parallel and an additional hysteresis voltage source (compare Figure 2c in reference [39]). This physical lithium-ion cell model is combined with smoothly interpolated lookup table of cell characteristic information from laboratory tests. The model is fully parameterized and validated with the cell type used in the high voltage (HV) battery pack of the robotic battery electric vehicle DLR ROboMObil [1]. It benefits from automatic discretization with higher order solvers, lookup table interpolation, as well as derivative calculation and symbolic transformation by means of the Modelica simulator (cf. Chapter 2), as well as from the derivative-free unscented Kalman filter (Chapter 2.3) with inequality state constraints (Chapter 3).

An Equations and Grid Table Combined Cell Model

61In the following section, a modified and enhanced version of the ESC model is developed, referred to as the modified enhanced self-correcting model (MESC). In contrast to the original approach the prediction model of the single lithium-ion cell is formulated in acausal continuous-time representation using Modelica. This mathematical description benefits from the automated discretization of the model, by means of a Modelica compiler. The generated prediction FMU can incorporate higher order real-time capable integrators, for example, a Runge-Kutta 4 method and therefore the accuracy as well as stability for a larger sample time T s can be significantly improved. The mathematical description of the MESC model in nonlinear state-space representation is formulated as follows:

62The differential equation for the SOC l depends on the cell current i cell , the nominal cell capacity C N , the coulombic efficiency η Ah and a correction factor k i . This factor takes the variation of the cell capacity into account due to the (dis)charging rate and the temperature, see Figure 5 The C-rate is a normalized measure of electric current, defined as the ratio of current I(t) in Amperes, to a cell's nominal capacity C N in Ampere-hours [18]. Following [40] the correction factor is determined by:

63wherein c i is a positive constant leading into a straight line for positive cell current, which intersects the ordinate at k 0 . For a negative cell current the correction factor is described by an exponential function. The parameters c i and k 0 are determined from capacity tests replacing the simple straight line with more accurate look-up tables. ̂P =̂+ + +1 ⋅ (̂+)

A Constrained Nonlinear Battery Observer

64This section is an extended version of [13] and [28], which addresses the modeling of a lithium-ion cell for online monitoring and offline benchmarking purposes. It is based on a modified version of the enhanced self-correcting model (ESC) originally proposed by [24], which is an equivalent circuit model with one RC element in parallel and an additional hysteresis voltage source (compare Figure 2c in reference [39]). This physical lithium-ion cell model is combined with smoothly interpolated lookup table of cell characteristic information from laboratory tests. The model is fully parameterized and validated with the cell type used in the high voltage (HV) battery pack of the robotic battery electric vehicle DLR ROboMObil [1]. It benefits from automatic discretization with higher order solvers, lookup table interpolation, as well as derivative calculation and symbolic transformation by means of the Modelica simulator (cf. Chapter 2), as well as from the derivative-free unscented Kalman filter (Chapter 2.3) with inequality state constraints (Chapter 3).

An Equations and Grid Table Combined Cell Model

65In the following section, a modified and enhanced version of the ESC model is developed, referred to as the modified enhanced self-correcting model (MESC). In contrast to the original approach the prediction model of the single lithium-ion cell is formulated in acausal continuous-time representation using Modelica. This mathematical description benefits from the automated discretization of the model, by means of a Modelica compiler. The generated prediction The hysteresis voltage h (presented in the second differential equation in (12)) is described by a more complex equation considering the additional factors M (polarization voltage) and γ (time constant). It describes the dynamic influence of charging and discharging of the cell as depicted in Figure 7. Herein M is half of the difference between the charge (blue) and discharge (red) line in dependency of the SOC, exemplified for l = 0.2 . Especially for lithium-ion cell types with a very flat SOC/OCV curve characteristic (e.g., LiFePO 4 cell chemistry) neglecting this dynamics may lead to a major model error. The remaining four differential equations describe an optimized fourth order critical damping current filter with only one remaining parameter ω and its states f f

66The output Equation (14) is similar to the original ESC model's output equation but aggregates the influence of the cell current (ohmic loss and current filter) into one summand. The internal resistance R i (l, i cell , T) of the cell is one of the most important descriptive variables. It depends on the SOC, the cell current and the temperature resulting in a three dimensional look-up table. This relationship is visualized for room temperature (T = 25 • C ) in Figure 6. Considering Equation (14) it is obvious that the resulting cell voltage u cell varies highly in case of a low SOC and high current flow due to an internal resistance increase of the cell. In such cases the cell is in a demanding situation and can be damaged irreversibly, since the higher resistance causes intense internal cell heating. Another important cell variable is the open circuit voltage (OCV) U OCV , whose characteristic curve incorporates the relationship between SOC and OCV, as shown in Figure 7. This figure also illustrates the hysteresis effects during charging and discharging of the cell. The blue and red curve are measured in a cell test bench experiment with very low currents applied to the cell terminals. This minimizes excitation of the cell dynamics so that the cell terminal voltage can be considered unloaded. In addition, the influence of the internal resistance is eliminated during the data analysis. The polarization voltage is defined as half of the difference between the two curves and therefore also depends on the OCV. This minimizes excitation of the cell dynamics so that the cell terminal voltage can be considered unloaded. In addition, the influence of the internal resistance is eliminated during the data analysis. The polarization voltage is defined as half of the difference between the two curves and therefore also depends on the OCV. Tests have shown that the polarization voltage depends on the actual cell temperature, whereas the highest effect of the considered lithium-ion cell type is for temperatures below 0 °C . However, it is important to mention that the hysteresis effect at positive temperature might be more significant for other cell types (e.g., LiFePO 4 or NiCoAl ). This relation is presented graphically in Figure 8. This minimizes excitation of the cell dynamics so that the cell terminal voltage can be considered unloaded. In addition, the influence of the internal resistance is eliminated during the data analysis. The polarization voltage M is defined as half of the difference between the two curves and therefore also depends on the OCV.

67Tests have shown that the polarization voltage depends on the actual cell temperature, whereas the highest effect of the considered lithium-ion cell type is for temperatures below 0 • C . However, it is important to mention that the hysteresis effect at positive temperature might be more significant for other cell types (e.g., LiFePO 4 or NiCoAl). This relation is presented graphically in Figure 8. Tests have shown that the polarization voltage depends on the actual cell temperature, whereas the highest effect of the considered lithium-ion cell type is for temperatures below 0 °C . However, it is important to mention that the hysteresis effect at positive temperature might be more significant for other cell types (e.g., LiFePO 4 or NiCoAl ). This relation is presented graphically in Figure 8.

Cell Model Parameter Derivation and Validation

68In the context of the ROboMObil project, it was possible to obtain a high performance cell from Li-Tec Battery GmbH "Li-Tec HEI40". It has a nominal capacity of 40 Ah and with its safety features it is fully capable for series production. For details on technical specifications please refer to Appendix A. All cell measurements for parameterization, testing, and validations were done with a Vötsch "VT4011" environment simulator and a BaSyTec cell testing system. In Figure 9 the Modelica implementation of the MESC model is shown. The stationary grid table data SOC/OCV, SOC correction, Polar Voltage, and R i have been derived offline with this experiment setup.

69The free model parameters in Equation (12), by name γ (hysteresis voltage change rate) and f f 1..4 (input current filter parameters) were determined by optimization with DLR MOPS (see [41] for more information) on the Linux cluster of the DLR SR institute.

70In the context of the ROboMObil project, it was possible to obtain a high performance cell from Li-Tec Battery GmbH "Li-Tec HEI40". It has a nominal capacity of 40 Ah and with its safety features it is fully capable for series production. For details on technical specifications please refer to Appendix A. All cell measurements for parameterization, testing, and validations were done with a Vötsch "VT4011" environment simulator and a BaSyTec cell testing system. In Figure 9 the Modelica implementation of the MESC model is shown. The stationary grid table data SOC/OCV, SOC correction, Polar Voltage, and i have been derived offline with this experiment setup.

71The free model parameters in Equation (12), by name (hysteresis voltage change rate) and f 1..4 (input current filter parameters) were determined by optimization with DLR MOPS (see [41] for more information) on the Linux cluster of the DLR SR institute.

Kalman Filter Setup -Perfect Measurements

72The MESC model has one input, the cell current, and one output, the cell voltage. These two quantities can be measured directly with high accuracy even in embedded systems. The third quantity is the cell temperature. It is determined by the use of a thermocouple sensor on the cell surface. To achieve a better estimation performance, a second measurement equation is implemented. The main idea is to take constraints into account with a recursive Kalman filter. For

73The MESC model has one input, the cell current, and one output, the cell voltage. These two quantities can be measured directly with high accuracy even in embedded systems. The third quantity is the cell temperature. It is determined by the use of a thermocouple sensor on the cell surface. To achieve a better estimation performance, a second measurement equation is implemented. The main idea is to take constraints into account with a recursive Kalman filter. For this purpose, an additional fictitious measurement is introduced. It can be weighted through the tuning of the output covariance matrix of the Kalman filter. This method is known as perfect measurement (PM) in the literature [33]. In this way the output equation of the MESC model is extended to:

74The first equation is identical to Equation (14) and the second one can be derived as follows:

75The measured SOC is calculated through the inverse of the OCV U −1 OCV lookup table in combination with a low pass filter to prevent peaks in the perfect measurement output due to rapid changes of the input current. This extension allows the Kalman filter to adjust the SOC directly and therefore to enforce a physically correct estimation.

Observer Configuration on an Embedded Microcontroller

76To exemplify the usage of a cell battery observer on an embedded microcontroller an AUTOSAR architecture has been chosen since it is subject of current research at DLR SR within the ITEA EMPHYSIS project and it is getting more and more important in the field of automotive. In the style of [42] a schematic configuration of an AUTOSAR layered microcontroller configuration is sketched in Figure 10. On the lowest layer, the microcontroller interacts with it's I/Os and other controllers via a bus system, for example, via CAN, or receives electrical signals from sensors or gives electric commands to actuators, for example, via the power electronics of an electric machine. In the overlaying turquoise colored layer the AUTOSAR Basic Software layer is arranged. In this layer bit streams from the I/O are more and more abstracted by help of different modules and a real-time operation system (RTOS) in combination with various libraries. These represent an infrastructure for the execution of components on the top layer, the AUTOSAR Software application layer. Between these both lies a middle layer, the AUTOSAR run time environment, which provides all interfaces and in-/outputs, between the lower hardware abstraction and the top application layer. The exchange between these both is described by a *.arxml file. Details on this are given, for example, in [42]. By this separation of application and close to hardware programming it is possible to design novel model and FMI based algorithms without the need to have deep knowledge of the complex AUTOSAR architecture. In the application layer of Figure 10 an example configuration with different applications, which make use of the here-proposed battery observer, is shown. In this example, a sensor software component performs signal preconditioning such as scaling, faulty sensor detection and initialization. Then, by means of an FMI based observer algorithm the observer software component (subject of investigation in this project) calculates the complete set of (virtual) sensor signals that then can be used within a controller or diagnosis software component. complex AUTOSAR architecture. In the application layer of Figure 10 an example configuration with different applications, which make use of the here-proposed battery observer, is shown. In this example, a sensor software component performs signal preconditioning such as scaling, faulty sensor detection and initialization. Then, by means of an FMI based observer algorithm the observer software component (subject of investigation in this project) calculates the complete set of (virtual) sensor signals that then can be used within a controller or diagnosis software component. This observer software component should embed the extended Kalman filter algorithm with nested FMUs for the cell model (MESC) and perfect measurements (PM), that is, in this scenario the FMUs are not interconnect-able to other software components as it is proposed in [42] and are only available to the Kalman filter algorithm.

77In Figure 11 the battery observer control structure is schematically pictured with the signal flow between the components and the FMUs as well as the algorithmic evaluations in the Kalman filter steps according to Figure 1 and Algorithm 1. The inputs, that need to be provided by the RTE, are the measured battery current −1 m and cell terminal voltage m . As outputs to the RTE the complete estimated state vector ̂+ (compare Equation (12)) and the corrected output vector ̂+ (compare Equation (15)) are defined. After the initialization phase with user tune-able model and This observer software component should embed the extended Kalman filter algorithm with nested FMUs for the cell model (MESC) and perfect measurements (PM), that is, in this scenario the FMUs are not interconnect-able to other software components as it is proposed in [42] and are only available to the Kalman filter algorithm.

78In Figure 11 the battery observer control structure is schematically pictured with the signal flow between the components and the FMUs as well as the algorithmic evaluations in the Kalman filter steps according to Figure 1 and Algorithm 1. The inputs, that need to be provided by the RTE, are the measured battery current I m k−1 and cell terminal voltage u m k . As outputs to the RTE the complete estimated state vectorx + k (compare Equation (12)) and the corrected output vectorŷ + k (compare Equation (15)) are defined. After the initialization phase with user tune-able model and filter parameters of the EKF as well as the both FMUs (MESC and perfect measurements), all indicated with the lower index (·) 0 , the algorithm is cyclic executed with a predefined fixed cycle time T s = t k+1 − t k .

79In the prediction step a forward integration with the previous state estimatesx k−1 and the input I m k−1 is calculated by the FMU MESC. Moreover, the directional derivatives of the states and the FMU outputs are computed, to determine the covariance prediction P − k of the Kalman filter. In the second step the perfect measurement FMU is evaluated to calculate a value for the fictive measured SOC l PM k (Equation (16)) that can be incorporated in the correction step of the Kalman filter. The inputs to the FMU PM are { l MESC

80It is also valid to use u m k instead of u MESC k , but the predicted cell voltage is less noisy and therefore preferable to the sensor signal. In the third and final step the measurement update of the Kalman filter is computed. The measurement vector y m k is composed of the fictive SOC measurement l PM k and the actual measured cell terminal voltage u m k , the covariance matrix P + k is updated and the corrected state vectorx + k is computed. The latter two values are used in the next cycle t k+1 of the time update step as recursion measures.

81Kalman filter. The inputs to the FMU PM are { MESC , m , MESC } . It is also valid to use m instead of MESC , but the predicted cell voltage is less noisy and therefore preferable to the sensor signal. In the third and final step the measurement update of the Kalman filter is computed. The measurement vector m is composed of the fictive SOC measurement PM and the actual measured cell terminal voltage m , the covariance matrix + is updated and the corrected state vector ̂+ is computed. The latter two values are used in the next cycle +1 of the time update step as recursion measures.

Parameterization and Model Validation

82In this chapter the experimental results with the unconstrained battery observer are discussed. For the generation of the experiment data a FTP-75 driving cycle is used as driving demand for ROboMObil's longitudinal dynamics powertrain model which is based on the DLR PowerTrain Library [3]. This model and its resulting power demand calculation have been validated on the DLR roller test rig in Stuttgart with the whole battery pack (cf. [1]). With this multiphysical model it is possible to convert the calculated electric power demand of the actuators into the current demand of one cell. In a next step this current demand ( Figure 12) is used as stimuli data for a single cell test bench in a climate chamber. Figure 11. Schematic of the cell observer software component and it's interaction with the FMUs.

83In this chapter the experimental results with the unconstrained battery observer are discussed. For the generation of the experiment data a FTP-75 driving cycle is used as driving demand for ROboMObil's longitudinal dynamics powertrain model which is based on the DLR PowerTrain Library [3]. This model and its resulting power demand calculation have been validated on the DLR roller test rig in Stuttgart with the whole battery pack (cf. [1]). With this multiphysical model it is possible to convert the calculated electric power demand of the actuators into the current demand of one cell. In a next step this current demand ( Figure 12) is used as stimuli data for a single cell test bench in a climate chamber.

84The voltage at the cell terminals, the surface temperature and the effective current flow are recorded during this test. Finally, they are used as input and measurement data for the nonlinear battery observer experiment setup, shown in Figure 11.

85In Figure 13 the experimental and the corrected results of the proposed FMI model based real-time observer are presented. The black reference curve is determined via precise testbench experiment with high fidelity current measurements. The red curve shows the SOC characteristic calculated via the perfect measurement. The voltage at the cell terminals, the surface temperature and the effective current flow are recorded during this test. Finally, they are used as input and measurement data for the nonlinear battery observer experiment setup, shown in Figure 11.

86In Figure 13 the experimental and the corrected results of the proposed FMI model based real-time observer are presented. The black reference curve is determined via precise testbench experiment with high fidelity current measurements. The red curve shows the SOC characteristic calculated via the perfect measurement. It is very erratic and noisy, in spite of signal prefiltering. This characteristic is qualitatively correct, especially in comparison to the green curve, which represents the output of a pure model simulation without observer correction. The pure simulation yields a SOC that is less than zero at the end of the simulation which is physically impossible (cf. Figure 13, bottom right). In a real world automotive application, this would cause the SOC display to show incorrect information. In this case it would not be possible to drive on, although the battery is not yet exhausted. Through the nonlinear estimation algorithm, a better and smoother estimation of the SOC can be achieved that converges to zero at the end (blue curve). These observations are quantified by normalized root mean square error criteria (FIT) in the following The voltage at the cell terminals, the surface temperature and the effective current flow are recorded during this test. Finally, they are used as input and measurement data for the nonlinear battery observer experiment setup, shown in Figure 11.

87In Figure 13 the experimental and the corrected results of the proposed FMI model based real-time observer are presented. The black reference curve is determined via precise testbench experiment with high fidelity current measurements. The red curve shows the SOC characteristic calculated via the perfect measurement. It is very erratic and noisy, in spite of signal prefiltering. This characteristic is qualitatively correct, especially in comparison to the green curve, which represents the output of a pure model simulation without observer correction. The pure simulation yields a SOC that is less than zero at the end of the simulation which is physically impossible (cf. Figure 13, bottom right). In a real world automotive application, this would cause the SOC display to show incorrect information. In this case it would not be possible to drive on, although the battery is not yet exhausted. Through the nonlinear estimation algorithm, a better and smoother estimation of the SOC can be achieved that converges to zero at the end (blue curve). These observations are quantified by normalized root mean square error criteria (FIT) in the following It is very erratic and noisy, in spite of signal prefiltering. This characteristic is qualitatively correct, especially in comparison to the green curve, which represents the output of a pure model simulation without observer correction. The pure simulation yields a SOC that is less than zero at the end of the simulation which is physically impossible (cf. Figure 13, bottom right). In a real world automotive application, this would cause the SOC display to show incorrect information. In this case it would not be possible to drive on, although the battery is not yet exhausted. Through the nonlinear estimation algorithm, a better and smoother estimation of the SOC can be achieved that converges to zero at the end (blue curve). These observations are quantified by normalized root mean square error criteria (FIT) in the following table. The results of the SOC SR-UKF with an average deviation of~2-3% SOC to the reference true value grant a good result of this estimator compared to recent developments in state of charge estimation as Figure 8 in reference [43] for LiNMC cell types (same chemistry as used here-see Appendix A). Further optimization of the Kalman filter parameters and reducing the sensor noise may also improve the results.

88Due to the efficient code for the prediction model provided by the extended FMI 2.0 co-simulation interface, this estimator runs with a real-time factor greater than 100 on standard desktop systems (Intel i7-4600U 2,7 GHz, 8 GB Ram, SSD). Thereby, it was possible to implement the observer on an embedded rapid prototyping controller of ROboMObil.

Extension to Inequality Constraint SOC Estimation

89In this section the application of the proposed constraint handling mechanisms (see Chapter 3) for an one-step Kalman filter estimation algorithm is exemplified. Both approaches, a sigma point projection approach (cf. [2]) as well as the simplified Newton descent search (Chapter 3.2), can be used here since a SR-UKF filter has been selected as the most appropriate method (cf. Table 3), which is stable in case of this estimation task. A common problem in battery state of charge estimation is the limitation of the SOC to realistic values at least between zero and one. Misinterpreted values of the perfect measurement Equation (16) exceed the abovementioned boundary values and may cause wrong values of the available charge and therefore also of the power allocation budget. A simplified approach to handle this is to limit the output value of the estimation, but this causes wrong values for future SOC estimate since the state tends more and more in the inadmissible region. In Figure 14 the influence of the proposed constraining methods is shown. In this scenario a sensor failure is virtually generated that causes a static cell voltage measurement drop of ∆V = 0.6V at T = 5 · 10 3 s (cf. Figure 15). Due to this the fictive SOC measurement calculated by the PM (cf. Chapter 4.3) drops immediately to zero (cf. Figure 14-T = 8 · 10 3 s ). The estimated SOC follows this trend more smoothly until it reaches also a SOC of zero at T = 1.1 × 10 3 s , where it is limited by the constraining algorithm. In Figure 15 (red curve) it can be seen that not only the SOC is effected by constraining algorithm also the observer output cell voltage is limited to the end-of-discharge voltage of the cell. average deviation of ~2-3% SOC to the reference true value grant a good result of this estimator compared to recent developments in state of charge estimation as Figure 8 in reference [43] for LiNMC cell types (same chemistry as used here-see Appendix A). Further optimization of the Kalman filter parameters and reducing the sensor noise may also improve the results. Due to the efficient code for the prediction model provided by the extended FMI 2.0 co-simulation interface, this estimator runs with a real-time factor greater than 100 on standard desktop systems (Intel i7-4600U 2,7 GHz, 8 GB Ram, SSD). Thereby, it was possible to implement the observer on an embedded rapid prototyping controller of ROboMObil.

90In this section the application of the proposed constraint handling mechanisms (see Chapter 3) for an one-step Kalman filter estimation algorithm is exemplified. Both approaches, a sigma point projection approach (cf. [2]) as well as the simplified Newton descent search (Chapter 3.2), can be used here since a SR-UKF filter has been selected as the most appropriate method (cf. Table 3), which is stable in case of this estimation task. A common problem in battery state of charge estimation is the limitation of the SOC to realistic values at least between zero and one. Misinterpreted values of the perfect measurement Equation (16) exceed the abovementioned boundary values and may cause wrong values of the available charge and therefore also of the power allocation budget. A simplified approach to handle this is to limit the output value of the estimation, but this causes wrong values for future SOC estimate since the state tends more and more in the inadmissible region. In Figure 14 the influence of the proposed constraining methods is shown. In this scenario a sensor failure is virtually generated that causes a static cell voltage measurement drop of Δ = 0.6 at = 5 ⋅ 10 3 (cf. Figure 15). Due to this the fictive SOC measurement calculated by the PM (cf. trend more smoothly until it reaches also a SOC of zero at = 1.1 × 10 3 , where it is limited by the constraining algorithm. In Figure 15 (red curve) it can be seen that not only the SOC is effected by constraining algorithm also the observer output cell voltage is limited to the end-of-discharge voltage of the cell. This simple example should give a motivation for the usage of the here proposed algorithms, in combination with a sensor fault detection system (cf. Figure 10) this methodology can help to prevent suddenly occurring faulty system states (i.e. immediately SOC drop to zero cf. Figure 14).

91Both state constraining methods have shown similar results in their temporal characteristics (see Table 4), the main difference could be found in the mean integration time ̅ k , where the sigma point projection methods outperforms the more general simplified Newton descent search approach. The experiment with a simulation period of 1.2 ⋅ 10 4 s has been executed on a 64-bit Windows based system (Intel i7-4600U 2,7 GHz, 8 GB Ram, SSD). Table 4. Assessment of the average calculation time of the algorithms.

Algorithm

92Average calculation time per step ̅ SR-UKF unconstrained 4,08 s SR-EKF unconstrained 4,27 SR-UKF w. simplified Newton descent search 5,93 SR-UKF w. sigma point projection constraints 5,19

Conclusion

93This work presented a new highly automated framework for generating model based observers for use in embedded applications. The benefits in comparison to conventionally manual and application-specific observer implementation can be summarized as follows:

94•

95Representation of a nonlinear acausal prediction model in an object oriented multi-physical modeling language (Modelica). • Automated, well proven and efficient equation sorting and discretization in a standardized format; • Direct integration in a library containing different types of nonlinear Kalman filter algorithms.

•

96Formulation of nonlinear state constraints in the same way as the prediction model.

97Proposal of a simplified approach for handling nonlinear state constraints. • Automated code generation for a cross-platform embedded target. This simple example should give a motivation for the usage of the here proposed algorithms, in combination with a sensor fault detection system (cf. Figure 10) this methodology can help to prevent suddenly occurring faulty system states (i.e. immediately SOC drop to zero cf. Figure 14).

98Both state constraining methods have shown similar results in their temporal characteristics (see Table 4), the main difference could be found in the mean integration time t k , where the sigma point projection methods outperforms the more general simplified Newton descent search approach. The experiment with a simulation period of 1.2 · 10 4 s has been executed on a 64-bit Windows based system (Intel i7-4600U 2,7 GHz, 8 GB Ram, SSD).

Conclusions

99This work presented a new highly automated framework for generating model based observers for use in embedded applications. The benefits in comparison to conventionally manual and application-specific observer implementation can be summarized as follows:

100•

101Representation of a nonlinear acausal prediction model in an object oriented multi-physical modeling language (Modelica). • Automated, well proven and efficient equation sorting and discretization in a standardized format; • Direct integration in a library containing different types of nonlinear Kalman filter algorithms.

•

102Formulation of nonlinear state constraints in the same way as the prediction model.

103Proposal of a simplified approach for handling nonlinear state constraints. • Automated code generation for a cross-platform embedded target.

104Moreover, the observer framework along with the state constraint mechanism have been successfully applied to a battery electric vehicle state of charge estimation problem. The results and benefits of the nonlinear constrained cell observer can be concluded as follows:

105• A continuous-time Modelica semi-physical cell model with state dependent characteristic mapping correlation has been automatically symbolically manipulated and discretized via Dymola and imported into the model based observer framework via the extended FMU 2.0 co-simulation interface.

106This gives benefits in comparison to [24,25] by way of error-prone manual discretization, the capability to make use of higher order discretization methods as well as prediction model integrated efficient table interpolation.

107The cell prediction model parameters and characteristics were derived from real world test bench experiments matching the cell type used in ROMO for the high voltage system. •

108An SR-UKF observer extended with a computional reliable method for state constraint handling has been designed and validated with experimental data from cell test bench investigations.

Outlook

109It is planned to release a commercial version of the DLR Kalman Filter Library as a Modelica Library as well as a MATLAB compliant version by the end of 2019. Ongoing research in the EMPHYSIS project will focus on an embedded platform specific version of the FMI standard, special numeric routines tailored to single precision computing and extended problem formulations such as NMPC or nonlinear dynamic inversion. Moreover, for future development it will be investigated, whether a software component design with a separation of the observer algorithm component and the underlying FMUs in different software components should be preferable (similar to [42]).

110Funding: The author's thanks go to the DLR ROboMObil team, as well as Prof. Martin Otter, Dr. Andreas Pfeiffer and Dr. Ricardo de Castro for their help with questions of implementation, scientific writing and numerical routines. Moreover, the author's special thanks go to the BMBF for supporting the research on the Modelica based observer framework in the ITEA project MODRIO (funded by BMBF grant number 01IS12022G) and the current research on the embedded FMI realization and standardization in the ITEA project EMPHYSIS (funded by BMBF grant number 01IS17023B).

Conflicts of Interest:

111The author declares no conflict of interest.

참고문헌 35건

  1. Sigma-point kalman filters for probabilistic inference in dynamic state-space models 2004
  2. Kalman Filtering and Neural Networks Wiley eBooks · Wiley · 2001 10.1002/0471221546
  3. Nonlinear Observers based on the Functional Mockup Interface with Applications to Electric Vehicles Linköping electronic conference proceedings · Linköping University Electronic Press · 2011 10.3384/ecp11063474
  4. ACADO toolkit—An open‐source framework for automatic control and dynamic optimization Optimal Control Applications and Methods · Wiley · 2010 10.1002/oca.939
  5. The Consistent Initialization of Differential-Algebraic Systems SIAM Journal on Scientific and Statistical Computing · Society for Industrial and Applied Mathematics · 1988 10.1137/0909014
  6. A real time capable battery model for electric mobility applications using optimal estimation methods Linköping electronic conference proceedings · Linköping University Electronic Press · 2011 10.3384/ecp11063398
  7. Kalman filtering with state constraints: a survey of linear and nonlinear algorithms IET Control Theory and Applications · Institution of Engineering and Technology · 2010 10.1049/iet-cta.2009.0032
  8. Optimization Library for Interactive Multi-Criteria Optimization Tasks Linköping electronic conference proceedings · Linköping University Electronic Press · 2012 10.3384/ecp12076669
  9. Constrained state estimation using the Unscented Kalman Filter 2006 14th Mediterranean Conference on Control and Automation · 2008 10.1109/med.2008.4602001
  10. Functional Mockup Interface 2.0: The Standard for Tool independent Exchange of Simulation Models Linköping electronic conference proceedings · Linköping University Electronic Press · 2012 10.3384/ecp12076173
  11. State-of-charge estimation based on microcontroller-implemented sigma-point Kalman filter in a modular cell balancing system for Lithium-Ion battery packs 2015 10.1109/compel.2015.7236525
  12. Nonlinear State Estimation with an Extended FMI 2.0 Co-Simulation Interface Linköping electronic conference proceedings · Linköping University Electronic Press · 2014 10.3384/ecp1409653
  13. An FMI-based Framework for State and Parameter Estimation Linköping electronic conference proceedings · Linköping University Electronic Press · 2014 10.3384/ecp14096647
  14. High-Performance Battery-Pack Power Estimation Using a Dynamic Cell Model IEEE Transactions on Vehicular Technology · Institute of Electrical and Electronics Engineers · 2004 10.1109/tvt.2004.832408
  15. Extended Kalman filtering for battery management systems of LiPB-based HEV battery packs Journal of Power Sources · Elsevier BV · 2004 10.1016/j.jpowsour.2004.02.031
  16. Particle Learning Framework for Estimating the Remaining Useful Life of Lithium-Ion Batteries IEEE Transactions on Instrumentation and Measurement · Institute of Electrical and Electronics Engineers · 2016 10.1109/tim.2016.2622838
  17. FMI for Physics-Based Models on AUTOSAR Platforms SAE technical papers on CD-ROM/SAE technical paper series · 2017 10.4271/2017-26-0358
  18. Optimal Charging of Li-Ion Batteries With Coupled Electro-Thermal-Aging Dynamics IEEE Transactions on Vehicular Technology · Institute of Electrical and Electronics Engineers · 2017 10.1109/tvt.2017.2676044
  19. Adaptive State-of-Charge Estimation Based on a Split Battery Model for Electric Vehicle Applications IEEE Transactions on Vehicular Technology · Institute of Electrical and Electronics Engineers · 2017 10.1109/tvt.2017.2728806
  20. Cycling degradation testing and analysis of a LiFePO<sub>4</sub> battery at actual conditions International Journal of Energy Research · Wiley · 2017 10.1002/er.3837
  21. A Double-Scale, Particle-Filtering, Energy State Prediction Algorithm for Lithium-Ion Batteries IEEE Transactions on Industrial Electronics · Institute of Electrical and Electronics Engineers · 2017 10.1109/tie.2017.2733475
  22. The Co-estimation of State of Charge, State of Health, and State of Function for Lithium-Ion Batteries in Electric Vehicles IEEE Transactions on Vehicular Technology · Institute of Electrical and Electronics Engineers · 2017 10.1109/tvt.2017.2751613
  23. Critical Review on the Battery State of Charge Estimation Methods for Electric Vehicles IEEE Access · Institute of Electrical and Electronics Engineers · 2017 10.1109/access.2017.2780258
  24. An optimal nonlinear observer for state-of-charge estimation of lithium-ion batteries 2017 10.1109/iciea.2017.8282810
  25. Optimal State Estimation 2006 10.1002/0470045345
  26. Degradation Testing and Modeling of 200 Ah LiFePO<sub>4</sub> Battery SAE technical papers on CD-ROM/SAE technical paper series · 2018 10.4271/2018-01-0441
  27. State-of-charge estimation of lithium-ion batteries using extended Kalman filter and unscented Kalman filter 2018 10.1109/spit.2018.8350462
  28. Robustness Evaluation of Extended and Unscented Kalman Filter for Battery State of Charge Estimation IEEE Access · Institute of Electrical and Electronics Engineers · 2018 10.1109/access.2018.2833858
  29. Model Based Energy Management and State Estimation for the Robotic Electric Vehicle ROboMObil 2018
  30. Nonlinear Constrained Moving Horizon Estimation Applied to Vehicle Position Estimation Sensors · Multidisciplinary Digital Publishing Institute · 2019 10.3390/s19102276
  31. LAPACK Users' Guide 1999 10.1137/1.9780898719604
  32. Nonlinear Programming 2005 10.1002/0471787779
  33. Deleted Work 1955
  34. ROMO - THE ROBOTIC ELECTRIC VEHICLE 2011
  35. A quasi-Newton algorithm for nonconvex, nonsmooth optimization with global convergence guarantees Mathematical Programming Computation · Springer Science+Business Media · 2015 10.1007/s12532-015-0086-2