• No results found

Paper III – Identification of nonlinear feedback mechanisms

7.2 Modeling and methods

one example, where the controller corresponds to the central nervous system (CNS), which senses the posture of the body and activates our muscles, such that we may stand upright against the forces of gravity instead of falling.

In this paper, we investigate the properties of the LAVA method, see Mattsson et al. (2018), for the case of identifying linear and nonlinear con-trollers operating in closed loop. The LAVA method was developed spe-cifically for identification of nonlinear systems. Here, this method is used to estimate both linear and nonlinear controllers in two different cases, a simulated standing human balance scenario and a real-world controller in a position servo.

7.2 Modeling and methods

7.2.1 Identification of a controller operating in closed loop We refer to a plant as some physical object which we may interact with through some input signal u. Interactions with the system will affect its state and can be observed in the output y. In classic system identification, the objective is to construct a mathematical model that describes the dynamics of the plant, or how y relates to u. The model is constructed based on data, which consist of observed input-output pairs, obtained through experiments.

Typically, the experiments consist in exciting the system by choosing u such that the data obtained contains sufficient information about the system dynamics to facilitate identifiability. In that case, we say that u provides sufficient excitation to the system.

The above describes the situation where the plant is a system operating in open loop, which is characterized by the fact that u is chosen manually.

In this work we are instead interested in systems that operate in closed loop, see Fig. 7.1, where u is chosen as the output of a controller. The controller can typically be seen as having two inputs, a reference signal r and (measurements of) the outputs y of the system to be controlled. The objective of the controller is then to choose u in order to bring the observed y as close to the reference signal r as possible. Some systems, for example biological systems, exist naturally as closed loop systems, where both the controller and the plant may be unknown.

In order for a controller, that operates in closed loop, to be identifiable, it is not sufficient that the plant output y provides sufficient excitation to the controller. As shown by Ljung (1999), an external excitation signal is also necessary to obtain data which facilitates identifiability. Therefore, we introduce an external disturbance signal d, as an additional input to the plant.

The data that is used to construct a model of the controller will be

Controller Plant d

u External

sensor

r y yb

Internal sensor

Figure 7.1: A system operating in closed loop, with feedback provided by a controller.

denoted by D, and referred to as the identification data. The identification data consist of discrete-time measurementsub andybof u and y, respectively D =nu(t),b y(t)b o, t= 1, . . . , N, (7.1) where t is the sample index and the data set consists of N measurements.

We make use of information from external sensors to find the estimate yb of y. Note that the information we obtain about y may be different from the information that the controller receives, since the signal y is sensed in different ways (see Fig. 7.1). There may be unknown internal sensors that provides the controller with its own internal estimate of y, this is especially true in the case of biological systems. For example, our senses communicate information to the brain, which is used to control our actions, and generally we can not assume that any external sensor will provide the exact same information as the biological sensory systems, to our identification data.

Therefore, it’s important to keep in mind that the models we construct will be based on the information we have available, which is generally not the same information that the controller has available.

7.2.2 Inertial sensors

We make use of inertial sensors to collect the data used for identification.

Inertial sensors consists of accelerometers, that measure linear acceleration, and gyroscopes, that measure angular velocity. These sensors are light-weight and have low power consumption, which makes them suitable for identification of systems where the output can be observed through move-ment. We will primarily use inertial sensors to obtain observations of the orientation and angular velocity in the experiments explained in Section 7.3 and Section 7.4. Sensor fusion of the accelerometer and gyroscope, and possibly a magnetometer that measures the local magnetic field, makes it possible to estimate the orientation of the sensor. Here, orientation estimates

98 7.2. Modeling and methods

were obtained using an extended Kalman filter with orientation deviation states, see Kok (2016).

7.2.3 Method for nonlinear system identification

We begin by considering a linear dynamical predictor model of the con-troller output

u(t) = Θϕ(t) + ε(t), (7.2)

where ϕ(t) is the ARX regressor

ϕ(t) = [u>(t − 1) . . . u>(t − na)

y>(t) . . . y>(t − nb+ 1) 1]>, (7.3) and naand nbare non-negative integers, which decide the order of the linear predictor model. The matrix Θ contains the model parameters and ε(t) is the prediction error. This nominal linear predictor yields a parsimonious model of the controller around an operating point. However, as the controller deviates from the operating point, the errors ε(t) become large due to model errors, and are poorly approximated by a white noise process as assumed in ARX-models.

We extend the nominal predictor by considering a data-driven model of the prediction errors:

ε(t) = Zγ(t), (7.4)

where γ(t) is any given vector-valued function of past inputs and outputs, and Z is a matrix of unknown parameters. The goal then is to identify a model

u(t) =b Θϕ(t) +b Zγ(t),b (7.5) where the first term tries to capture linear structures in the data and the second term is an overparametrized error model that tries to capture devi-ations from the nominal linear predictor. The identification method used is the latent variable (LAVA) approach in Mattsson et al. (2018), which reg-ularizes the overparameterized model learning towards the linear predictor class in a data-adaptive manner and seeks a sparse parameter matrixZb. This is a property which makes the LAVA method favour parsimonious models, meaning linear models with as few parameters as possible are favoured over nonlinear models with a large set of parameters.

In the examples below, we let γ(t) be the nonlinear Laplace operator basis (Mattsson et al. 2018; Solin and Särkkä 2014). This is a multiscale basis with universal approximation properties, similar to wavelet basis.

7.2.4 Evaluation metrics

We use validation data that is separate from the identification data, as input to the identified model to simulate the controller output, which is then used to evaluate the model. The simulated controller output is computed recursively as

b

us(t) = fubs(t − 1), . . . ,ubs(t − na), y(t), . . . ,b yb(t − nb+ 1); Θ,b Zb,

(7.6)

where f(·) is the function that corresponds to (7.5), and the simulation is performed for t = L, . . . , N, where L = max(na, nb) + 1 and

b

us(L − k) =ub(L − k), k = 1, . . . , na. (7.7) We will use the RMSE and FIT metrics to evaluate the performance of the identified models. Here, we define the RMSE as the root of the average squared simulation errors

RMSE = vu ut1

N XN

t=1kubs(t) − u(t)k22, (7.8) and the FIT metric as

FIT = 100 1 − kuubsk2 ku − ¯u 1k2

!

, (7.9)

where ¯u is the empirical mean of u and 1 is a vector of ones.

We also compare the number of elements in Z, nb z, to the number of identified nonzero elements, which is given by the l0-norm, kZbk0. This will serve as a metric for sparsity.

Related documents