Keywords

These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

This chapter addresses the modelling abstraction of fast dynamic state transitions into instantaneous discrete state changes and its consequences and surveys various bond graph representations of hybrid system models proposed in the literature. The bond graph model-based quantitative approach to FDI in hybrid systems presented in Chap. 4 uses a bond graph representation with system mode independent computational causalities. As a result, a single set of equations in the form of a DAE system can be derived that holds for all system modes. The chapter concludes by addressing the index of the DAE system as it is an information that is relevant with regard to a symbolic and numerical processing of the DAE system.

2.1 Hybrid System Models

The way an engineering system is modelled depends on the purpose of a modelling and simulation study. Depending on the kind of problem or on the design stage modellers take different views of a system that either exists or is yet to be developed. For instance, it is well known that integrated digital circuits are modelled and simulated at different levels of abstractions. A hierarchical approach may start at the circuit level by accounting for the electrical dynamical behaviour of transistors, resistors and capacitors. One level up the hierarchy, the electrical behaviour is still of interest but transistors are abstracted into switches. State transitions are accounted for by rise and fall times. At the gate level the focus is on the logic behaviour of the circuits. The fact that a logic gate is built my means of electrical elements is taken into account by the time a signal needs to pass the logic gate. A top-down hierarchical design of complex digital circuitry starts at even higher levels of abstraction such as the register transfer level.

Besides the fast switching of transistors, electrical diodes or thyristors, fast changing phenomena such as the opening or closing of hydraulic check valves, the engagement-disengagement of clutches, stick-slip effects or stops in mechanical motion give rise to the modelling abstraction that such mode changes take place instantaneously and may be considered discrete events that either happen autonomously caused by internal continuous time variables that have crossed some threshold values or are due to external control signals. Such a modelling abstraction is justified because the continuous time evolution of fast mode transitions during short time intervals is not relevant for the overall dynamic system behaviour. That is, there are discrete events at which switch state variables instantaneously switch between discrete values. The set of all discrete switch states \(m_j(t), \; j = 1, \ldots , n_f\) characterises a system mode at time instant \(t > 0\). For the time span of a system mode, the discrete switch state variables take constant values while the system behaviour is described by a continuous time model that is mode specific. Hence, if the abstraction of instantaneous mode switches is adopted then a model encompasses discrete events at which mode changes instantaneously take place and continuous time models for the dynamic system behaviour in each mode. Such models are usually called hybrid system models.

Adopting a hybrid system model entails a number of consequences.

  • If fast switching devices are modelled as switches then parts of an overall system model are instantaneously disconnected or reconnected for a while. That is, an overall model is of variable structure. The result of such a structural change is a continuous time model that holds for the resulting system mode.

  • The number of state variables of an overall model is not time-invariant but mode dependent. Due to a connection of model parts storage elements may become dependent, e.g. if a clutch is engaged or if rigid bodies stick together for a while due to Coulomb friction.

    In [1], Cellier and Kofman call a model a variable structure model if structural properties such as the number of differential equations depend on the discrete state of some switches.

  • The formulation of a mathematical model becomes mode dependent. In one mode it may be an explicit state space model. If storage elements become dependent the model turns into a set of differential-algebraic equations (DAEs).

  • The numerical integration of the model equations often requires the determination of the time instant of the discrete events and a reinitialisation. Hence, the numerical computation of a hybrid system model may be viewed as the solution of a sequence of initial value problems (IVPs). Modern numerical solvers for DAE systems such as IDA [2] from the SUNDIALS suite or DASRT [3] provide a root finding feature such that the time instances of mode switches can be located.

    If an event condition rather than the time instant of an event is known, the event is commonly denoted as a state event. The event condition is specified by a function of continuous variables and a state event occurs when the function crosses zero. If the time instant of a discrete event is known in advance, the event is called a time event. In that case, the event can be scheduled to happen by entering its time and its type into a calendar of forthcoming events.

The computation of models with variable structure is still a subject of ongoing research as latest publications show [4, 5]. With regard to a modelling by means of bond graphs the question arises how to represent a hybrid system model in a bond graph framework.

2.2 Bond Graph Representations of Hybrid System Models

Bond graph modelling starts from considering the exchange of energy between system components and energy conversion. As the exchange and the conversion of energy happen continuously with respect to time, bond graph modelling was, at first, limited to the representation of continuous time models. Bond graphs were mainly developed to obtain a mathematical model in the form of a system of ODEs or DAEs for the simulation of the dynamic behaviour of a system or to obtain transfer functions for the analysis of the frequency domain behaviour, for the analysis of structural observability and controllability, or for the design of a controller. Besides, various proposals to extend the bond graph modelling framework to capture discrete discontinuous events have evolved during the past two decades. So far, none of the reported approaches has attained common usage.

Combination of Petri Nets and Bond Graphs

One approach is to combine the advantages of established graphical representations by capturing physically feasible system modes and discrete transitions between them in a Petri net (PN) and by modelling the dynamic behaviour in each system mode by a bond graph or set of disjoint bond graphs composed of standard elements [6, 7]. Accordingly,

  • the dynamic system behaviour is modelled by a set of bond graphs each of which has time-invariant computational causalities,

  • each bond graph holds for the time period between two discrete events,

  • for each system mode, the structure of the bond graph can be different,

  • the mathematical model is a set of initial value problems.

Other approaches prefer a uniform model representation and suggest to let bond graphs capture also instantaneous discontinuous state changes although power conservation means that it takes a finite time to change the content of an energy storage element. Bond graph representations of hybrid models can be categorised into those that aim to keep computational causalities system mode independent and those accepting variable causalities.

Switching Off and On Degrees of Freedom by Means of Switched Residual Sinks

One way to keep computational causalities time-invariant as proposed in [8] is to use sinks of invariant causality in conjunction with a modulated transformer \(\mathrm{MTF} : b(t)\) that switches off and on degrees of freedom.

Fig. 2.1
figure 1

Switching off and on degrees of freedom by sinks of invariant causality [6]

Example: Bouncing Ball

Figure 2.1 depicts the well known bouncing ball problem and a bond graph representation of a hybrid model.

In the bond graph of Fig. 2.1, \(b(t) \in \{0,1\} \; \forall \ t \ge 0\). For \(b = 0\), there is no force between the floor and the ball. The ball is freely moving in the air. If, however, the ball is in contact with the ground (\(b = 1\)) then the modulated effort source MSe imposes a constraint force \(\lambda \) which enforces that the ground and the ball move with the same velocity. Both inertia elements are in fixed integral causality. When the ball drops to the floor numerical integration restarts with new initial conditions. Modulated sinks imposing either an effort or a flow so that their input variable vanishes are termed residual sinks. As to the representation of the residual sink in Fig. 2.1, one might ask whether the relative velocity \(v_b - v_w\) is fed into the modulated effort sink as a signal when this information is already delivered into the sink by the power bond attached to it. A standard effort sink Se does not serve the intended purpose as its output is independent of the input. In this case, a sink is needed that delivers an output so that the input vanishes. To that end, the input is sensed and fed as a signal into a modulated sink. The presentation has been adopted from [9] where it is introduced to display controlled constraint forces in multibond graphs of rigid multibody systems. Actually, these modulated sinks represent Lagrange multipliers that are not limited to mechanical systems modelling and can be used for various other purposes as well, e.g. to add tearing information into a bond graph [10]. In the context of FDI, residual sinks can be used to couple a behavioural bond graph model of a system subject to faults to a bond graph of the faultless system with nominal parameters [11]. In Chap. 4, they are used in this way to numerically determine ARR residuals. For the sake of a concise bond graph representation residual sinks are denoted by the standard symbol of a source or sink prefixed by the letter ‘r’, e.g. rSe denotes a residuals effort sink.

Fig. 2.2
figure 2

Switched power junctions [6]

Switched Power Junctions (SPJs)

In order to account for the abstraction of ideal, no power consuming switching in a bond graph with invariant causalities that holds for all system modes, Umarikar extended 0- and 1-junctions by allowing for more than one bond to impose an effort on a 0-junction and more than one bond imposing a flow on a 1-junction with the constraint that only one of the causality imposing bonds is active at a time instant [12, 13]. These extensions are called switched power junctions and are not to be confused with controlled junctions to be referred to subsequently. Figure 2.2 illustrates the idea.

For a switched power junction holds

$$ \forall \; t \ge 0 \quad \exists \ j \in \mathbb {N} \quad ( m_j(t) = 1 \wedge \ m_i(t) = 0 \quad \forall \ \; i \ne j ) \nonumber $$

The equations for a switched power 0-junction read

$$\begin{aligned} e_3(t)&= {m_1(t)} e_1(t) + {m_2(t)} e_2(t) = e_4(t) \end{aligned}$$
(2.1a)
$$\begin{aligned} f_1(t)&= {m_1(t)} ( f_3(t) - f_4(t) ) \end{aligned}$$
(2.1b)
$$\begin{aligned} f_2(t)&= {m_2(t)} ( f_4(t) - f_3(t) ) \end{aligned}$$
(2.1c)

Accordingly, equations can be formulated for a switched power 1-junction.

Fig. 2.3
figure 3

Bond graph with SPJs of a boost converter [12]

Example: Boost Converter

The bond graph of a boost converter in Fig. 2.3 illustrates the use of these extended junctions.

Summation of efforts at the encircled left 1-junction and summation of flows at the rightmost encircled 0-junction yields mode dependent state equations (2.2a)–(2.2b)

$$\begin{aligned} 1&: \quad \;\, \displaystyle L \frac{d}{dt} i_L = E - {m_2} V_C - R_L i_L \end{aligned}$$
(2.2a)
$$\begin{aligned} 0&: \quad \displaystyle C \frac{d}{dt} V_C = {m_2} i_L - \displaystyle \frac{V_C}{R} \end{aligned}$$
(2.2b)

The Ideal Switch as a Bond Graph Element

If one is willing to accept that computational causalities in bond graphs are mode dependent and if one neglects the energy loss associated with an instantaneous change of a switch state then fast switching devices may be modelled as an ideal switch [1418] and represented by a bond graph switch element Sw or by controlled junctions [1921]. In the case of an open switch, the bond graph switch Sw becomes a zero flow source \(\mathrm{Se} :0\). In the case of a closed switch the bond graph switch element turns into a zero flow source \(\mathrm{Sf} :0\). Hence, the causality at a switch port is mode dependent as displayed in Fig. 2.4.

Fig. 2.4
figure 4

The ideal switch as an additional bond graph element

Remark 2.1

Van der Schaft and Schuhmacher call variables such as the power variables of the bond graph switch element Sw complementary variables in the sense that for the two of them an inequality holds and for all times at least one of them is strictly an equality. Systems in which mode switching is determined by complementarity conditions they call complementary systems [22]. In the case that both variables can be assumed to be nonnegative, the complementarity condition is often expressed as

$$\begin{aligned} 0 \le f(t) \; \perp \; e(t) \ge 0 \quad \text {or} \quad 0&\le e(t) - f(t) \ge 0 \end{aligned}$$
(2.3)

In general, the complementary variables can be vectors if inequalities hold componentwise.

Let \(\mathbf {M}\) be a \(k \times k\) matrix and \(\varvec{q}\) a \(k\)-dimensional real vector. The so-called linear complimentary problem then consists in finding \(k\)-dimensional vectors \(\varvec{\lambda }\) and \(\varvec{y}\) such that

$$\begin{aligned} \varvec{y}&= \mathbf {M} \varvec{\lambda } + \varvec{q} \end{aligned}$$
(2.4a)
$$\begin{aligned} \varvec{0}&\le \varvec{y} - \varvec{\lambda } \ge \varvec{0} \end{aligned}$$
(2.4b)

This problem has a unique solution if the matrix fulfills a certain condition [22].    \(\square \)

Example: Mechanical Stop

In the bond graph of Fig. 2.5, an ideal switch Sw is used to model an elastic mechanical stop.

Fig. 2.5
figure 5

Modelling a mechanical stop by means of an ideal switch [6, 18]

Clearly, if the cart is not in contact with the stop then \(F_\mathrm{sw} = 0 \, \wedge \, v_{12} := v_1 - v_2 \ge 0\). If the cart is in contact with the stop then \(F_\mathrm{sw} \ge 0 \, \wedge v_{12} = 0\). That is, \(0 \le F_\mathrm{sw} \perp v_{12} \ge 0\). The force \(F_\mathrm{sw}\) may be thought of as a Lagrange multiplier \(\lambda \) which is either zero or takes a value to be computed.

A causality change at a switch port propagates at least locally into the bond graph and affects the causality at the ports of other elements as indicated in Fig. 2.6 for the example of the mechanical stop.

Fig. 2.6
figure 6

Propagation of causality changes at the switch port

Causality changes due to a mode change can be captured by using a ‘Boolean’ variable \(b\) in the constitutive equation of the switch.

$$\begin{aligned} 0&= b \cdot F_\mathrm{sw} + \bar{b} \cdot (v_1 - v_2) \end{aligned}$$
(2.5)

where \(b(t) \in \{0,1\} \; \forall \ t \ge 0\) and \(\bar{b} := 1 - b\). Then the following DAE system can be deduced from the bond graph in Fig. 2.6.

$$\begin{aligned} \left[ \begin{array}{cc|cc} m &{} 0 &{} 0 &{} 0 \\ 0 &{} 1 &{} 0 &{} 0 \\ \hline 0 &{} 0 &{} 0 &{} 0 \\ 0 &{} 0 &{} 0 &{} 0 \end{array} \right] \left[ \begin{array}{c} \dot{v}_1 \\ \dot{F_c} \\ \hline \dot{v}_2 \\ \dot{F}_\mathrm{sw} \end{array} \right] \, + \, \left[ \begin{array}{cc|cc} 0 &{} 0 &{} 0 &{} 1 \\ 0 &{} 0 &{} -k &{} 0 \\ \hline 0 &{} 1 &{} r &{} -1 \\ \bar{b} &{} 0 &{} - \bar{b} &{} b \end{array} \right] \left[ \begin{array}{c} {v}_1 \\ {F_c} \\ \hline {v}_2 \\ {F}_\mathrm{sw} \end{array} \right]&= \left[ \begin{array}{c} F_\mathrm{in} \\ 0 \\ 0 \\ 0 \end{array} \right] \end{aligned}$$
(2.6)

In each of the two modes, DAE system (2.6) reduces to a simple ODE system.

Mosterman argues that ideal switches are not energy elements, that they represent control aspects rather than physical concepts ([21], p. 53).

Causality Resistors

Back in 1993, Asher proposed to assist an ideal switch by a resistor he called ‘causality resistor’ that adapts its causality to causality changes at the switch port so that the rest of the bond graph remains causally unaffected [23]. As long as the simulated dynamic behaviour is not significantly affected, the parameter value of a causality resistor can be chosen within reasonable limits but may lead to stiff model equations and thus may give rise to an increase of computational costs.

The physical meaning of a causality resistor depends on the application area and how it is used in conjunction with an ideal switch. For instance, the bond graph in Fig. 2.7 may be a piecewise linear model of an electrical diode. The corresponding circuit schematic is displayed in Fig. 2.8.

Fig. 2.7
figure 7

Bond graph model of an electrical diode using an ideal switch Sw and a ‘causality resistor’ \(\mathrm{R} : R_2\). a Ideal switch closed. b Ideal switch open

Fig. 2.8
figure 8

Piecewise linear model of an electrical diode

The causality resistor \(\mathrm{R} : R_2\) clearly avoids the propagation of causality changes at the port of the ideal switch into the rest of the bond graph and captures the diode’s high resistance \(R_\mathrm{off}\) in reverse mode. The resistor \(\mathrm{R} : R_1\) represents the diode’s small ON-resistance \(R_\mathrm{on}\).

Let \(i_D\) denote the current through the diode and \(\varDelta V : = V_a - V_b\). Then from the bond graph in Fig. 2.7a the equation

$$\begin{aligned} i_D&= \left( \frac{1}{R_1} + \frac{1}{R_2} \right) \varDelta V \; = \; \ \left( \frac{1}{R_\mathrm{on}} + \frac{1}{R_\mathrm{off}} \right) \varDelta V \; \approx \; \frac{1}{R_\mathrm{on}} \varDelta V \end{aligned}$$
(2.7)

is immediately deduced, where \(R_\mathrm{off} \gg R_\mathrm{on}\). Likewise, the causal bond graph in Fig. 2.7b gives

$$\begin{aligned} i_D&= i_{R_2} \; = \; \frac{1}{R_2} \varDelta V \; = \; \frac{1}{R_\mathrm{off}} \varDelta V \end{aligned}$$
(2.8)

As in the case of a mechanical stop (cf. Fig. 2.6), the bond graphs for both modes in Fig. 2.7 can be merged into one single bond graph from which equations valid for both modes can be deduced.

Fig. 2.9
figure 9

Bond graph of the diode model capturing both modes

From the bond graph in Fig. 2.9 the following equations can be derived.

$$\begin{aligned} i_2&= \frac{\varDelta V}{R_\mathrm{off}} \end{aligned}$$
(2.9a)
$$\begin{aligned} i_D&= i_2 + i_\mathrm{sw} \end{aligned}$$
(2.9b)
$$\begin{aligned} \varDelta V&= R_\mathrm{on} i_\mathrm{sw} + u_\mathrm{sw} \end{aligned}$$
(2.9c)

The constitutive equation of the switch may be expressed by means of a variable \(b(t) \in \{0,1\} \; \forall \ t \ge 0\). Let \(\bar{b} := 1 - b\). Then

$$\begin{aligned} 0&= b \, i_\mathrm{sw} + \bar{b} \, u_\mathrm{sw}. \end{aligned}$$
(2.10)

That is, \(b(t) = 0\) means that the switch is closed, \(b(t) = 1\) indicates that the switch is open.

From this set of equations an equation for the current \(i_D\) can be obtained that holds for both modes.

$$\begin{aligned} i_D&= \left( \frac{1}{R_\mathrm{off}} + \frac{\bar{b}}{\bar{b} \, R_\mathrm{on} - b} \right) \varDelta V \end{aligned}$$
(2.11)

Controlled Junctions

As early as 1974, Thoma introduced the concept of time dependent junctions [24] in order to switch off and on connections between power ports. Mosterman picked up this idea and introduced controlled junctions [21]. In contrast to switched power junctions, a local control algorithm associated with a controlled junction switches off all adjacent bonds of a controlled junction when a switching device considered as an ideal switch turns off and re-activates all bonds when the switch is closed. That is, an ideal switch in ON-mode is represented by a standard 0- or 1-junction. In OFF-mode the junction is replaced by a source of value zero as shown in Fig. 2.10.

Fig. 2.10
figure 10

Controlled 0-junction. a ON mode. b OFF mode

As Fig. 2.10 shows, a discrete switch state change entails a change in causality that is to be propagated into the bond graph. Bond graphs using controlled junctions are usually called Hybrid Bond Graphs (HBGs).

Figure 2.11 displays a hybrid bond graph for the well known bouncing ball problem given the assumption of a perfect non-elastic collision between the ball and the floor. As the focus of the bond graph methodology is to model the continuous time exchange of energy between system components and possible energy conversion and since none of the proposed extensions to include discrete events has become a widely accepted standard, there is not much bond graph software that support hybrid bond graphs. Mosterman has developed a software HYBrSIM especially suited for continuous-discrete event bond graph modelling using controlled junctions [25]. In the tool suite MoTHS, hybrid bond graphs are transformed into block diagrams by using block diagram models that can be efficiently reconfigured for those parts of a hybrid bond graph that need a re-assignment of causality after a system mode change has happened [20]. Wang and his co-workers [26] also map hybrid bond graphs onto block diagrams for simulation with Simulink® Footnote 1[27].

Fig. 2.11
figure 11

Hybrid bond graph of the bouncing ball problem and a finite state automaton associated with the controlled 0-junction \(0_1\) [6, 21]

Fig. 2.12
figure 12

Bond graph representation of a non-ideal switch. a Piecewise linear approximation of the characteristic of a diode. b Bond graph model of a switching device with \(\mathrm{R} : R_{on}\) in fixed conductance causality

Non-ideal Switches

Finally, another way to keep computational causalities in a bond graph system mode independent is to model fast switching devices as non-ideal switches and to account for a resistance in ON-mode. The functionality of electronic diodes or hydraulic check valves suggests to represent a non-ideal switch in a bond graph by means of a resistor with conductance causality. In [28], the nonlinear characteristic of a diode is approximated by a piecewise linear one. The switching is explicitly represented by decomposing the resistor into an MTF with a modulus \(m(t) \in \{0,1\} \; \forall \ t \ge 0\) and a resistor \(\mathrm{R} : R_{on}\) accounting for the ON-resistance as displayed in Fig. 2.12. Depending on the value of the transformer modulus \(m(t)\), model parts linked by such MTFs are either connected or disconnected. For \(s\) switches in a hybrid model, there are \(s_f \le 2^s\) physically feasible switch state combinations. Each one of them constitutes a system mode.

In this book, the bond graph representation of a non-ideal switch proposed by Ducreux et al. as early as 1993 is used in a bond graph model-based approach to FDI in hybrid systems. This approach offers the following advantages.

  • Switching devices, e.g. semiconductor switches in power electronic systems that are explicitly represented by a component model can be more easily identified in a bond graph in comparison to a representation that accounts for switches by controlled junctions. An initial not simplified bond graph is more close to a system schematic (cf. Chap. 4, Figs. 4.2 and 4.3).

  • One single bond graph can be set up that holds for all system modes.

  • The standard Sequential Causality Assignment Procedure (SCAP) can be applied without any modification resulting in time-invariant computational causalities.

  • A single set of model equations as well as equations for fault indicators valid for all system modes can be (automatically) derived from the bond graph. They contain the discrete moduli \(m_i(t) \in \{0,1\}\), \(i = 1, \ldots , s\), of the switching MTFs. Inserting values for the moduli belonging to a feasible switch state combination gives the equations that hold for the associated system mode.

  • Existing software such as SYMBOLS™Footnote 2 [29] could be used to generate a set of ARRs.

Fig. 2.13
figure 13

Bipolar transistor with a reversed biased diode in parallel often used in power electronic converters and its bond graph representation. a Transistor-diode pair. b Bond graph representation

Semiconductor switches in power electronic inverters are commonly made up of a transistor together with a diode in anti-parallel connection as depicted in Fig. 2.13a for a bipolar transistor to provide a path for an inductive load current when conducting switches are turned off and thus to avoid damage of the transistors in an inverter. MOSFET transistors have a built-in diode. Figure 2.13b shows a bond graph model of such a transistor-diode pair.

The time invariant conductance causality of the ON resistor of non-ideal switches may lead to conflicts at junctions that can be resolved by adding a storage element. Equations derived from a bond graph may be symbolically formulated in such a way that the parameter of these additional storage elements can be set to zero as well as the small ON resistance of some switches turning them into ideal switches and avoiding small time constants. That is, ideal switches may be considered the limit case of non-ideal switches. Avoiding stiff equations is of interest in the case when an explicit formulation of ARRs is not possible so that the model equations need to be solved numerically in order to determine the residuals of ARRs. In [30], Buisson et al. compare the use of ideal and non-ideal switches in a bond graph framework in the light of perturbation theory.

For the sake of a concise representation in the bond graphs of the examples in this book, a switched \(\mathrm{MTF} : m(t)\), \(m \in \{0,1\}\), in conjunction with the ON resistance \(R : \mathrm{R}_\mathrm{on}\) of a switch is represented as a component model denoted by \(\mathrm{Sw} : m\) as shown in Fig. 2.14.

Fig. 2.14
figure 14

Bond graph model of a non-ideal switch denoted as a component model \(\mathrm {Sw} : m\)

Instantaneous Structural Changes

If phenomena such as the engagement of a clutch or a change from slip to stick friction is considered as a discrete event then the instantaneous mode change results in a change of the number of state variables. As long as two moving rigid bodies stick together due to friction they build a single body for some time span with one single state variable. In power electronic systems, the OFF state of a switch may cause two inductor currents to become equal. This means that in a bond graph representation of a hybrid model causality at some storage ports may change from integral to derivative causality. Preferred integral causality may, however, be preserved by using a modulated sink that either impose an effort or a flow on two dependent storage elements so that their output variables become equal. They are to be activated whenever a system mode change happens that causes two storage elements to become dependent. Their activation can be achieved by a ‘Boolean’ controlled transformer as depicted for the example of a mechanical clutch.

Example: Mechanical Clutch

Figure 2.15 depicts a bond graph representation of a hybrid model of a clutch.

Fig. 2.15
figure 15

Bond graph of a clutch with fixed mode independent causalities

The left upper modulated effort source provides a moment \(M\) that enforces that the plates of the clutch stick together when the clutch is in mode ‘engaged’, i.e. their angular velocities are equal. This moment is imposed on the two I-elements in integral causalities. At the time instant the clutch instantaneously switches from disengagement to engagement, numerical integration must be re-initialised. At this discrete event, the modulated sink is activated and the output of both I-elements jump to a common value and integration restarts from this value.

2.3 Equations Formulation for Switched LTI Systems

The use of such modulated sinks that are activated and deactivated at discrete time instances means that the underlying mathematical model is of the form of a DAE system. These sinks enforce that algebraic constraints for the output variables of some storage elements are met but there is no differential equation for their output. When the modulated sinks are active, the DAE system is of index 2.

Let the moduli \(m_j(t) \in \{0,1\} \; \forall \ t \ge 0\), \(j = 1, \ldots , n_s\), of the \(n_s\) switching MTFs be grouped into a vector \(\varvec{m}(t)\), the outputs \(\varvec{z}_i\) of all storage elements in integral causality, the inputs \(\varvec{z}_d\) of all storage elements in derivative causality and the outputs of resistors and switches be grouped into a descriptor vector \(\varvec{x}\). The outputs of all modulated sinks activated at switching events are combined into a vector \(\varvec{\lambda }\). Let \(\varvec{u}\) denote the vector of all system inputs.

Fig. 2.16
figure 16

Partitioning of a bond graph model into fields

If it is assumed that the system under consideration can be described by a linear time-invariant model for the time spans between two discrete switching events then, starting from the partitioning of a bond graph model into fields as displayed in Fig. 2.16, a DAE system in the form

$$\begin{aligned} \left[ \begin{array}{c|c} \varvec{E} &{} \varvec{0} \\ \hline \varvec{0} &{} \varvec{0} \end{array} \right] \frac{d}{dt} \left[ \begin{array}{c} \varvec{x}(t) \\ \hline \varvec{\lambda }(t) \end{array} \right]&= \left[ \begin{array}{c|c} \varvec{A}_{11}(\varvec{m}(t)) &{} \varvec{A}_{12}(\varvec{m}(t)) \\ \hline \varvec{A}_{21}(\varvec{m}(t)) &{} \varvec{0} \end{array} \right] \left[ \begin{array}{c} \varvec{x}(t) \\ \hline \varvec{\lambda }(t) \end{array} \right] \nonumber \\&+ \, \left[ \begin{array}{c} \varvec{B}_1(\varvec{m}(t)) \\ \hline \varvec{B}_2(\varvec{m}(t)) \end{array} \right] \varvec{u}(t) \end{aligned}$$
(2.12)

can be established. In (2.12), the matrices are of proper dimensions and \(\varvec{E} = \left[ \begin{array}{c} \varvec{E}_1 \\ \varvec{0} \end{array} \right] \).

If, for some time intervals, no residual sinks are switched on via an MTF, then the mathematical model takes the form

$$\begin{aligned} \varvec{E}\dot{\varvec{x}}(t)&= \varvec{A}_{11}(\varvec{m}(t))\varvec{x}(t) + \varvec{B}_1(\varvec{m}(t))\varvec{u}(t) \end{aligned}$$
(2.13)

for these time intervals. If the set of algebraic constraints can be solved then the DAE system can be reduced to an explicit linear state equation.

For controlled switching elements, the time instances of the discrete state transitions are known a priori. For other events such as the transition from slip to stick friction, the value of the MTF moduli involved is the result of a local automaton evaluating constraints on model variables. In that case, the time instant of the event is to be determined and numerical integration is to be reset in general.

For the clutch example, the DAE system derived from the BG in Fig. 2.15 reads

$$\begin{aligned} \left[ \begin{array}{cc|c} J_1 &{} 0 &{} 0 \\ 0 &{} J_2 &{} 0 \\ \hline 0 &{} 0 &{} 0 \end{array} \right] \frac{d}{dt} \left[ \begin{array}{c} \omega _1 \\ \omega _2 \\ \hline M \end{array} \right]&= \left[ \begin{array}{cc|c} 0 &{} 0 &{} -(1 - b) \\ 0 &{} 0 &{} (1 - b) \\ \hline (1 - b)\, &{} - \,(1 - b) &{} 0 \end{array} \right] \left[ \begin{array}{c} \omega _1 \\ \omega _2 \\ \hline M \end{array} \right] \nonumber \\&\,+ \left[ \begin{array}{ccc} 1 &{} 0 &{} -b \\ 0 &{} -1 &{} b \\ 0 &{} 0 &{} 0 \end{array} \right] \left[ \begin{array}{c} M_1 \\ M_2 \\ M_R \end{array} \right] \end{aligned}$$
(2.14)

If the clutch is disengaged (\(b = 1)\) then the DAE system reduces to

$$\begin{aligned} \left[ \begin{array}{cc} J_1 &{} 0 \\ 0 &{} J_2 \end{array} \right] \frac{d}{dt} \left[ \begin{array}{c} \omega _1 \\ \omega _2 \end{array} \right]&= \left[ \begin{array}{ccc} 0 &{} 0 &{} 0 \\ 0 &{} 0 &{} 0 \end{array} \right] \left[ \begin{array}{c} \omega _1 \\ \omega _2 \end{array} \right] + \left[ \begin{array}{ccc} 1 &{} 0 &{} - 1 \\ 0 &{} -1 &{} 1 \end{array} \right] \left[ \begin{array}{c} M_1 \\ M_2 \\ M_R \end{array} \right] \end{aligned}$$
(2.15)

and could be formulated as an explicit state space equation.

A different bond graph approach to hybrid system modelling recently proposed by Margetts [19] inspired by the work of Buisson [31] and of Mosterman [21] also leads to an implicit formulation of system equations that holds for all system modes and can be systematically constructed from a hybrid bond graph. This approach makes use of controlled junctions and partitions the field of storage elements and the field of resistors into a field with elements having static causalities and another field with elements having causalities that dynamically change. Margetts terms the latter dynamic causalities and expresses them on a hybrid bond graph by a dashed perpendicular causal stroke in addition to the solid line causal stroke assigned by application of the SCAP.

2.4 Index of a DAE System Derived from the Bond Graph of a Hybrid Model

In this book, switching devices such as electrical diodes and transistors, or hydraulic valves are modelled as non-ideal switches represented by a bond graph component model Sw that is composed of a switched MTF and a resistor in fixed conductance causality. The choice of fixed conductance causality is motivated by the fact that it is the flow through the element that is determined by the discrete switch state.

Structural changes such as the engagement and disengagement of a clutch or the change between slip and stick mode for two rigid bodies considered as instantaneous discrete events cause the number of states in one system mode to change instantaneously at the advent of a discrete event. If two rigid bodies stick together for the duration of that system mode, the two of them may be considered as one body, or one inertia is dependent of the other so that one degree of freedom is temporarily lost. As presented in Sect. 2.3, such structural changes are modelled in a bond graph by means of a switched MTF and a residual sink that supplies an output variable so that its input vanishes. As a result, storage elements that have been assigned integral causality remain in integral causality for all system modes. If linear constitutive element equations are assumed, the equations derived from such a bond graph with static, system mode independent causalities can be formulated as a linear implicit DAE (2.12).

A characteristic of DAEs besides their form is their differentiation index [32]. For a definition and an example see Appendix C. It is an indicator for the problems to be encountered with the numerical solution of a set of DAEs. Systems of index \(>\)1 are usually called higher index DAEs and the higher the index the more severe numerical difficulties can be. As the mathematical description of problems in various disciplines often leads to DAE system, they have been a research subject for more than two decades. A large body of publications and a number software programs for their numerical solution have emerged. DAE systems of index 1 can be safely numerically computed by means of the backward differentiation formula (BDF) [33, 34] implemented in solvers such as the well known and widely used DASSL code [35].

For the solution of higher index problems, index reduction techniques [34] such as the graph-based Pantelides algorithm [36] or the dummy derivative method [37] have been reported in the literature and are used in some software programs. Both methods are based on the symbolic differentiation of some of the constraint equations of a DAE system and thus introduce equations with higher order derivatives of unknown variables with respect to time. This differentiation entails a problem in its own to find a set of consistent initial values. The Pantelides algorithm aiming at the determination of a set of consistent initial conditions can and is used to determine which equations are to be differentiated how many times in order to reduce the index to one or zero. The algorithm assumes that the index does not change. A direct initialization technique for DAE systems has been presented in [38]. Reference [39] consideres the problem of consistent initial conditions for switched linear passive network.

Index reduction entails another well known problem, namely that of numerical drift. Original constraint equations get lost by differentiation and cannot be taken into account in the numerical solution of the reduced index system. Hence, the numerical solution of the reduced index problem can only approximate the original constraints. This suggests to keep the original constraints and differentiated equations in the numerical solution of the reduced index problem resulting in more equations than unknowns in the reduced index problem. The dummy derivative method addresses this problem by considering the derivatives of some variables as new independent algebraic variables called dummy derivatives so that the number of unknowns matches the number of equations. This approach, however, requires to decide which variables are selected as dummy derivatives and which ones as states.

Hybrid models may be described by a single set of DAEs including discrete state variables, e.g. switch state variables that change their discrete values at discrete events. That is, for each set of values of the discrete state variables representing a physically feasible system mode a set of DAEs is obtained that describes the dynamic behaviour in that system mode. Such a set of \(\textit{n}_\textit{f}\) DAE systems

$$\begin{aligned} \varvec{F}_i( \varvec{x}(t), \dot{\varvec{x}}(t), \varvec{u}(t), \varvec{y}(t)) \, = \, \varvec{0} \; , \quad i = 1, \ldots , n_f \end{aligned}$$
(2.16)

together with a set of conditions \(i = C(t, \varvec{x})\) is termed a system of hybrid DAEs (HDAEs) where \(\varvec{F}\) denotes a vector-valued function, \(t\) the time, \(\varvec{x}\) the vector of unknown variables composed of state variables and algebraic variables, \(\varvec{u}\) the vector of known inputs and \(\varvec{y}\) the vector of outputs. Evaluation of the function \(C\) at the advent of a discrete event determines which DAE system is to be used to describe the dynamic behaviour for the duration of the next system mode. At discrete events parts of the overall DAE system are deactivated or re-activated so that the index of a DAE system for subsequent system mode may be different from the one of the DAE system for the current system mode. For the duration of a system mode, however, the DAE index remains constant. A mixed symbolic and numerical solution of HDAEs involves

  • index reduction and a selection of states for the reduced index problem augmented by initial constraints and differentiated equations,

  • discrete event detection during evaluation of a continuous time model for the current system mode,

  • initialisation at start time and re-initialisation at discrete events.

Algorithms for these tasks have been implemented, for instance, in the open-source OpenModelica software environment [40, 41].

As problems are to be encountered with the numerical solution of higher index DAEs and as there is no general solver for them, given a causal bond graph, it is an important question of what index a DAE system derived from the bond graph is. In [42], van Dijk classifies causal paths and determines the index of bond graphs of continuous time models with a given type of causal paths. For hybrid models, a bond graph representation with time-invariant causalities is used in this book. Causal paths through switches, however, depend on the switch state.

First, it is assumed that all storage elements are in integral causality for all system modes. That is, no residual sinks are switched on at discrete events to keep some storage elements in integral causality that otherwise would be become dependent and would get derivative causality accordingly. Causal paths between resistive ports are allowed. As the switch model contains a resistor in conductance causality, there may also be causal paths between a resistor and a switch or between switches. If a switch in one of these causal paths is in OFF mode, the switch and the causal path can be disregarded. Causal paths between resistors mean that their outputs are determined by a set of algebraic relations. Let \(\varvec{a}\) denote the vector of the outputs of resistors and of switches, then the DAE of a switched LTI system is of the form

$$\begin{aligned} \left[ \begin{array}{cc} \mathbf {I} &{} \mathbf {0} \\ \mathbf {0} &{} \mathbf {0} \end{array} \right] \left[ \begin{array}{c} \dot{\varvec{x}}(t) \\ \dot{\varvec{a}}(t) \end{array} \right]&= \left[ \begin{array}{cc} \mathbf {A}_{11}(\varvec{m}(t)) &{} \mathbf {A}_{12}(\varvec{m}(t)) \\ - \mathbf {A}_{21}(\varvec{m}(t)) &{} \mathbf {I} - \mathbf {A}_{22}(\varvec{m}(t)) \end{array} \right] \left[ \begin{array}{c} \varvec{x}(t) \\ \varvec{a}(t) \end{array} \right] \nonumber \\&\quad \, \,+ \left[ \begin{array}{c} \mathbf {B}_1(\varvec{m}(t)) \\ - \mathbf {B}_2(\varvec{m}(t)) \end{array} \right] [\varvec{u}] \end{aligned}$$
(2.17)

where \(\varvec{m}(t)\) denotes the vector of switch states \(m_j(t) \in \{0,1\}\), \(j = 1, \ldots , n_s\), at time instant \(t > 0\). For the time interval between two discrete events, \(\varvec{m}(t)\) is constant. Differentiation of the algebraic equation

$$\begin{aligned} \varvec{0}&= - \mathbf {A}_{21} \varvec{x} + (\mathbf {I} - \mathbf {A}_{22}) \varvec{a} - \mathbf {B}_2 \varvec{u} \end{aligned}$$
(2.18)

with respect to time yields the new DAE system

$$\begin{aligned} \underbrace{ \left[ \begin{array}{cc} \mathbf {I} &{} \mathbf {0} \\ - \mathbf {A}_{21} \;\; &{} \mathbf {I} - \mathbf {A}_{22} \end{array} \right] }_{\displaystyle \mathbf {E}^{1}} \left[ \begin{array}{c} \dot{\varvec{x}}(t) \\ \dot{\varvec{a}}(t) \end{array} \right]&= \left[ \begin{array}{cc} \mathbf {A}_{11}(\varvec{m}(t)) &{} \mathbf {A}_{12}(\varvec{m}(t)) \\ - \varvec{0} &{} \varvec{0} \end{array} \right] \left[ \begin{array}{c} \varvec{x}(t) \\ \varvec{a}(t) \end{array} \right] \\&\quad \,\, + \left[ \begin{array}{c} \mathbf {B}_1(\varvec{m}(t)) \varvec{u} \\ - \mathbf {B}_2(\varvec{m}(t)) \dot{\varvec{u}}\end{array} \right] \nonumber \end{aligned}$$
(2.19)

In [42], van Dijk has shown that the determinant of \(\mathbf {E}^{1}\), \(\mathrm{det}(\mathbf {E}^{1}) = \mathrm{det}(\mathbf {I} - \mathbf {A}_{22})\), is non-zero for bond graphs with causal paths between resistive ports. That means that the inverse of \(\mathbf {E}^{1}\) exists and that differentiation of the algebraic equation (2.18) is sufficient to transform the DAE system (2.17) into a set ODEs. Accordingly, (2.17) is a DAE system of index 1.

Example: Electrical Network with Two Independent Switches

This is checked for the example of the switched network in Fig. 2.17.

Fig. 2.17
figure 17

Electrical circuit with two independent switches

The two switches may be operated independently. That is, there are four physical feasible switch state combinations constituting four system modes. The circuit diagram is easily transformed into the causal bond graph in Fig. 2.18. The switches are considered non-ideal and are represented by a model Sw containing a switched \(\mathrm{MTF}\): \(m(t)\) in conjunction with an ON resistor in fixed conduction causality. The two storage elements are in integral causality in all four system modes.

The bond graph in Fig. 2.18 contains three causal paths between resistors and switches.

$$\begin{aligned} \mathrm{R} : R_1&\rightarrow e_2 \rightarrow e_3 \rightarrow e_4 \rightarrow \mathrm{Sw} : m_1 \\ \mathrm{R} : R_1&\rightarrow e_2 \rightarrow e_3 \rightarrow e_9 \rightarrow e_{11} \rightarrow \mathrm{Sw} : m_2 \\ \mathrm{R} : R_2&\rightarrow e_{10} \rightarrow e_{11} \rightarrow \mathrm{Sw} : m_2 \end{aligned}$$
Fig. 2.18
figure 18

Bond graph with system mode independent causalities of the electrical circuit in Fig. 2.17

The DAE system for that example reads

$$\begin{aligned} \frac{d}{dt} \left[ \begin{array}{c} i_L \\ u_c \end{array} \right]&= \left[ \begin{array}{cc} 0 &{} \displaystyle -\frac{1}{L} \\ \displaystyle \frac{1}{C} &{} 0 \end{array} \right] \left[ \begin{array}{c} i_L \\ u_c \end{array} \right] + \left[ \begin{array}{cccc} \displaystyle - \frac{1}{L} &{} 0 &{} 0 &{} 0 \\ 0 &{} \displaystyle \frac{1}{C} &{} 0 &{} 0 \end{array} \right] \left[ \begin{array}{c} u_{R_1} \\ u_{R_2} \\ i_{Sw_1} \\ i_{Sw_2} \end{array} \right] + \left[ \begin{array}{c} \displaystyle \frac{1}{L} \\ 0 \end{array} \right] [E] \end{aligned}$$
(2.20)

and

$$\begin{aligned} \underbrace{ \left[ \begin{array}{c} u_{R_1} \\ u_{R_2} \\ i_{Sw_1}\\ i_{Sw_2} \end{array} \right] }_{\displaystyle \varvec{a}}&= \underbrace{ \left[ \begin{array}{cc} R_1 &{} 0 \\ 0 &{} 0 \\ 0 &{} 0 \\ 0 &{} \displaystyle - \frac{m_2}{R_o} \end{array} \right] }_{\displaystyle \mathbf {A}_{21}} \underbrace{ \left[ \begin{array}{c} i_L \\ u_c \end{array} \right] }_{\displaystyle \varvec{x}} + \underbrace{ \left[ \begin{array}{cccc} 0 &{} 0 &{} R_1 &{} R_1 \\ 0 &{} 0 &{} 0 &{} R_2 \\ \displaystyle - \frac{m_1}{R_o} &{} 0 &{} 0 &{} 0 \\ \\ \displaystyle - \frac{m_2}{R_o} &{} \displaystyle - \frac{m_2}{R_o} &{} 0 &{} 0 \end{array} \right] }_{\displaystyle \mathbf {A}_{22}} \underbrace{ \left[ \begin{array}{c} u_{R_1} \\ u_{R_2} \\ i_{Sw_1} \\ i_{Sw_2} \end{array} \right] }_{\displaystyle \varvec{a}} + \underbrace{ \left[ \begin{array}{c} 0 \\ 0 \\ \displaystyle \frac{m_1}{R_o} \\ \\ \displaystyle \frac{m_2}{R_o} \end{array} \right] }_{\displaystyle \mathbf {B}_2} \underbrace{[E]}_{\displaystyle \varvec{u}} \end{aligned}$$
(2.21)

where \(R_o\) denotes the ON resistance of the switches. Transformation to triangular form shows that the matrix (\(\mathbf {I} - \mathbf {A}_{22}\)) is non-singular independent of the switch states \(m_1(t), m_2(t)\). That is, the DAE system describing the dynamic behaviour of the switched network is of index 1 for all four system modes.

Example: DC-DC Buck Converter

Figure 2.19 depicts the circuit schematic of a buck converter.

Fig. 2.19
figure 19

Circuit schematic of a DC-DC buck converter

If the transistor \(Q_1\) and the diode \(D_1\) are modelled as non-ideal switches the bond graph in Fig. 2.20 is obtained.

Fig. 2.20
figure 20

Bond graph in preferred integral causality of the buck converter in Fig. 2.19

Fig. 2.21
figure 21

Bond graph in preferred integral causality of the buck converter in case \(\mathrm{Sw} : m_2\) is on

The two switches commutate conversely. There are two system modes, in which one switch is on while the other one is off. A third feasible mode, in which both switches are off is not considered. If one of the switches is on, conductance causality of its ON resistance can be changed. The result is a causal path between the two non-ideal switches. In Fig. 2.21, it has been assumed that \(\mathrm{Sw} : m_2\) is on.

However, as one of two switches is off, i.e. the current through that switch vanishes, the causal path can be disregarded. That is, in system modes \(m_1 =1 \, \wedge \, m_2 = 0\) and \(m_1 =0 \, \wedge \, m_2 = 1\), there are no causal paths between resistive ports and no dependent storage elements giving rise to an algebraic constraint between state variables. Hence, the dynamic behaviour in these modes is described by a set of two ODEs. In the context of DAEs, the special case of ODEs without any additional algebraic constraints is termed a DAE system of index 0.

If there are storage elements with derivative causality in all system modes then causal paths may exist to other storage elements of the same type in integral causality. This means that the state variable of a storage element in derivative causality is algebraically related to the state variables of a storage elements in integral causality. Also in this case, the DAE system for the time interval between two discrete events is of index 1 [42].

Structural Changes

For some systems with structural changes such as a clutch, storage elements may temporarily become dependent for the duration of a system mode. In such a case, a residual sink may be switched on that delivers a power variable so that the conjugate power variable vanishes and storage elements can keep integral causality. As their state variables jump to a new joint value, numerical integration has to be re-initialised at such a discrete event.

For a system mode, in which such switched residual sinks provide a non-zero output \(\varvec{\lambda }\), the DAEs for a switched LTI system are of the form

$$\begin{aligned} \left[ \begin{array}{cc} \mathbf {I} &{} \mathbf {0} \\ \mathbf {0} &{} \mathbf {0} \end{array} \right] \frac{d}{dt} \left[ \begin{array}{c} \varvec{x} \\ \varvec{\lambda }\end{array} \right]&= \left[ \begin{array}{cc} \mathbf {A}_{11} &{} \mathbf {A}_{12} \\ \mathbf {A}_{22} &{} \mathbf {0} \end{array} \right] \left[ \begin{array}{c} \varvec{x} \\ \varvec{\lambda } \end{array} \right] + \left[ \begin{array}{c} \mathbf {B}_1 \\ \mathbf {0} \end{array} \right] [ \varvec{u} ] \end{aligned}$$
(2.22)

The entries of the matrices depend on the values of the current switch states. As the variable \(\varvec{\lambda }\) is absent in the algebraic constraint

$$\begin{aligned} \varvec{0}&= \mathbf {A}_{22} \varvec{x} \end{aligned}$$
(2.23)

differentiation of (2.23) does not give an equation for \(\dot{\varvec{\lambda }}\) but an algebraic equation that is called a hidden constraint.

$$\begin{aligned} \varvec{0}&= \mathbf {A}_{22} [ \mathbf {A}_{11} \varvec{x} + \mathbf {A}_{11} \varvec{\lambda } + \mathbf {B}_1 \varvec{u} ] \end{aligned}$$
(2.24)

If the matrix \(\mathbf {A}_{22}\mathbf {A}_{11}\) is non-singular, (2.24) differentiated with respect to time can be solved for \(\mathrm{d} \varvec{\lambda }/ \mathrm{dt}\). According to the definition of the differentiation index, the DAE in this system mode is of index 2.

Remark 2.2

  1. 1.

    Initial conditions must also satisfy hidden constraints. It is these hidden constraints that pose problems for DAE-solvers.

  2. 2.

    The DAE form (2.22) is known as Hessenberg index-2 form. This form can be directly numerically solved by the DASKP 3.0 solver [43, 44] or the MEBDFI [45] solver available in Maple [46]. Both solvers use the BDF method.   \(\square \)

As a result, if the dynamic behaviour of a system can be described by a switched LTI system, the DAE system derived from the bond graph is of index \(\le \)1 as long as no structural changes occur. If a structural change modelled by a switched residual sink happens, the DAE index jumps to two.

Example: Clutch

As an example, consider the bond graph of a clutch in Fig. 2.15. There are no causal paths between resistors and no dependent storage elements. Clearly, as long as the clutch is disengaged, the DAE system is of index 0. In the case when the clutch is engaged, the unknown constraint force \(M\) between the two plates keeps their inertia elements in integral causality and at the same time ensures that the algebraic constraint

$$\begin{aligned} 0&= \omega _1 - \omega _2 \end{aligned}$$
(2.25)

holds. Clearly, differentiating this constraint with respect to time does not give the derivative of the unknown constraint force \(M\). Substituting \(\mathrm{d}\omega _1 / \mathrm{dt}\), \(\mathrm{d}\omega _2 / \mathrm{dt}\) in the derivative of the constraint allows to obtain \(\mathrm{d}M / \mathrm{dt}\) after differentiation of the resulting hidden constraint

$$\begin{aligned} 0&= - \frac{1}{J_1} M + \frac{1}{J_1} M_1 - \frac{1}{J_2} M + \frac{1}{J_2} M_2 \end{aligned}$$
(2.26)

Hence, once the clutch is engaged, the DAE is of index 2.

2.5 Discrete Event Simulation of Hybrid Systems

Instead of discretising the time and using a BDF-based method for the numerical computation of a continuous-time model one may think of quantising the state variables. That is, instead of using a multistep method to compute an approximation of the value \(x(t_{k+1})\) of a state variable \(x\) at time \(t_{k+1}\), the question then is at what time the state \(x\) will deviate from its current value \(x(t_k)\) by more than a given quantum \(\varDelta Q\). In other words, the task is to find the smallest time step \(h\) so that

$$\begin{aligned} x(t_k + h)&= x(t_k) \pm \varDelta Q \end{aligned}$$
(2.27)

This approach replaces the traditional discrete time based computation of continuous time models by a discrete event simulation that advances the time from the time point of an event to the time of the next event which is attractive for the computation of hybrid models because discrete events, i.e. discontinuous mode changes, and the continuous time behaviour during system modes can be uniformly processed in the framework of the well-known Discrete EVent System (DEVS) specification introduced by Ziegler [47, 48]. Moreover, the DEVS formalism is supported by software libraries such as adevs [49, 50] or simulation environments such as PowerDEVS [51, 52].

A DEVS model of a system takes a sequence of discrete events, i.e. of instantaneous system changes, as inputs and produces an output sequence of events according its initial conditions. Figure 2.22 displays this input/output behaviour of a DEVS model. Events can be characterised by a value and the time point of their occurrence. Accordingly, they are indicated by perpendicular strokes in Fig. 2.22. A sequence of events is called an event trajectory. It is assumed that the number of state changes in any finite time interval is finite.

Fig. 2.22
figure 22

Input/output behaviour of a DEVS model [1, 53]

An atomic DEVS model is defined as a tuple of sets and functions (cf. Appendix A.3). If the output events of an atomic DEVS model are converted into input events of another atomic DEVS model, i.e. if atomic DEVS models are coupled, then the result defines a new DEVS model. That is, complex systems can be modelled in the DEVS framework in a hierarchical manner. The DEVS formalism is widely used in computer science. Its application to the numerical solution of continuous-time models, however, is much less common.

The quantised state system (QSS) method introduced by Kofman [53] allows for a discrete event simulation of hybrid systems. The method starts from the observation that a piecewise constant trajectory can be represented by sequences of events. The reader is referred to the literature, e.g. references [1, 53, 54] for details. In the following, only the basic idea is outlined in a simplified manner.

Consider the state space equation

$$\begin{aligned} \dot{x}(t)&= f(x(t), u(t)) \end{aligned}$$
(2.28)

where \(x(t)\) is the state and \(u(t)\) the input given by a piecewise constant function. Let \(\mathrm{floor} : \mathbb {R} \rightarrow \mathbb {Z}^{+}\) denote a function that returns the integer part of its positive real-valued argument. The QSS-method then solves the approximate system

$$\begin{aligned} {\dot{x}}(t)&= d_x(t) \end{aligned}$$
(2.29a)
$$\begin{aligned} q(t)&= \mathrm{floor}(x(t)) \end{aligned}$$
(2.29b)
$$\begin{aligned} d_x(t)&= f(q(t),u(t)) \end{aligned}$$
(2.29c)

The variable \(q\) is called a quantised variable and Eq. (2.29) a quantised state system (QSS). equations 2.29a2.29b constitute a dynamic subsystem with a piecewise constant input trajectory \(d_x(t)\) and a piecewise constant output trajectory \(q(t)\). The third Eq. 2.29c is a static relation. The quantised state system (2.29) can be displayed by the block diagram in Fig. 2.23.

Fig. 2.23
figure 23

Block diagram of a quantised state system

The static block and the quantised integrator can be represented by a DEVS model. Their coupling again builds a DEVS model. The DEVS models can be translated into PowerDEVS models. The software environment PowerDEVS provides a library with a number of predefined atomic and coupled DEVS models and a graphical user interface that permits to build coupled DEVS models.

Given a time instant \(t_k\) and a constant quantum \(\varDelta Q\), then the next time step \(h\) that satisfies (2.27) can be determined if the derivative of the state variable in (2.29a) is approximated by a difference quotient.

$$\begin{aligned} \frac{x(t_k + h) - x(t_k)}{h}&= \frac{\pm \varDelta Q}{h} \; = \; d_x(t_k) \; = \; f(q(t_k),u(t_k)) \end{aligned}$$
(2.30)

The QSS method outlined so far bears a problem because it cannot be guarantied that a DEVS model resulting from the coupling of atomic DEVS models will perform a finite number of transitions in any finite time interval. DEVS models with this ability are said to be legitimate. For illegitimate DEVS models the simulation will get stuck. Kofman has shown that the problem can be overcome by introducing hysteresis in the relationship between a state variable \(x\) and its quantised variable \(q\) [53]. However, the method is only first-order accurate. A quantisation for which the hysteresis value equals the quantum value produces a piecewise constant output trajectory that only changes when the difference between input and output exceeds the quantum. As a result, the state variables have a piecewise linear trajectory. To improve accuracy, Kofman proposed a second-order accurate QSS2 method [55]. For this method, the quantisation that does not need hysteresis produces piecewise linear output trajectories having discontinuities whenever the absolute value of the difference between a state variable and its quantised variable reaches the quantum. If the QSS2 method is applied to LTI systems then state variables have piecewise parabolic trajectories provided input trajectories are piecewise constant.

The outlined quantised state integration can be applied to systems of coupled ODEs with piecewise constant input functions. Moreover, it can be extended so that hybrid DAE systems can be solved by discrete event simulation [54].

Bond Graph Models and Discrete Event Simulation

As can be seen from Fig. 2.23, a coupled DEVS model is obtained from a continuous time model by feeding the output of an integrator into a quantising block turning the integrator into a so-called quantised integrator provided input trajectories are piecewise constant. This observation suggests that discrete event simulation can be applied to systems represented by a bond graph because a causal bond graph is equivalent to a block diagram in which the block diagram replacement of each energy storage element includes an integrator (Fig. 2.24).

Fig. 2.24
figure 24

Block diagram of a bond graph C storage element in integral causality

It is sufficient to quantise the static relation between the energy variable of a storage element and its output power variable. Consider, e.g. the linear 1-port C element in integral causality in Fig. 2.24 and let \(q_q(t) = \mathrm{floor}(q(t))\) the quantisation of its displacement \(q\). The continuous constitutive equations of a C element with the capacitance \(C\)

$$\begin{aligned} \dot{q}(t)&= f(t) \end{aligned}$$
(2.31a)
$$\begin{aligned} e(t)&= \frac{1}{C} q(t) \end{aligned}$$
(2.31b)

are then replaced by

$$\begin{aligned} \dot{q}(t)&= f(t) \end{aligned}$$
(2.32a)
$$\begin{aligned} e(t)&= \frac{1}{C} q_q(t) \; = \; \varPhi _q( q(t)) \end{aligned}$$
(2.32b)

That is, the characteristic of a storage element is approximated by a piecewise constant function \(\varPhi _q()\) (with hysteresis). The other bond graph elements are static elements. A 2-port transformer, for instance, takes two piecewise constant inputs and delivers two piecewise constant outputs. Bond graphs in which the characteristic of the storage elements has been quantised are called quantised bond graphs (QBGs) in [53, 56]. The elements of a quantised bond graph can be represented by DEVS models. The result of their coupling is a DEVS model of the QBG. Hence, this approximation of an initial continuous-time bond graph model can be computed by means of discrete event simulation.

Another approach that also allows to approximate each continuous time element of a bond graph by a DEVS model so that a DEVS simulation can be performed has been reported in [57, 58]. The task is to transform piecewise continuous input and output trajectories of a bond graph element into discrete event trajectories. To translate, e.g. the continuous time model of a C element in integral causality into a discret event model, the input trajectory of the flow \(f(t)\) between two time instances \(t_i\) and \(t_j\) is approximated by a linear function \(f(t) = a_1 t + a_0\). The output trajectory of \(e(t)\) is a second order polynomial \(e(t) = b_2 t^2 + b_1 t = (a_1/2C) t^2 + (a_0/C) t\). This polynomial is approximated by a linear function \(\tilde{e}(t) = \tilde{b}_1 t + \tilde{b}_0\). Its coefficients are determined by the value of \(e(t)\) at the beginning and at the end of the time interval \([t_i, t_j]\).

$$\begin{aligned} \tilde{e}(t)&= \frac{e(t_j) - e(t_i)}{t_j - t_i} t + e(t_i) \end{aligned}$$
(2.33)

A discrete event is considered to take place whenever the linear trajectory for the time interval \([t_i, t_j]\) crosses a threshold or when there is a significant change of its slope. This threshold crossing or a gradient change determines the time instant of the next event and thus the length of the time interval of the current linear trajectory.

An attractive feature of a discrete event simulation of hybrid systems is that the simulation time advances from discrete event to discrete event. For the QSS method, discontinuities in the inputs and the quantised variables dictate the time advance. No iteration is necessary to locate the time point of a discontinuity allowing for an efficient processing of models with discontinuities. Discrete event simulation using the quantised-based integrations needs much less simulation steps than a numerical integration method of comparable accuracy based on time-discretisation. Accordingly, computational costs are saved. Nevertheless, there are still some problems to be tackled with the QSS approach as detailed in [1, Chap. 12.11].

2.6 Summary

The survey in this chapter shows that there are various bond graph approaches to hybrid system modelling having their pros and cons. A comparison of approaches using ideal switches versus those using non-ideal switches has been given in [30].

In this book, a bond graph representation of hybrid system models is chosen as basis for bond graph model-based FDI in Chap. 4. The representation is system mode independent with regard to computational causalities and allows for deriving a set of model equations in the form of a DAE system that holds for all system modes. This is achieved by modelling fast switching devices by an MTF associated with a resistor in fixed conductance causality and by means of MTFs switching on and off residual sinks in the case of structural changes. The residual sinks allow for keeping integral causality at storage elements that become dependent by a system mode change and would take derivative causality.

If the dynamic behaviour of a system can be described by a switched LTI system, a linear implicit DAE system can be derived from the bond graph. The entries of its matrices depend on the discrete switch states. As long as no structural changes occur, i.e. no residual sinks are switched on, the DAE system is of index \(\le \)1. For system modes in which residuals sinks are switched on, the DAE system is of index 2. There are solvers available for its direct numerical computation that are based on the BDF-method. An alternative may be to perform a DEVS simulation that uses quantised based integration.