Observer Design for a Variable Moment of Inertia System

: Variable moment of inertia systems are common, and a popular laboratory system of this type is the “ball-and-beam”. Such systems are, however, nonlinear and often unstable. Efﬁcient control requires full state information (or at least partial velocities), which are generally difﬁcult to measure. That is why the design of state observers is a relevant problem. In this paper, a new design of an observer is proposed. This new nonlinear observer uses partial output injection and the circle criterion to ensure semiglobal stability. Moreover, we present a complete modeling of the system and systematic testing of the observer in comparison to a baseline in the form of a linear observer. The results show that the designed observer outperforms its linear counterpart and does not impede control.


Introduction
Systems with a varying moment of inertia are quite common in nature and in engineering, so interest in their properties is natural. One of the more common laboratory examples of such systems is the "ball-and-beam" (or "ball-on-beam"). Such systems remain ever popular [1][2][3]. This system is a nontrivial example of nonlinearity and the fourth order of dynamics with a mechanical realization. The control of such systems involving complications requires full state information, which cannot be directly measured and has to be estimated.
In this paper, we consider methods of state estimation for the system (1). Both nonlinear and linear observer designs are presented, and their performance is compared and illustrated with simulations. Our nonlinear observer design is novel, as it reformulates its error dynamics as a Lurie system. Lurie systems are a type of feedback system with linear dynamics and nonlinear, static (but potentially time-varying) feedback. Lurie systems enjoy a well-grounded theory of stability [28], but are still a thriving field of study [29][30][31][32][33].
The main contributions of the paper are as follows: • A systematic model design of the "ball-and-beam" system; • The design of a nonlinear observer with a specific structure and stability proven in a novel way; • A systematic analysis and comparison with a typical linear observer.
The comparisons are made both in open-loop and closed-loop (with a linear controller). The observer design for the ball-and-beam system was also considered in [26,27].
The rest of the paper is organized as follows. First, we present the ball-on-beam variable moment of inertia system; we formulate its equations and present the method by which they were obtained and how to obtain the system parameters. Then, we describe the methods that we used to illustrate our contribution. First, we show how a linear, reference observer can be designed. Then, we present our proposed structure and prove its stability. Finally, we explain which control structures were used to show how the observer operates. Then, we move to the simulation experiments, where we show how observers operate both independently and as a part of the control system. The paper ends with a discussion and conclusions.

Ball-on-Beam Variable Moment of Inertia System
A schematic illustration of the ball-and-beam system is depicted in Figure 1. This and similar systems were considered among others in [34,35] Typically, one is interested in the stabilization of the position of the ball at the middle of the beam, while the beam is in a position parallel to the ground. It is easily verifiable that the equilibrium considered is unstable. Many different stabilization techniques can be applied to solve this problem. One of them is static linear state feedback (i.e., it can be a solution to the linear quadratic problem for the system's linearization). However, usually, only positions (x 1 and x 3 ) can be measured, so to apply the state feedback controller, one needs to know the values of the velocities. A very good way to obtain them is the state observer.
The mathematical model of the system consists of the following equations: (1) where x 1 is the ball's position, x 2 is the ball's velocity, x 3 is the beam's angle, and x 4 is the beam's angular velocity. The driving torque is applied to the beam's joint and is represented as a control signal u. Such a model is convenient for implementation, and its determination is described in the following section.

Determination of the Physical Model
A good method to determine models of mechanical systems is the Euler-Lagrange formalism, which was used in [34]. A more advanced approach to modeling was used in [11,[36][37][38][39]. In order to create the model, its parameters have to be considered.
The system depicted in Figure 1 consists of a rotating beam and a ball rolling on it. The system has the following physical parameters: J beam -beam moment of inertia (kg·m 2 ); m-ball weight (kg); r-ball radius (m); L p -beam length (m).
We assumed that we can control the torque of the beam M. For the purpose of modeling, we made the following assumptions: (1) The ball does not slide on the beam (it only rolls); (2) The angle of the beam |α| ≤ α max ; (3) The friction is negligible; (4) The ball is perfectly round and homogenous; (5) The ball does not rebound from limiters; (6) The ball does not lose contact with the beam; (7) The beam is perfectly symmetric and flat.
There are many approaches in the literature to obtain the model's equation. To derive the state equations for this system, we used the Euler-Lagrange formalism [40]: where L is the Lagrangian, P is the Rayleigh loss function, F i are the forces having an influence on the system, and x i are the generalized coordinates. The Lagrangian takes the form: where: E p -the potential energy of the ball, given by the equation: E k -the kinetic energy of the ball-and-beam given by the equation: with ω the angular velocity of the ball. The Rayleigh loss function in this case is very simple, as it only relates to the rolling friction of the ball: with b the friction coefficient. F i is the torque applied to the axis of the beam, and we denote it as M.

Remark 1.
In Equation (4), we made an assumption about the ball's vertical position h. We also assumed that h = 0 on the beam axis level. It would be more common to assume h = 0 at the point where the ball's vertical position is minimal. However, in this case, h would be dependent on other system parameters: the beam length l and the max beam angle α max . This would make the equations more difficult to compute and analyze. Nevertheless, it has to be mentioned that this assumption allows the potential energy of the ball to be negative, and as a result, the sum of all energies in the system can also be negative.
After a simple trigonometric operation, the following expression for the potential energy can be written as: In the kinetic energy Equation (5), the moment of inertia of the ball with respect to the beam junction and the moment of inertia of the ball in its body center can be expressed as: The angular rate of the ball is simply related to its linear velocity: Evaluating the Lagrange equation leads to the formulation of the following differential equations: After substituting (3) into (2), we obtain the following state equations (with the classical choice of physical symbols for generalized coordinates): In order to simplify the implementation of the model, it can be transformed to the form of (1) with u = M. The parameters from (12) and (1) along with the explicit formulas are presented in Table 1. Table 1. Physical model parameters are inconvenient to use when implementing models in software environments. That is why for our implementation, we preferred the form with nonphysical, precomputed parameters. For convenience, this table includes both physical and precomputed parameters along with explicit formulas.

Physical Parameters
Computational Parameters m 0.208 kg

Model Parameters
The ball mass m and radius r, along with the beam's length L p can be computed directly. To compute the beam's inertia moment, we need to compute its mass m b as well. Afterwards, we performed the following experiment: The beam was hung on a thread with length L n (see Figure 2). Afterwards, the beam was made to have small oscillations (we assumed in the α range sin α = α). The period of this oscillation T was measured.

Figure 2.
It is possible to estimate the moment of inertia J beam of the beam of length L p by making a physical pendulum with it, by hanging it on a string with a length of L n . As long as the angle α is small, the period of oscillation can be used to compute J beam .
Afterwards, we used an equation for the physical pendulum: where d is the distance between the beam's center of gravity and the point where the thread is attached, in our case: where: L p -length of the beam, L n -length of the thread. After substituting (14), Equation (13) can be transformed to the following: Factors on the right side, such as the weight, the length of the thread and the beam, and the pendulum's period, are easy to measure and allow estimating the beam's inertia moment. Finally, the friction coefficient was assumed to be negligible.

Methods
In this section, we cover the methods of state estimation that were considered in this paper. First, we present the design of the linearized observer and determine the Jacobi matrix, the observability, and the observer gain. Then, we move to the new proposed observer structure and prove its semiglobal stability. Finally, we present the control structures that we considered to analyze the observers.

Linear Observer Design
First, we present the observer for a linearized system. We present it first because it can be seen that for the system (1), the Jacobi matrix takes the form: where: This form of the Jacobi matrix is coupled with the system output: allowing the use of the strongest observability criteria for the nonlinear systems. The criteria (see for example [41] or compare with the analogous result for controllability [42]) state that the nonlinear system is locally observable at the point x * if the pair (C; J(x * )) is observable. For the considered system, we can verify that the observability matrix (see for example [43]) takes the form: Therefore, Q is independent of x * and nonsingular. This means that the system (1) with (17) is locally observable everywhere. Knowing the Jacobi matrix, we can compute linear approximation of system (1) near the 0 equilibrium, resulting in the linear system: being the right side of (1) and ∆x is a deviation from 0 equilibrium. Using such a system, one can propose a linear Luenberger observer:x For this observer, the gain matrix G 1 was chosen in such a way that eigenvalues of the matrix A − G 1 C were real in the interval range [−21, −20]. Such a choice of the gain is not perfect, and the search for the optimal one is advised. Such problems were considered among others in [44,45]. The observer gain was computed using the place method from the MATLAB ® Control Toolbox™ [46] (or equivalently using the Python Control Systems Library [47]; both implement the algorithm by Kautsky et al. [48]) and has the form:

Nonlinear Observer Design
For the design of the nonlinear observer for the system (1), one should see that the right side of (1) has the following structural property: where L is in block-diagonal Frobenius form (see [49]): This is similar approach to the so-called output injection observers, where it is intended to cancel as many as possible nonlinear terms in the error equation.
The dynamics of the error for such an observer has (after simple transformations and settingx 4 = x 4 − e 4 ) the following form: where: Therefore, the dynamics of the error is a linear system with one scalar, time-varying nonlinearity (nonautonomous Lurie system [28]).

Remark 2.
It should be noted that because x 3 is bounded due to the assumptions, x 1 is bounded because of the finite length of the beam, and the control torque is bounded; for practical reasons, also x 2 and x 4 are bounded, and those bounds can either be computed through simulations or estimated analytically. In other words, one can consider x 1 and x 4 as bounded time-varying parameters, so (22) is a quadratic function with time-varying parameters. In Figure 3, one can see the sector in which the values of (22) are contained: the upper bound of the sector is sup x 1 ,x 2 f (v, t), and the lower bound is inf x 1 ,x 2 f (v, t).
The system (21) is in the form that allows the application of the circle criterion (see [28,50]). In Figure 3, one can see that the global asymptotic stability of (21) is impossible, because the sector containing the nonlinear function (22) grows quadratically.  . The nonlinearity of the error dynamics treated as a Lurie system is constrained to a piecewise quadratically bounded sector. Because of this quadratic growth, it cannot be globally bounded by a linear term, which is why the observer can be made only semiglobally stable. What should be noted, however, is that the values of the nonlinearity depend on the dynamics on the control system, so as long as they are far from the boundary values (so that stabilization works), they are much smaller. Examples of the values taken by the nonlinear function in a closed-loop experiment are marked in black.
For such a system, we can compute the transfer function: which for the appropriate choice of G 2 and setting the eigenvalues of the matrix A − G 2 C as real and contained in the interval [−21, −20], allows achieving the modulus of the transfer function with a 10 −17 order of magnitude. This gain, computed similarly to the previous one, has the form: For such a gain, one can see that the appropriate frequency inequality is fulfilled (see [28]): , e 4max ] and some ε > 0. This allows solving the appropriate Lyapunov equation and finding the quadratic form, that is the Lyapunov functional for (21) and semipositive definite, giving the basin of attraction consisting of all the possible initial errors (because of the original system state constraints). Such a situation is the example of the so-called semiglobal stability property. Regarding the observer design, by the choice of the parameter (in our case G 2 ), one can achieve any desired finite basin of attraction.

Considered Control System
As stated earlier, our idea for the observer design was to estimate the velocities (linear of the ball and angular of the beam) that cannot be implemented directly. Then, we would have the full state information that we could use to construct the feedback. As a simple solution to the feedback problem (as it is not the main focus of the paper), we used a linear feedback control, designed to set the eigenvalues of the closed-loop system as linearized around the equilibrium and as real in the interval [−3, −4]. This can be obtained using the place method mentioned earlier. One gain realizing this postulate has the form: K = 2.197 0.183 0.518 0.106 (24) To keep the realism in the controller, we introduced saturation, making the control limited as |u| < 5. It is important to notice that this is not a globally stabilizing controller. That is why large transitional errors can move it outside of the basin of attraction and cause system instability. Moreover, it should be noted that, in general, for nonlinear systems, there is no separation property. Therefore, the globally stable observer and globally stable controller might not result in a globally stable system. That is why we compared our observers both inside and outside of the control loop.
To test the observers, we used this controller in two ways. First, we close a feedback loop with the system state and introduced the observer just as a state estimator. Such a structure is presented in Figure 4a,c.
The second structure that we wanted to use was the implementation of the observer in the control loop. In this case, we used the position (linear of the ball and angular of the beam) with the velocity estimates taken from the observer. Such structures are presented in Figure 4b,d. Nonlinear observer

Controller System
Nonlinear observer y u y −ŷ x Figure 4. The presentation of the control structures used in the testing of the observers (linear and nonlinear), considered in two scenarios. The first one is to use the observer independently of the system ((a) and (c), respectively). In such cases, the system is controlled by a state feedback, from the actual system state, and the observer estimates the missing state variables. The second test is based on the observer operating as a part of the control system ((b) and (d), respectively). In such a case, the state feedback is constructed with the system outputs, and the missing state variables are taken from the observer. Note: The white circle denotes the simple summation element; the black circle, however, can be considered an equivalent to the Simulink™mux block, i.e., joining two signals into a vector of signals fed into the system.

Simulation Experiments
All simulations were realized in MATLAB ® and reconfirmed with Python. The Python code is available in the provided repository. To solve the differential equations, we used the Dormand-Prince 5(4) Runge-Kutta method, which is a fifth-order method with a fourth-order error estimator. The method uses local extrapolation and provides a dense output. We now discuss the results for the linear and nonlinear observers.

Remark 3.
Because of the relative fragility of the linear-based closed-loop (which we do not discuss here in detail), we chose the initial conditions to be consistent with the output measurements at the initial state. Otherwise, the system had a tendency to destabilize.

Linear Observer Results
First, we discuss the behavior of the linear observer outside of the control loop (the structure in Figure 4a). As can be seen in Figures 5 and 6, even the closeness of the initial conditions did not prevent transitional errors. What can be consistently observed among all cases is that the estimation of the linear velocity x 2 was simple for both of the observers, and the transitional errors were small. For the estimation of the angular velocity x 4 , the linear observer needed more time, approximately 1 s. As the time constants of the linearized system error were all less than 0.05 s, this cannot be considered a satisfactory behavior.
The introduction of the linear observer into the control loop (the structure in Figure 4b) behaved as expected and reduced the control quality. The estimation of the linear velocity was still effective (Figure 7), but as we can see, the system stabilized after 5 s, twice as long as previously. In the case of the angular velocity (Figure 8), we can see that the estimation error, while having relatively moderate transitional errors, converged to zero after more than 3 s. This is the mentioned fragility, as increasing the initial estimation error (different initial condition) caused the system to completely destabilize. . Even outside of the control loop, the linear observer has difficulties estimating the angular velocity x 4 , and its estimatex 4 , even starting with the same initial conditions, has large transitional errors that take about 1 s to vanish. As the time constants of the linearized system error are all less than 0.05 s, it cannot be considered a satisfactory behavior.

Nonlinear Observer Results
We follow with the analysis of the nonlinear observer outside of the control loop (the structure in Figure 4c). Because of the stability of the observer, we relaxed the requirements on the initial conditions, and the observer started from 0. The nonlinear observer introduced an effect, known as the "peaking phenomena", where initially, the estimate had a large transitory error, which can be seen even in the estimates of the linear velocity ( Figure 9). This transitional error however vanished after approximately 0.25 s, which was consistent with the time constants of the linear part of the error dynamics −0.05 s. Therefore, the error vanished after 5 time constants. A similar behavior was observed for the angular velocity ( Figure 10). In both cases, the transitional error was brief and in the opposite direction to the growth of the state variable.
The introduction of the nonlinear observer into the control loop (the structure in Figure 4d) gave surprising results. First of all, the state estimation of both the linear and angular velocities (Figures 11 and 12) did not differ much from the case of the observer working independently. Moreover, the control quality was not adversely affected by the peaks in the estimation error. Quite the opposite, as the volatility increased at the beginning, this helped obtain the quicker stabilization of the angular velocity.

Discussion and Conclusions
In this paper, two methods for the observer design of a highly nonlinear system with a variable moment of inertia were presented. The modeling of this system was presented, along with the methods for the parameter derivation. The observability of the system with respect to the output (17) was verified, and two observers were designed. The first one was the classical linear full-rank observer for the linearized system. The second one was a new idea for a semiglobally stable observer, which in some aspects was similar to the one presented in [51]. For such an observer, the outline of stability proof was presented, based on the circle criterion. The effectiveness of both observers was illustrated with simulations.
The proposed observer structure addressed an interesting problem. When designing state observers for linear systems, the error dynamics is also linear, which simplifies the analysis. In nonlinear systems, this is not so easy. The optimal situation is the so-called output injection, where using the output measurements in the observer instead of the respective state estimates, we can cancel out the nonlinear terms in the error equation. Those systems are, however, rare, and the transformation to them is highly nontrivial. If the nonlinearities are bounded (for example, by the Lipschitz constant), then a Lyapunov function for the error equation can be designed and appropriate bounds used. High-gain observers mix this approach with the transformation in a way analogous to linearizing the feedback. They however have a tendency toward even larger transitory peaks. Sliding-mode observers require the careful design of the sliding surface, which for a four-dimensional system, can be troublesome. That is why the proposed approach stands out. We performed partial output injection and treated the remaining part as a Lurie system that could be handled by a circle criterion to ensure the semiglobal stability. This approach is attractive, but highly unique. However, as was presented, this works both outside and inside the control loop.
The limitations of this approach come from the specificity, as only some systems have this property. Moreover, issues can arise similar to the case of the output injection observers, when the identification is bad and the canceling is only partial.
Further work will include testing this observer with some global control and comparisons with different types of observers.
Funding: This research was funded by AGH's Research University Excellence Initiative under project "Interpretable methods of process diagnosis using statistics and ma-chine learning" and by AGH's subvention for scientific activity.

Institutional Review Board Statement: Not applicable.
Informed Consent Statement: Not applicable.

Data Availability Statement:
The data presented in this study and the code for the analysis are openly available in the GitHub repository https://github.com/KAIR-ISZ/public_data. (accessed on 10 September 2021).