A Robustness Analysis to Structured Channel Tampering Over Secure-by-Design Consensus Networks

This letter addresses multi-agent consensus networks where adverse attackers affect the convergence performances of the protocol by manipulating the edge weights. We generalize (Fabris and Zelazo, 2022) and provide guarantees on the agents’ agreement in the presence of attacks on multiple links in the network. A stability analysis is conducted to show the robustness to channel tampering in the scenario where part of the codeword, corresponding to the value of the edge weights, is corrupted. Exploiting the built-in objective coding, we show how to compensate the conservatism that may emerge because of multiple threats in exchange for higher encryption capabilities. Numerical examples related to semi-autonomous networks are provided.


I. INTRODUCTION
Water networks are complex large-scale systems comprising diverse components including transport structures (e.g.open channels, pipelines), flow control units, and storage apparatuses.In particular, open-channel networks (OCNs) serve several purposes such as draining rainwater outside urbanized areas in order to avoid flooding and ensuring an appropriate water supply for the irrigation of farmlands.As the frequency, intensity, and duration of storm events have increased worldwide because of climate change [1]- [3], OCNs have proven unable to handle severe flood phenomena [4] or water shortages and droughts [5].Therefore, the analysis of such systems and the design of advanced control techniques to improve their management have recently become an objective of major impact and interest within the research community.
Different approaches can be developed for the water distribution problem because of the several aspects to be considered, such as cost minimization, control optimization, supply or allocation issues, leak management.The vast majority of solutions encompasses either traditional numerical modeling techniques [6] or machine learning tools and graph-based algorithms.As machine learning is often exploited for quality and maintenance-related issues (e.g.leak and infiltration assessment [7]), graph theory is better employed for more operational planning problems.Examples of graph theory applied to water network distribution problems are very common and used to solve different tasks.For example, in [8], graph theory is used to devise an algorithm to manage the scheduling of the water network, and this returns an optimal minimal cost pump-scheduling pattern; more thoroughly, in [9] it is introduced a holistic analysis framework to support water utilities on the decision making process for efficient supply management.Furthermore, within graph theory, it is common opinion (see [10], [11]) that theoretical computer science lays on a vantage point for the understanding of key emergent properties in complex interconnected systems.Overall, these trends highlight that one of the most challenging aspect within the regulation of OCNs is to find a viable, efficient, topology-independent and distributed method that can be used to solve water distribution problems pertaining to this category of networks.In this perspective, we shall model such problems and the corresponding solutions by exploiting the typical approaches employed with networked systems.
Given this premise, we build a novel solution to balance water levels in OCNs subject to floods or shortages upon the well-known consensus protocol.In a network of agents, ''consensus'' means an agreement regarding a certain quantity of interest that usually depends on the state of all agents.A consensus algorithm (or protocol) is an interaction rule that specifies the information exchange between an agent and its neighbors on the network [12].Consensus can be applied for multiple purposes, as discussed in [13], where a general theoretical framework is provided.Relevant to our study is [14], where a consensus-based control strategy for a water distribution system is proposed.This enables a water system to continuously supply the demand while minimizing the impact of faulty equipment within the water distribution facilities.
Constraints are another aspect that consensus theory takes into account, as in [15], where it is considered the global consensus problem for discrete-time multi-agent systems with input saturation constraints under fixed undirected topologies.Due to the existence of different kinds of state constraints, most existing consensus algorithms cannot be applied directly (see e.g.[16], where the state is confined in an interval around the initial conditions in order to obtain convergence on opinion dynamics and containment control).Hence, these distributed protocols need to be designed depending on the specific application challenge.
Contributions: For the above reasons, a novel and versatile consensus algorithm is here presented to face the water level compensation subject to flow constraints in OCNs, which in fact translate into restrictions on the state variation [17].Related studies concerning water distribution issues over networks can be already found in [18]- [20], where power or price-based costs are minimized in order to obtain control solutions capable of ensuring optimal governance of the active elements in the underlying network.However, these strategies are not intended to operate on OCNs and deal with water leveling and flow constraints.Differently from the methods of these works, here it is proposed an autonomous time-varying difference-equation-based model and the related regulation scheme that accounts for general flow constraints.In particular, we encapsulate the handling of physical restrictions affecting each waterway flow into a modified version of the classic distributed consensus protocol.Then, this approach can be carried out through the solution to a guidance problem that seeks a feasible decentralized control reference for the water exchange among the channels of the given network in order to attain a common level increment.
The main contribution of this work is thus devoted to the development of a distributed algorithm satisfying the above requirements.With the aim of optimizing water distribution in an OCN, the proposed strategy is capable of (i) allowing for the allocation of even amounts of water, in terms of height increments, over the underlying network; (ii) coping with general flow constraints associated to each one of the considered channels.These two aspects are accommodated by resorting to the adaptation of the classic average consensus to the specific framework of interest and introducing a timevariant adjustment on the protocol, so that different water regimes occurring at each channel can be managed while reaching an agreement dictated by the mean of the initial water height increments.Remarkably, beyond the specific application to OCNs, the proposed solution is shown to have wider application properties, namely it can be used in more general problems and topologies, as it is designed to fit any networked systems in which the discrete-time average consensus dynamics is demanded to account for a limited capacity of information exchange.A further contribution of this paper is indeed represented by the general exploration via Lyapunov-based convergence analysis of the devised distributed algorithm.As a result, an analytical metric for the convergence rate is also suggested.Lastly, numerical simulations on the realistic scenario offered by the Cavallino water network (see Fig. 1) situated in the Venice metropolitan area, Italy, are reported to validate the presented theoretical findings.
Paper organization: The remainder of this paper is organized as follows.In Sec.II, we introduce mathematical preliminaries and briefly review the consensus theory.Sec.III describes the setup for which our consensus-based reference generation protocol for even water compensation is proposed.To this purpose, its dynamics is presented along with a method that guarantees to avoid constraint violations corresponding to water flow limitations imposed on the network.Then, Sec.IV yields an iterative distributed procedure for the implementation of the consensus protocol previously introduced.In relation to this, a Lyapunov-based convergence analysis is also provided in the Appendix to prove the effectiveness and the correctness of the aforementioned algorithm.Sec.V is devoted to the results of our numerical simulations.Finally, Sec.VI concludes our work, discussing future research directions.

II. PRELIMINARIES
In this section, the preliminary notions and assumptions to model OCNs are reported.Also, the discrete-time consensus protocol is briefly reviewed.

A. BASIC NOTATION
Hereafter, symbols N, R, R ≥0 and R >0 denote the sets of natural, real, nonnegative real, and positive real numbers.Both letters k and l indicate discrete time instants, while t and τ refer to continuous time.With Log and sign, the base-10 logarithm and the sign functions are meant.The following notation is quite standard in linear algebra [21].Given a vector ϖ ∈ R N comprising of the components ϖ i , with i = 1, . . ., N , its infinity norm and its span are respectively denoted by ∥ϖ∥ ∞ and ⟨ϖ⟩.Given a matrix Ω ∈ R N ×N , its ij-th entry is indicated with [Ω] ij and its eigenvalues are denoted by λ Ω i , for i = 0, . . ., N − 1; also, by |Ω|, we mean the (entry-wise) absolute value of matrix Ω.A matrix Ω having nonnegative entries is row-stochastic if each row sums to 1, Ω ∈ stoch(R n×n ); it is doubly-stochastic, if it is row-stochastic and also each column entries sum to 1, Ω ∈ stoch2 (R n×n ).Then, we indicate with I N ∈ R N ×N and 1 N ∈ R N the identity matrix and the agreement vector of dimension N , respectively.Moreover, symbols |S|, ⊤, ∝ and s denote respectively the cardinality of set S, the transpose operation for matrices, the direct proportionality relation and complex frequency variable for continuous-time transfer functions.For a continuous scalar function f : R → R : t → f (t) sampled with period T s > 0, the difference quotient of f over T s at k is defined as δf [Ts] (k) = [f (kT s +T s )−f (kT s )]/T s ; the shift operator is denoted with z, so that for all τ ∈ R ≥0 one has f (τ + T s ) = zf (τ ).Lastly, the operator ∇ is used to denote the gradient of a differentiable function.

B. GRAPH-BASED OCN MODEL
In this work, we account for bidirectional and interconnected OCNs comprised of n ≥ 2 channels and m ≥ 3 junctions.The latter are of two types, and they can either link a pair of subsequent channels or simply represent an endpoint for the water system.A water network of this kind can be thus modeled as a graph Let L denote the line graph operator that maps a given graph H into its adjoint L(H) [23], [24].In order to operate with the regulation procedure proposed in this paper, the adjoint G := L(G o ) of the given topology G o is constructed and considered.More precisely, letting G = (V, E), the nodes in the (adjoint) vertex set V = {v 1 , . . ., v n } represent each of the channels, i.e. v ℓ = e o ℓ , for all ℓ = 1, . . ., n.Also, there exists an edge e ij in the (adjoint) edge set E ⊆ V × V 1 By assumption, channels are characterized by a bidirectional water flow.No restriction is imposed on the presence of hydraulic pumps capable of directing the streams along both the ways.
if and only if channels v i and v j are both incident to one of the junctions in V o .It is well-known that if a graph H is connected so is L(H); hence, G is connected.Furthermore, denoting with , as shown in [25].Similarly, we define the (adjoint) i-th neighborhood of channel i and its corresponding (adjoint) degree as With these positions, it can be derived that the adjacency matrix Moreover, we let N i := N i ∪ {i}, d m := min i=1,...,n {d i }, d M := max i=1,...,n {d i } be respectively the extended i-th neighborhood, minimum degree and maximum degree in G. Lastly, the radius and diameter 2 of G are denoted by ρ and ϕ, respectively.

C. REVIEW OF THE CONSENSUS PROTOCOL
We now provide an overview of the discrete-time weighted consensus problem in the field of multi-agent systems (see also [26], [27] for more details on the topic).Let us consider a group of n homogeneous agents, e.g. the n pairs of actuators installed at the two endpoints of each channel in a water system modeled by an undirected and connected (adjoint) graph G. Let us also assign a discrete-time state x i (k) ∈ R to the i-th agent, for i = 1, . . ., N , with k = 0, 1, 2, . ... The full state of the whole network can be thus expressed by The discrete-time consensus within a multi-agent system can be characterized as follows.
Let us consider a connected graph G = (V, E) in which it is assigned a weight p ij ∈ (0, 1) to each edge e ij ∈ E and it is assigned a self-loop p ii ∈ [0, 1) to each node v i ∈ V, such that j∈N i p ij = 1 for all i = 1, . . ., n.Let us define the update matrix P as [P] ij = p ij , if (i, j) ∈ E or i = j and [P] ij = 0, otherwise, such that P ∈ stoch(R n×n ).It is well known that the linear discrete-time consensus protocol drives the ensemble state x(k) to the agreement set if at least one of the self-loops p ii is chosen to be strictly positive [28].In many frameworks, the consensus protocol ( 1) is required to perform the arithmetic mean of the initial conditions.For this purpose, the update matrix is usually designed to be doubly-stochastic, namely it is imposed that P ∈ stoch 2 (R n×n ); an example of such design can be obtained by following the Metropolis-Hastings (MH) structure in which coefficients [P] ij = p ij are assigned as otherwise. ( By the Gershgorin's disk theorem [29], P has n real eigen- In addition, as shown in [30], it is known that this design of P ensures average consensus for protocol (1), as it is guaranteed that λ P n−1 > −1 and λ P 1 < 1.

III. THE ROLE OF CONSENSUS DYNAMICS IN THE REGULATION OF OPEN-CHANNEL NETWORKS
The following paragraphs are devoted to the formulation of the regulation problem for an OCN.In particular, it is highlighted how the consensus dynamics can be exploited to provide an autonomous reference to balance the channels' water levels in the system.

A. SETUP AND PROBLEM FORMULATION
Let us consider the water channels i = 1, . . ., n in G.As illustrated in Fig. 2, we assume that the i-th channel has length L i , trapezoidal cross section characterized by height h S i > 0 and bank slope θ i ∈ (0, π/2), so that θ i approaching zero corresponds to having vertical banks.The i-th zero water level reference is chosen at height h Z i ∈ [0, h S i ], and at that level, the width of the i-th cross section is given by b i > 0. Let Then the volume variation V i ( x i ) causing a height increment x i is given by Because of (3), since x i is upper bounded by The volume (increment) V i in ( 3) is considered as the portion of space between the blue and red surfaces.In case of x i < 0 and V i < 0, the red surface lays below the blue one.
x i is lower bounded by i .Consequently, by inverting (3), we find the dependence of increment x i w.r.t. the corresponding volume variation V i , that is, where are positive constants depending on the geometry of the i-th channel.Now, let us consider the difference quotients δ x [Ts] i (k), δV [Ts] i (k) at time k and define the download and upload limitations for the i-th water flow rate as the functions with each C J i (k) bounded from above.By means of ( 5), the following flow rate constraint can be taken into account: In relation to the i-th channel, it is easy to show that if there exist functions bounded from above, and the water height constraint is enforced, then flow rate constraint in ( 6) is guaranteed, provided that C J i (k) and c J i (k) are suitably related to each other.In particular, by (4), constraint (8) can be rewritten as Multiplying each term in (9) by (10) becomes a stricter or equivalent version of (6).Inequality (10) can be trivially extended to the case in which θ i = 0 by imposing Under closed-loop control, local measurements of the system physical quantities play a fundamental role in the design of a regulator, i.e. a scheme that estimates the current state and governs it.In the considered framework, height measurements are likely more reliable and accessible than volume ones because either the latter are derived from the former and thus subject to larger errors, or more complex measuring techniques are needed to retrieve volume information.Thus, motivated by the fact that water flow constraint in ( 6) can be ensured by inequality (8) on the water height change rate through the selection of each c J i (k), such that c J i (k) ≤ C J i (k)/w i , we propose a general regulation scheme that evenly balance the height references across the given x j d i (kT s ) x j 2 (kT s ) x j 1 (kT s ) . . . . . .
x i (kT s + τ ) x i (kT s ) t = kT s FIGURE 3: Local control scheme for the i-th channel.The inner control loop is shaded in violet and the time-varying consensus coefficients q ij (k) though which the previous value of the generated reference is combined among i's neighbors are highlighted in green (see Subsec.III-B for a detailed discussion).The rest of the OCN is schematically represented as the orange cloud.
With the main aim of regulating the OCN, the information flowing in the red element is considered, replacing that coming from the blue element, which bridges the inner and outer feedback loops and is used in the practical implementation of the scheme.
network by acting on the local water levels of the channels.To this aim, we suppose to deploy n agents on the water system, namely n pairs of communicating actuators (e.g.weir gates or pumps) installed at the endpoints of each channel.More formally, the following assumption is made.

Assumption 1. The flow of the given water network G o is controlled by n agents (actuator pairs), each one of them associated to the corresponding i-th channel. The communication established through the network of agents is then captured by topology
In order to focus on the design of a water distribution algorithm, we further assume that the i-th agent is endowed with a local closed-loop control scheme capable of regulating the water increment x i exactly.As schematically shown in Fig. 3, such a scheme is formed by each inner feedback loop (shaded in violet) determined by the i-th inner controller K i (s) and the i-th plant Π i (s) and an outer feedback loop (in black).
More precisely, letting ν i (t) be a zero mean Gaussian white noise and given the i-th measured water level increment x i (kT s ) = x i (kT s ) + ν i (kT s ) at time t = kT s , the reference x i (kT s + T s ) ∈ R is imposed and is supposed to be ideally tracked by the true unknown state3 , i.e. it holds that x i (kT s + τ ) → x i (kT s + T s ) as τ → T s .Considering the channel i and the corresponding control depicted in Fig. 3, the current reference x i (kT s + T s ) is consequently computed as a linear combination of the past input references x j (kT s ), with j ∈ N i = {i, j 1 , . . ., j di }, via time-varying coefficients q ij (k).In addition, it is worth to mention that, for a real setting, the current reference x i (kT s + T s ) has to be maintained over time for all t ∈ [kT s , kT s + T s ), e.g. by means of the classic zero-order hold H 0 (s).
Also, a final setup assumption regards the initial conditions.

Assumption 2. The mean of the initial conditions
Indeed, whenever α ̸ = 0 occurs then the ensemble state x(0) can be detrended and reassigned so that x i (0) ← ( x i (0)− α) for all i = 1, . . ., n.It is worth to note that this operation is just equivalent to recalculate each reference h Z i as , where α can be computed by running a preliminary average consensus protocol, e.g. through (1)-( 2).Preprocessing the initial data via detrending as said is advantageous because each quantity h ⋆ i provides the desired final water level.
Denoting with x ∈ R n the ensemble reference vector, the even compensation of the water levels in the underlying OCN can be thus formulated as the (decentralized) minimization of the following objective function: where it is imposed for the coefficients p ij of the matrix P to have MH characterization, as in (2).We thus finally formalize the following guidance problem.
Problem 1. Suppose to govern the flow dynamics of the underlying OCN via the control scheme depicted in Fig. 3 and let assumptions Asm. 1 -Asm. 2 be satisfied.Design an iterative and fully distributed discrete-time procedure that determines an update rule for the i-th increment reference x i (kT s + T s ), which is tracked by (an estimate of) the i-th state x i (kT s ) over k ∈ N, with i = 1, . . ., n.In particular, ensure that x(kTs) minimizes (11) while constraint in (8) is guaranteed to hold for all k ∈ N.
Practically speaking, solving Problem 1 corresponds to the design of a dynamic reference for the local controllers, which guarantees to minimize the imbalance of water levels throughout the OCN -possibly leading to their equalization -starting from an arbitrarily uneven initial level distribution (due, e.g., to localized natural events or human actions or system failure).Note that Problem 1 does not deal with the design of a specific control strategy, since the goal of this paper is to construct a reference signal for the regulation of an OCN.In fact, any valid control law allowing for Asm. 1 -Asm. 2 that seeks reference tracking can be employed.
Rather, Problem 1 focuses on yielding an operative sequence that (i) serves as a water increment reference to be tracked; (ii) optimally compensates the water levels in the underlying OCN, namely it directly minimizes objective (11); (iii) does not violate the water height constraint (8).

B. PROPOSED CONSENSUS-BASED REFERENCE GENERATION PROTOCOL FOR OCN REGULATION
In the sequel, we present the dynamics of the considered iterative water level regulation scheme introduced in Sec.III-A in order to find a solution to Problem 1. Drawing inspiration from [31], we include memory in the classic consensus dynamics (1) to provide a weighted correction to current water level, thus leading to the so-called reference generation protocol (RGP) where x ∈ R n represents the ensemble water increment reference, T s = 1 is set w.l.o.g. and η(k) ∈ (0, 1) can be considered a parameter trading-off self-measurements against neighbors' measurements.Imposing the MH structure on matrix P in (12), as specified in (2), a crucial observation immediately follows.
Remark 1. Leveraging the structure of objective J (x) in (11), dynamics in (12) can be easily rewritten as The expression (13) can be considered a steepest descent update rule [32] with adaptive step-size (1 − η(k)) and descent direction −∇J (x(k)) = (P − I n )x(k).Therefore, the proposed RGP (12) can be seen as a distributed direct method to minimize the objective (11).Notice that, in principle, several approaches can be adopted as an alternative of (13) to render the objective J (x) minimum [33], as far as the local controller employed is able to track the generated reference.
It is worth to note that matrix otherwise.Its eigenvalues at time k belong to the interval (−1 + 2η(k), 1]; indeed, exploiting the linearity of the spectrum, it holds that i , for all i = 0, . . ., n − 1.Also, parameter η(k) allows the presence of positive self-loops.
Intuitively, the η(k) parameter can be tuned to control the dynamics in (12), since its convergence is a function of the spectrum of Q η (k), which is strongly dependent on η(k).A good and viable strategy of selecting parameter η(k) when it is constant, namely if η(k) = η 0 and Q η (k) = Q η0 for all k ∈ N, is given by the minimization of the second largest (in modulus) eigenvalue of Q η0 : As shown in [34], after assigning the optimal value for η 0 is indeed yielded by However, it is well-known that spectral analysis applied to time-varying dynamical systems cannot be exploited to study their convergence.As method in ( 14) cannot be used in this setting, in the subsequent discussions we provide a suitable approach to design the value of η(k) at each time k -also accounting for water flow constraints -and an appropriate convergence analysis concerning ( 12) is treated in App.B.
Remark 2. It is well-known that undesired perturbations affecting the coupling consensus weights w.r.t. a nominal value may lead to instability for the whole interconnected system [35], [36].Consequently, besides the need to cope with constraints depending on the network state, an effective design of η(k) at each instant k is crucial to guarantee fast and robust convergence properties for the protocol in (12).

C. HANDLING OF THE NETWORK CONSTRAINTS
The formulation of system ( 12) defined through the update matrix Q η (k) does not take into account limitations to the information exchange between two connected nodes (i.e., channels).To this purpose, a proper tuning for parameter η(k) is proven to ensure that constraint ( 8) is satisfied for all k = 0, 1, 2, . .., so that water flows can be desirably handled.Again, w.l.o.g.we let T s = 1, requiring the following local constraints to hold at each iteration k in relation to the water level variation δx i (k) := δx i (k): (i) if δx i (k) < 0, we say that node i is in download regime, so the i-th download constraint holds (ii) if δx i (k) > 0, we say that node i is in upload regime, so the i-th upload constraint holds (iii) otherwise, node i is considered to be at the equilibrium, and we simply allow Clearly, the download constraint in (17) regulates the outgoing flow of a node towards its neighbors.On the other hand, the upload constraint in (18) accounts for the opposite effect, namely the capacity for a node to receive an incoming water flow from its neighbors.Also, for the sake of completeness, (19) specifies the case relative to the equilibrium regime 4 for node i, that is x i (k + 1) = x i (k).Now, a proper tuning for the parameter η(k) is derived to ensure ( 17)- (19) during the execution of protocol (12).To begin, we examine the download regime: under this condition, we provide a value for η(k) that is denoted with η D (k).By considering the i-th equation of RGP (12) and substituting x i (k + 1) into the download constraint (17) one has: (20) In order to state an explicit relation for η D (k), we first observe that (x i (k) − n j=1 p ij x j (k)) is strictly positive ∀i = 1, . . ., n; this is proven by substituting x i (k + 1), as expressed in RGP (12), into the download regime characterization δx i (k) < 0, and by exploiting the fact that η D (k) ∈ (0, 1) will be guaranteed.Hence, one obtains Clearly, inequality ( 21) exhibits a direct dependence on the i-th state; thus, it cannot be properly used to derive parameter η D (k), as this is a global quantity.Nonetheless, enforcing where inequality ( 21) is satisfied for all i = 1, . . ., n.Notice however that with these positions, (22) expresses a tight (centralized) upper bound for (21).
As a matter of fact, aiming at distributing the computation of η D (k), we exploit the fact that ) holds by the submultiplicative property of the infinite norm and Lem. 2 in App.A (with ω defined as in (45)).It is thus possible to impose Differently from (22), inequality ( 25) is more conservative but it allows to provide a fully distributed design method for η(k), e.g. by relying only on the so-called max-consensus protocol to retrieve the value of ∥x(k)∥ ∞ .Remarkably, the r.h.s. of ( 25) can be used to set the value of η D (k).However, in general, it is not guaranteed for quantity ) to be strictly positive.For this reason, we introduce a parameter where η ⋆ is chosen as in ( 16) and ζ ∈ (0, 1) is an arbitrarily small given constant 5 .Quantity η L , defined as in (26), indeed 5 To the authors' experience, it seems that, actually, all P ∈ stoch 2 (R n×n ) defined via the MH in method (2) yield ς P ≥ 0 (see (15)).This leads to the necessity of imposing η L = ζ, within this framework, discarding systematically the more desirable choice η L = η ⋆ .
prevents to obtain η D (k) ≤ 0 by setting η D (k) = η L if 1 − c D (k)/(ω ∥x(k)∥ ∞ ) ≤ 0. On the one hand, η L represents a suboptimal choice for the value of η D (k) whenever η L ≥ 1− c D (k)/(ω ∥x(k)∥ ∞ ), since it ensures fast convergence for the corresponding static6 consensus protocol.On the other hand, selecting η D (k) = η L whenever η L < 1−c D (k)/(ω ∥x(k)∥ ∞ ) may result in the violation of download constraint (17).Therefore, we finally set Whereas, for the upload regime, we provide a value for η(k) that is denoted with η U (k) through a similar reasoning.Setting we retrieve where ω and η L respectively defined as in ( 45) and (26).

IV. DISTRIBUTED IMPLEMENTATION OF THE PROPOSED REFERENCE GENERATION PROTOCOL
In this section, we present the main contribution of this work, namely a new distributed strategy that leverages time-varying consensus to evenly compensate water levels, along with its convergence analysis.
Generally speaking, the distribution imbalance of a quantity among states can be measured and described in many ways, such as J (x) in (11).However, to discuss convergence properties, here we define the distribution imbalance through the max-min disagreement function W : such that W (x(k)) = 0 if and only if x(k) = α ′ 1 n , with α ′ ∈ R. So, to establish whether the consensus is reached, we select an arbitrarily small threshold γ > 0 for which condition W (x(k)) ≤ γ allows us to state that x(k) ≃ α ′ 1 n .Also, observe that ξW (x) 2 ≤ J (x) ≤ (n/2)W (x) 2 holds for all x ∈ R n , with ξ defined as in (43).Hence, any convergence performance expressed in function of the objective J (x) in ( 11) can be bounded through the properties of W (x) in (35).Under this premise, our aim is to reach an agreement relatively to the network states in order to ensure even water distribution by minimizing W (x(k)) in (35).This minimization is attained through Alg. 1, hereafter discussed, which indeed terminates at k as soon as assuring, as formally demonstrated in App.B, with α defined in Asm. 2. Specifically, the proposed algorithm (pseudocode in Alg. 1) requires the following information: the (detrended) initial for all i = 1, . . ., n do 4: end for

9:
for all i = 1, . . ., n do 10: break the main while loop 14: 15: end for 17: k ← k + 1 18: end while condition x(0), the adjoint graph G of the given network topology G o , the constraint functions c D i and c U i , for all i = 1, . . ., n.Moreover, each agent i needs to store beforehand a local copy -indicated by the same symbol with superscript i -of constant η L computed as in (26), weights p ij , ∀j ∈ N i , obtained via (2) in relation to G, threshold γ and the diameter ϕ of the underlying network G.It is worth noting that quantities such as η L or ϕ could be also retrieved during the initialization of this procedure in a distributed fashion, exploiting decentralized algorithms (see e.g.[40], [41] to estimate the eigenvalues needed in the calculations of η L and [42] for ϕ).
From the first half of Alg. 1 (lines 1-8), it is possible to understand how preliminary quantities are retrieved in a distributed way.Indeed, lines 3-8 represent an intermediate call to a subroutine running the MCP.In particular, the computation of Remarkably, the four different invocations at lines 4-7 to the MCP can be parallelized.To be precise, quantities c i D (k) and c i U (k) could be determined beforehand, as these do not depend on the state x(k).We also recall that the MCP converges over any given undirected and connected topology G and returns the maximum value of the considered quantity in at most a time proportional to the diameter ϕ.This fact is exploited to guarantee that this stage of the main Alg. 1 be executed within the time interval The second part of Alg. 1 from line 9 to line 16 addresses as in (30); then determine η i (k) as in (31).the main body of the provided solution to the reference generation.In particular, lines 10-12 implement the termination condition described in (36) (exiting the while loop), and lines 13-15 illustrate how the state x(k) is locally updated into x(k + 1) according to equations ( 12), ( 30) and (31).As a final note, we highlight how the two for loops at lines 3 and 9 are indeed parallel executions on all nodes and not sequential operations.An overview on the fundamental mechanism beneath the proposed RGP can be now sketched in the workflow diagram depicted in Fig. 4.
To conclude, we point out that a measure of the convergence rate of Alg. 1 can be given by Specifically, the lower the value of R the faster Alg. 1 terminates satisfying the agreement conditions ( 36)- (37), since the expression in (38) is established upon the results obtained from the following theorem (proof and more details in App.B).Moreover, the rate R takes into account the computational burden due to max-consensus protocol, which requires at most ϕ steps to be run.The lower bound R = 1 is attained when G is regular (d M = d m ) and ϕ = 1: this occurs if and only if an OCN has m = 3 junctions.
Theorem 1.The RGP (12), with η(k) selected as in (31), converges to average consensus as k → ∞.In particular, by taking W (x(k)) in (35) as a Lyapunov function, W (x(k)) vanishes with an approximate exponential decay rate r ∈ (0, 1) depending on the graph radius ρ and the minimum nonzero entry of Q η (k) over time k.For dynamics in (12), discretetime consensus (Def. 1) is achieved as with α defined in Asm. 2 and with l ∈ N and being r upper bounded by and lower bounded by where the topology-dependent constants ξ, ξ and the upper bound η H are respectively defined as in (43), (44), and (32).

V. NUMERICAL SIMULATIONS
We discuss here some numerical simulations to support our previous results.We consider a portion of the Cavallino network in Fig. 1 having m = 22 junctions and n 1 = 25 channels, and compare it with its corresponding complete topology (see Fig. 5).This latter is characterized by the same number of junctions (m = 22) and the maximum allowed   For both G and T , the corresponding initial conditions x (G,0) and x (T ,0) satisfy x (G,0) ∞ = x (T ,0) ∞ ≃ 4.64, as they are fairly selected to verify Within this setup, the remaining topological parameters characterizing graphs G and T are collected in Tab 1.
Fig. 6 depicts the outcome of Alg. 1 executed on networks G and T , respectively.Specifically, Figs.6a-6e show how the state trajectories representing the water increment reference evolve as a function of time, starting from a generic initial condition: in practice, starting from an uneven water distribution over the network, Alg. 1 guarantees to reach an equilibrium among the channels.
It is worth to note that the dynamics corresponding to T converges to average consensus faster than that of G, as T is a regular graph with higher degree d M 2 d m2 = 40 w.r.t. to those of G (ranging from 2 to 5); furthermore, T has a total of (n 2 d M 2 /2) = 4620 edges and its diameter is given by ϕ 2 = min(2, n 2 − 2) = 2.These two facts that information is exchanged far more rapidly among the nodes of T (see the convergence rate indexes in Tab. 1).The faster convergence of dynamics related to T is explicitly in Fig. 6f, where for = 6 it occurs that W ( k) := W (x( k)) ≤ γ.Indeed, the max-min disagreement decreases more quickly w.r.t. that in Fig. wherein k = 40 iterations are needed to execute the whole water distribution algorithm and reach a balanced condition.Nonetheless, from both these latter plots it is possible to appreciate the exponential decay of W (k). In Figs.6c-6g it is illustrated the behavior of quantity δx ⋆ (k) := S j (k) ∥x(k)∥ ∞ , where S j (k) ∈ {−1, 0, 1} is the sign of the component Clearly, the imposed constraints are not violated for all k = 0, 1, 2, . .., since δx ⋆ (k) remains bounded within functions −c D i and c U i .However, Fig. 6g shows that trajectory |δx ⋆ (k)| = ∥x(k)∥ ∞ exhibits a more peaked and faster behavior than the corresponding one in Fig. 6c: this is due to the fact that G is a less connected structure, hence less subject to fast and strong variations of the dynamics.Moreover, it is worth to observe Figs.6d-6h, as they detail the evolution of parameter η(k).Counterintuitively, η(k) approaches the suboptimal value η L faster when Alg. 1 is implemented on G.In reality, this behavior is a consequence of the fact that dynamics corresponding to T is faster, and for this reason it needs to be slowed down by higher values of η(k) in order not to violate the imposed water flow constraints.
Finally, a further scenario is also considered, in which the upload and download constraint functions are artificially modified to mimic a sudden and unpredicted failure of the channel capacities.It can be seen in Figs.7a-7d that, under the application of Alg. 1 also in such non-nominal conditions, the abrupt c U -c D variations (Fig. 7c) yield some real-time adjustment of the |δx ⋆ (k)| variable, which is reflected in the overall slower convergence ( k = 95) with respect to the nofail case of Figs.6a-6d.also in this situation, convergence is attained despite the violation of the theoretical η bounds, as shown in Fig. 7d.
In the light of this analysis, it can be observed that the proposed Alg. 1 operates correctly and robustly over diverse and realistic network conditions, despite that there exist obvious differences dictated by the underlying topology on how fast the agreement is reached.Indeed, as requested by Problem 1, it is guaranteed convergence to average consensus for the input reference feeding each agent in Fig. 3 and constraints (8) are satisfied at all time instants k = 0, 1, 2, . ...

VI. CONCLUSIONS AND CONTINUING RESEARCH
In this work, an automated solution to the water level regulation within an OCN is presented and it is designed an consensus-based algorithm providing the reference to attain an even distribution of water levels.After modeling and characterizing the OCN with the tools of graph theory, the proposed approach leverages fully decentralized computations and also considers the presence of water exchange capacity limits, which are embedded in the developed iterative procedure as download and upload constraints for each branch of the system.addition, it is shown devised converges exponentially fast.A potential research direction represented by the analysis and design of the entire control scheme accounting for reference generation regulation.a couple of interesting investigation extensions are embodied by the development of the presented scheme exploiting directed topologies the improvement of its convergence properties.

APPENDIX.
A. PRELIMINARY LEMMAS Lemma 1.Let us consider an undirected and connected graph G = (V, E).Let us also define the MH matrix P ∈ stoch 2 (R n×n ) associated to G as in (2).Then the smallest nonzero entry min pij>0 {p ij } of P is yielded by and the largest entry of P can be upper bounded as Under the same assumptions of Lem. 1, for any MH matrix P ∈ stoch 2 (R n×n ) it holds that ||I n − P|| ∞ ≤ ω.
Proof.Exploiting the Gershgorin's disk theorem [29] and the structure of P dictated by ( 2), one has

B. CONVERGENCE ANALYSIS
The proof of Thm. 1 provides convergence guarantees towards average consensus for RGP (12), whose distributed implementation is performed through Alg. 1.The related convergence rate is also discussed subsequently.
Proof.Define the product matrices and omit the dependency on k for brevity, except where needed to avoid confusion.
The following remarks conclude the discussion on the convergence analysis.Notice that ≥ 0.5, as G is connected with at least n ≥ 2 channels, implying that ρ ≥ 1.Thus, being an estimation of r, r serves as a purely topological index that can roughly measure how quickly this convergence takes place.Alternatively, index can be used for the same purpose, as R ∝ r.From (54), the quantity R = ϕ R in (38) is finally suggested.
Remark 4. The detrending operation applied on the initial conditions helps reducing the value of r in (41), as r ∝ ∥x(0)∥ ∞ .Therefore, the adoption of Asm. 2 also allows to (likely) improve the convergence rate of Alg. 1.

FIGURE 4 :FIGURE 5 :
FIGURE 4: Workflow diagram of the proposed RGP based on Alg. 1, seen from the local perspective of the i-th channel.With reference to the whole view given in Fig. 3, this element represents the rightmost part, where the green blocks in the two figures correspond.

FIGURE 6 :
FIGURE 6: Reference generation (Alg. 1) for the Cavallino OCN case study applied on graphs G (a)-(d) and T (e)-(h).Panels (a)-(e) show the behavior of the controlled quantity and (b)-(f) reports the related disagreement function.In (c)-(g) it appears that the level variation δx * does not violate the given channel constraints.

FIGURE 7 :
FIGURE 7: Reference generation (Alg. 1) for the Cavallino OCN case study applied on graphs G for a faulty scenario where the channel constraint capacity values are artificially abruptly modified (c U ,c D in (c)).
th neighborhood of junction i and with d o i = |N o i | the degree of junction i, the cardinality of the (adjoint) edge set is yielded by |E|

TABLE 1 :
Topological constants pertaining to graphs G and T .