Simulation of Piecewise Hybrid Dynamical Systems in Matlab

,


Introduction
A hybrid dynamical system is a system containing on the same time continuous state variables and event variables in interaction. We find hybrid systems in different fields. We cite robotic systems, chemical systems controlled by vans and pumps, biological systems (growth and division) and nonlinear electronics systems.
Because of interaction between continuous and discrete aspects, the behavior of hybrid systems can be seen as extremely complex. However, this behavior becomes relatively simple for piece-wise affine hybrid dynamical systems that can, in contrast, generate bifurcation and chaos. There are many examples such as power electronics DC-DC converters.
The common power electronics DC-DC converters are the buck converter and the boost converter. They are switching systems with time variant structure [9].
DC-DC converters are widely used in industrial, commercial, residential and aerospace environments. These circuits are typically controlled by PWM (Piece Wise Modulation) or other similar techniques to regulate the tension and the current given to the charges. The controller decides to pass from one configuration to another by considering that transitions occur cyclically or in discrete time. In order to make the analysis possible, most of mathematical treatments use some techniques that are based on averaging or discretization. Averaging can mean to wrong conclusions on operation of a system. Discrete models do not give any information on the state of the system between the sampled instants. In addition, they are difficult to obtain. In fact, in most cases, a pure analytic study is not possible. Another possible approach to analyze these converters can be done via some models of hybrid dynamical systems. DC-DC converters are particularly good candidates for this type of analysis because of their natural hybrid structure. The nature of commutations of these systems makes them strongly nonlinear. They present specific complex phenomena such as fractals structures of bifurcation and chaos.
The study of nonlinear dynamics of DC-DC converters started in 1984 by works of Brockett and Wood [4]. Since then, chaos and nonlinear dynamics in power electronics circuits have attracted different research groups around the world. Different nonlinear phenomena have been observed such as routes to chaos following the period doubling cascade [16], [5], [19], [20] and [23] or quasi-periodic phenomena [6], [7] and [8], besides border collision bifurcations [23] and [2].
Switched circuits behavior is mostly simulated by pure numerical methods where precision step is increased when the system is near a switching condition. Those numerical tools are widely used mainly because of their ease-of-use and their ability to simulate a wide range of circuits including nonlinear, time-variant, and non-autonomous systems.
Even if those simulators can reach the desired relative precision for a continuous trajectory, they can miss a switching condition and then diverge drastically from the trajectory as in figure 1. This could be annoying when one is interested by border collision bifurcations, or when local behavior is needed with a good accuracy. In those applications, an alternative is to write down analytical, or semi-analytical, trajectories and switching conditions to obtain a recurrence which is very accurate and fast to run. Building and adapting such ad'hoc simulators represent a lot of efforts and a risk of mistakes.
Generic and accurate simulators can be proposed if we are restricted to a certain class of systems. A simulation tool with no loss of events is proposed in [14] and [15] for PWAHSs defined on polytopes (finite regions that are bounded by hyperplanes). This class of PWA differential systems has been widely studied as a standard technique to approximate a range of nonlinear systems.
But closed polytopic partition of the state space does not allow simulation of most switching circuits where switching frontiers are mostly single affine constraints or time-dependent periodical events.
We focus on planar PWAHSs with such simple switching conditions which can model a family of switched planar circuits: bang-bang regulators, the Boost converter, the Charge-Pump Phase Locked Loop (CP-PLL), . . . This class of systems has analytical trajectories that help to build fast algorithms with no loss of events. We propose a semi-analytical solver for hybrid systems which provides: • A pure numerical method when the system is nonlinear or non-planar; • A pure analytic method when all continuous parts of the system and switching conditions can be solved symbolically. This can be the case for the boost converter [3], [21], the second order charge-pump phase locked loop [17], [22].
• A mixed method using analytical trajectories and numerical computation of the switching instant when those solutions are transcendent. This has been used for the third order CP-PLL [17]. It can also be the case for the Buck converter [10], [21], . . .
This chapter is organized as follows. Section 2 contains our main results. We describe the problem to be deal with, we introduce a general algorithm to solve planar HSs, we present the algorithm that detects events' occurrence and devote a subsection to our approach efficiency. Section 3 Illustrates the current-mode controlled Boost converter example. Finally, a conclusion is stated in Section 4.

A HS (X, E, t): general definition
A general definition of HSs is presented here. This type of dynamical systems is characterized by the coexistence of two kinds of state vectors: continuous state vector X(t) of real values, and discrete state vector E(t) belonging to a countable discrete set M. Definition 1. A continuous-time, autonomous HS is a system of the form:

HSs class of interest
We consider a two dimensional PWAHS (X(t) ∈ R 2 ). F has then the affine piece-wise form, where A E(t) ∈ R 2× 2 and B E(t) ∈ R 2 are two matrices that depend on the discrete state E(t). Hence, a two dimensional PWAHS is a HS that take the form: We consider two kinds of events: state dependent events and periodic events.
The state dependent event transition S E i E j is defined by an affine state border of the form N ij .X < l ij . In this case an event can occur when the continuous state reaches the border of Note that the set S E i E j is not polytopic in the sense that the domain is not the interior of a closed bounded polytope.

Remark -We consider, without loss of generality, the case where a transition occurs at time dS E i E j if and only if the state X(dS E i E j ) reaches a border of the set S
T is the period and ϕ is the phase of such periodic events.

Event-driven simulation of PWAHSs
The simulation will compute the hybrid state from event to event. Knowing the states X(t k ) and . Then the following algorithm runs the simulation determining the date at the next event as the smallest: ; end Algorithm 1: Algorithm computing the hybrid state at t k+1 .

Event detection occurrence: description and algorithm
We consider the affine Cauchy problem in R 2 : where X 0 is the initial value. We compute the smallest strictly positive time t * i so that the trajectory of X(t) intersects the fixed border B i arriving from the part of the plan where N i .X < l i . The function f i (t) = N i .X(t) − l i defines the guard condition for a border B i . Thus, the problem can be formulated as follows: If f i does not have any strictly positive root or the last condition is not satisfied, t * i is given the infinite value.

Analytical trajectories
Definition 2. For any square matrix A of order n and t in R, the exponential matrix e tA is defined by where I is the identity matrix.
It is well known that the analytical trajectory X(t) of the initial value matrix differential equation (3) is given in terms of the exponential matrix and the variation of constants formula by the general integral form: When A is invertible, the above expression becomes linear: The analytical expression of the exponential matrix e At takes two forms depending on whether the eigenvalues p 1 and p 2 of the matrix A are equal or not: where A = a 11 a 12 a 21 a 22 , A • = a 22 −a 12 −a 21 a 11 and I = 1 0 0 1 .
Using these expressions, we can determine the function f (t) of the problem (4) as follows: where a i are real scalars.
Depending on the eigenvalues p 1 and p 2 , there are five cases that determine the values of the coefficients a i as shown in Table 1. Remark -Coefficients a i are real scalars that depend on Table 1. Expressions of f (t) depending on the eigenvalues p 1 and p 2 .
the eigenvalues p 1 and p 2 , the initial point X k and the border parameters are N i and l i .
In some cases, (p 1 = p 2 = 0, gray cell in Table 1) roots of f (t) can be found analytically and the problem is solved with machine precision.
In other cases, the solution can not be found with classical functions and then a numeric algorithm should be used. Using classical methods like Newton does not guaranty existence or convergence of the smallest positive root. To meet these conditions, let us use analytical roots of the derivative function f (t) expressed in Table 2. We can then compute analytically Table 2. Expressions of f (t) depending on the eigenvalues p 1 and p 2 the set L of ordered roots of f (t), those roots determines monotone intervals of f (t). The following algorithm is used to return the solution t * when it exists or the value ∞ if not.
Remark -When (p 1 , p 2 ) ∈ C * × C * the set L is infinite: when the real part of p i is positive, the algorithm Break; end end Algorithm 2: Algorithm computing t * when a solution is transcendent.
will end by finding a root. In the other case, the set L should be reduced to its three first elements, to find a crossing point when it exists.

Matlab modelling
Our semi-analytical solver is composed of different main programs that define the studied affine system. First, we create the affine system given with a specifically chosen name. Then, we define the matrices A i and B i . After that, we give the switching borders with the sign of transitions and all necessary elements or we give the period if it is about a periodic event. Finally, we execute the simulation by specifying the initial state and the time of simulation.

Application: Current-mode controlled Boost converter
A current-mode controlled Boost converter in open loop consists of two parts: a converter and a switching controller. The basic circuit is given in figure 3.
This converter is a second-order circuit comprising an inductor, a capacitor, a diode, a switch and a load resistance connected in parallel with the capacitor.
The general circuit operation is driven by the switching controller. It compares the inductor current i L with the reference current I re f and generates the on/off driving signal for the switch S. When S is on, the current builds up in the inductor.
When the inductor current i L reaches a reference value, the switch opens and the inductor current flows through the load and the diode. The switch is again closed at the arrival of the next clock pulse from a free running clock of period T.
The Boost converter controlled in current mode is modeled by an affine piece-wise hybrid system defined by the same sub-systems given in equation as follows: In the case of the Boost converter controlled in current mode, there are two types of events: A state event defined by a fixed border of the set S E 1 E 2 : and another periodic event defined by the dates t = dP E i E j , where dP E i E j belongs to the set: where T is the period of this periodic event. The different simulations are obtained using our planar PWA solver.
Before performing any study of the observed bifurcations in this circuit, a numerical simulation in the parametric plane is needed.
The following program calcule_balayage_mod.m is used to obtain the parametric plane:  The figure 4 of the parametric plane allows to emphasize the parameters values for which there exists at least one attractor (fixed point, cycle of order k, strange attractor). Figure 5 shows a bifurcation diagram (Feigenbaum type) in the plane (I re f , i L ). However, figure 6 shows the bifurcation diagram in the space plane (I, i L , v C ).
To draw these two figures we use programs: calcule_figuier.m and affiche_figuier.m   In these two figures, the voltage V in is fixed to 10V and the current I re f varies in the interval [0.5, 1.6]. We observe a period cascade doubling leading to a chaotic regime, interrupted by a border collision bifurcation at I re f = 1.23A (see figure 7). In this figure, a distinction is given between the attractors of attractive cycle type of the order 1 to 14. Each cycle of order k is associated with one color.
For example, the blue area O1 represents the parameters' values for which there exists an attractive fixed point (fundamental periodic regime). The red area O2 represents the existence of an attractive cycle of order 2. The yellow area O4 represents the existence of an attractive cycle of order 4 and so on until getting the cycles O14 of order k = 14. The black area O+ corresponds to parameters values (I re f , V in ) for which there exist cycles of order k ≥ 15 or other types of attractors. In this last area, a chaotic phenomenon could be observed. This bi-dimensional diagram shows some bifurcation curves. In fact, for the rectangle defined by the interval of parameter V in ∈ [7,15] and the parameter I re f ∈ [0.5, 1.6], we observe an area of blue color (existence of attractive fixed point) followed by an area of red color (existence of cycle of order 2), an area of yellow color (existence of cycle of order 4) and another area of black color (existence of cycle of order k ≥ 15 or another attractor type); this succession of zones corresponds to the existence of period doubling cascade.

Conclusion
In this chapter, we have showed an accurate and fast method to determine events' occurrence for planar piece-wise affine hybrid systems. As a result, we have implemented our algorithm in Matlab toolbox version (free downloadable on http://felguezar.000space.com/). This toolbox has also been completed by analysis tools such as displaying the bifurcation and parametric diagrams. The algorithm takes the advantage of the analytical form that appears in the planar case. Our approach can not be extended to a higher dimension. DC-DC converters like Boost converter are known to be simple switched circuits but very rich in nonlinear dynamics. As application, we have chosen the example of Boost converter controlled in current mode.