# Passivity Preserving Energy-Aware Design for Multi-Dimensional Switched Systems: Application to Open Multi-Robot Systems

Esteban Restrepo, Cristian Secchi, Paolo Robuffo Giordano

► To cite this version:

Esteban Restrepo, Cristian Secchi, Paolo Robuffo Giordano. Passivity Preserving Energy-Aware Design for Multi-Dimensional Switched Systems: Application to Open Multi-Robot Systems. Automatica, 2025, 181, pp.112496. 10.1016/j.automatica.2025.112496. hal-04330519

HAL Id: hal-04330519

https://hal.science/hal-04330519v1

Submitted on 8 Dec 2023

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons CC BY 4.0 - Attribution - International License
# Passivity Preserving Energy-Aware Design for Multi-Dimensional Switched Systems: Application to Open Multi-Robot Systems

Esteban Restrepo<sup>a</sup>, Cristian Secchi<sup>b</sup>, Paolo Robuffo Giordano<sup>a</sup>

## Abstract

We propose a passivity-preserving energy-tank-based framework for the analysis and control design of multi-mode multi-dimensional switched systems. We present a new design of hybrid energy tank that is modeled as an impulsive switched system and that allows to account for the sudden (and possibly non-passive) jumps in energy of the system due to the change of dimension of the state at the switching instants. Under this framework we establish passivity of the plant-plus-tank system via an energy-based condition for the switching signal. To demonstrate the utility of our framework we apply the methodology to a case-study of growing importance and interest of its own: open multi-robot systems with arbitrary addition and removal of agents in an autonomous energy-aware and passive way.

**Key words:** Hybrid systems, passivity, multi-robot systems, distributed control.

## 1 Introduction

The framework of hybrid systems and, more specifically, switched systems is an important tool for analysis and control design of systems that abruptly change between different operational modes with different dynamics [15]. In the same way, passivity theory, or dissipativity theory in general, is a useful tool for analyzing and designing controllers for dynamical systems from the input and output perspective and to study the interaction of a physical system with its environment. Moreover, passivity provides an important framework for stability analysis since a passive system without input is Lyapunov stable [30].

Several works in the literature have studied the passivity of switched systems—see e.g. [11, 28, 40] to mention a few. The representative work [40] proposes a framework for dissipativity of switched systems and establishes passivity by introducing the concept of “cross-supply rates”. A common point between the latter and most works in the literature, however, is that it is as-

sumed that all the switching modes share the same state dimension. This enables one to represent the systems using a single state space entity and facilitates the analysis and design procedures. Keeping the dimension of the state constant, however, may not be realistic to characterize different physical plants or a plant in the different modes of operation. Indeed, many kinds of complex physical systems are more accurately modeled as hybrid systems that switch between multiple operational modes, each with a different dynamic behavior. Examples of these are aircraft landing gears [13], the Brownian motor (nanoscale motion of myosin) [2], or switched formation control of spacecrafts [39], to mention a few. Some basic notions tailored for these kind of systems are presented in [34, 35], where also the term *multi-mode multi-dimensional* ($M^3D$) switched systems is coined to refer to such systems. Nonetheless, $M^3D$ switched systems have been considerably less studied than other kinds of hybrid systems, especially in terms of stability and passivity. Indeed, analyzing the passivity (and stability) of an $M^3D$ switched system is not trivial since the total energy of the system can suddenly increase due to the impulsive change in dimension of the state between different operational modes. This sudden injection of energy into the system may be considered as a non-passive behavior that can render the system unstable. The lat-

<footnote><sup>a</sup> CNRS, Univ Rennes, Inria, IRISA, Campus de Beaulieu, 35042 Rennes, France</footnote>

<footnote><sup>b</sup> Department of Sciences and Methods of Engineering, University of Modena and Reggio Emilia, 41121 Modena, Italy</footnote>

<footnote>Email addresses: esteban.restrepo@inria.fr (Esteban Restrepo), cristian.secchi@unimore.it (Cristian Secchi), prg@irisa.fr (Paolo Robuffo Giordano).</footnote>

<footnote n="1">¹ This work was supported by the ANR-20-CHIA-0017 project “MULTISHARED”</footnote>
sults for the OMRS so that it can handle the addition and removal of agents (or groups thereof) autonomously in a passive and energy-aware way. Our proposed approach can therefore be thought of also generalizing the passivity-based generalized-connectivity framework proposed in [8] to the (more challenging) setting of OMRS. The rest of this paper is organized as follows. In Section 2 some preliminaries on passivity and energy tanks are recalled. The energy-aware design and passivity analysis of M³D switched systems is presented in Section 3. In Section 4 is addressed the case-study of open multi-robot systems along with a numerical example. Finally, some concluding remarks are included in Section 5.

**Notations:** A continuous function $\alpha : \mathbb{R}_{\ge 0} \to \mathbb{R}_{\ge 0}$ is of class $\mathcal{K}$ ($\alpha \in \mathcal{K}$), if it is strictly increasing and $\alpha(0) = 0$; $\alpha \in \mathcal{K}_{\infty}$ if, in addition, $\alpha(s) \to \infty$ as $s \to \infty$. A continuous function $\sigma : \mathbb{R}_{\ge 0} \to \mathbb{R}_{\ge 0}$ is of class $\mathcal{L}$ if it is decreasing and $\sigma(s) \to 0$ as $s \to \infty$. A function $\beta : \mathbb{R}_{\ge 0} \times \mathbb{R}_{\ge 0} \to \mathbb{R}_{\ge 0}$ is of class $\mathcal{KL}$ if, $\beta(\cdot, \cdot) \in \mathcal{K}$ for any $t \in \mathbb{R}_{\ge 0}$, and $\beta(s, \cdot) \in \mathcal{L}$ for any $s \in \mathbb{R}_{\ge 0}$. For a function $f : \mathbb{R}^n \to \mathbb{R}^m$, $s(t) \mapsto f(s(t))$ we use, with a slight abuse of notation, $f(s(t))$, $f(s)$, and $f(t)$ interchangeably when clear from the context. We use $| \cdot |$ for the Euclidean norm of vectors and the induced $L_2$ norm of matrices.

## 2 Preliminaries

### 2.1 Passivity and Port-Hamiltonian systems

Consider the following nonlinear system

$$ \dot{x}(t) = f(x(t)) + g(x(t))u(t) \quad (1) $$

$$ y(t) = h(x(t)) \quad (2) $$

where $x \in \mathbb{R}^n$ is the state of the system and $(u, y) \in \mathbb{R}^m \times \mathbb{R}^m$ is the input-output pair.

**Definition 1 (Passivity [32])** The system (1)-(2) is passive with respect to the pair $(u, y)$ if there exists a function of the state, called storage function, $V : \mathbb{R}^p \to \mathbb{R}_{\ge 0}$ such that the following balance holds for all $t_f \ge t_0 \ge 0$:

$$ \int_{t_0}^{t_f} u(s)^\top y(s) ds \ge V(x(t_f)) - V(x(t_0)) \ge -V(x(t_0)). \quad (3) $$

The pair $(u, y)$ is called power port, or simply port, of the system. The product $u^\top y$ is the power crossing the power port. More precisely, under the passivity framework, the storage function can be interpreted as a (generalized) energy function and the product $y^\top u$ as a (generalized) power flow. Therefore, input and output are called power conjugated variables. Moreover, the passivity property in Definition 1 can be used for establishing stability properties. Indeed, for the autonomous system without inputs $(u(t) = 0)$ the equilibrium points corresponding to the (local) minima of the storage function are (locally) asymptotically stable. If the storage function is positive definite with a single global minimum $(V(x) > 0$, for all $x \ne 0$) and is radially unbounded $(V(x) \to \infty$ as $x \to \infty$), Definition 1 implies that the

equilibrium point is globally asymptotically stable.

Considering (1)-(2) as a port-Hamiltonian (pH) system, its input-state-output formulation is given by

$$ \dot{x} = [J(x) - R(x)] \nabla H(x) + g(x)u \quad (4) $$

$$ y = g^\top(x) \nabla H(x) \quad (5) $$

where $\nabla H := \frac{\partial H}{\partial x}$ is the gradient of the Hamiltonian $H$ which maps the state variables to the total energy of the system, $R \in \mathbb{R}^{n \times n}$ is a positive-definite continuous matrix representing the energy-dissipating elements, and $J \in \mathbb{R}^{n \times n}$ is a skew-symmetric continuous matrix representing the internal interconnection structure along which energy is distributed and generalizing the Symplectic/Poisson structures of analytic mechanics. We refer the reader to [5] for an introduction to port-Hamiltonian modeling and control of robotic systems. An immediate property of pH systems (4)-(5) is that they are passive with respect to the Hamiltonian as storage function and the input-output pair $(y, u)$. Indeed, for all $t_f \ge t_0 \ge 0$ we have that

$$ \begin{aligned} \dot{H}(x(t)) = & - \nabla H^\top(x(t)) R(x(t)) \nabla H(x(t)) + y^\top(t) u(t) \\ & \le y^\top(t) u(t). \end{aligned} \quad (6) $$

Then, integrating (6) over the interval $[t_0, t_f]$, we obtain the passivity condition

$$ H(x(t_f)) - H(x(t_0)) \le \int_{t_0}^{t_f} y(s)^\top u(s) ds. \quad (7) $$

### 2.2 Energy-tanks

The concept of energy tank, initially proposed in [29] allows to establish an “energy budget” for the pH system (4)-(5) in order to implement any desired control action according to the available stored energy while preserving passivity [31].

Mathematically an energy tank is a dynamical system which constitutes an atomic energy storing element. Denoting $x_t \in \mathbb{R}$ as the state variable of the tank system and using a pH formulation, the dynamics of the tank can be represented as

$$ \dot{x}_t = u_t \quad (8) $$

$$ y_t = \frac{\partial T(x_t)}{\partial x_t}, \quad (9) $$

where $T$ is the non-negative energy function of the tank. By implementing a suitable power-preserving interconnection between the tank and the pH system, it is possible to implement a desired control action while preserving the passivity of the system. Let us distinguish between the interaction port (with input $u_e$) and the control port (with input $u_c$), and set $u = u_c + u_e$. As a consequence, both the control and the interaction input are conjugated to the same original output $y_c = y_e = y$.
Then, the power preserving interconnection between the plant (4)-(5) and the tank (8)-(9) reads formally

$$ \begin{bmatrix} u_c \\ u_t \end{bmatrix} = \begin{bmatrix} 0 & \frac{w}{\partial T/\partial x_t} \\ -\frac{w}{\partial T/\partial x_t} & 0 \end{bmatrix} \begin{bmatrix} y_c \\ y_t \end{bmatrix} \quad (10) $$

where $w$ is the desired task-dependent control action to be passively implemented. Notice that due to its skew-symmetry, the interconnection (10) is a power preserving interconnection. In fact, it can be easily seen that $u_c^\top y_c = -u_t y_t$. This interconnection produces two key effects, whose combination embodies the role of energy tanks. First, it correctly implements the desired action, i.e., from the side of the plant, one obtains

$$ \dot{x} = [J(x) - R(x)] \nabla H(x) + g(x)w + g(x)u_e. \quad (11) $$

Secondly, the interconnection is power-preserving, which can be inferred from the skew-symmetry of the matrix in (10). This power-preserving interconnection implies that the plant-plus-tank system is passive. Indeed, the closed-loop system reads

$$ \begin{bmatrix} \dot{x} \\ \dot{x}_t \end{bmatrix} = \begin{bmatrix} J(x) - R(x) & g(x) \frac{w}{\partial T/\partial x_t} \\ -\frac{w}{\partial T/\partial x_t} & g^\top(x) \end{bmatrix} \begin{bmatrix} \frac{\partial \mathcal{H}}{\partial x} \\ \frac{\partial \mathcal{H}}{\partial x_t} \end{bmatrix} + \begin{bmatrix} g(x) \\ 0 \end{bmatrix} u_e \quad (12) $$

$$ y_e = [g^\top(x) \quad 0] \begin{bmatrix} \frac{\partial \mathcal{H}}{\partial x} \\ \frac{\partial \mathcal{H}}{\partial x_t} \end{bmatrix}. \quad (13) $$

Then, evaluating the variation of the closed-loop Hamiltonian, given by $\mathcal{H} := H + T$, along the system trajectories one obtains

$$ \dot{\mathcal{H}} = \frac{\partial \mathcal{H}}{\partial x} R(x) \frac{\partial \mathcal{H}}{\partial x} + y_e^\top u_e \le y_e^\top u_e, $$

which proves passivity of the closed-loop system with respect to the interaction port $(u_e, y_e)$, with $\mathcal{H}$ as storage function, and with the same dissipation rate of the original system. This means that the (undefined in sign) power $y^\top w$ flowing on the port of the original system is at any time exchanged with the tank without being dissipated or generated.

The advantage of the energy-tank framework is that the action $w$ is free to be chosen arbitrarily without necessarily fulfilling a passivity requirement. In this context the energy in the tank $T(x_t)$ denotes the amount of energy available to implement $w$ before the overall passivity is lost. Indeed, note that (10) and (12) become singular when $\partial T/\partial x_t = 0$, which marks the instant when it is no longer possible to passively apply the action $w$. Considering the common choice of energy-tank function $T(x_t) = 0.5x_t^2$, in order to avoid singularities and preserve passivity, it is then necessary to initialize

$\partial T/\partial x_t = x_t$ such that $T(x_t(t_0)) \ge \varepsilon$ and guarantee that $T(x_t(t)) \ge \varepsilon$, where $\varepsilon > 0$ is a lower bound for the energy stored in the tank. Similarly, in order to avoid practically unfeasible behaviors one should impose an upper bound on the energy that can be stored in the tank, that is, $T(x_t(t)) \le \bar{\varepsilon}$ for all $t \ge t_0$. In this case, one could implement the action $\zeta w$, instead of $w$—cf. [26], where

$$ \zeta = \begin{cases} 0, & \text{if } (T < \varepsilon) \text{ or } (T = \bar{\varepsilon} \wedge \dot{x}_t > 0) \\ 1, & \text{otherwise.} \end{cases} \quad (14) $$

The purpose of the parameter $\zeta$ is to “disconnect” the tank when the available energy goes below a threshold or when the energy reaches the upper bound and the system is trying to convey more energy into the tank. The former ensures that singularities are avoided and the latter prevents too much energy to be stored so that passivity is preserved.

## 3 Energy-tank-based design for multi-mode multi-dimensional switched systems

### 3.1 Modeling of M$^3$D switched systems

As mentioned in the Introduction, in numerous practical applications a plant can be modeled as an M$^3$D switched system, that is, a hybrid system switching into different operational modes where the dynamic evolution of the system at each mode is determined by a state space of different dimension. Given the switching signal $\sigma(t)$, where $\sigma: \mathbb{R}_{\ge 0} \to S$ is a piece-wise constant function and $S := \{1, 2, \dots, S\}$ is the set of $S \in \mathbb{N}$ possible subsystems (or modes), a general nonlinear control-affine M$^3$D switched system is given by

$$ \dot{x}_{\sigma(t)}(t) = f_{\sigma(t)}(x_{\sigma(t)}(t)) + g_{\sigma(t)}(x_{\sigma(t)}(t))u_{\sigma(t)}(t) \quad (15) $$

$$ y_{\sigma(t)}(t) = h_{\sigma(t)}(x_{\sigma(t)}(t)) \quad (16) $$

where $x_{\sigma(t)} \in \mathbb{R}^{n_{\sigma(t)}}$ is the state of the system and $(u_{\sigma(t)}, y_{\sigma(t)}) \in \mathbb{R}^{m_{\sigma(t)}} \times \mathbb{R}^{n_{\sigma(t)}}$ is the input-output pair. Equations (15)-(16) represent the dynamic evolution of the system at time $t$. However, for an M$^3$D switched system the state and input-output dimensions, respectively, $n_{\sigma(t)}$ and $m_{\sigma(t)}$, may change at the switching instants. This naturally leads to an impulsive switched system representation. Let $\phi \in S$ denote a mode of the system, that is, $\phi = \sigma(\tau)$, where $\tau \in [t_l, t_{l+1})$ and $t_l, t_{l+1}$ are switching instants. Moreover, let $\phi, \hat{\phi} \in S$ denote two consecutive modes where $\hat{\phi}$ precedes $\phi$. Then, we have that at the switching instant $t_l$ the state transition is formulated as

$$ x_{\phi}(t_l) = \Xi_{\phi, \hat{\phi}} x_{\hat{\phi}}(t_l^-) + \Phi_l \quad (17) $$

where $\Xi_{\phi, \hat{\phi}} \in \mathbb{R}^{n_{\phi} \times n_{\hat{\phi}}}$ is a 0-1 rectangular matrix indicating the dimension variation of the state at instant $t_l$, and $\Phi_l \in \mathbb{R}^{n_{\phi}}$ is a real vector indicating the value changes of the state at $t_l$. Specifically, $\Xi_{\phi, \hat{\phi}}$ can be obtained by
removing rows from (dimension reduction) or by adding zero rows to (dimension expansion) specific positions of an identity matrix $I_{\hat{\phi}}$. On the other hand, $\Phi_l$ indicates the value changes of $x_{\sigma(t)}$ at any $t_l$. It yields two types of changes, i.e., the changes caused by initial value assignment for the new expanded state components and the changes caused by instant jumps of the intact state components.

In this paper we assume that, for every mode $\phi \in S$, the M$^3$D switched system (15)-(16) and (17) can be set in an input-state-output port-Hamiltonian formulation akin to (4)-(5). Therefore we rewrite (15)-(16) and (17) as

$$ \dot{x}_{\phi}(t) = [J_{\phi}(x_{\phi}(t)) - R_{\phi}(x_{\phi}(t))]\nabla H_{\phi}(x_{\phi}(t)) \quad (18) \\ + g_{\phi}(x_{\phi}(t))u_{\phi}(t) $$

$$ y_{\phi}(t) = g_{\phi}^{\top}(x_{\phi}(t))\nabla H_{\phi}(x_{\phi}(t)) \quad (19) $$

$$ x_{\phi}(t_l) = \Xi_{\phi, \hat{\phi}} x_{\hat{\phi}}(t_l^-) + \Phi_l \quad (20) $$

where $H_{\phi}$ denotes the Hamiltonian of the system for each mode $\phi \in S$. Using this formulation, akin to (6) and (7), the system (18)-(19) is passive with respect to the Hamiltonian as a storage function. Indeed, for every activated mode $\phi = \sigma(t)$ with $t \in [t_l, t_{l+1})$, we have

$$ \begin{aligned} \dot{H}_{\phi}(x_{\phi}(t)) = & -\nabla H_{\phi}^{\top}(x_{\phi}(t)) R_{\phi}(x_{\phi}(t)) \nabla H_{\phi}(x_{\phi}(t)) \\ & + y_{\phi}^{\top}(t) u_{\phi}(t) \\ & \leq y_{\phi}^{\top}(t) u_{\phi}(t). \end{aligned} \quad (21) $$

Then, integrating (21) over the interval $[t_l, t_{l+1}]$, we have that

$$ H_{\phi}(x_{\phi}(t_{l+1})) - H_{\phi}(x_{\phi}(t_l)) \leq \int_{t_l}^{t_{l+1}} y_{\phi}(s)^{\top} u_{\phi}(s) ds. \quad (22) $$

Due to the switching and impulsive nature of the system, establishing passivity (stability) at each activated mode does not guarantee passivity (stability) of the switched system. To see this let $\alpha_{1\phi}$ and $\alpha_{2\phi}$ be class $K_{\infty}$ functions for every mode $\phi \in S$ such that

$$ \alpha_{1\phi}(|x_{\phi}(t)|) \leq H_{\phi}(x_{\phi}(t)) \leq \alpha_{2\phi}(|x_{\phi}(t)|). \quad (23) $$

Then, from (23) and using (20), we have that the Hamiltonian at a switching instant satisfies

$$ \begin{aligned} H_{\phi}(x_{\phi}(t_l)) \leq & \alpha_{2\phi}(|\Xi_{\phi, \hat{\phi}} x_{\hat{\phi}}(t_l^-) + \Phi_l|) \\ \leq & \alpha_{2\phi}(|\Xi_{\phi, \hat{\phi}} x_{\hat{\phi}}(t_l^-)| + |\Phi_l|) \\ \leq & \alpha_{2\phi}(2|x_{\hat{\phi}}(t_l^-)|) + \alpha_{2\phi}(2|\Phi_l|) \\ \leq & \alpha_{2\phi} \circ (2\alpha_{1\hat{\phi}}^{-1})(H_{\hat{\phi}}(x_{\hat{\phi}}(t_l^-))) + \alpha_{2\phi}(2|\Phi_l|), \end{aligned} \quad (24) $$

where the second inequality is a consequence of the non-decreasing nature of class-K functions and the third is

the (weak) triangle inequality [12]. Adding and subtracting $H_{\hat{\phi}}(x_{\hat{\phi}}(t_l^-))$ on the right-hand side of (24) we have

$$ H_{\phi}(x_{\phi}(t_l)) \leq H_{\hat{\phi}}(x_{\hat{\phi}}(t_l^-)) + \alpha_{2\phi}(2|\Phi_l|) \\ + \alpha_{2\phi} \circ (2\alpha_{1\hat{\phi}}^{-1} - \text{id})(H_{\hat{\phi}}(x_{\hat{\phi}}(t_l^-))). \quad (25) $$

Denoting $\Delta H_{\phi, \hat{\phi}}(x_{\hat{\phi}}(t_l^-))$ the last two terms on the right-hand side of (24), we can write

$$ H_{\phi}(x_{\phi}(t_l)) \leq H_{\hat{\phi}}(x_{\hat{\phi}}(t_l^-)) + \Delta H_{\phi, \hat{\phi}}(x_{\hat{\phi}}(t_l^-)). \quad (26) $$

In (26), $\Delta H_{\phi, \hat{\phi}}$ denotes the variation of the total internal energy of the system between two consecutive modes at the switching instant $t_l$ due to the impulsive and switching nature of the system. Specifically, when $\Delta H_{\phi, \hat{\phi}}(x_{\hat{\phi}}(t_l^-)) > 0$ we have that the energy of the system increases. The sudden injection of energy into the system due to an impulsive jump of the state may be considered as a non-passive behavior that can render the system unstable. The latter may occur in practical applications, even if the (weak) passivity of the system is not lost, if the increase in energy is relatively large. Therefore, additional considerations need to be taken into account in order to deal with the impulsive behavior of the system and guarantee the preservation of passivity (stability) between switching instants over a long enough time horizon.

The framework for dissipativity of switched systems introduced in [40] establishes passivity of the whole systems by introducing the concept of “cross-supply rates”. The authors show that if an additional condition is set on the “cross-supply rates”, mainly that the (virtual) energy transfer from an activated mode $\phi$ to the other modes during the activation interval of $\phi$ remains finite, the switched system is passive. However, in [40] it is assumed that the state is everywhere continuous, therefore the results are not applicable to the present case where impulsive behavior is induced due to the change in dimension of the state. Weak passivity is established for M$^3$D switched systems in [14] given that the switching signal satisfies a “transition-dependent average dwell-time” condition. However, the system is assumed to be exponentially passive at each mode. Note that, in contrast, using the pH framework we only assume passivity (or output strict passivity). In light of this, we next propose a new design of energy tank in order to deal with the non-passive instantaneous injection of energy for M$^3$D switched and passive systems in pH form.

## 3.2 Switched energy-tank design

As exposed in the Preliminaries section, one of the main advantages of the energy-tank-based formulation is the possibility of dealing with (and implementing) non-passive control actions by using the energy stored in the tank. Such property is well suited to the problem at hand. Indeed, as mentioned before, the sudden
increase in energy, denoted $\Delta H_{\phi, \hat{\phi}}$ in (26), may be considered as a non-passive behavior, which can be dealt with exploiting the passivity-preserving advantages of the energy tank-based design.

Note, however, that the usual formulation of energy tanks exposed in Section 2.2, which deals with non-passive input actions in the continuous dynamics of the system, cannot be directly applied since, in the context of this paper, the non-passive behavior comes from the impulsive jumps of the state (and its dimension) at the discrete switching instants. In light of this, we propose a new energy-tank-based approach where the energy-tank system is designed as an impulsive hybrid system of the form:

$$ \dot{x}_{t\hat{\phi}}(t) = u_{t\hat{\phi}}(t) \quad (27) $$

$$ y_{t\hat{\phi}}(t) = x_{t\hat{\phi}}(t) \quad (28) $$

$$ x_{t\phi}(t_l) = \mu_{\phi, \hat{\phi}} x_{t\hat{\phi}}(t_l^-) \quad (29) $$

where $\mu_{\phi, \hat{\phi}} > 0$ is a value to be designed.

The main idea behind the impulsive switching formulation in (29) with the design parameter $\mu_{\phi, \hat{\phi}}$ is to allow the tank to instantaneously deplete ($\mu_{\phi, \hat{\phi}} < 1$) of its stored energy in order to cope with the impulse of energy in (26) due to the switching. Similarly, if $\Delta H_{\phi, \hat{\phi}}(x_{\hat{\phi}}(t_l^-))$ in (26) is negative, the impulsive dissipated energy can be instantaneously stored in the energy tank ($\mu_{\phi, \hat{\phi}} > 1$) for future use. More precisely, set the tank energy to $T_{\phi} = 0.5x_{t\hat{\phi}}^2$. Then, using (29), at a switching instant we have

$$ \begin{aligned} T_{\phi}(x_{t\phi}(t_l)) &= \frac{1}{2}x_{t\phi}^2(t_l) \\ &= \frac{1}{2}x_{t\hat{\phi}}^2(t_l^-) + \frac{1}{2}(\mu_{\phi, \hat{\phi}}^2 - 1)x_{t\hat{\phi}}^2(t_l^-). \end{aligned} \quad (30) $$

Akin to (26), denoting $\Delta T_{\phi, \hat{\phi}}(x_{t\hat{\phi}}(t_l^-)) := (1/2)(\mu_{\phi, \hat{\phi}}^2 - 1)x_{t\hat{\phi}}^2(t_l^-)$, we rewrite (30) as

$$ T_{\phi}(x_{t\phi}(t_l)) \le T_{\hat{\phi}}(x_{t\hat{\phi}}(t_l^-)) + \Delta T_{\phi, \hat{\phi}}(x_{t\hat{\phi}}(t_l^-)). \quad (31) $$

Now, let us define the total energy function

$$ \mathcal{H}_{\phi}(\xi_{\phi}) := H_{\phi}(x_{\phi}) + T_{\phi}(x_{t\phi}), \quad (32) $$

where $\xi_{\phi}^{\top} := [x_{\phi}^{\top} \ x_{t\phi}] \in \mathbb{R}^{n_{\phi}+1}$. Using (26) and (31) we obtain

$$ \begin{aligned} \mathcal{H}_{\phi}(\xi_{\phi}(t_l)) &\le H_{\hat{\phi}}(x_{\hat{\phi}}(t_l^-)) + T_{\hat{\phi}}(x_{t\hat{\phi}}(t_l^-)) \\ &\quad + \Delta H_{\phi, \hat{\phi}}(x_{\hat{\phi}}(t_l^-)) + \Delta T_{\phi, \hat{\phi}}(x_{t\hat{\phi}}(t_l^-)) \\ &\le \mathcal{H}_{\hat{\phi}}(\xi_{\phi}(t_l^-)) \\ &\quad + \Delta H_{\phi, \hat{\phi}}(x_{\hat{\phi}}(t_l^-)) + \Delta T_{\phi, \hat{\phi}}(x_{t\hat{\phi}}(t_l^-)). \end{aligned} \quad (33) $$

Recall that from (26) the non-passive behavior occurs because of the sudden jump in energy at a switching instant, denoted by $\Delta H_{\phi, \hat{\phi}}$, which can be significantly large. Therefore, the objective here is to choose the parameter $\mu_{\phi, \hat{\phi}}$ in (30) so that the jump in energy of the system is instantaneously compensated by the energy stored in the tank, thus preventing large energy inputs that could destabilize the system. In other words, we want that

$$ \Delta H_{\phi, \hat{\phi}}(x_{\hat{\phi}}(t_l^-)) + \Delta T_{\phi, \hat{\phi}}(x_{t\hat{\phi}}(t_l^-)) \le \beta \quad (34) $$

where $\beta$ is a (relatively small) positive design constant to be defined. Substituting (30), the condition (34) can be transformed into a bound on $\mu_{\phi, \hat{\phi}}$:

$$ \begin{aligned} \frac{1}{2}\mu_{\phi, \hat{\phi}}^2 x_{t\hat{\phi}}^2(t_l^-) &\le T_{\hat{\phi}}(x_{t\hat{\phi}}(t_l^-)) - \Delta H_{\phi, \hat{\phi}}(x_{\hat{\phi}}(t_l^-)) + \beta \\ \mu_{\phi, \hat{\phi}} &\le \sqrt{\frac{T_{\hat{\phi}}(x_{t\hat{\phi}}(t_l^-)) - \Delta H_{\phi, \hat{\phi}}(x_{\hat{\phi}}(t_l^-)) + \beta}{T_{\hat{\phi}}(x_{t\hat{\phi}}(t_l^-))}}. \end{aligned} \quad (35) $$

It is evident that if $\mu_{\phi, \hat{\phi}}$ satisfies (35) at a switching instant $t_l$ the energy-compensation requirement (34) is satisfied. Then, letting

$$ \bar{\omega}_{\phi, \hat{\phi}} := T_{\hat{\phi}}(x_{t\hat{\phi}}(t_l^-)) - \Delta H_{\phi, \hat{\phi}}(x_{\hat{\phi}}(t_l^-)) + \beta $$

we may set $\mu_{\phi, \hat{\phi}} = \sqrt{\bar{\omega}_{\phi, \hat{\phi}}/T_{\hat{\phi}}(x_{t\hat{\phi}}(t_l^-))}$.

Note that for $\mu_{\phi, \hat{\phi}}$ to be well defined, $\bar{\omega}_{\phi, \hat{\phi}}$ must be greater than zero. On one hand, in case that the energy decreases at a switching instant due to the change of dimension of the state, that is, when $\Delta H_{\phi, \hat{\phi}}(x_{\hat{\phi}}(t_l^-)) < 0$, $\bar{\omega}_{\phi, \hat{\phi}}$ is positive and $\mu_{\phi, \hat{\phi}}$ is well-defined. However, as mentioned in Section 2.2, there should be an upper bound on the amount of energy that is stored in order to avoid practically unfeasible behaviors. Therefore, denoting by $\bar{\varepsilon}$ the upper limit for the energy stored in the tank, we let $\mu_{\phi, \hat{\phi}}$ be instead given by

$$ \mu_{\phi, \hat{\phi}} := \begin{cases} \sqrt{\bar{\varepsilon}/T_{\hat{\phi}}(x_{t\hat{\phi}}(t_l^-))}, & \text{if } \bar{\omega}_{\phi, \hat{\phi}} \ge \bar{\varepsilon} \\ \sqrt{\bar{\omega}_{\phi, \hat{\phi}}/T_{\hat{\phi}}(x_{t\hat{\phi}}(t_l^-))}, & \text{otherwise.} \end{cases} \quad (36) $$

Definition (36) guarantees that the tanks does not fill more than the maximum limit at any switching instant. On the other hand, when $\Delta H_{\phi, \hat{\phi}}(x_{\hat{\phi}}(t_l^-)) > 0$, that is, when the energy increases at a switching instant, the energy available in the tank just before the switching, i.e., $T_{\hat{\phi}}(x_{t\hat{\phi}}(t_l^-))$, should be enough to account for such an increase. Moreover, in order to avoid singularities, the tank must not empty completely. More precisely, it should hold that

$$ T_{\hat{\phi}}(x_{t\hat{\phi}}(t_l^-)) - \Delta H_{\phi, \hat{\phi}}(x_{\hat{\phi}}(t_l^-)) + \beta \ge \varepsilon > 0, \quad (37) $$
where $\varepsilon$ is the lower limit for the energy stored in the tank. Inequality (35) imposes an energy-based switching condition for M³D switched system. Indeed, in order for $\mu_{\phi, \hat{\phi}}$ to be well-defined and to avoid singularities, the switching signal $\sigma(t)$ should be such that, at every switching instant $t_l$, the energy condition (37) is satisfied.

The switching condition (37) on the switching signal is not unlike those normally found in the literature of switching systems. Due to the energy-based switching condition (37), the switching signal may be considered as being state dependent, i.e., $\sigma(\xi_{\phi}(t))$, since the energy functions $T_{\phi}$ and $H_{\phi}$ are defined in terms of the state of the system. Therefore, the energy-based condition (37) may be considered as a state-dependent counterpart to the time-dependent conditions such as, e.g., the transition dependent average dwell time introduced in [38]. Following a stability (passivity) analysis of a hybrid system, it is usually shown in the literature that if the switching signal satisfies a particular dwell-time condition, a specific stability (passivity) property is established for the hybrid system. In a similar way, with our switched energy-tank design, in Theorem 4 below, we show that if the switching signal $\sigma(\xi_{\phi}(t))$ satisfies the energy-based switching condition (37) the system is guaranteed to be (weakly) passive. Moreover, note that if the switching signal is such that (37) is satisfied at every jump, it also guarantees that the tank is not completely depleted, thus avoiding singularities.

**Remark 1** Note that at the switching times $t_l$ when the energy decreases, i.e., $\Delta H_{\phi, \hat{\phi}}(x_{\hat{\phi}}(t_l^-)) < 0$, the energy-based switching condition (37) always holds. This can be intuitively explained since only a sudden injection of energy into the system would cause it to become unstable. Therefore, the system is always allowed to jump from a mode $\hat{\phi}$ to a mode $\phi$ where $\Delta H_{\phi, \hat{\phi}}(x_{\hat{\phi}}(t_l^-)) < 0$. •

**Remark 2** The filling of the tank, apart from the (possible) switching instances when $\Delta H_{\phi, \hat{\phi}}(x_{\hat{\phi}}(t_l^-)) < 0$, is carried out by the continuous dynamics between switching instants by properly designing the continuous time dynamics of the tank (27). A possible choice, commonly found in the literature—see e.g. [1, 8], is:

$$ \dot{x}_{t\phi} = \frac{\zeta}{x_{t\phi}} [D(x_{\phi}(t)) - u_{t\phi}], \quad (38) $$

where $\zeta$ is as in (14), $D \ge 0$ is the power dissipated by the system (15)-(16), and $u_{t\phi}$ is an additional control that may be used to passively implement other task-dependent actions between switching instants without affecting the passivity of the whole system, as it is normally the case in energy-tank-based approaches. •

**Remark 3** One advantage of the energy-based (state-dependent) switching strategy, compared to other time-dependent approaches, is the increased autonomy since switching instants are not required to be known in advance. Indeed, the switching signal $\sigma(t)$ could be provided

by a “supervisor” that detects, based on some condition, that a switching can (or should) take place. Then, the system would autonomously switch whenever condition (37) is fulfilled, thus determining autonomously and at runtime the suitable switching time (not decided in advance). Note that, as mentioned in Remark 2, since the tanks (are allowed to) fill/empty during the continuous evolution of the system between switching instants, it is possible that the supervisor would detect that a switching could take place but the amount of energy in the tank may not be enough for (37) to hold. In such a case, the system could wait until the tank fills with enough energy and once (37) is satisfied the system effectively switches. An example of this behavior is presented for the case of open multi-agent systems in Section 4. •

### 3.3 Closed-loop system and passivity analysis

Now, akin to (10), distinguishing between an interaction port $u_{e\phi}$ and a control port $u_{c\phi}$ at each mode $\phi \in S$, i.e., $u_{\phi} = u_{c\phi} + u_{e\phi}$, we set the power preserving interconnection to

$$ \begin{bmatrix} u_{c\phi} \\ u_{t\phi} \end{bmatrix} = \begin{bmatrix} 0 & \frac{\zeta w_{\phi}}{x_{t\phi}} \\ -\frac{\zeta w_{\phi}}{x_{t\phi}} & 0 \end{bmatrix} \begin{bmatrix} y_{c\phi} \\ y_{t\phi} \end{bmatrix}, \quad (39) $$

where $w_{\phi}$ is a task-dependent action to be passively implemented. Then, using (18)-(20), (38) and (28)-(29) we write the complete closed-loop M³D switched system in the pH form

$$ \dot{\xi}_{\phi}(t) = [\bar{J}_{\phi}(\xi_{\phi}(t)) - \bar{R}_{\phi}(\xi_{\phi}(t))] \nabla H_{\phi}(\xi_{\phi}(t)) + \bar{g}_{\phi}(\xi_{\phi}(t)) u_{e\phi}(t) \quad (40) $$

$$ y_{e\phi}(t) = \bar{g}_{\phi}^{\top}(x_{\phi}(t)) \nabla H_{\phi}(\xi_{\phi}(t)) \quad (41) $$

$$ \xi_{\phi}(t_l) = \Xi_{\phi, \hat{\phi}} \xi_{\phi}(t_l^-) + \bar{\Phi}_l \quad (42) $$

where

$$ \nabla H_{\phi}(\xi_{\phi}) := \left[ \frac{\partial H}{\partial x_{\phi}}^{\top} \quad \frac{\partial H}{\partial x_{t\phi}}^{\top} \right]^{\top} \quad (43) $$

$$ \bar{J}(\xi_{\phi}(t)) := \begin{bmatrix} J_{\phi}(x_{\phi}(t)) & g_{\phi}(x_{\phi}(t)) \frac{\zeta w_{\phi}(t)}{x_{t\phi}(t)} \\ -\frac{\zeta w_{\phi}(t)}{x_{t\phi}(t)} g_{\phi}^{\top}(x_{\phi}(t)) & 0 \end{bmatrix} \quad (44) $$

$$ \bar{R}(\xi_{\phi}(t)) := \begin{bmatrix} R_{\phi}(x_{\phi}(t)) & 0 \\ -\bar{D}_{\phi}(\xi_{\phi}(t)) & 0 \end{bmatrix}, \quad (45) $$

$$ \bar{g}_{\phi}(\xi_{\phi}(t)) := \begin{bmatrix} g_{\phi}(x_{\phi}(t)) \\ 0 \end{bmatrix} \quad (46) $$

$$ \Xi_{\phi, \hat{\phi}} := \begin{bmatrix} \Xi_{\phi, \hat{\phi}} & 0 \\ 0 & \mu_{\phi, \hat{\phi}} \end{bmatrix}, \quad \bar{\Phi}_l := \begin{bmatrix} \Phi_l \\ 0 \end{bmatrix}, \quad (47) $$

and $\bar{D}_{\phi}(\xi_{\phi}(t)) := \frac{\zeta}{x_{t\phi}} \frac{\partial H}{\partial x_{\phi}}^{\top} R_{\phi}(x_{\phi}(t))$, due to the fact that $D(x_{\phi}(t))$ is the dissipated energy of the system by
definition, that is, $D(x_{\phi}(t)) := \frac{\partial H}{\partial x_{\phi}}^{\top} R_{\phi}(x_{\phi}(t)) \frac{\partial H}{\partial x_{\phi}}$.

Now, we state the following result.

**Theorem 4** Consider the multi-mode multi-dimensional switched port-Hamiltonian system (40)-(42), where for every transition from mode $\hat{\phi} \in S$ to its consecutive mode $\phi \in S$, the factor $\mu_{\phi, \hat{\phi}}$ in (29) is chosen according to (36). Then, if the (state-dependent) switching signal $\sigma(\xi_{\phi}(t))$ is such that the energy-based switching condition (37) is satisfied with $\beta = 0$ ($\beta > 0$), the system is (weakly) passive with respect to the power port $(u_{e\sigma(t)}(t), y_{e\sigma(t)}(t))$.

*Proof.* Let us consider the multiple storage functions $\mathcal{H}_{\phi}$. We know, from (40)-(41) and from (33)-(34), that for every mode $\phi \in S$, with previous mode $\hat{\phi} \in S$, the storage functions satisfy

$$ \dot{\mathcal{H}}_{\phi}(\xi_{\phi}(t)) \leq y_{e\phi}(t)^{\top} u_{e\phi}(t) \quad (48) $$

$$ \mathcal{H}_{\phi}(\xi_{\phi}(t_l)) \leq \mathcal{H}_{\hat{\phi}}(\xi_{\hat{\phi}}(t_l^-)) + \beta. \quad (49) $$

Integrating (48) over the interval $[t_l, t_{l+1}^-)$, where $t_0 \le t_l \le t_{l+1} \le t_f$, yields

$$ \mathcal{H}_{\sigma(t_{l+1}^-)}(\xi_{\phi}(t_{l+1}^-)) \leq \mathcal{H}_{\sigma(t_l)}(\xi_{\phi}(t_l)) + \int_{t_l}^{t_{l+1}^-} y_{e\sigma(s)}(s)^{\top} u_{e\sigma(s)}(s) ds. \quad (50) $$

Then, applying (49) and (50) recursively we have

$$ \begin{aligned} & \mathcal{H}_{\sigma(t_{l+1}^-)}(\xi_{\phi}(t_{l+1}^-)) \\ & \leq \mathcal{H}_{\sigma(t_l^-)}(\xi_{\phi}(t_l^-)) + \int_{t_l}^{t_{l+1}^-} y_{e\sigma(s)}(s)^{\top} u_{e\sigma(s)}(s) ds + \beta \\ & \leq \mathcal{H}_{\sigma(t_{l-1}^-)}(\xi_{\phi}(t_{l-1}^-)) + \int_{t_l}^{t_{l+1}^-} y_{e\sigma(s)}(s)^{\top} u_{e\sigma(s)}(s) ds \\ & \quad + \int_{t_{l-1}}^{t_l^-} y_{e\sigma(s)}(s)^{\top} u_{e\sigma(s)}(s) ds + 2\beta \\ & \vdots \\ & \leq \mathcal{H}_{\sigma(t_0^-)}(\xi_{\phi}(t_0^-)) + \sum_{j=0}^l \int_{t_j}^{t_{j+1}^-} y_{e\sigma(s)}(s)^{\top} u_{e\sigma(s)}(s) ds + l\beta. \end{aligned} \quad (51) $$

Furthermore, setting $t_f = t_{l+1}^-$ and from the non-negativity of $\mathcal{H}_{\sigma(t)}$, we obtain

$$ \begin{aligned} & \sum_{j=0}^{l} \int_{t_j}^{t_{j+1}^-} y_{e\sigma(s)}(s)^{\top} u_{e\sigma(s)}(s) ds \geq \mathcal{H}_{\sigma(t_{i+1}^-)}(\xi_{\phi}(t_{l+1}^-)) \\ & \quad - \mathcal{H}_{\sigma(t_0^-)}(\xi_{\phi}(t_0^-)) - l\beta \\ & \int_{t_0}^{t_f} y_{e\sigma(s)}(s)^{\top} u_{e\sigma(s)}(s) ds \geq -\gamma \end{aligned} \quad (52) $$

where $\gamma := \mathcal{H}_{\sigma(t_0)}(\xi_{\phi}(t_0)) + l\beta \geq 0$, which implies that the M$^3$D switched system (40)-(42) is weakly passive. If $\beta = 0$, (52) implies that the system is passive. ■

## 4 Application to open multi-robot systems

In an OMRS, agents may arbitrarily leave or join the system due to failure, secondary tasks, human action, etc. This naturally leads to their representation as an M$^3$D switched system, where the state of the network, collecting the state variables of the agents present in the group, increases or decreases in dimension as robots leave or new ones join the system. In this section we use the previously-presented energy-tank-based framework so that the OMRS, subject to a proximity-based sensing model, can deal with the addition and removal of agents in an autonomous way while preserving passivity.

### 4.1 Modeling of the multi-robot system

The agents are modeled as floating masses in $\mathbb{R}^3$ coupled by means of inter-agent forces. We use the pH formalism to represent each agent as an element storing kinetic energy with a dynamic model given by

$$ \dot{p}_i = F_i^{\lambda} + F_i^e - B_i M_i^{-1} p_i, \quad i = 1, \dots, n_{\phi} \quad (53) $$

$$ v_i = \frac{\partial \mathcal{K}_i}{\partial p_i} = M_i^{-1} p_i $$

where $p_i \in \mathbb{R}^3$ and $M_i \in \mathbb{R}^{3 \times 3}$ are, respectively, the momentum and the positive-definite inertia matrix of agent $i$, $\mathcal{K}_i(p_i) := \frac{1}{2} p_i^{\top} M_i^{-1} p_i$ is the kinetic energy stored by the agent during its motion, and $B_i \in \mathbb{R}^{3 \times 3}$ is a positive-definite matrix representing a velocity damping term. The force $F_i^{\lambda} \in \mathbb{R}^3$ represents a potential force that is used for cooperative behavior such as, e.g., generalized connectivity maintenance—see below—and $F_i^e \in \mathbb{R}^3$ is an additional input that can be exploited for implementing other tasks of interest. $v_i \in \mathbb{R}^3$ is the velocity of the agent and $x_i \in \mathbb{R}^3$ its position, with $\hat{x}_i = v_i$.

With respect to the interaction between the agents, we assume that they communicate over a dynamic topology described by an *undirected* graph $G_{\phi}(V_{\phi}, E_{\phi}(t))$ where the set of nodes $V_{\phi} := \{1, 2, \dots, n_{\phi}\}$ corresponds to the labels of the agents and the set of edges, $E_{\phi} \subseteq V_{\phi}^2$ represents the communication between a pair of nodes, that is, an edge $e_k := (i, j) \in E_{\phi}$, is an unordered pair indicating that agent $j$ has access to information from node $i$ and vice-versa. We assume that the communication between the agents is proximity-based, that is, and edge $e_k$ connecting agents $i$ and $j$ exists if and only if $\|p_i - p_j\| \le R$, with $R$ denoting the upper-bound on the distance for below which the communication is reliable. Hence, we define the set of neighbors of agent $i$ as

$$ \mathcal{N}_{\phi,i} := \{j \in V_{\phi}, | j \neq i \text{ and } \|p_i - p_j\| < R\}. \quad (54) $$

To model this proximity-based communication we use the adjacency matrix $A_{\phi} \in \mathbb{R}^{n_{\phi} \times n_{\phi}}$, where the element $a_{ij}$, represents the weight of edge $e_k$. Namely, $a_{ij} > 0$
if and only if $j \in \mathcal{N}_{\phi,i}$, and $a_{ij} = 0$ otherwise. More precisely, given $r < R$ and denoting $d_{ij} := ||p_i - p_j||$, we let

$$a_{ij} = \begin{cases} 1, & \text{if } d_{ij} \le r \\ \frac{1}{2}\left(1 + \cos\left(\frac{\pi(d_{ij}-r)}{R-r}\right)\right), & \text{if } r < d_{ij} \le R \\ 0, & \text{if } R < d_{ij}. \end{cases} \quad (55)$$

Another useful graph-related notion in the incidence matrix of the graph which maps the nodes the edges. Here we define the incidence matrix in a non-standard way. First, note that since $\mathcal{G}_{\phi}(t)$ is undirected, it follows that $a_{ij} = a_{ji}$. Now, let

$$\begin{aligned} \mathcal{E}_{\phi}^{*} &= \{(1, 2), (1, 3), \dots, (1, n_{\phi}), \dots, (n_{\phi} - 1, n_{\phi})\} \\ &= \{e_1, e_2, \dots, e_{n_{\phi}-1}, \dots, e_{n_{\phi}(n_{\phi}-1)/2}\} \end{aligned} \quad (56)$$

be the set of all possible edges in $\mathcal{G}_{\phi}(t)$, that is, all the pairs $(i, j)$ such that $i < j$, sorted in lexicographical order. Then, we define $E_{\phi} \in \mathbb{R}^{n_{\phi} \times |\mathcal{E}_{\phi}^{*}|}$ such that, $\forall e_k = (i, j) \in \mathcal{E}_{\phi}^{*}$, $[E_{\phi}]_{ik} = -1$ and $[E_{\phi}]_{jk} = 1$, if $e_k \in \mathcal{E}_{\phi}$, and $[E_{\phi}]_{ik} = [E_{\phi}]_{jk} = 0$ otherwise.

The Laplacian matrix $L_{\phi} \in \mathbb{R}^{n_{\phi} \times n_{\phi}}$ is a symmetric positive semi-definite matrix given by $L_{\phi} = \text{diag}\{A_{\phi}1\} - A_{\phi}$, with $1 \in \mathbb{R}^{n_{\phi}}$ the vector of all ones, or, equivalently, $L_{\phi} = E_{\phi}E_{\phi}^{\top}$. It is well known that some fundamental properties of the graph are associated with the Laplacian matrix. Specifically, denoting $\lambda_{2,\phi}$ as the second smallest eigenvalue of $L_{\phi}$, we have that $\lambda_{2,\phi} > 0$ if and only if $\mathcal{G}_{\phi}(t)$ is connected and $\lambda_{2,\phi} = 0$ otherwise—see [9] for more details on graph theory. Furthermore, we state the following assumption.

**Assumption 1** The graph $\mathcal{G}_{\sigma(t)}$ is connected for all $t \ge t_0$. Equivalently, $\lambda_{2,\sigma(t)}(t) > 0$ for all $t \ge t_0$.

The interaction force $F_{i}^{\lambda}$ can be taken as the gradient of a potential function $V_{\phi}^{\lambda}: \mathcal{D} \to \mathbb{R}_{\ge 0}$, i.e.,

$$F_{i}^{\lambda} = -\frac{\partial V_{\phi}^{\lambda}(\lambda_{2,\phi}(x))}{\partial x_{i}}, \quad (57)$$

where $V_{\phi}^{\lambda}$ is $\mathcal{C}^1$ over its domain and has the property that $V_{\phi}^{\lambda}(\lambda_{2,\phi}(x)) \to \infty$ as $\lambda_{2,\phi}(x) \to 0$. The latter guarantees that the connectivity of the network is preserved.

**Remark 5** For ease of exposition, in this paper we consider the proximity-based weights (55), which, coupled with the gradient control (57) guarantees the maintenance of connectivity, cf. [8]. However, note that by properly designing the weights $a_{ij}$ of the adjacency matrix so that $\lambda_{2,\phi}(x)$ is a state-dependent measure of generalized connectivity as in [8], the same interaction force (57) may be used to guarantee the satisfaction of multiple constraints such as collision avoidance, (bi)connectivity maintenance, visibility maintenance, obstacle avoidance, etc.

**Remark 6** Assumption 1 implies that at every switching instant $t_1$, the “remaining graph,” that is, the graph that is left after the (possible) removal of agents and their incident edges, is connected. This is not guaranteed even if the connectivity of the graph is preserved between switching instants, that is, for all $t \in [t_1, t_{1+1})$, using a connectivity-maintenance algorithm such as in, e.g., [8]. If, instead, a biconnectivity-preserving algorithm as the one proposed [25] is used, Assumption 1 is reasonable. Indeed, a biconnected graph is robust to node removal and, using the approach presented in [25] the graph is guaranteed to become and stay biconnected in finite time, thereby ensuring that the remaining graph stays connected.

**Remark 7** It is important to mention that although the formulation in (57) requires knowledge of the algebraic connectivity $\lambda_{2,\phi}$, which is a global parameter, there exist numerous algorithms in the literature for estimating the algebraic connectivity in a distributed manner with a specified error bound—see e.g. [27]—or even with prescribed convergence and a non-constant number of agents—see [16]. Therefore, in this paper we consider that the algebraic connectivity (or at least a good enough estimation) is known to the agents at all times.

Due to the open nature of the system, the dimension of the state is not constant for all switching modes $\phi \in \mathcal{S}$. Indeed, as robots are allowed to leave and join the system, the dimension of the state decreases or increases, respectively, at each mode. Therefore, akin to (18)-(20), the OMRS is represented as an $\mathbb{M}^3\mathcal{D}$ switched system. Define $p_{\phi}^{\top} = [p_1^{\top} \cdots p_{n_{\phi}}^{\top}] \in \mathbb{R}^{3n_{\phi}}$, $B_{\phi} = \text{diag}(B_i) \in \mathbb{R}^{3n_{\phi} \times 3n_{\phi}}$, $F_{\phi}^{e\top} = [F_1^{e\top} \cdots F_{n_{\phi}}^{e\top}] \in \mathbb{R}^{3n_{\phi}}$. Furthermore, let $z_k = x_i - x_j$ represent the relative position of agent $i$ with respect to agent $j$. Then, replicating the order used for $\mathcal{E}_{\phi}^{*}$ all the possible $|\mathcal{E}_{\phi}^{*}|$ relative positions are collected in the vector of varying dimension

$$z_{\phi}^{\top} = [z_1, \dots, z_{3n_{\phi}(n_{\phi}-1)/2}] \in \mathbb{R}^{3n_{\phi}(n_{\phi}-1)/2}.$$

Note that, with $\partial z_k / \partial x_i = I_3$, (57) may be expressed as

$$F_{i}^{\lambda} = - \sum_{k=1}^{3n_{\phi}(n_{\phi}-1)/2} \frac{\partial V_{\phi}^{\lambda}(\lambda_{2,\phi})}{\partial z_k}. \quad (58)$$

and that $\dot{z}_k = v_i - v_j$.

Now, let the energy of the system be given by

$$H_{\phi}(p_{\phi}, z_{\phi}) = \sum_{i=1}^{n_{\phi}} K_{i}(p_{i}) + V_{\phi}^{\lambda}(\lambda_{2,\phi}(z_{\phi})) \ge 0. \quad (59)$$

Then, we have

$$\begin{bmatrix} \dot{p}_{\phi}(t) \\ \dot{z}_{\phi}(t) \end{bmatrix} = - \begin{bmatrix} B_{\phi} & -\mathbb{E}_{\phi} \\ \mathbb{E}_{\phi}^{\top} & 0 \end{bmatrix} \nabla H_{\phi}(t) + G_{\phi} F_{\phi}^{e}(t) \quad (60)$$
$$v_{\phi}(t) = G_{\phi}^{\top} \nabla H_{\phi}(t) \quad (61)$$

$$\begin{bmatrix} p_{\phi}(t_l) \\ z_{\phi}(t_l) \end{bmatrix} = \begin{bmatrix} \Xi_{\phi, \hat{\phi}}^p & 0 \\ 0 & \Xi_{\phi, \hat{\phi}}^z \end{bmatrix} \begin{bmatrix} p_{\hat{\phi}}(t_l^-) \\ z_{\hat{\phi}}(t_l^-) \end{bmatrix} + \begin{bmatrix} \Phi_l^p \\ \Phi_l^z \end{bmatrix} \quad (62)$$

where

$$\nabla H_{\phi}^{\top} = \left[ \frac{\partial^{\top} H_{\phi}}{\partial p_{\phi}} \quad \frac{\partial^{\top} H_{\phi}}{\partial z_{\phi}} \right],$$

$\Xi_{\phi, \hat{\phi}}^p \in \mathbb{B}^{n_{\phi} \times n_{\hat{\phi}}}$ and $\Xi_{\phi, \hat{\phi}}^z \in \mathbb{B}^{M_{\phi} \times M_{\hat{\phi}}}$ are 0-1 rectangular matrices indicating the dimension variation of the state at $t_l$, and $\Phi_{l,p} \in \mathbb{R}^{n_{\phi}}$ and $\Phi_{l,z} \in \mathbb{R}^{M_{\phi}}$ are the real vectors indicating the value changes of $p_{\hat{\phi}}$ and $z_{\hat{\phi}}$, respectively, at any $t_l$. Moreover, $\mathbb{E}_{\phi} = E_{\phi} \otimes I_3$, $G_{\phi}^{\top} = [I_{n_{\phi}} \otimes I_3 \ 0]$, with '$\otimes$' denoting the Kronecker product, and $v_{\phi} \in \mathbb{R}^{3n_{\phi}}$ is the conjugate power variable associated with $F_{\phi}^e$.

The derivative of (59) along (60)-(61) for every mode $\phi \in S$ satisfies

$$\begin{aligned} \dot{H}_{\phi}(p_{\phi}, z_{\phi}) &= -\nabla H_{\phi}^{\top}(t) B_{\phi} \nabla H_{\phi}(t) + \nabla H_{\phi}^{\top}(t) G_{\phi} F_{\phi}^{e}(t) \\ &\leq v_{\phi}(t)^{\top} F_{\phi}^{e}(t), \end{aligned} \quad (63)$$

implying that the multi-robot system is passive during each active mode.

Following the analysis exposed in the previous section, at the switching instant we have

$$H_{\phi}(t_l) \leq H_{\phi}^{\top}(t_l^{-}) + \Delta H_{\phi, \hat{\phi}}(t_l^{-}). \quad (64)$$

In the context of OMRS, the instantaneous change in energy, $\Delta H_{\phi, \hat{\phi}}$, comes primarily from the fact that agents join and/or leave at switching instants. For a transition from mode $\hat{\phi} \in S$ to $\phi \in S$, let $\mathcal{R}_{\phi, \hat{\phi}} \subseteq \mathcal{V}_{\hat{\phi}}$ denote the set of agents that are part of the system in both modes, i.e., all

$$\mathcal{R}_{\phi, \hat{\phi}} := \{i \in \mathbb{N} : i \in \mathcal{V}_{\hat{\phi}} \cap \mathcal{V}_{\phi}\}. \quad (65)$$

Similarly, let $\mathcal{J}_{\phi, \hat{\phi}} \subset \mathcal{V}_{\phi}$, and $\mathcal{L}_{\phi, \hat{\phi}} \subset \mathcal{V}_{\hat{\phi}}$ be, respectively, the sets of joining and leaving agents, i.e.,

$$\mathcal{J}_{\phi, \hat{\phi}} := \{i \in \mathcal{V}_{\phi} : i \notin \mathcal{V}_{\hat{\phi}}\}, \quad \mathcal{L}_{\phi, \hat{\phi}} := \{i \in \mathcal{V}_{\hat{\phi}} : i \notin \mathcal{V}_{\phi}\}. \quad (66)$$

Then, from the definition of the Hamiltonian in (59) and the sets (65)-(66), we have that

$$\begin{aligned} H_{\phi}(t_l) &= \sum_{i \in \mathcal{R}_{\phi, \hat{\phi}}} \mathcal{K}_i(p_i(t_l)) + \sum_{i \in \mathcal{J}_{\phi, \hat{\phi}}} \mathcal{K}_i(p_i(t_l)) + V_{\phi}^{\lambda}(\hat{\lambda}_{2, \phi}(z_{\phi}(t_l))) \\ &= \sum_{i \in \mathcal{R}_{\phi, \hat{\phi}}} \mathcal{K}_i(p_i(t_l^-)) + \sum_{i \in \mathcal{J}_{\phi, \hat{\phi}}} \mathcal{K}_i(p_i(t_l^-)) \pm \sum_{i \in \mathcal{L}_{\phi, \hat{\phi}}} \mathcal{K}_i(p_i(t_l^-)) \\ &\quad + V_{\phi}^{\lambda}(\lambda_{2, \phi}(z_{\phi}(t_l))) \pm V_{\hat{\phi}}^{\lambda}(\lambda_{2, \hat{\phi}}(z_{\hat{\phi}}(t_l^-))) \\ &= H_{\hat{\phi}}(t_l^-) + \Delta \mathcal{K}_{\phi, \hat{\phi}}(t_l^-) + \Delta V_{\phi, \hat{\phi}}^{\lambda}(t_l^-), \end{aligned}$$

where

$$\Delta \mathcal{K}_{\phi, \hat{\phi}}(t_l^-) := \sum_{i \in \mathcal{J}_{\phi, \hat{\phi}}} \mathcal{K}_i(p_i(t_l^-)) - \sum_{i \in \mathcal{L}_{\phi, \hat{\phi}}} \mathcal{K}_i(p_i(t_l^-)) \quad (67)$$

is the variation in total kinetic energy due to agents leaving/joining and

$$\Delta V_{\phi, \hat{\phi}}(t_l^-) := V_{\phi}^{\lambda}(\lambda_{2, \phi}(z_{\phi}(t_l))) - V_{\hat{\phi}}^{\lambda}(\lambda_{2, \hat{\phi}}(z_{\hat{\phi}}(t_l^-))) \quad (68)$$

is the variation in the total potential energy. Denoting $\Delta H_{\phi, \hat{\phi}}(t_l^-) := \Delta \mathcal{K}_{\phi, \hat{\phi}}(t_l^-) + \Delta V_{\phi, \hat{\phi}}^{\lambda}(t_l^-)$, we obtain (64).

## 4.2 Distributed energy tanks

In order to account for the sudden change in total energy of the OMRS in a distributed way, instead of considering a single tank for the switched system as in Section 3.2, in this section for the energy-based design we define $n_{\phi}$ individual tanks forming an OMRS. That is, we consider that each robot in the network possesses an energy tank and it is able to communicate the current state of its tank with its neighbors.

For each $i \in \mathcal{V}_{\phi}$, let the continuous evolution of the energy-tank state be given by

$$\dot{x}_{ti}(t) = \zeta_i \left[ \frac{\kappa}{x_{ti}(t)} D_i(p_i(t)) - c \sum_{j \in \mathcal{N}_i} (x_{ti}(t) - x_{tj}(t)) + \frac{w_i^{\top}(t)y_i(t)}{x_{ti}(t)} \right]. \quad (69)$$

The first term in the right-hand side of (69), where $D_i(p_i(t)) = p_i(t)^{\top} M_i^{-1} B_i M_i^{-1} p_i(t)$ denotes the dissipated energy by robot $i$ which serves as a way to fill in the tank. The second term in the right-hand side of (62) is an agreement protocol designed so that the agents continuously reach consensus on the energy in the individual tanks. This allows for the total energy in the tanks to be distributed equivalently over the whole multi-robot system, thereby making the individual tanks behave as a single energy-tank for the OMRS. The last term is a free task-dependent action to be implemented in a passive way. Finally, $\zeta_i$ is defined, for each agent, as in (14), i.e.,

$$\zeta = \begin{cases} 0, & \text{if } (T_i < \varepsilon) \text{ or } (T_i = \bar{\varepsilon} \wedge \dot{x}_{ti} > 0) \\ 1, & \text{otherwise,} \end{cases} \quad (70)$$

in order to prevent the tank from filling more than the specified upper limit.

Now, recall the sets $\mathcal{R}_{\phi, \hat{\phi}}$, $\mathcal{J}_{\phi, \hat{\phi}}$, and $\mathcal{L}_{\phi, \hat{\phi}}$, defined previously in (65)-(66), and denote as $\mathcal{M}_{\phi, \hat{\phi}}^{\mathcal{J}} \subseteq \mathcal{R}_{\phi, \hat{\phi}}$ and $\mathcal{M}_{\phi, \hat{\phi}}^{\mathcal{L}} \subseteq \mathcal{R}_{\phi, \hat{\phi}}$ the sets of remaining agents that are neighbors to the joining and leaving robots, respectively,
i.e.,

$$ \mathcal{M}_{\phi, \hat{\phi}}^{\mathcal{J}} := \{i \in \mathcal{R}_{\phi, \hat{\phi}} : (i, j) \in \mathcal{E}_{\phi}(t_{l}^{+}), \forall j \in \mathcal{J}_{\phi, \hat{\phi}}\} \quad (71) $$

$$ \mathcal{M}_{\phi, \hat{\phi}}^{\mathcal{L}} := \{i \in \mathcal{R}_{\phi, \hat{\phi}} : (i, j) \in \mathcal{E}_{\hat{\phi}}(t_{l}^{-}), \forall j \in \mathcal{L}_{\phi, \hat{\phi}}\}, (72) $$

and let $\mathcal{M}_{\phi, \hat{\phi}}^{\mathcal{JL}} := \mathcal{M}_{\phi, \hat{\phi}}^{\mathcal{J}} \cup \mathcal{M}_{\phi, \hat{\phi}}^{\mathcal{L}}$. Then, the state transition of the tanks of the remaining agents at the switching time $t_l$ is given by

$$ x_{ti}(t_l) = \begin{cases} \mu_i x_{ti}(t_l^{-}), & \text{if } i \in \mathcal{M}_{\phi, \hat{\phi}}^{\mathcal{JL}} \\ x_{ti}(t_l^{-}), & \text{otherwise,} \end{cases} \quad (73) $$

The transition law (73) guarantees that only those nodes that are neighbors to joining or leaving agents at the switching instants $t_l$ will update their energy-tank state in order to compensate for the increase or decrease in total energy, making the approach distributed since only local interactions are required.

Defining $x_{t\phi}^{\top} = [x_{t1}^{\top} \cdots x_{tn_{\phi}}^{\top}] \in \mathbb{R}^{n_{\phi}}$, $\tilde{D}_{\phi}(p_{\phi}(t))^{\top} = [\frac{\zeta_{i\kappa}}{x_{t1}(t)} D_1(p_1(t)) \cdots \frac{\zeta_{i\kappa}}{x_{tn_{\phi}}(t)} D_{n_{\phi}}(p_{n_{\phi}}(t))]$, and $\tilde{W}_{\phi}(t) = \text{diag}\{\zeta_i \frac{w_i(t)^{\top}}{x_{ti}(t)}\}$, and considering, without loss of generality, that the states of the agents leaving are removed from the end and new states are appended to the end, the impulsive switching multiple tanks may be written in compact form as

$$ \dot{x}_{t\phi}(t) = \tilde{D}_{\phi}(p_{\phi}(t)) - L_{\phi}x_{t\phi}(t) + \tilde{W}_{\phi}(t)y_{\phi}(t) \quad (74) $$

$$ x_{t\phi}(t_l) = \Xi_{\phi, \hat{\phi}}^{t} \Lambda_{\phi, \hat{\phi}} x_{t\phi}(t_l^{-}) + \Phi_l^{t} \quad (75) $$

where $\Phi_{l,t}$ is a real valued vector with the values of the new states, $\Xi_{\phi, \hat{\phi}}^{t} \in \mathbb{R}^{n_{\phi} \times n_{\hat{\phi}}}$ is a 0-1 rectangular matrix indicating the dimension variation of the state at $t_l$, and $\Lambda_{\phi, \hat{\phi}} \in \mathbb{R}^{n_{\hat{\phi}} \times n_{\phi}}$ is a diagonal matrix with entries $[\Lambda_{\phi, \hat{\phi}}]_{ii} = \mu_i$ if $i \in \mathcal{M}_{\phi, \hat{\phi}}^{\mathcal{JL}}$, $[\Lambda_{\phi, \hat{\phi}}]_{ii} = 1$ if $i \in \mathcal{R}_{\phi, \hat{\phi}} \setminus \mathcal{M}_{\phi, \hat{\phi}}^{\mathcal{JL}}$, and $[\Lambda_{\phi, \hat{\phi}}]_{ii} = 0$ otherwise.

For every mode $\phi \in S$, let the energy function of the tanks be

$$ T_{\phi}(t) = \frac{1}{2} \sum_{i=1}^{n_{\phi}} x_{ti}^{2}(t). \quad (76) $$

Then, at a switching instant $t_l$, the energy in the tanks is the (updated) energy of the remaining agents plus the

energy of the joining robots. More precisely, we have

$$ \begin{aligned} T_{\phi}(t_l) &= \frac{1}{2} \sum_{i \in \mathcal{V}_{\phi}} x_{ti}^{2}(t_l) \\ &= \frac{1}{2} \left[ \sum_{i \in \mathcal{R}_{\phi, \hat{\phi}}} x_{ti}^{2}(t_l) + \sum_{i \in \mathcal{J}_{\phi, \hat{\phi}}} x_{ti}^{2}(t_l) \right] \\ &= \frac{1}{2} \left[ \sum_{i \in \mathcal{V}_{\phi} \setminus \mathcal{M}_{\phi, \hat{\phi}}^{\mathcal{JL}}} x_{ti}^{2}(t_l) + \sum_{i \in \mathcal{M}_{\phi, \hat{\phi}}^{\mathcal{JL}}} x_{ti}^{2}(t_l) + \sum_{i \in \mathcal{J}_{\phi, \hat{\phi}}} x_{ti}^{2}(t_l) \right] \\ &= \frac{1}{2} \left[ \sum_{i \in \mathcal{V}_{\hat{\phi}} \setminus \mathcal{M}_{\phi, \hat{\phi}}^{\mathcal{JL}}} x_{ti}^{2}(t_l^{-}) + \sum_{i \in \mathcal{M}_{\phi, \hat{\phi}}^{\mathcal{JL}}} \mu_i^2 x_{ti}^{2}(t_l^{-}) + \sum_{i \in \mathcal{J}_{\phi, \hat{\phi}}} x_{ti}^{2}(t_l) \right] \\ &= T_{\hat{\phi}}(t_l^{-}) + \frac{1}{2} \left[ \sum_{i \in \mathcal{M}_{\phi, \hat{\phi}}^{\mathcal{JL}}} (\mu_i^2 - 1)x_{ti}^{2}(t_l^{-}) + \sum_{i \in \mathcal{J}_{\phi, \hat{\phi}}} x_{ti}^{2}(t_l) - \sum_{i \in \mathcal{L}_{\phi, \hat{\phi}}} x_{ti}^{2}(t_l^{-}) \right]. \end{aligned} \quad (77) $$

Letting $\Delta T_{\phi, \hat{\phi}}(t_l)$ denote the second term on the right-hand side of (77), we have

$$ T_{\phi}(t_l) = T_{\hat{\phi}}(t_l^{-}) + \Delta T_{\phi, \hat{\phi}}(t_l). \quad (78) $$

Now, following the development is Section 3.2 and letting the total energy of the OMRS be

$$ \mathcal{H}_{\phi}(p_{\phi}, z_{\phi}, x_{t\phi}) := H_{\phi}(p_{\phi}, z_{\phi}) + T_{\phi}(x_{t\phi}), \quad (79) $$

we have that

$$ \begin{aligned} \mathcal{H}_{\phi}(t_l) &\leq H_{\hat{\phi}}(t_l^{-}) + T_{\hat{\phi}}(t_l^{-}) + \Delta H_{\phi, \hat{\phi}}(t_l) + \Delta T_{\phi, \hat{\phi}}(t_l) \\ &\leq \mathcal{H}_{\hat{\phi}}(t_l^{-}) + \Delta H_{\phi, \hat{\phi}}(t_l) + \Delta T_{\phi, \hat{\phi}}(t_l). \end{aligned} \quad (80) $$

Therefore, as in (34), we want to choose $\mu_i$, $\forall i \in \mathcal{R}_{\phi, \hat{\phi}}$, such that, for a small positive constant $\beta$ it holds that

$$ \Delta H_{\phi, \hat{\phi}}(t_l) + \Delta T_{\phi, \hat{\phi}}(t_l) \leq \beta. \quad (81) $$

In order to choose the proper values for the parameters $\mu_i$, let us first define the following sets. Let $\mathcal{N}_{i}^{\mathcal{J}} \subseteq \mathcal{N}_{\phi,i}$ and $\mathcal{N}_{i}^{\mathcal{L}} \subseteq \mathcal{N}_{\hat{\phi},i}$ denote the sets of joining and leaving agents that are neighbors to robot $i \in \mathcal{R}_{\phi, \hat{\phi}}$ at $t_l$ and $t_l^{-}$, respectively. More precisely

$$ \mathcal{N}_{i}^{\mathcal{J}} = \{j \in \mathcal{J}_{\phi, \hat{\phi}} : (i, j) \in \mathcal{E}(t_l^{+}), \forall i \in \mathcal{R}_{\phi, \hat{\phi}}\}, \quad (82) $$

$$ \mathcal{N}_{i}^{\mathcal{L}} = \{j \in \mathcal{L}_{\phi, \hat{\phi}} : (i, j) \in \mathcal{E}(t_l^{-}), \forall i \in \mathcal{R}_{\phi, \hat{\phi}}\}. \quad (83) $$

Moreover at a switching instant $t_l$ we set the following protocol:
* Every leaving robot, i.e. $i \in \mathcal{L}_{\phi, \hat{\phi}}$, sends to its neighbors at $t_l^-$ its tank energy and its kinetic energy divided by its number of neighbors.

* Every joining robot, i.e. $i \in \mathcal{J}_{\phi, \hat{\phi}}$, sends to its neighbors at $t_l^+$ its tank energy and its kinetic energy divided by its number of neighbors.

Then, using (77) and (81), we obtain

$$ \sum_{i \in \mathcal{M}_{\phi, \hat{\phi}}^{\mathcal{J}, \mathcal{L}}} (\mu_i^2 - 1)x_{ti}^2(t_l^-) + \sum_{i \in \mathcal{J}_{\phi, \hat{\phi}}} x_{ti}^2(t_l) - \sum_{i \in \mathcal{L}_{\phi, \hat{\phi}}} x_{ti}^2(t_l^-) \\ \leq -2\Delta H_{\phi, \hat{\phi}} + 2\beta. \qquad (84) $$

Then, for every agent $i \in \mathcal{R}_{\phi, \hat{\phi}}$, we set the values of $\mu_i$ to

$$ \mu_i = \begin{cases} \bar{\epsilon}/x_{ti}(t_l^-), & \text{if } x_{ti}^* \geq \bar{\epsilon} \\ x_{ti}^*/x_{ti}(t_l^-), & \text{otherwise,} \end{cases} \qquad (85) $$

where

$$ x_{ti}^* = \left[ 2 \left( T_i(t_l^-) - \left( \sum_{j \in \mathcal{N}_i^{\mathcal{J}}} \frac{T_j(t_l^+)}{|\mathcal{N}_{\phi,j}|} - \sum_{j \in \mathcal{N}_i^{\mathcal{L}}} \frac{T_j(t_l^-)}{|\mathcal{N}_{\hat{\phi},j}|} \right) - \left( \sum_{j \in \mathcal{N}_i^{\mathcal{J}}} \frac{\mathcal{K}_j(t_l^+)}{|\mathcal{N}_{\phi,j}|} - \sum_{j \in \mathcal{N}_i^{\mathcal{L}}} \frac{\mathcal{K}_j(t_l^-)}{|\mathcal{N}_{\hat{\phi},j}|} \right) - v_i \right]^{\frac{1}{2}} \qquad (86) $$

and $T_i$ and $\mathcal{K}_i$ are, respectively, the tank energy and the kinetic energy of robot $i$ and $v_i$ is a value to account for the change in the potential (generalized connectivity) energy, which is chosen so that the following holds:

$$ \sum_{i \in \mathcal{N}_{\phi, \hat{\phi}}^{\mathcal{J}}} v_i + \Delta V_{\phi, \hat{\phi}}^{\lambda} \leq \beta. \qquad (87) $$

**Remark 8** Recalling Remark 7, in this paper we assume that the algebraic connectivity at mode $\phi$, $\lambda_{2,\phi}$, is known by all the agents. Under this assumption one could simply choose $v_i = \Delta V_{\phi, \hat{\phi}}^{\lambda}$ for every $i$. However, in practice, the knowledge of $\lambda_{2,\phi}$, that is, the algebraic connectivity at the next mode $\phi$ is not necessarily known and should be estimated. For this, one could consider multiple solutions. On the one hand, one could leverage the delay between the change in topology (jump from mode $\hat{\phi}$ to $\phi$) and consider $\Delta V_{\phi, \hat{\phi}}^{\lambda} = 0$ at the switching instant. Indeed, as in [16], the estimated value of $\lambda_{2,\phi}$ does not instantly change when an agent is added/removed and rather manifests a transient before it stabilizes to the new value in mode $\phi$. In this case one could simply set $v_i$ to be a positive small constant. On the other hand, one could consider, e.g., that a joining agent is able to communicate with the would-be neighbors in the network before joining the system, at which point an additional estimation of $\lambda_{2,\phi}$ at the next mode $\phi$ could be performed “in

the background” and hence calculate $\Delta V_{\phi, \hat{\phi}}^{\lambda}$. A solution to this implementation-related problem is, however, an open problem which will be investigated in future work. • Akin to (37), it is now possible to deduce from (85) an energy-based switching condition for the OMRS. Indeed, we have that a switching can take place as long as for every $i \in \mathcal{R}_{\phi, \hat{\phi}}$ the following holds:

$$ T_i(t_l^-) - \left( \sum_{j \in \mathcal{N}_i^{\mathcal{J}}} \frac{T_j(t_l^+)}{|\mathcal{N}_{\phi,j}|} - \sum_{j \in \mathcal{N}_i^{\mathcal{L}}} \frac{T_j(t_l^-)}{|\mathcal{N}_{\hat{\phi},j}|} \right) - \left( \sum_{j \in \mathcal{N}_i^{\mathcal{J}}} \frac{\mathcal{K}_j(t_l^+)}{|\mathcal{N}_{\phi,j}|} - \sum_{j \in \mathcal{N}_i^{\mathcal{L}}} \frac{\mathcal{K}_j(t_l^-)}{|\mathcal{N}_{\hat{\phi},j}|} \right) - v_i \geq \varepsilon > 0 \qquad (88) $$

In other words, each “remaining” agent uses the energy in its own tank and some of the energy of its leaving neighbors to compensate for the increase of energy due to the joining/leaving agents.

Besides preserving passivity, one of the main advantages of the (state-dependent) energy-based switching condition (88) resulting from our approach, with respect to, e.g. approaches considering time-dependent switching signal, is that the protocol for adding or removing agents into the network becomes completely autonomous and distributed. Indeed, based on the energy condition (88) any individual agent $i \in \mathcal{R}_{\phi, \hat{\phi}}$ can decide autonomously whether to let a (potential) neighbor (join) leave. Hence, in this context, recalling Remark 3, if a potentially joining agent is detected, e.g., via embedded sensors, but the energy in the concerned tanks is not enough to satisfy (88), the agent will not be added to the system and it will continue with its evolution until the energy-based condition is satisfied due to, e.g., the tanks filling further or more of the robots already in the group detecting the new agent. The latter is explicitly presented in the numerical example in Section 4.4 below. Moreover, the condition (88) is distributed, therefore scalable, as it only depends on local information. These two properties make our approach well suited for implementation in autonomous long-term multi-robot missions in dynamic environments where the addition and removal of agents via, e.g., a human supervisor or the design on a time-dependent switching signal is impractical or even unfeasible.

## 4.3 Passivity of the OMRS

From (60)-(62) and (74)-(75) the complete multi-mode multi-dimensional system can be written in the form

$$ \begin{bmatrix} \dot{p}_{\phi}(t) \\ \dot{z}_{\phi}(t) \\ \dot{x}_{t\phi}(t) \end{bmatrix} = \begin{pmatrix} \begin{bmatrix} 0 & \mathbb{E}_{\phi} & 0 \\ -\mathbb{E}_{\phi} & 0 & \tilde{W}_{\phi}(t) \\ 0 & -\tilde{W}_{\phi}(t) & 0 \end{bmatrix} & \end{pmatrix} \qquad (89) $$
$$-\begin{bmatrix} B_{\phi} & 0 & 0 \\ 0 & 0 & 0 \\ -P_{\phi}(t)B_{\phi} & 0 & L_{\phi} \end{bmatrix} \begin{bmatrix} \frac{\partial \mathcal{H}_{\phi}(t)}{\partial p_{\phi}} \\ \frac{\partial \mathcal{H}_{\phi}(t)}{\partial z_{\phi}} \\ \frac{\partial \mathcal{H}_{\phi}(t)}{\partial x_{t\phi}} \end{bmatrix} + G_{\phi} F_{\phi}^{e}(t)$$

$$v_{\phi}(t) = G_{\phi}^{\top} \begin{bmatrix} \frac{\partial \mathcal{H}_{\phi}(t)}{\partial p_{\phi}} \\ \frac{\partial \mathcal{H}_{\phi}(t)}{\partial z_{\phi}} \\ \frac{\partial \mathcal{H}_{\phi}(t)}{\partial x_{t\phi}} \end{bmatrix} \quad (90)$$

$$\begin{bmatrix} p_{\phi}(t_l) \\ z_{\phi}(t_l) \\ x_{t\phi}(t_l) \end{bmatrix} = \begin{bmatrix} \Xi_{\phi, \hat{\phi}}^{p} p_{\hat{\phi}}(t_l^{-}) \\ \Xi_{\phi, \hat{\phi}}^{z} z_{\hat{\phi}}(t_l^{-}) \\ \Xi_{\phi, \hat{\phi}}^{t} \mathcal{M}_{\phi, \hat{\phi}} x_{t\hat{\phi}}(t_l^{-}) \end{bmatrix} + \begin{bmatrix} \Phi_l^p \\ \Phi_l^z \\ \Phi_l^t \end{bmatrix} \quad (91)$$

where $P_{\phi}(t) := \text{diag}\{\zeta_i \frac{p_i^{\top} M_i^{-\top}}{x_{ti}}\}$.

Now, we state the following result:

**Proposition 9** Consider the open multi-robot system (89)-(91) in port-Hamiltonian form, where for every mode transition from $\hat{\phi} \in S$ to $\phi \in S$, and for every $i \in \mathcal{R}_{\phi, \hat{\phi}}$ the factor $\mu_i$ is chosen as in (85). Then, under Assumption 1 if the (state-dependent) switching signal $\sigma(\xi_{\phi}(t))$ is such that at every switching instant $t_l$ the energy-based switching condition (88) holds with $\beta = 0$ ($\beta > 0$), the system is (weakly) passive with respect to the power port ($F_{\sigma(t)}^e(t), v_{\sigma(t)}(t)$). □

*Proof.* Consider the multiple storage functions $\mathcal{H}_{\phi}$. For every mode $\phi \in S$, the derivative of $\mathcal{H}_{\phi}$ along (89) yields

$$\begin{align}
\dot{\mathcal{H}}_{\phi} &= -\frac{\partial \mathcal{H}_{\phi}^{\top}(t)}{\partial p_{\phi}} B_{\phi} \frac{\partial \mathcal{H}_{\phi}(t)}{\partial p_{\phi}} - x_{t\phi}^{\top} P_{\phi}(t) B_{\phi} \frac{\partial \mathcal{H}_{\phi}(t)}{\partial p_{\phi}} \nonumber \\
&\quad - \zeta x_{t\phi}^{\top}(t) L_{\phi} x_{t\phi}(t) + \frac{\partial \mathcal{H}_{\phi}^{\top}(t)}{\partial p_{\phi}} G_{\phi}^{\top} F_{\phi}^{e}(t) \nonumber \\
&\leq v_{\phi}^{\top} F_{\phi}^{e}(t). \tag{92}
\end{align}$$

Moreover, from (80)-(81), for every mode $\phi \in S$, with previous mode $\hat{\phi} \in S$, the storage functions satisfy

$$\mathcal{H}_{\phi}(t_l) \leq \mathcal{H}_{\hat{\phi}}(t_l^{-}) + \beta. \quad (93)$$

Integrating (92) over the interval $[t_l, t_{l+1}^{-})$, where $t_0 \le t_l \le t_{l+1} \le t_f$, yields

$$\mathcal{H}_{\sigma(t_{l+1}^{-})}(t_{l+1}^{-}) \leq \mathcal{H}_{\sigma(t_l)}(t_l) + \int_{t_l}^{t_{l+1}^{-}} v_{\sigma(s)}(s)^{\top} F_{\sigma(s)}^{e}(s) ds. \quad (94)$$

Then, applying (93) and (94) recursively we have

$$\begin{align}
\mathcal{H}_{\sigma(t_{l+1}^{-})}(t_{l+1}^{-}) &\leq \mathcal{H}_{\sigma(t_l^{-})}(t_l^{-}) + \int_{t_l}^{t_{l+1}^{-}} v_{\sigma(s)}(s)^{\top} F_{\sigma(s)}^{e}(s) ds + \beta \nonumber \\
&\leq \mathcal{H}_{\sigma(t_{l-1})}(t_{l-1}) + \int_{t_l}^{t_{l+1}^{-}} v_{\sigma(s)}(s)^{\top} F_{\sigma(s)}^{e}(s) ds \nonumber \\
&\quad + \int_{t_{l-1}}^{t_l^{-}} v_{\sigma(s)}(s)^{\top} F_{\sigma(s)}^{e}(s) ds + 2\beta \nonumber \\
&\vdots \nonumber \\
&\leq \mathcal{H}_{\sigma(t_0)}(t_0) + \sum_{j=0}^{l} \int_{t_j}^{t_{j+1}^{-}} v_{\sigma(s)}(s)^{\top} F_{e\sigma(s)}^{e}(s) ds + l\beta. \tag{95}
\end{align}$$

Furthermore, setting $t_f = t_{l+1}^{-}$ and from the non-negativity of $\mathcal{H}_{\sigma(t)}$, we obtain

$$\begin{align}
\sum_{j=0}^{l} \int_{t_j}^{t_{j+1}^{-}} v_{\sigma(s)}(s)^{\top} F_{\sigma(s)}^{e}(s) ds &\geq \mathcal{H}_{\sigma(t_{l+1}^{-})}(t_{l+1}^{-}) \nonumber \\
&\quad - \mathcal{H}_{\sigma(t_0)}(t_0) - l\beta \nonumber \\
\int_{t_0}^{t_f} v_{\sigma(s)}(s)^{\top} F_{\sigma(s)}^{e}(s) ds &\geq -\gamma \tag{96}
\end{align}$$

where $\gamma := \mathcal{H}_{\sigma(t_0)}(t_0) + l\beta \geq 0$. Eq. (96) with $\beta = 0$ ($\beta > 0$) implies that the OMRS is (weakly) passive. ■

### 4.4 A numerical example

We consider a multi-agent-plus-distributed-energy-tanks system modeled as in (89)-(91), where the initial positions and the initial interaction graph are presented in Fig. 1. The initial network is composed of 21 agents starting at rest ($v_i(0) = 0$ m/s) with their individual tanks initialized at $x_{ti}(0) = 2$. The lower and upper limits of the energy tanks are set, respectively, to $\bar{\epsilon} = 0.125$ and $\bar{\epsilon} = 12.5$.

Instead of using the interconnection weights presented in (55), we use the generalized connectivity framework presented in [8], which, on top of connectivity maintenance, also allows to guarantee collision avoidance between the agents. Then, the interaction forces, $F_i^{\lambda}$, are designed as in (57). However, recalling Remark 6, instead of using the algebraic connectivity of the graph, i.e., $\lambda_{2,\phi}$, as a measure of (generalized) connectivity for the potential function $V_{\phi}^{\lambda}$, we use the so-called perturbed algebraic connectivity $\hat{\lambda}_{2,\phi}$ in order to guarantee that the graph becomes and remains biconnected (robust to the removal of nodes)—cf. [25]. For the external forces $F_{\phi,i}^e$ we use an input in order to achieve flocking of the agents and convergence to a circular path, as can be seen
in Fig. 2. More precisely we set

$$F_{\phi,i}^{e} = - \sum_{j \in \mathcal{N}_{\phi,i}} a_{ij}(v_i - v_j) - (v_i - \bar{v}),$$

where $\bar{v} = [-0.24 \cos(0.0096t) \ 0.24 \sin(0.0096t)]^T$.

In this simulation scenario, as the agents move in the workspace they encounter some other agents that are scattered over the path of the multi-agent system. An animation of the simulation is available at https://youtu.be/EdS22EO-UpE.

In the simulation, as a new agent is detected the energy-based condition (88) is checked and, if it holds, the new agent joins the network and the tank states of the remaining agents are updated following (73) with (85). If an agent is detected but the energy in the tank is not enough to compensate for the increase in energy, that is, if (88) does not hold, the agent does not join and the system waits until the energy requirement is satisfied in order to add the agent. This can be seen in the animation where the agent labeled #24 is detected by #10 at $t = 4.77s$ but it is only added to the system once the energy condition is satisfied at $t = 5.34s$. Similarly, at some time instants some of the agents present in the network decide to leave. Then again, if the condition (88) is satisfied, the agents effectively leave the systems and the tank states are updated as (73) with (85). The evolution of the number of agents in time is presented in Fig. 3. Also in Fig. 4 is presented the evolution of the tank states. There it can be seen that when there are agents joining or leaving the network the energy-tanks of the concerned agents deplete in order to account for the sudden jump in energy, so that the variation in total energy, depicted in Fig. 5, satisfies (81) with $\beta = 10$. Also it can be seen in Fig. 6 that throughout the simulation, the connectivity and collision-avoidance constraints, represented by the dashed red lines, are always respected.

<figure><img src="image_2.png" /><figcaption>Fig. 1. Initial configuration.</figcaption></figure>

## 5 Conclusions

We presented new energy-aware framework based on hybrid energy tanks for the analysis and passivity-

<figure><img src="image_3.png" /><figcaption>Fig. 2. Trajectories of the agents and final configuration and graph.</figcaption></figure>

<figure><img src="image_4.png" /><figcaption>Fig. 3. Variation of the number of agents in the network.</figcaption></figure>

<figure><img src="image_5.png" /><figcaption>Fig. 4. Evolution of the tank states.</figcaption></figure>

<figure><img src="image_6.png" /><figcaption>Fig. 5. Evolution of the total energy of the OMAS.</figcaption></figure>
<figure><img src="image_7.png" /><figcaption>Fig. 6. Distances between the connected agents. The dashed lines represent the allowed maximum and minimum distances.</figcaption></figure>

preserving control design of multi-mode multi-dimensional switched systems. The hybrid energy tank is modeled as an impulsive switched system in order to account for the sudden jumps in energy of the system due to the change of dimension of the state at switching instants. Under our proposed framework we provide an energy-based condition for the switching signal that allows us to establish (weak) passivity of the plant-plus-tank system. We demonstrate the utility of our framework by applying the methodology to the case-study of open multi-robot systems subject to a proximity-based interaction model. With our energy-aware design we show how the multi-robot system can autonomously manage the arbitrary addition and removal of agents in a distributed and passive way. We believe that this autonomous and distributed management of the additions/removals resulting from the energy-based switching condition makes our proposed energy-aware and passivity-preserving framework well suited for implementation of complex long-term or persistent missions involving multi-robot systems and interactions with the environment or human subjects. Current research focuses on considering antagonistic and non-cooperative interactions as well as testing the results in an experimental setup.

## References

[1] Federico Benzi, Federica Ferraguti, Giuseppe Riggio, and Cristian Secchi. An energy-based control architecture for shared autonomy. *IEEE Transactions on Robotics*, 38(6):3917-3935, 2022.

[2] Aniello Buonocore, Luigia Caputo, Enrica Pirozzi, and LM Ricciardi. On a pulsating brownian motor and its characterization. *Mathematical biosciences*, 207(2):387-401, 2007.

[3] Jorge Cortés and Magnus Egerstedt. Coordinated control of multi-robot systems: A survey. *SICE Journal of Control, Measurement, and System Integration*, 10(6):495-503, 2017.

[4] Zoreh Al Zahra Sanai Dashti, Gabriele Oliva, Carla Seatzu, Andrea Gasparri, and Mauro Franceschelli. Distributed mode computation in open multi-agent systems. *IEEE Control Systems Letters*, 6:3481-3486, 2022.

[5] Vincent Duindam, Alessandro Macchelli, Stefano Stramigioli, and Herman Bruyninckx. *Modeling and control of complex physical systems: the port-Hamiltonian approach*. Springer Science & Business Media, 2009.

[6] Mauro Franceschelli and Paolo Frasca. Stability of open multiagent systems and applications to dynamic consensus. *IEEE Transactions on Automatic Control*, 66(5):2326-2331, 2021.

[7] Cinara Ghedini, Carlos Ribeiro, and Lorenzo Sabattini. Toward fault-tolerant multi-robot networks. *Networks*, 70(4):388-400, 2017.

[8] Paolo Robuffo Giordano, Antonio Franchi, Cristian Secchi, and Heinrich H Bülthoff. A passivity-based decentralized strategy for generalized connectivity maintenance. *The International Journal of Robotics Research*, 32(3):299-323, 2013.

[9] Chris Godsil and Gordon F Royle. *Algebraic graph theory*, volume 207. Springer Science & Business Media, 2001.

[10] Luis Guerrero-Bonilla, David Saldaña, and Vijay Kumar. Design guarantees for resilient robot formations on lattices. *IEEE Robotics and Automation Letters*, 4(1):89-96, 2019.

[11] Wassim M Haddad, Vijay Sekhar Chellaboina, and Sergey G Nersesov. *Impulsive and hybrid dynamical systems: stability, dissipativity, and control*. Princeton University Press, 2006.

[12] Christopher M Kellett. A compendium of comparison function results. *Mathematics of Control, Signals, and Systems*, 26:339-374, 2014.

[13] W Krüger, I Besselink, D Cowling, DB Doan, W Kortüm, and W Krabacher. Aircraft landing gear dynamics: simulation and control. *Vehicle System Dynamics*, 28(2-3):119-158, 1997.

[14] Zhanrui Liao and Yue Wang. Passivity analysis of nonlinear impulsive multi-dimensional switched systems. In *2021 American Control Conference (ACC)*, pages 846-851, 2021.

[15] Jan Lunze and Françoise Lamnabhi-Lagarrigue. *Handbook of hybrid systems control: theory, tools, applications*. Cambridge University Press, 2009.

[16] Ioanna Malli, Charalampos P. Bechlioulis, and Kostas J. Kyriakopoulos. Robust distributed estimation of the algebraic connectivity for networked multi-robot systems. In *2021 IEEE International Conference on Robotics and Automation (ICRA)*, pages 9155-9160, 2021.

[17] Jonathan C. Mayo-Maldonado and Paolo Rapisarda. Dissipative switched linear differential systems. *IEEE Transactions on Automatic Control*, 61(12):3813-3825, 2016.

[18] Jonathan C. Mayo-Maldonado, Paolo Rapisarda, and Paula Rocha. Stability of switched linear differential systems. *IEEE Transactions on Automatic Control*, 59(8):2038-2051, 2014.

[19] James McLurkin and Daniel Yamins. Dynamic task assignment in robot swarms. In *Robotics: Science and Systems*, volume 8. Cambridge, USA, 2005.

[20] Dimitra Panagou, Dušan M. Stipanović, and Petros G. Voulgaris. Distributed coordination control for multi-robot networks using lyapunov-like barrier functions. *IEEE Transactions on Automatic Control*, 61(3):617-632, 2016.

[21] Jacopo Panerati, Marco Minelli, Cinara Ghedini, Lucas Meyer, Marcel Kaufmann, Lorenzo Sabattini, and Giovanni Beltrame. Robust connectivity maintenance for fallible robots. *Autonomous Robots*, 43:769-787, 2019.

[22] Rushabh Patel, Paolo Frasca, Joseph W. Durham, Ruggero Carli, and Francesco Bullo. Dynamic partitioning and coverage control with asynchronous one-to-base-station communication. *IEEE Transactions on Control of Network Systems*, 3(1):24-33, 2016.

[23] Isaac Pinyol and Jordi Sabater-Mir. Computational trust and reputation models for open multi-agent systems: a review. *Artificial Intelligence Review*, 40(1):1-25, 2013.
[24] Esteban Restrepo, Antonio Loría, Ioannis Sarras, and Julien Marzat. Consensus of open multi-agent systems over dynamic undirected graphs with preserved connectivity and collision avoidance. In *2022 IEEE 61st Conference on Decision and Control (CDC)*, pages 4609–4614, 2022.

[25] Esteban Restrepo and Paolo Robuffo Giordano. Distributed biconnecitvity achievement and preservation in multi-agent systems. *IEEE Control Systems Letters*, pages 1–1, 2023. (Early access).

[26] Giuseppe Riggio, Cesare Fantuzzi, and Cristian Secchi. On the use of energy tanks for multi-robot interconnection. In *2018 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS)*, pages 3738–3743, 2018.

[27] Lorenzo Sabattini, Cristian Secchi, Nikhil Chopra, and Andrea Gasparri. Distributed Control of Multirobot Systems With Global Connectivity Maintenance. *IEEE Transactions Robot.*, 29(5):1326–1332, October 2013.

[28] Ricardo G Sanfelice. *Hybrid feedback control*. Princeton University Press, 2021.

[29] Cristian Secchi, Stefano Stramigioli, and Cesare Fantuzzi. Position drift compensation in port-hamiltonian based telemanipulation. In *2006 IEEE/RSJ International Conference on Intelligent Robots and Systems*, pages 4211–4216. IEEE, 2006.

[30] Rodolphe Sepulchre, Mrdjan Janković, and Petar V Kokotović. *Constructive nonlinear control*. Springer Science & Business Media, 2012.

[31] Stefano Stramigioli. Energy-aware robotics. In *Mathematical Control Theory I: Nonlinear and Hybrid Control Systems*, pages 37–50. Springer, 2015.

[32] Arjan Van der Schaft. *L2-gain and passivity techniques in nonlinear control*. Springer, 2000.

[33] Vineeth S. Varma, Irinel-Constantin Morărescu, and Dragan Nešić. Open multi-agent systems with discrete states and stochastic interactions. *IEEE Control Systems Letters*, 2(3):375–380, 2018.

[34] Erik I Verriest. Multi-mode multi-dimensional systems. In *Proceedings of the 17th international symposium on mathematical theory of networks and systems*, pages 1268–1274, 2006.

[35] Erik I Verriest. Pseudo-continuous multi-dimensional multi-mode systems: Behavior, structure and optimal control. *Discrete Event Dynamic Systems*, 22:27–59, 2012.

[36] Renato Vizuete, Charles Monnoyer de Galland, Julien M. Hendrickx, Paolo Frasca, and Elena Panteley. Resource allocation in open multi-agent systems: an online optimization analysis. In *2022 IEEE 61st Conference on Decision and Control (CDC)*, pages 5185–5191, 2022.

[37] Li Wang, Aaron D. Ames, and Magnus Egerstedt. Safety barrier certificates for collisions-free multirobot systems. *IEEE Transactions on Robotics*, 33(3):661–674, 2017.

[38] Mengqi Xue, Yang Tang, Wei Ren, and Feng Qian. Stability of multi-dimensional switched systems with an application to open multi-agent systems. *Automatica*, 146:110644, 2022.

[39] Hao Yang, Bin Jiang, Vincent Cocquempot, and Mou Chen. Spacecraft formation stabilization and fault tolerance: A state-varying switched system approach. *Systems & control letters*, 62(9):715–722, 2013.

[40] Jun Zhao and David J Hill. Dissipativity theory for switched systems. *IEEE Transactions on Automatic Control*, 53(4):941–953, 2008.