Keywords

1 Introduction

In general, the most widely studied dynamic systems in the literature can be classified into two groups: continuous and discrete switched systems [1]. But in practice, the discrete and continuous dynamics constitute of the fundamental attribute of dynamic systems [2], such systems are called hybrid dynamic system. Switched system is a kind of important hybrid dynamic system which is studied from the aspects of Systematics and Cybernetics, and it is made up by continuous-time evolving subsystems, discrete-event driven subsystems which interact with each other and switch strategy that decides which of the subsystem is active at each moment(switch strategy is also called switch rate, switch law, switching signal etc.). A main problem of switched systems which is always inherent in all dynamical systems is the presence of uncertainties and external disturbances [3], the attribute of switched systems is not simple superposition of all subsystems’. Namely, even if each subsystem is not stable, by structuring switch strategy, it can ensure that switched systems are tended to be asymptotically stable, and even if each subsystem is stable, selecting inappropriate switch strategy, switched system may not have stability.

Switched systems can depict actual system more scientifically, and as an international cutting-edge direction of the research of hybrid system theory, it gets extensive attention on the field of control and computer. There are many applications of switched systems, such as in control of mechanical systems, traffic management and many other practical control fields. The motivation of studying switched systems is from the fact that many practical systems are inherently multi-models [3], and as a special simplified model of hybrid systems, its analysis and design method is easier to generalize to general hybrid dynamic system. So switched system draws extensive attention on the field of control and computer. At present, switched systems will be one of the most research directions and strategic important topic.

1.1 Research Background of System Simulation

Simulation is the imitating for real things, and it, which is based on the theory of similarity theory, cybernetics and computer information processing technologies, etc., is a multi-disciplinary crossing technology in order to research real systems by the tool of computers and physical devices to build mathematical models. Simulation is an important scientific mean to gradually know complex systems and an efficient mean of optimization for hybrid systems. It can help realize the essence of systems and accurately analyze the performance of systems, it also deepens the understanding of complex system and gains a set of system theory which can strengthen the control of systems. At present, where there is scientific research, there must have the support of simulation. Simulation becomes one of the main research methods in the field of scientific research after experiment and theory.

1.2 Introduction of Simulator

Simulator can intuitively model for the systems of realistic life and improve and efficiency of modeling through user friendly graphical interface. Based on the theory of switched systems, the simulation of systems can be implemented under the MATLAB environment more easily and conveniently with the framework [2]. So this article mainly simulates several types of switched systems under the design environment of MATLAB. Based on the MATLAB simulation, it can not only facilitate the modeling of complex systems, but also can be more understanding of interaction of each subsystem and the nature of complex system.

1.3 Main Work of This Paper

Most of the previous papers studied dynamic systems which are classified into continuous or discrete switched, linear or non-linear. Such as, discrete-time linear switched systems [4, 5], continuous-time systems [6], and so on. And most consider the construction of Lyapunov function to study stability of systems [7], which is hard to get the conditions. But in this paper, we divide dynamic systems into event-driven and time-driven switched systems according to the switch strategy. We can simply simulate the stability of all kinds switched systems and the relationship with their subsystems. The main work of this paper as following.

The rest of the paper is organized as follows. In Sect. 1, we describe the related works about incentive schemes. Section 2 analyses and simulates time-driven switched system including periodically switched systems and impulsive switched systems. Event-driven switched system is analyzed in Sect. 3, in which subsystems are designed based on event driven switched system of user requirement.

2 Stability of Time-Driven Switched System and Its Simulation

2.1 Theory of Stability of Periodically Switched Systems

Periodically switched systems are timely carried out in accordance with the fixed time, namely periodically switched systems have a periodic switching rule. In a period, each subsystem switches based on the order of switch law in a fixed time. In each period, subsystems cycle successively and switch in sequence.

In accordance with the definition of periodically switched system, we establish the mathematical model of periodically switched systems, as the following Eq. 1:

$$\begin{aligned} \dot{x}(t)&=A_{\sigma (t)}x(t)\nonumber \\ x(t_{0})&=x_{0}\ \end{aligned}$$
(1)

In which, it can be easily seen that each subsystem \(\dot{x}(t)=A_{\sigma (t)}x(t)\) is active for \(\triangle t_{k}\) seconds within each Period [11]. If the period of periodically switched system is T, the system matrix appears periodical satisfying \(A_{i}\epsilon R^{n\times n}\) and \(A(t)=A(T+t)\), \(x(t)\epsilon \mathfrak {R}^{n\times n}\) is state vector of switched systems and is the right continuous piecewise constant function, \(\sigma (t):[0,+\infty ]\rightarrow M={1,2,\ldots m}\) is switched signal, \(\sigma (t)=i\) means that the i-th subsystem is activated. Switching sequence is \(\{\)x\(_{0}\); (i\(_{0}\), t\(_{0}\))(i\(_{1}\), t\(_{1}\))...(i\(_{k}\), t\(_{k}\))|i\(_{k}\) \(\epsilon \) M, k \(\epsilon \) N\(\}\), In which, \(t_{0}\) is initial time, \((i_{k},t_{k})\) represents that the \(i_{k}\)-th subsystem of switched system is activated, when \(t_{k}\le t \le t_{k+1}\), and at the time of \(t_{k+1}\), \(i_{k}\)-th subsystem finishes and \(i_{k}\)-th subsystem is activated. Therefore, in the time of \([t_{k},t_{k+1}]\), the motion trajectory of periodically switched system (1) is determined by the \(i_{k}\)-th subsystem. And periodical switching sequence is

(2)

In which, switching period of periodically switched system is \(T=t_{m}-t_{0}\), we define \(\varDelta t_{k}=t_{k}-t_{k-1} \) \(k=1,2\ldots m\) as the running time of k-th subsystem in each period, which is equivalent to the dwell time of each subsystem in each period.

We know that if system matrix of a subsystem is stable, subsystem has stability. The main results about the stability of subsystem are as following Lemma 1.

Lemma 1

If the system matrix \(A_{i}\), \(i=1,2\ldots m\) of each subsystem is stable matrix, all eigenvalues of each system matrix \(A_{i}\), \(i=1,2\ldots m\) has negative real part or negative real number.

Lemma 1 is suitable for each kind of switched system, including impulsive switched system in Sect. 2.3 and designed event-driven switched system in Sect. 3.

2.2 Simulation Example of Periodically Switched Systems

Example 1

Supposed periodically switched system is \(\left\{ {\begin{array}{*{20}{c}} {\dot{x}(t) = {A_1}x(t)} \\ \begin{array}{l} \dot{x}(t) = {A_2}x(t) \\ \dot{x}(t) = {A_3}x(t) \\ \end{array} \\ \end{array}} \right. \), which has three subsystems. The system matrix of first subsystem is \({A_1} = \left[ {\begin{array}{*{20}{c}} {\mathrm{{ - }}3} &{} {\mathrm{{ - }}1} &{} 0 \\ {\mathrm{{ - }}4} &{} {\mathrm{{ - }}3} &{} 0 \\ 0 &{} 0 &{} {\mathrm{{ - }}3} \\ \end{array}} \right] \), the system matrix of second subsystem is \({A_2} = \left[ {\begin{array}{*{20}{c}} 0 &{} 0 &{} {\mathrm{{ - }}3} \\ {\mathrm{{ - }}2} &{} 1 &{} 0 \\ 0 &{} {\mathrm{{ - }}4} &{} 1 \\ \end{array}} \right] \), the system matrix of third subsystem is \({A_3} = \left[ {\begin{array}{*{20}{c}} {\mathrm{{ - }}2} &{} {\mathrm{{ - }}3} &{} 0 \\ 0 &{} {\mathrm{{ - }}1} &{} 0 \\ 0 &{} 3 &{} {\mathrm{{ - }}1} \\ \end{array}} \right] \), initial value of system is \(x(0) = 1,y(0) = 2,z(0) = - 2\), and period is 6 s.

Example 2.1 of periodically switched system switches according to the switched law in Fig. 1(a), we draw the system state response diagram in Fig. 1(b) and phase plane diagram of switched system in Fig. 1(c). According to Lemma 1, there exists a positive definition matrix \({P_1}\) which makes system matrix \({A_1}\) of first subsystem have \(P_1^{ - 1}{A_1}{P_1} = \left[ {\begin{array}{*{20}{c}} { - 1} &{} 0 &{} 0 \\ 0 &{} { - 5} &{} 0 \\ 0 &{} 0 &{} { - 1} \\ \end{array}} \right] \), the eigenvalues of \({A_1}\) are −1, −1 and −5 which are all negative, so first subsystem is stable; there exists a positive definition matrix \({P_2}\) which makes system matrix \({A_2}\) of second subsystem have \(P_2^{ - 1}{A_2}{P_2} = \left[ {\begin{array}{*{20}{c}} { - 2.2593} &{} 0 &{} 0 \\ 0 &{} {\mathrm{{2}}\mathrm{{.1296 + 2}}\mathrm{{.4673i}}} &{} 0 \\ 0 &{} 0 &{} {\mathrm{{2}}\mathrm{{.1296 - 2}}\mathrm{{.4673i}}} \\ \end{array}} \right] \), the eigenvalues of \({A_2}\) are −2.2593, 2.1296 + 2.4673 and \(2.1296-2.4673\)i which don’t all have negative real part, so second subsystem is unstable; similarly, there exists a positive definition matrix \({P_3}\) which makes system matrix \({A_3}\) of third subsystem have \(P_3^{ - 1}{A_3}{P_3} = \left[ {\begin{array}{*{20}{c}} { - 2} &{} 0 &{} 0 \\ 0 &{} { - \mathrm{{1}}} &{} 0 \\ 0 &{} 0 &{} { - 1} \\ \end{array}} \right] \), eigenvalues \({A_3}\) of are −2, −1 and −1 which are all negative, so third subsystem has stability. We can get first and third subsystem are stable and second subsystem is unstable in Fig. 2 which is exactly consistent with above reasoning. Although subsystems of periodically switched system of Example 2.1 are not all stable, but the whole periodically switched system of Example 2.1 is tended to globally exponential stability in Fig. 1(b) under switch law in Fig. 1(a).

Fig. 1.
figure 1

(a) Switch law of Example 2.1; (b) state response curve of switched system; (c) phase plane of switched system

Fig. 2.
figure 2

State response of subsystems. (a) State response curve of the first subsystem; (b) state response curve of the second subsystem; (c) state response curve of the third subsystem

2.3 Theory and Stability of Impulsive Switched Systems

Impulsive dynamical systems are a type of hybrid systems consisting of three elements: an impulsive law being used to determine when the impulses occur; a continuous differential equation, which governs the continuous evolution of the system between impulses; and a difference equation governing the way the system states are changed at impulse times [9]. In other words, impulsive switched system is put a pulse function or impulse switch strategy into switched system, and the states of systems will sudden change at certain instants of switching which will change the value of state variable of some subsystems and which leads to switched system structure changed. Different switch law may lead to different switched results. Within the past several years, there is an increasing interest in the qualitative theory of impulsive switched systems. The reason is that impulsive switched systems can model nonlinear systems which exhibit not only impulsive dynamical behaviors but also switching phenomena [10].

Supposed there are m subsystems, we establish the mathematical model of impulsive switched systems, as the following Eq. 3:

$$\begin{aligned} \left\{ \begin{array}{lll} \dot{x}(t)=A_{i_{k}}x(t),t\,\epsilon \,(t_{k},t_{k+1}),i_{k}+1,2...m,k=1,2,...m\\ \varDelta {x}(t_{_{k}})=x^{+}_{k}-x^{-}_{k}= {B_k}x({t_k}),k = 1,2...m\\ x^{+}_{0}=x_{0} \end{array} \right. \end{aligned}$$
(3)

In which \(x(t) \in {\mathfrak {R}^n}\) is input state vector, \(t_k\) is on behalf of switched state of k-th subsystem in the moment of \(t_k\) and in this moment adding a pulse control to switched system, \(k = 1,2 \ldots m\), \(t_k^ - \) and \(t_k^ + \) respectively represent a moment before and after the moment of \(t_k\) and have

$$\begin{array}{l} x({t_k}) = x(t_k^ - ) = \mathop {\lim }\limits _{h \rightarrow {0^ + }} x({t_k} - h) \\ x({t_k}) = x(t_k^ + ) = \mathop {\lim }\limits _{h \rightarrow {0^ - }} x({t_k} - h) \\ \end{array}$$

\(A_i\) is the system matrix of impulsive switched system, \(B_i\) is impulsive control matrix which is adding a pulse effect to switched system in a moment.

2.4 Simulation Example of Impulsive Switched Systems

Example 2

Supposed impulsive switched system is \(\left\{ {\begin{array}{*{20}{c}} {\dot{x}(t) = {A_{{i_k}}}x(t)} \\ {\varDelta x({t_k}) = {B_k}x({t_k})} \\ \end{array}} \right. \) in which system matrix of switched system is \({A_1} = \left[ {\begin{array}{*{20}{c}} { - 7} &{} 0 &{} {\mathrm{{ - }}1} \\ {\mathrm{{ - }}9} &{} {\mathrm{{ - }}8} &{} 0 \\ { - 8} &{} {\mathrm{{ - }}3} &{} {\mathrm{{ - }}1} \\ \end{array}} \right] \) and impulsive control matrix is \({B_1} = \left[ {\begin{array}{*{20}{c}} { - 1} &{} 6 &{} { - 8} \\ 0 &{} { - 1} &{} { - 2} \\ 0 &{} 0 &{} {\mathrm{{ - }}1} \\ \end{array}} \right] \), initial value is \(x(0) = [ {1;0; - 2}]\).

Example 2.2 switches according to the switch law in the following Fig. 3(a). Then using MATLAB, we can draw the system state response diagram and phase plane diagram in Fig. 3(b) and in Fig. 3(c), respectively.

Fig. 3.
figure 3

(a) Switch law of Example 2.2; (b) state response curve of switched system; (c) phase plane of switched system

Fig. 4.
figure 4

State response of subsystems. (a) State response curve of switched system subsystem; (b) state response curve of impulsive control subsystem

Because in a moment the time of impulsive control matrix is too short, so the time axis of switch law of Example 2.2 in Fig. 5(a) expends 50 times.

According to computing, the eigenvalues of system matrix A of example 2.3 are −9.7190, −5.9526 and −0.3284, the eigenvalues of impulsive control matrix B are all −1 which is triple root. So all subsystems are stable. According to the state response and phase plane curve of switched system in Figs. 4(a) and (b), respectively. We can also see subsystem and impulsive control subsystem are tended to globally exponential stability. And we can gain the whole impulsive switched system is tended to globally exponential stability in Fig. 3(b) under the switch strategy in Fig. 3(a).

3 Stability of Event-Driven Switched System and Its Simulation

3.1 Theory of Stability of the Designed Switched Systems

Subsystem is designed based on event driven switched system of user requirement, switched systems carry out based on switch strategy related to system state, and it switches to the corresponding subsystem by judging the switching condition based on the change of switch law at any time. Supposed there are m subsystems, we establish the mathematical model of designed switched systems, as the following Eq. 4:

$$\begin{aligned} \left\{ \begin{array}{l} \dot{x}(t) = {f_{p(x)}}(x(t)) = {A_i}x(t) \\ y(t) = {g_{p(x)}}(x(t)) \\ p({t^ + }) = {\delta _{p(x)}}(x(t),\sigma (t)) \\ \end{array} \right. \end{aligned}$$
(4)

In which, \(p(x) \in \{ 1,2,3 \ldots n\} \) is discrete state variables in actual process, when it satisfies the switch strategy related to some system state, it switches to a subsystem, namely it indicates logic state of first subsystem, second subsystem etc. \(\dot{x}(t) \in {\mathfrak {R}^n}\) presents the collection of subsystem of switched system which is a continuous set of input state. \(y(t) \in {\mathfrak {R}^n}\) is output function, \(\delta ()\) function depends on piecewise constant function of state of subsystems x(t) which is discrete input.

Above all, if we need determine whether a switched system is tended to asymptotically stable, we must examine each subsystem, if eigenvalues of subsystem matrix are all negative, the subsystem is stable. If subsystems are not all stable, we just need to find positive definite symmetric matrix P, if there exists such matrix, the system is stable, otherwise the system is unstable.

3.2 Simulation Example of Designed Switched Systems

Example 3

Supposed the following event driven switched system:

$$\begin{array}{*{20}{c}} {\frac{{dx}}{{dt}} = f(x) + y} \\ {\frac{{dy}}{{dt}} = - x} \\ \end{array}f(x) = \left\{ {\begin{array}{*{20}{c}} { - 4x} \\ { - 2x} \\ { - x - 3} \\ \end{array}} \right. \begin{array}{*{20}{c}} {x > 0} \\ { - 1 \le x \le 0} \\ {x < - 1} \\ \end{array}$$

This switched system includes three subsystem, when switch law \(x > 0\), defining the first system is \(\begin{array}{l} \frac{{dx}}{{dt}} = \mathrm{{ - }}4x + y \\ \frac{{dy}}{{dt}} = - x \\ \end{array}\), the general solution is

$$\begin{aligned} \left\{ \begin{array}{ll} x(t) = C1 \times (2 + \sqrt{3} ){e^{ - (2 + \sqrt{3} )t}} + C2 \times (2 - \sqrt{3} ){e^{( - 2 + \sqrt{3} )t}} \\ y(t) = C1{e^{ - (2 + \sqrt{3} )t}} + C2 \times {e^{( - 2 + \sqrt{3} )t}} \\ \end{array} \right. \end{aligned}$$
(5)
Fig. 5.
figure 5

(a) Switch law of Example 2.2; (b) state response curve of switched system; (c) phase plane of switched system

Fig. 6.
figure 6

State response of subsystems. (a) State response curve of the first subsystem; (b) state response curve of the second subsystem; (c) state response curve of the third subsystem

When switch law \(\mathrm{{ - }}1 \le x \le 0\), define the second subsystem is \(\begin{array}{l} \frac{{dx}}{{dt}} = \mathrm{{ - }}2x + y \\ \frac{{dy}}{{dt}} = - x \\ \end{array}\), the general solution is

$$\begin{aligned} \left\{ \begin{array}{ll} x(t) = (C1 + C2 \times (t - 1)){e^{ - t}} \\ y(t) = (C1 + C2 \times t){e^{ - t}} \\ \end{array} \right. \end{aligned}$$
(6)

When switch law \(x < - 1\), defining third subsystem is \(\begin{array}{l} \frac{{dx}}{{dt}} = \mathrm{{ - }}x\mathrm{{ - }}3 \\ \frac{{dy}}{{dt}} = - x \\ \end{array}\), the general solution is

$$\begin{aligned} \left\{ \begin{array}{ll} x(t) = \frac{1}{2}C1 \times {e^{ - \frac{1}{2}t}}(\sin (\frac{{\sqrt{3} }}{2}t) - \sqrt{3} \cos (\frac{{\sqrt{3} }}{2}t)) \\ +\,\frac{1}{2}C2 \times {e^{ - \frac{1}{2}t}}(\sqrt{3} \sin (\frac{{\sqrt{3} }}{2}t) + \cos (\frac{{\sqrt{3} }}{2}t)) \\ y(t) = C1 \times {e^{ - \frac{1}{2}t}}\cos (\frac{{\sqrt{3} }}{2}t) + C2 \times {e^{ - \frac{1}{2}t}}\sin (\frac{{\sqrt{3} }}{2}t) + 3 \\ \end{array} \right. \end{aligned}$$
(7)

According to the general solution in Eqs. 57, when \(t \rightarrow \infty \), x(t), y(t) are all tended to 0. Therefore, when \(t \rightarrow \infty \), three subsystems of Example 3.1 are all tended to globally exponential stability. Supposed initial value is \(x(0) = \mathrm{{ - }}1,y(0) = 1\) and the value of t is from 0 to 100. Switch law of Example 3.1 is only related to the state of system, and it switches according to switch law in Fig. 5(a). Using MATLAB, we can draw the system state response and phase plane diagram in Figs. 5(b) and (c).

According to state response and phase plane curve of subsystems in Fig. 6, we can see that first and second subsystem are all tended to stability in Fig. 6(a) and in Fig. 6(b), third subsystem is unstable in Fig. 6(c), but the whole switched system is tended to globally exponential stability under the switch law in Fig. 5(c).

4 Conclusions

The article mainly expounds several kinds of switched system and their background, meaning and purpose of system simulation, establish mathematical model of each kind of switched system and analyzes stability of periodically switched system, impulsive switched system and designed event driven switched system whose switch strategy is related to the state of subsystem. Simultaneously, using MATLAB simulation software, we simulate and program those switched system and analyzes their stability from the whole switched system and their subsystems to study their relationship.

Stability is the basic condition of running a system, and is a challenging issue in the study of switched system [8]. So if you want to study the evolution process of a system, you must study the stable condition of system running. At present, many problems of switched systems still have miraculous differences and arguments in the academic which include the uncertainty and emergent of hybrid system, and there have no necessary and sufficient conditions to prove the stability of one switched system. So now, switched systems, scientific theories about simulation and method systems need to be further thought and developed in order to better apply to reality and solve more problems in more field of reality.