4.1 Main-grid Dynamic
As mentioned in previous section, a main grid unit (grid connected mode) is called a unit injecting (absorbing) an amount of power into (from) the network via common coupling port. In order to describe the dynamic of the main-grid edge \({\mathcal {E}}_{G}\), the following model is considered:
$$ \begin{aligned} {\dot{\theta}}_{G}&={\omega}_{G},\\[-4pt] E_{G}&=V_{G},\\[-4pt] P_{G}&=v^{\top}_{G}i_{G},\ \ Q_{G}=v^{\top}_{G} \left[\begin{array}{cc} 0 & -1 \\ 1 & 0 \end{array}\right] i_{G}. \end{aligned} $$
(3)
Where θG and ωG are phase angle and phase frequency of the main-grid. In addition, vG and iG are voltage and current of main-grid. In addition, PG and QG are also active and reactive power injected (absorbed) by main grid. It is assumed that in grid-connected mode the frequency and voltage of microgrid are stabilized by main grid. Furthermore, it is also assumed that microgrid can absorb (inject) infinite amount of power from (to) main-grid. Hence, we have:
$$ \begin{aligned} 0=&-d_{G}({\omega}_{G}-\bar{\omega})+(P_{G}-P_{e}),\\ 0=&-a_{G}(v_{G}-\bar{V})+(Q_{G}-Q_{e}). \end{aligned} $$
(4)
Where \(\bar {V}\) and \(\bar {\omega }\) are desired voltage and phase frequency of micro-grid. In addition, Pe and Qe are active and reactive power of microgrid and dG and aG are constant coefficients. Furthermore, we have \({\omega }_{G}=\bar {\omega }\) and \(v_{G}=\bar {V}\).
In grid-connected mode, the main grid stabilizes voltage and frequency. In addition, the voltage of main-grid can be considered as follows:
$$ v_{G}=E_{G} \left[\begin{array}{c} sin({\omega}_{G}t) \\ sin\left({\omega}_{G}t+\frac{2\pi}{3}\right) \\ sin\left({\omega}_{G}t-\frac{2\pi}{3}\right) \end{array}\right] $$
(5)
In dq form, the voltage of main-grid can also be represented as follows:
$$ v_{G_{dq}}=\sqrt{\frac{2}{3}}E_{G} \left[\begin{array}{c} sin({\omega}_{G}t) \\ cos({\omega}_{G}t) \end{array}\right]={\bar{v}}_{G_{dq}} $$
(6)
Where main-grid connects to microgrid through a port of dimension p=pdq=2 in dq-form.
4.2 Microsource dynamics
As mentioned in Section 3, the microsource unit is called a unit injecting an amount of power to the network. In this section, the dynamic of microsource unit is represented in port-Hamiltonian form. In order to describe this dynamic, a microsource equipped with three-phase inverter is considered (Fig. 2).
Let s1,⋯,s6 denote the states of the switches S1,⋯,S6 in Fig. 2, where s=0 when the switch is open and s=1 when the switch is closed. The network switches topology reveals that:
$$ \begin{aligned} v_{ao}&=v_{dc}s_{1},\ v_{ao}=v_{ao}(1-s_{4}),\\ v_{bo}&=v_{dc}s_{2},\ v_{bo}=v_{bo}(1-s_{5}),\\ v_{co}&=v_{dc}s_{3},\ v_{co}=v_{co}(1-s_{6}). \end{aligned} $$
(7)
Considering the constraints imposed by the circuit, i.e., short-cutting the voltage source is not allowed, leads to the observation that the bottom and top switch can never be closed at the same time. Furthermore, for continuity considerations in each phase leg, we have:
$$s_{1}+s_{4}=1,\ s_{2}+s_{5}=1,\ s_{3}+s_{6}=1. $$
The above equations imply that Eq. (7) can be rewritten into a simplified form. Introducing the new variables sa=s1=s4,sb=s2=s5 and sc=s3=s6 yields the simplified equations:
$$ v_{ao}=v_{dc}s_{a},\ v_{bo}=v_{dc}s_{b},\ v_{co}=v_{dc}s_{c}. $$
(8)
Definition 4
The Hamiltonian energy function of the microsource, which denotes the total energy, is given by:
$$ {\mathcal{H}}(\phi,q,q_{dc})=\sum_{j=a,b,c}{\left(\frac{1}{2}\frac{{\phi}^{2}_{j}}{L}+\frac{1}{2}\frac{q^{2}_{j}}{C}\right)}+\frac{1}{2}\frac{q^{2}_{dc}}{C_{dc}} $$
(9)
Where ϕis the flux linkage across the inductors, q and qdc the charge in the capacitors. In addition, L and C denote the inductance and capacitance of the microgrid ac-side. In addition Cdc denote the capacitance of microsource dc-side.
Therefore, the microsource can be represented in port-Hamiltonian form as follows:
$$ \begin{aligned} \left[\begin{array}{c} \dot{\phi} \\ \dot{q} \\ {\dot{q}}_{dc} \end{array}\right] &=\left(\left[\begin{array}{ccc} {\mathbb{0}}_{3} & {\mathbb{0}}_{3} & \widehat{\boldsymbol{s}} \\ {\mathbb{0}}_{3} & {\mathbb{0}}_{3} & {0}_{31} \\ -{\boldsymbol{s}}^{\top} & {0}_{13} & 0 \end{array}\right] +\left[\begin{array}{ccc} {\mathbb{0}}_{3} & {-\mathbb{I}}_{3} & {0}_{31} \\ {\mathbb{I}}_{3} & {\mathbb{0}}_{3} & {0}_{31} \\ {0}_{13} & {0}_{13} & 0 \end{array}\right] \right. \\ &-\left.\left[\begin{array}{ccc} {R\mathbb{I}}_{3} & {\mathbb{0}}_{3} & {0}_{31} \\ {\mathbb{0}}_{3} & {\mathbb{0}}_{3} & {0}_{31} \\ {0}_{13} & {0}_{13} & G_{dc} \end{array}\right] \right) \left[\begin{array}{c} \frac{\partial {\mathcal{H}}}{\partial \phi} \\ \frac{\partial {\mathcal{H}}}{\partial q} \\ \frac{\partial {\mathcal{H}}}{\partial q_{dc}} \end{array}\right] -\left[\begin{array}{c} {\mathbb{0}}_{3} \\ {\mathbb{I}}_{3} \\ {0}_{13} \end{array}\right] i_{S_{abc}} \\&\quad+\left[\begin{array}{c} {0}_{31} \\ {0}_{31} \\ 1 \end{array}\right] i_{S_{0}}, \\ v_{o,abc} &=\left[\begin{array}{ccc} {\mathbb{0}}_{3} & {\mathbb{I}}_{3} & {0}_{31} \end{array}\right] {\nabla}{\mathcal{H}}(\phi, q, q_{dc}).\\ y_{A}&=\left[\begin{array}{ccc} {\bar{v}}_{dc}{\mathbb{I}}_{3} & {\mathbb{0}}_{3} & -\bar{i} \end{array}\right] {\nabla}{\mathcal{H}}(\phi, q, q_{dc}).\\ \end{aligned} $$
(10)
Where \(\widehat {\boldsymbol {s}}={\left ({\widehat {s}}_{a},{\widehat {s}}_{b},{\widehat {s}}_{c}\right)}^{\top }=\boldsymbol {\Upsilon }\boldsymbol {s}\), \(\boldsymbol {\Upsilon }=\frac {1}{3}\left [\begin {array}{ccc} 2 & -1 & -1 \\ -1 & 2 & -1 \\ -1 & -1 & 2 \end {array}\right ] \)and s=(sa,sb,sc). In addition, Gdc is the conductance of microsource dc-side and x=(ϕ,q,qdc)⊤ is state vector of microsource unit. Furthermore, the yA and \(\bar {x}\) are auxiliary output and desired states respectively.
The microsource modeling can be transformed to dq form as follows:
$$ {\begin{aligned} \left[\begin{array}{c} {\dot{\phi }}_{dq} \\ {\dot{q}}_{dq} \\ {\dot{q}}_{dc} \end{array}\right] &=\left(\left[\begin{array}{ccc} {\mathbb{0}}_{2} & {\mathbb{0}}_{2} & u_{dq} \\ {\mathbb{0}}_{2} & {\mathbb{0}}_{2} & 0_{21} \\ -u^{\top }_{dq} & 0_{12} & 0 \end{array}\right] +\left[\begin{array}{ccc} {\bar{\omega} L\boldsymbol{\mathrm{J}}} & {-\mathbb{I}}_{2} & 0_{21} \\ {\mathbb{I}}_{2} & {\bar{\omega} C\boldsymbol{\mathrm{J}}} & 0_{21} \\ 0_{12} & 0_{12} & 0 \end{array}\right] \right. \\ &\quad-\left.\left[\begin{array}{ccc} {R\mathbb{I}}_{2} & {\mathbb{0}}_{2} & 0_{21} \\ {\mathbb{0}}_{2} & {\mathbb{0}}_{2} & 0_{21} \\ 0_{12} & 0_{12} & G_{dc} \end{array}\right]\right) \left[\begin{array}{c} \frac{\partial {\mathcal{H}}}{\partial {\phi}_{dq}} \\ \frac{\partial {\mathcal{H}}}{\partial q_{dq}} \\ \frac{\partial {\mathcal{H}}}{\partial q_{dc}} \end{array}\right] -\left[\begin{array}{c} {\mathbb{0}}_{2} \\ {\mathbb{I}}_{2} \\ 0_{12} \end{array}\right] i_{S_{dq}} +\left[\begin{array}{c} 0_{21} \\ 0_{21} \\ 1 \end{array}\right] i_{S_{0}}, \\ v_{o_{dq}} &=\left[\begin{array}{ccc} {\mathbb{0}}_{2} & {\mathbb{I}}_{2} & 0_{21} \end{array}\right] {\nabla}{\mathcal{H}}({\phi}_{dq},q_{dq},q_{dc}), \\ y_{A}&=\left[\begin{array}{ccc} {\bar{v}}_{dc}{\mathbb{I}}_{2} & {\mathbb{0}}_{2} & -{\bar{i}}_{dq} \end{array}\right] {\nabla}{\mathcal{H}}({\phi}_{dq},q_{dq},q_{dc}). \end{aligned}} $$
(11)
where \(\boldsymbol {\mathrm {J}}= \left [\begin {array}{cc} 0 & 1 \\ -1 & 0 \end {array}\right ]\) and also ΥT0dq=T0dq.
Therefore, the microsource dynamic for \(i\in {\mathcal {E}}_{S}\) can be described as follows:
$$ {\begin{aligned} \left[\begin{array}{c} {\dot{\phi }}_{{dq}_{i}} \\ {\dot{q}}_{{dq}_{i}} \\ {\dot{q}}_{{dc}_{i}} \end{array}\right] &=\left(\left[\begin{array}{ccc} {\mathbb{0}}_{2} & {\mathbb{0}}_{2} & u_{{dq}_{i}} \\ {\mathbb{0}}_{2} & {\mathbb{0}}_{2} & 0_{21} \\ -u^{\top }_{{dq}_{i}} & 0_{12} & 0 \end{array}\right] +\left[\begin{array}{ccc} {\bar{\omega} L_{i}\boldsymbol{\mathrm{J}}} & {-\mathbb{I}}_{2} & 0_{21} \\ {\mathbb{I}}_{2} & {\bar{\omega} C_{i}\boldsymbol{\mathrm{J}}} & 0_{21} \\ 0_{12} & 0_{12} & 0 \end{array}\right] \right. \\ &-\left.\left[\begin{array}{ccc} {R_{i}\mathbb{I}}_{2} & {\mathbb{0}}_{2} & 0_{21} \\ {\mathbb{0}}_{2} & {\mathbb{0}}_{2} & 0_{21} \\ 0_{12} & 0_{12} & G_{{dc}_{i}} \end{array}\right] \right) \left[\begin{array}{c} \frac{\partial {\mathcal{H}}_{i}}{\partial {\phi }_{{dq}_{i}}} \\ \frac{\partial {\mathcal{H}}_{i}}{\partial q_{{dq}_{i}}} \\ \frac{\partial {\mathcal{H}}_{i}}{\partial q_{{dc}_{i}}} \end{array}\right] -\left[\begin{array}{c} {\mathbb{0}}_{2} \\ {\mathbb{I}}_{2} \\ 0_{12} \end{array}\right] i_{{S_{dq}}_{i}} +\left[\begin{array}{c} 0_{21} \\ 0_{21} \\ 1 \end{array}\right] i_{{S_{0}}_{i}}, \\ v_{{o_{dq}}_{i}} &=\left[\begin{array}{ccc} {\mathbb{0}}_{2} & {\mathbb{I}}_{2} & 0_{21} \end{array}\right] {\nabla}{\mathcal{H}}_{S}\left(x_{i}\right), \\ y_{A_{i}}&=\left[\begin{array}{ccc} {\bar{v}}_{{dc}_{i}}{\mathbb{I}}_{2} & {\mathbb{0}}_{2} & -{\bar{i}}_{dq} \end{array}\right] {\nabla}{\mathcal{H}}_{S}\left(x_{i}\right) \end{aligned}} $$
(12)
Where we have:
$$ \begin{aligned} \left[\begin{array}{c} {\dot{\phi }}_{{dq}_{i}} \\ {\dot{q}}_{{dq}_{i}} \\ {\dot{q}}_{{dc}_{i}} \end{array}\right] \in {\mathbb{R}}^{n_{i}},\ \ u_{{dq}_{i}}\in {\mathbb{R}}^{m_{i}}, \\ v_{{o_{dq}}_{i}} \in {\mathbb{R}}^{p_{i}}, \ \ i_{{S_{dq}}_{i}} \in {\mathbb{R}}^{p_{i}}, \ \ i_{{S_{0}}_{i}}\in \mathbb{R}. \end{aligned} $$
(13)
In addition, ni=5,mi=2 and pi=2. The port-Hamiltonian energy function is also defined as \({\mathcal {H}}_{i}:{\mathbb {R}}^{n_{i}}\to \mathbb {R}\).
The aggregated model of the microsource dynamics can be obtained by collecting the port-Hamiltonian forms given by Eq. (12) for \(i\in {\mathcal {E}}_{S}\). Let the numbers:
$$ n_{S}:=\sum^{s}_{i=1}{n_{i}},\ m_{S}:=\sum^{s}_{i=1}{m_{i}},\ p_{S}:=\sum^{s}_{i=1}{p_{i}},\ {p}_{S_{0}}:=s. $$
(14)
the aggregated vectors:
$$ {}\begin{aligned} &{\boldsymbol{v}}_{S,dq}=col(v_{{S_{dq}}_{i}}),\ \ {\boldsymbol{i}}_{S,dq}=col(i_{{S_{dq}}_{i}})\\ &{\boldsymbol{u}}_{S,dq}=col(u_{{dq}_{i}}),\ \ {\boldsymbol{v}}_{S,dq}=col(v_{{o_{dq}}_{i}})\\ &{\boldsymbol{v}}_{S_{0}}=col(v_{{S_{0}}_{i}}),\ \ {\boldsymbol{i}}_{S_{0}}=col(i_{{S_{0}}_{i}})\\ &\left[\begin{array}{c} {\boldsymbol{\phi }}_{S,dq} \\ {\boldsymbol{q}}_{S,dq} \\ {\boldsymbol{q}}_{{dc},S} \end{array}\right] =col\left[\begin{array}{c} {\phi }_{{dq}_{i}} \\ q_{{dq}_{i}} \\ q_{{dc}_{i}} \end{array}\right],\ \ \left[\begin{array}{c} \frac{\partial {\mathcal{H}}_{S}}{\partial {\boldsymbol{\phi }}_{S,dq}} \\ \frac{\partial {\mathcal{H}}_{S}}{\partial {\boldsymbol{q}}_{S,dq}} \\ \frac{\partial {\mathcal{H}}_{S}}{\partial {\boldsymbol{q}}_{{dc},S}} \end{array}\right] =col\left[\begin{array}{c} \frac{\partial {\mathcal{H}}_{i}}{\partial {\phi }_{{dq}_{i}}} \\ \frac{\partial {\mathcal{H}}_{i}}{\partial q_{{dq}_{i}}} \\ \frac{\partial {\mathcal{H}}_{i}}{\partial q_{{dc}_{i}}} \end{array}\right] \end{aligned} $$
(15)
the interconnection and dissipation matrices:
$$ \begin{aligned} {\mathcal{J}}_{S_{u}}:=bdg\left\{\left[\begin{array}{ccc} {\mathbb{0}}_{2} & {\mathbb{0}}_{2} & u_{{dq}_{i}} \\ {\mathbb{0}}_{2} & {\mathbb{0}}_{2} & 0_{21} \\ -u^{\top}_{{dq}_{i}} & 0_{12} & 0 \end{array}\right]\right\}, \\ {\mathcal{J}}_{S_{c}}:=bdg\left\{\left[\begin{array}{ccc} {\bar{\omega} L_{i}\boldsymbol{\mathrm{J}}} & {-\mathbb{I}}_{2} & 0_{21} \\ {\mathbb{I}}_{2} & {\bar{\omega} C_{i}\boldsymbol{\mathrm{J}}} & 0_{21} \\ 0_{12} & 0_{12} & 0 \end{array}\right]\right\}, \\ {\mathcal{R}}_{S}:=bdg\left\{\left[\begin{array}{ccc} {R_{i}\mathbb{I}}_{2} & {\mathbb{0}}_{2} & 0_{21} \\ {\mathbb{0}}_{2} & {\mathbb{0}}_{2} & 0_{21} \\ 0_{12} & 0_{12} & G_{{dc}_{i}} \end{array}\right]\right\}. \end{aligned} $$
(16)
interaction port and microsource port matrices:
$$ \begin{aligned} F_{S}:=&bdg\left\{\left[\begin{array}{c} {\mathbb{0}}_{2} \\ {-\mathbb{I}}_{2} \\ 0_{12} \end{array}\right] \right\}, \ \ F_{S_{0}}:=bdg\left\{\left[\begin{array}{c} 0_{21} \\ 0_{21} \\ 1 \end{array}\right]\right\} \\ A_{S}:=&bdg\left\{\left[\begin{array}{c} {\bar{v}}_{{dc}_{i}}{\mathbb{I}}_{2} \\ {\mathbb{0}}_{2} \\ -{\bar{i}}^{\top}_{{dq}_{i}} \end{array}\right]\right\} \end{aligned} $$
(17)
and the total Hamiltonian function \({\mathcal {H}}_{S}:{\mathbb {R}}^{n_{s}}\to \mathbb {R}\) is defined as follows:
$$ {\mathcal{H}}_{S}:=\sum^{s}_{i=1}{{\mathcal{H}}_{i}} $$
(18)
The aggregated model of the microsource dynamics can be written as:
$$ {{} \begin{aligned} \left[\begin{array}{c} {\dot{\boldsymbol{\phi }}}_{S,dq} \\ {\dot{\boldsymbol{q}}}_{S,dq} \\ {\dot{\boldsymbol{q}}}_{{dc},S} \end{array}\right]\!&=\!({\mathcal{J}}_{S_{u}}\,+\,{\mathcal{J}}_{S_{c}}\,-\,{\mathcal{R}}_{S}) \left[\begin{array}{c} \frac{\partial {\mathcal{H}}_{S}}{\partial {\boldsymbol{\phi }}_{S,dq}} \\ \frac{\partial {\mathcal{H}}_{S}}{\partial {\boldsymbol{q}}_{S,dq}} \\ \frac{\partial {\mathcal{H}}_{S}}{\partial {\boldsymbol{q}}_{{dc},S}} \end{array}\right] +{F_{S}}{\boldsymbol{i}}_{S,dq}+{F_{S_{0}}}{\boldsymbol{i}}_{S_{0}}, \\ {\boldsymbol{v}}_{S,dq}&=F^{\top }_{S}{\nabla}{\mathcal{H}}_{S}\left(x_{S}\right), \\ y_{S_{A}}&=A^{\top }_{S}\left({\bar{x}}_{S}\right){\nabla}{\mathcal{H}}_{S}\left(x_{S}\right). \end{aligned}} $$
(19)
Remark 2
The following general port-Hamiltonian form is considered for microsource dynamics:
$$ \left\{ \begin{array}{l} {\dot{x}}_{S}=\left[{\mathcal{J}}_{S_{u}}+{\mathcal{J}}_{S_{c}}-{\mathcal{R}}_{S}\right]\mathrm{\nabla }{\mathcal{H}}_{S}\left(x_{S}\right)+{F_{S}}w_{S}+{F_{S_{0}}}w_{S_{0}}, \\ y_{S_{A}}=A^{\top }_{S}\left({\bar{x}}_{S}\right){\nabla}{\mathcal{H}}_{S}\left(x_{S}\right), \\ y_{S}=F^{\top }_{S}\mathrm{\nabla }{\mathcal{H}}_{S}\left(x_{S}\right), \\ y_{S_{0}}=F^{\top }_{S_{0}}\mathrm{\nabla }{\mathcal{H}}_{S}\left(x_{S}\right). \end{array} \right. $$
(20)
Where xS=(ϕS,dq,qS,dq,qdc,S) is state vector of microsource units; \({{\mathcal {H}}_{S}}(x_{S})\)is Hamiltonian energy function; \({\mathcal {J}}_{S_{u}}\) and \({\mathcal {J}}_{S_{c}}\) are interconnection matrices and \({\mathcal {R_{S}}}\) is dissipation matrices; (wS,yS)=(iS,dq,vS,dq) is conjugated interaction port variables; \(\left (w_{S_{0}},y_{S_{0}}\right)=\left ({\boldsymbol {i}}_{S_{0}},{\boldsymbol {v}}_{dc,S}\right)\) is also conjugated microsource port variables. Other matrices can be defined as follows, FS interaction port matrix and \(F_{S_{0}}\) microsource port matrix. Furthermore, the \(y_{S_{A}}\) is auxiliary passive outputs.
4.3 Distribution line dynamics
A distribution line unit is called a unit that transfer power in the microgrid and also absorb or inject a little amount of power compared to microsource and load units. It is assumed that all distribution line units are describing by mixed lines (i.e. R−L series). A circuit representation of series line is illustrated in Fig. 3. The model consists of an R−L unit (resistive-inductive line). Therefore, The model of the distribution line unit is simply given by the following port-Hamiltonian formulation:
$$ \begin{aligned} \dot{\phi }&=-\left[R\otimes {{\mathbb{I}}_{3}}\right]\mathrm{\nabla }{\mathcal{H}}(\phi)+v, \\ i&=\mathrm{\nabla }{\mathcal{H}}(\phi). \end{aligned} $$
(21)
Where ϕ is the magnetic flux in the inductor.
Definition 5
The Hamiltonian energy function of the distribution line, \({\mathcal {H}}(\phi):{\mathbb {R}}^{3}\to \mathbb {R}\), is described as follows:
$$ {\mathcal{H}}(\phi):= \frac{1}{2}{\phi }^{\top }{\left(L\otimes {{\mathbb{I}}_{3}}\right)}^{-1}\phi. $$
(22)
In order to describe the port-Hamiltonian model in dq form, we have:
$$ \begin{aligned} {\dot{\phi }}_{dq}&=\left[{{\bar{\omega}} L\boldsymbol{\mathrm{J}}}-R{\mathbb{I}}_{2}\right]\frac{\partial {\mathcal{H}}\left({\phi}_{dq}\right)}{\partial {\phi}_{dq}}+v_{dq}, \\ i_{dq}&=\frac{\partial{\mathcal{H}}\left({\phi}_{dq}\right)}{\partial {\phi}_{dq}}. \end{aligned} $$
(23)
Where \(\boldsymbol {\mathrm {J}}= \left [\begin {array}{cc} 0 & 1 \\ -1 & 0 \end {array}\right ]\). In addition, \({\mathcal {H}}\left ({\phi }_{dq}\right):{\mathbb {R}}^{2}\to \mathbb {R}\) is Hamiltonian energy function and described as follows:
$$ {\mathcal{H}}\left({\phi }_{dq}\right):= \frac{1}{2}{\phi}^{\top}_{dq}{\left(L\otimes {{\mathbb{I}}_{2}}\right)}^{-1}{\phi}_{dq}. $$
(24)
Therefore, the distribution line dynamic for \(i\in {\mathcal {E}}_{D}\) can be described as follows:
$$ \begin{aligned} {\dot{\phi }}_{{dq}_{i}}&=\left[{{\bar{\omega}} L_{i}\boldsymbol{\mathrm{J}}}-R_{i}{\mathbb{I}}_{2}\right]\frac{\partial {\mathcal{H}}\left({\phi}_{{dq}_{i}}\right)}{\partial {\phi }_{{dq}_{i}}}+v_{{dq}_{i}}, \\ i_{{dq}_{i}}&=\frac{\partial {\mathcal{H}}\left({\phi}_{{dq}_{i}}\right)}{\partial {\phi }_{{dq}_{i}}}. \end{aligned} $$
(25)
Where we have:
$$ {\phi }_{{dq}_{i}}\in {\mathbb{R}}^{n_{i}},\ \ \ v_{{dq}_{i}}\in {\mathbb{R}}^{p_{i}},\ \ \ i_{{dq}_{i}}\in {\mathbb{R}}^{p_{i}}. $$
(26)
Where ni=2 and pi=2. In addition, port-Hamiltonian energy function defines as \({\mathcal {H}}_{i}\left ({\phi }_{{dq}_{i}}\right):{\mathbb {R}}^{n_{i}}\to \mathbb {R}\).
The aggregated model of the distribution line dynamics can be obtained by collecting the port-Hamiltonian forms given by Eq. (25) for \(i\in {\mathcal {E}}_{D}\). Let the numbers:
$$ n_{D}:=\sum^{d}_{i=1}{n_{i}},\ \ \,\ \ \ p_{D}:=\sum^{d}_{i=1}{p_{i}}. $$
(27)
the aggregated vectors:
$$ \begin{aligned} {\boldsymbol{i}}_{D,dq}&=col\left(i_{{dq}_{i}}\right), \ {\boldsymbol{v}}_{D,dq}=col\left(v_{{dq}_{i}}\right), \\ {\boldsymbol{\phi }}_{D,dq}&=col\left({\phi }_{{dq}_{i}}\right), \ \frac{\partial {\mathcal{H}}_{D}}{\partial {\boldsymbol{\phi }}_{D,dq}}=col\left(\frac{\partial {\mathcal{H}}_{i}}{\partial {\phi}_{{dq}_{i}}}\right). \end{aligned} $$
(28)
the interconnection and dissipation matrix:
$$ \begin{aligned} {\mathcal{J}}_{D_{c}}&:=bdg\left\{{{\bar{\omega}} L_{i}\boldsymbol{\mathrm{J}}}\right\}, \\ {\mathcal{R}}_{D}&:=bdg\left\{{R_{i}\mathbb{I}}_{2}\right\}. \end{aligned} $$
(29)
interaction port matrices:
$$ F_{D}:=bdg\left\{{\mathbb{I}}_{2}\right\} $$
(30)
and the total Hamiltonian energy function \({\mathcal {H}}_{D}:{\mathbb {R}}^{n_{D}}\to \mathbb {R}\):
$$ {\mathcal{H}}_{D}:=\sum^{d}_{i=1}{{\mathcal{H}}\left({\phi }_{{dq}_{i}}\right)} $$
(31)
The aggregated model of the distribution line edges can be written as:
$$ \begin{aligned} {\dot{\boldsymbol{\phi}}}_{D,dq}&=\left({\mathcal{J}}_{D_{c}}-{\mathcal{R}}_{D}\right)\frac{\partial {\mathcal{H}}_{D}}{\partial {\boldsymbol{\phi}}_{D,dq}}+{F_{D}}{\boldsymbol{v}}_{D,dq}, \\ {\boldsymbol{i}}_{D,dq}&={F^{\top}_{D}}\frac{\partial {\mathcal{H}}_{D}}{\partial {\boldsymbol{\phi}}_{D,dq}}. \end{aligned} $$
(32)
Remark 3
The general port-Hamiltonian formulation of the distribution line dynamics is given by:
$$ \left\{ \begin{array}{c} {\dot{x}}_{D}=\left[{\mathcal{J}}_{D_{c}}-{\mathcal{R}}_{D}\right]{\nabla}{\mathcal{H}}_{D}\left(x_{D}\right)+{F_{D}}w_{D}, \\ y_{D}=F^{\top}_{D}{\nabla}{\mathcal{H}}_{D}\left(x_{D}\right)\ \end{array} \right. $$
(33)
4.4 Load dynamics
A load unit is called a power unit that absorbs an amount of power from the micro-grid. Without loss of generality, it is assumed that all load units are describing by R−C parallels. A circuit representation of load unit (resistance-capacitance parts)is illustrated in Fig. 4. The model of the load unit is simply given by the following port-Hamiltonian system:
$$ \begin{aligned} \dot{q}&=-\left[R\otimes {\mathbb{I}}_{3}\right]{\nabla}{\mathcal{H}}(q)+i, \\ v&={\nabla}{\mathcal{H}}(q). \end{aligned} $$
(34)
Where q is the charge in the capacitor.
Definition 6
The Hamiltonian energy function of load unit, \({\mathcal {H}}(q):{\mathbb {R}}^{3}\to \mathbb {R}\), is described as follows:
$$ {\mathcal{H}}(q):= \frac{1}{2}q^{\top}{\left(C\otimes {\mathbb{I}}_{3}\right)}^{-1}q $$
(35)
In order to describe the port-Hamiltonian model in dq form, we have:
$$ \begin{aligned} {\dot{q}}_{dq}&=\left[{{\bar{\omega}} C\boldsymbol{\mathrm{J}}}-R{\mathbb{I}}_{2}\right]\frac{\partial {\mathcal{H}}\left(q_{dq}\right)}{\partial q_{dq}}+i_{dq}, \\ v_{dq}&=\frac{\partial {\mathcal{H}}\left(q_{dq}\right)}{\partial q_{dq}}. \end{aligned} $$
(36)
Where \(\boldsymbol {\mathrm {J}}= \left [\begin {array}{cc} 0 & 1 \\ -1 & 0 \end {array}\right ]\). In addition, \({\mathcal {H}}\left (q_{dq}\right):{\mathbb {R}}^{2}\to \mathbb {R}\) is Hamiltonian energy function and described as follows:
$$ {\mathcal{H}}\left(q_{dq}\right):= \frac{1}{2}q^{\top}_{dq}{\left(C\otimes {\mathbb{I}}_{2}\right)}^{-1}q_{dq}. $$
(37)
Therefore, the load dynamic for \(i\in {\mathcal {E}}_{L}\) can be described as follows:
$$ \begin{aligned} {\dot{q}}_{{dq}_{i}}&=\left[{{\bar{\omega}} C_{i}\boldsymbol{\mathrm{J}}}-R_{i}{\mathbb{I}}_{2}\right]\frac{\partial {\mathcal{H}}\left(q_{{dq}_{i}}\right)}{\partial q_{{dq}_{i}}}+i_{{dq}_{i}}, \\ v_{{dq}_{i}}&=\frac{\partial {\mathcal{H}}\left(q_{{dq}_{i}}\right)}{\partial q_{{dq}_{i}}}. \end{aligned} $$
(38)
Where we have:
$$ q_{{dq}_{i}}\in {\mathbb{R}}^{n_{i}},\ \ \ i_{{dq}_{i}}\in {\mathbb{R}}^{p_{i}},\ \ \ v_{{dq}_{i}}\in {\mathbb{R}}^{p_{i}}. $$
(39)
In addition, ni=2 and pi=2. The port-Hamiltonian energy function is also defined as \({\mathcal {H}}_{i}\left (q_{{dq}_{i}}\right):{\mathbb {R}}^{n_{i}}\to \mathbb {R}\).
The aggregated model of the load dynamics are obtained by collecting the port-Hamiltonian forms given by Eq. (38) for \(i\in {\mathcal {E}}_{L}\). Let the numbers:
$$ n_{L}:=\sum^{\ell}_{i=1}{n_{i}},\ \ \,\ \ \ p_{L}:=\sum^{\ell}_{i=1}{p_{i}}. $$
(40)
the aggregated vectors:
$$ \begin{aligned} {\boldsymbol{i}}_{L,dq}&=col\left(i_{{dq}_{i}}\right),\ {\boldsymbol{v}}_{L,dq}=col\left(v_{{dq}_{i}}\right), \\ {\boldsymbol{q}}_{L,dq}&=col\left(q_{{dq}_{i}}\right),\ \frac{\partial {\mathcal{H}}_{L}}{\partial {\boldsymbol{q}}_{L,dq}}=col\left(\frac{\partial {\mathcal{H}}_{i}}{\partial q_{{dq}_{i}}}\right), \end{aligned} $$
(41)
the interconnection and dissipation matrix:
$$ \begin{aligned} {\mathcal{J}}_{L_{c}}&:=bdg\left\{{{\bar{\omega}} C_{i}\boldsymbol{\mathrm{J}}}\right\}, \\ {\mathcal{R}}_{L}&:=bdg\left\{{R_{i}\mathbb{I}}_{2}\right\}. \end{aligned} $$
(42)
interaction port matrices:
$$ F_{L}:=bdg\left\{{\mathbb{I}}_{2}\right\}. $$
(43)
and the total Hamiltonian function \({\mathcal {H}}_{L}:{\mathbb {R}}^{n_{L}}\to \mathbb {R}\) for load dynamics:
$$ {\mathcal{H}}_{L}:=\sum^{\ell}_{i=1}{{\mathcal{H}}\left({\phi}_{{dq}_{i}}\right)}. $$
(44)
The aggregated model of the distribution load dynamics can be written as:
$$ \begin{aligned} {\dot{\boldsymbol{q}}}_{L,dq}&=\left({\mathcal{J}}_{L_{c}}-{\mathcal{R}}_{L}\right)\frac{\partial {\mathcal{H}}_{L}}{\partial {\boldsymbol{q}}_{L,dq}}+{F_{L}}{\boldsymbol{i}}_{L,dq}, \\ {\boldsymbol{v}}_{L,dq}&=F^{\top}_{L}\frac{\partial {\mathcal{H}}_{L}}{\partial {\boldsymbol{q}}_{L,dq}}. \end{aligned} $$
(45)
Remark 4
The general port-Hamiltonian formulation of the distribution load dynamics is given by:
$$ \left\{ \begin{array}{c} {\dot{x}}_{L}=\left[{\mathcal{J}}_{L_{c}}-{\mathcal{R}}_{L}\right]{\nabla}{\mathcal{H}}_{L}\left(x_{L}\right)+{F_{L}}{w_{L}}, \\ y_{L}=F^{\top}_{L}{\nabla}{\mathcal{H}}_{L}\left(x_{L}\right). \end{array}\right. $$
(46)
4.5 Microgrid overall dynamic
The microgrid overall dynamic is obtained by collecting the aggregated unit dynamics Eqs. (3), (5), (20), (33) and (46). Therefore, the overall dynamic can be rewritten in port-Hamiltonian formulation as follows (Fig. 5):
$$ \begin{aligned} 0&=w_{G}-\bar{w}_{G}=i_{G_{dq}}-\bar{i}_{G_{dq}}, \\[-2pt] {\dot{x}}_{S}&=\left[{\mathcal{J}}_{S_{u}}+{\mathcal{J}}_{S_{c}}-{\mathcal{R}}_{S}\right]{\nabla}{\mathcal{H}}_{S}\left(x_{S}\right)+F_{S}w_{S}+F_{S_{0}}w_{S_{0}},\\ {\dot{x}}_{L}&=\left[{\mathcal{J}}_{L_{c}}-{\mathcal{R}}_{L}\right]{\nabla}{\mathcal{H}}_{L}\left(x_{L}\right)+F_{L}w_{L},\\ {\dot{x}}_{D}&=\left[{\mathcal{J}}_{D_{c}}-{\mathcal{R}}_{D}\right]{\nabla}{\mathcal{H}}_{D}\left(x_{D}\right)+F_{D}w_{D},\\ y_{G}&=\bar{y}_{G}={\bar{v}}_{G_{dq}},\\ y_{S_{A}}&=A^{\top}_{S}\left({\bar{x}}_{S}\right){\nabla}{\mathcal{H}}_{S}(x),\\ y_{S}&=F^{\top}_{S}{\nabla}{\mathcal{H}}_{S}\left(x_{S}\right),\\ y_{L}&=F^{\top}_{L}{\nabla}{\mathcal{H}}_{L}\left(x_{L}\right),\\ y_{D}&=F^{\top}_{D}{\nabla}{\mathcal{H}}_{D}\left(x_{D}\right),\\ y_{S_{0}}&=F^{\top}_{S_{0}}{\nabla}{\mathcal{H}}_{S}\left(x_{S}\right).\\ \end{aligned} $$
(47)
Let collecting the numbers (14), (27) and (40) as follows:
$$ \begin{aligned} n_{T}&:=n_{S}+n_{L}+n_{D},\ m_{T}:=m_{S}, \\ p_{T}&:=p_{S}+p_{L}+p_{D},\ p_{T_{0}}:= p_{S_{0}}, \end{aligned} $$
(48)
Collecting interconnection matrices of the microgrid unit dynamics (16), (29) and (42):
$$ \begin{aligned} {\mathcal{J}}_{T_{u}}:=& bdg\left\{{\mathcal{J}}_{S_{u}},0,0\right\}, \ {\mathcal{J}}_{T_{c}}:= bdg\left\{{\mathcal{J}}_{S_{c}},{\mathcal{J}}_{L_{c}},{\mathcal{J}}_{D_{c}}\right\}, \\ {\mathcal{J}}_{S_{u}}:=&bdg\left\{\left[\begin{array}{ccc} {\mathbb{0}}_{2} & {\mathbb{0}}_{2} & u_{{dq}_{i}} \\ {\mathbb{0}}_{2} & {\mathbb{0}}_{2} & 0_{21} \\ -u^{\top}_{{dq}_{i}} & 0_{12} & 0 \end{array}\right]\right\},\\ {\mathcal{J}}_{S_{c}}:=&bdg\left\{\left[\begin{array}{ccc} {{\bar{\omega}} L_{i}\boldsymbol{\mathrm{J}}} & {-\mathbb{I}}_{2} & 0_{21} \\ {\mathbb{I}}_{2} & {{\bar{\omega}} C_{i}\boldsymbol{\mathrm{J}}} & 0_{21} \\ 0_{12} & 0_{12} & 0 \end{array}\right]\right\}, \\ {\mathcal{J}}_{L_{c}}:=&bdg\left\{{{\bar{\omega}} C_{i}\boldsymbol{\mathrm{J}}}\right\}, \ {\mathcal{J}}_{D_{c}}:=bdg\left\{{{\bar{\omega}} L_{i}\boldsymbol{\mathrm{J}}}\right\}. \end{aligned} $$
(49)
Collecting dissipation matrices of the microgrid unit dynamics (16), (29) and (42):
$$ \begin{aligned} {\mathcal{R}}_{T}&:=bdg\left\{{\mathcal{R}}_{S},{\mathcal{R}}_{L},{\mathcal{R}}_{D}\right\}, \\ {\mathcal{R}}_{S}&:=bdg\left\{\left[\begin{array}{ccc} {R_{i}\mathbb{I}}_{2} & {\mathbb{0}}_{2} & 0_{21} \\ {\mathbb{0}}_{2} & {\mathbb{0}}_{2} & 0_{21} \\ 0_{12} & 0_{12} & G_{{dc}_{i}} \end{array}\right]\right\}, \\ {\mathcal{R}}_{L}&:=bdg\left\{{R_{i}\mathbb{I}}_{2}\right\}, \ {\mathcal{R}}_{D}:=bdg\left\{{R_{i}\mathbb{I}}_{2}\right\}. \\ \end{aligned} $$
(50)
and collecting interaction port matrices of the microgrid unit dynamics (17), (30) and (43):
$$ \begin{aligned} F_{T}:=&bdg\left\{F_{G},F_{S},0,F_{D}\right\}, \\ F_{G}:=& 1, \ F_{S}:= bdg\left\{\left[\begin{array}{c} {\mathbb{0}}_{2} \\ {-\mathbb{I}}_{2} \\ 0_{12} \end{array}\right] \right\}, \\ F_{L}:=& bdg\left\{{\mathbb{I}}_{2}\right\}, \ F_{D}:= bdg\left\{{\mathbb{I}}_{2}\right\}. \end{aligned} $$
(51)
and collecting microsource port matrices (17):
$$ \begin{aligned} F_{T_{0}}:= bdg\left\{F_{S_{0}},0,0\right\}; \ F_{S_{0}}:= bdg\left\{\left[\begin{array}{c} 0_{21} \\ 0_{21} \\ 1 \end{array}\right]\right\}. \end{aligned} $$
(52)
and collecting overall auxiliary passive output matrices (19):
$$ A_{T}:=bdg\left\{A_{S},0,0\right\}; \ A_{S}:=bdg\left\{\left[\begin{array}{c} {\bar{v}}_{{dc}_{i}}{\mathbb{I}}_{2} \\ {\mathbb{0}}_{2} \\ -{\bar{i}}^{\top}_{S_{{dq}_{i}}} \end{array}\right]\right\}. $$
(53)
The overall port-Hamiltonian form of inverter-based microgrid can be represented as follows:
$$ {{} \begin{aligned} 0&=w_{G}-\bar{w}_{G}, \\ {\dot{x}}_{T}&\,=\,\left[{\mathcal{J}}_{T_{u}}\,+\,{\mathcal{J}}_{T_{c}}-{\mathcal{R}}_{T}\right] {\nabla}{\mathcal{H}}_{T}\left(x_{T}\right)\\&\quad+F_{T}w_{T}+F_{T_{0}}w_{T_{0}},\\ y_{G}&=\bar{y}_{G},\\ y_{T_{A}}&=A^{\top}_{T}\left({\bar{x}}_{T}\right){\nabla}{\mathcal{H}}_{T}\left(x_{T}\right),\\ y_{T}&=F^{\top}_{T}{\nabla}{\mathcal{H}}_{T}\left(x_{T}\right),\\ y_{T_{0}}&=F^{\top}_{T_{0}}{\nabla}{\mathcal{H}}_{T}\left(x_{T}\right). \end{aligned}} $$
(54)
Where the overall Hamiltonian energy function \({\mathcal {H}}_{T}:{\mathbb {R}}^{n_{T}}\to \mathbb {R}\) is given by:
$$ {\mathcal{H}}_{T}:={\mathcal{H}}_{G}+{\mathcal{H}}_{L}+{\mathcal{H}}_{D} $$
(55)
Furthermore, in overall microgrid dynamic (54), the state space vectors are defined as follows:
$$ {{} \begin{aligned} x_{T}&=\left[\begin{array}{c} {\boldsymbol{\phi}}_{S,dq} \\ {\boldsymbol{q}}_{S,dq} \\ {\boldsymbol{q}}_{{dc},S} \\ {\boldsymbol{q}}_{L,dq} \\ {\boldsymbol{\phi}}_{D,dq} \end{array}\right] \in{\mathbb{R}}^{n_{T}},\ w_{T}= \left[\begin{array}{c} {\boldsymbol{i}}_{S,dq} \\ {\boldsymbol{i}}_{L,dq} \\ {\boldsymbol{v}}_{D,dq} \end{array}\right] \in {\mathbb{R}}^{p_{T}}, \\ y_{T}\!&=\!\left[\begin{array}{c} {\boldsymbol{v}}_{S,dq} \\ {\boldsymbol{v}}_{L,dq} \\ {\boldsymbol{i}}_{D,dq} \end{array}\right] \in{\mathbb{R}}^{p_{T}},\ w_{T_{0}}\,=\,{\boldsymbol{i}}_{S_{0}}\in{\mathbb{R}}^{p_{T_{0}}},\ y_{T_{0}}={\boldsymbol{v}}_{S_{0}}\in{\mathbb{R}}^{p_{T_{0}}}, \end{aligned}} $$
(56)
As mentioned in Section 3, the microgrid topology can be define based on graph \(\mathcal {G}\). In addition, the incidence matrix\(D\in {\mathbb {R}}^{\bigvee \times e}\) of the microgrid graph is obtained by treating buses as nodes and power units (main-grid, microsource, distribution lines and loads) as edges and given by:
$$ \begin{aligned} D= \left[\begin{array}{ccccc} \hat{\sigma}{\mathbb{I}}_{G} & 0 & 0 & 0 & \hat{\sigma}D_{G} \\ 0 & {\mathbb{I}}_{S_{V}} & 0 & 0 & D_{S_{V}}\\ 0 & 0 & {\mathbb{I}}_{S_{F}} & 0 & D_{S_{F}} \\ 0 & 0 & 0 & {\mathbb{I}}_{L} & D_{L} \\ -\hat{\sigma}{\boldsymbol{1}}^{\top}_{G} & -{\boldsymbol{1}}^{\top}_{S_{V}} & -{\boldsymbol{1}}^{\top}_{S_{F}} & {-\boldsymbol{1}}^{\top}_{L} & 0 \end{array}\right] \end{aligned} $$
(57)
Where \(\hat {\sigma }=\left (1-\sigma \right)\) and σ shows the microgrid different operation modes, i.e. σ=0 for grid-connected and σ=1 for islanding mode. In addition, 1× is correspond to a column vector with all its entries equal to one and the of size of vectors defines as follows:
$$ {\boldsymbol{1}}_{G}\in {\mathbb{R}}^{g},\ \ \left[\begin{array}{cc} {\boldsymbol{1}}_{S_{V}} & {\boldsymbol{1}}_{S_{F}} \end{array}\right] \in {\mathbb{R}}^{s},\ \ {\boldsymbol{1}}_{L}\in {\mathbb{R}}^{\ell} $$
(58)
Notably, in islanding mode, the microsources are divided to grid-forming (stabilizing frequency) and grid feeding (stabilizing voltage and power). Hence, the sub-matrices, \(D_{S_{V}}\) and \(D_{S_{F}}\), are refereed to these divisions. Furthermore, the sub-matrix D′ represents the incidence matrix of the \({\mathcal {G}}'\) microgrid graph, that is obtained by eliminating the reference node and edges that are connected to it.
$$ {{D}'}^{\top}= \left[\begin{array}{cccc} \hat{\sigma}D_{G} & D_{S_{V}} & D_{S_{F}} & D_{L} \end{array}\right] $$
(59)
In addition, the sub-matrix of microsource incidence matrix is also decomposed to capture the information about the microgrid different operation modes (grid-connected and islanding).
In this section, the vector of node voltages \(\mathcal {V}\) and the vector of edge voltages and currents (Ve,Ie) are defined as follows:
$$ {{} \begin{aligned} \mathcal{V}\mathrm{:=} \left[\begin{array}{c} {\mathcal{V}}_{G} \\ {\mathcal{V}}_{S_{V}} \\ {\mathcal{V}}_{S_{F}} \\ {\mathcal{V}}_{L} \\ 0 \end{array}\right] \in {\mathbb{R}}^{\bigvee},\ V_{e}\mathrm{:=}\! \left[\begin{array}{c} v_{G} \\ v_{S_{V}} \\ v_{S_{F}} \\ v_{L} \\ v_{D} \end{array}\right] \in {\mathbb{R}}^{e},\ I_{e}\mathrm{:=}\! \left[\begin{array}{c} i_{G} \\ i_{S_{V}} \\ i_{S_{F}} \\ i_{L} \\ i_{D} \end{array}\right] \in {\mathbb{R}}^{e} \end{aligned}} $$
(60)
Where the reference node is considered to be a ground potential.
Using Kirchhoff’s current and voltage laws we get then:
$$ {\boldsymbol{0}}_{\bigvee}={DI}_{e},\quad V_{e}=D^{\top}\mathcal{V} $$
(61)
Then, recalling the definition of incidence matrix given in (57), we have
$$ \left\{\begin{array}{l} 0=i_{G}+\hat{\sigma}D_{G}i_{D}, \\ 0=i_{S_{V}}+D_{S_{V}}i_{D}, \\ 0=i_{S_{F}}+D_{S_{F}}i_{D}, \\ 0=i_{L}+D_{L}i_{D}, \\ 0=\hat{\sigma}{\boldsymbol{1}}^{\top}_{G}i_{G}+{\boldsymbol{1}}^{\top}_{S_{V}}i_{S_{V}}+{\boldsymbol{1}}^{\top}_{S_{F}}i_{S_{F}}{+\boldsymbol{1}}^{\top}_{L}i_{L}. \end{array} \right. $$
(62)
$$ \left\{ \begin{array}{l} v_{G}={\mathcal{V}}_{G}, \\ v_{S_{V}}={\mathcal{V}}_{S_{V}}, \\ v_{S_{F}}={\mathcal{V}}_{S_{F}}, \\ v_{L}={\mathcal{V}}_{L}, \\ v_{D}=D^{\top}_{G}{\mathcal{V}}_{G}+D^{\top}_{S_{V}}{\mathcal{V}}_{S_{V}}+D^{\top}_{S_{F}}{\mathcal{V}}_{S_{F}}{+D}^{\top}_{L}{\mathcal{V}}_{L}. \end{array} \right. $$
(63)
Therefore, the overall interconnection law is obtained as follows:
$$ w=\mathcal{T}y, $$
(64)
By defining \(w:= col\left (i_{G},i_{S_{F}},i_{S_{V}},i_{L},v_{D}\right)\) and \(y:= col\left (v_{G},v_{S_{F}},v_{S_{V}},v_{L},i_{D}\right)\), the overall interconnection matrix is obtained as follows:
$$ \mathcal{T}= \left[\begin{array}{ccccc} 0 & 0 & 0 & 0 & -\hat{\sigma}D_{G} \\ 0 & 0 & 0 & 0 & {-D}_{S_{V}} \\ 0 & 0 & 0 & 0 & -D_{S_{F}} \\ 0 & 0 & 0 & 0 & -D_{L} \\ \hat{\sigma}D^{\top}_{G} & D^{\top}_{S_{V}} & D^{\top}_{S_{F}} & D^{\top}_{L} & 0 \\ \end{array}\right] $$
(65)
Note that the overall interconnection law is power preserving. In fact
$$ w^{\top}y=y^{\top}{\mathcal{T}}^{\top}y=0, $$
(66)
Where the matrix \(\mathcal {T}\) is skew-symmetry. We also have:
$$ w_{T}={\mathcal{T}}_{T}y_{T}+\left[\begin{array}{c} 0 \\ 0 \\ 0 \\ \hat{\sigma}D^{\top}_{G} \end{array}\right] v_{G}={\mathcal{T}}_{T}y_{T}+{G_{T}}{\bar{y}_{G}}, $$
(67)
where the vG is the voltage of main-grid. Therefore the matrix \({\mathcal {T}}_{T}\) is defined as follows:
$$ {\mathcal{T}}_{T}= \left[\begin{array}{cccc} 0 & 0 & 0 & {-D}_{S_{V}} \\ 0 & 0 & 0 & -D_{S_{F}} \\ 0 & 0 & 0 & -D_{L} \\ D^{\top}_{S_{V}} & D^{\top}_{S_{F}} & D^{\top}_{L} & 0 \end{array}\right] $$
(68)
Remark 5
By adding the dynamic of main-grid in grid-connected mode (3) to overall port-Hamiltonian modeling (54) and using the interconnection law (68), we then have:
$$ \begin{aligned} 0&=w_{G}-\bar{w}_{G}, \\ {\dot{x}}_{T}&=\left[{\mathcal{J}}_{T_{u}}+{\mathcal{J}}_{T_{c}}-{\mathcal{R}}_{T}+{F_{T}}{{\mathcal{T}}_{T}}{F^{\top}_{T}}\right]{\nabla}{\mathcal{H}}_{T}\left(x_{T}\right) \\ &\quad+{G_{T}}{\bar{y}}_{G}+{F_{T_{0}}}{w_{T_{0}}},\\ y_{T_{A}}&=A^{\top}_{T}\left({\bar{x}}_{T}\right){\nabla}{\mathcal{H}}_{T}\left(x_{T}\right), \\ y_{T}&=F^{\top}_{T}{\nabla}{\mathcal{H}}_{T}\left(x_{T}\right), \\ y_{G}&=\bar{y}_{G}, \\ y_{T_{0}}&=F^{\top}_{T_{0}}{\nabla}{\mathcal{H}}_{T}\left(x_{T}\right). \\ \end{aligned} $$
(69)
Where the matrix \(F_{T}\mathcal {T}F^{\top }_{T}\) is skew-symmetry.
In addition, by using \(i_{G}={\nabla }{\mathcal {H}}_{T}\left (x_{D}\right)\), so we have:
$$ \begin{aligned} 0=w_{G}-\bar{w}_{G}&=-\hat{\sigma}D_{G}i_{D}+\bar{w}_{G} \\ &=-\hat{\sigma}D_{G}{\nabla}{\mathcal{H}}_{T}\left(x_{D}\right)+\bar{w}_{G}. \end{aligned} $$
(70)
Remark 6
The microgrid overall port-Hamiltonian system (69) satisfies the power balance equation:
$$ \begin{aligned} {\dot{{\mathcal{H}}}}_{T}&={\left[{\nabla}{\mathcal{H}}_{T}\left(x_{T}\right)\right]}^{\top}{\dot{x}}_{T} \\ &=-{\left[{\nabla}{\mathcal{H}}_{T}\left(x_{T}\right)\right]}^{\top}{\mathcal{R}}_{T} \left[{\nabla}{\mathcal{H}}_{T}\left(x_{T}\right)\right] \\ &+{\left[{\nabla}{\mathcal{H}}_{T}\left(x_{T}\right)\right]}^{\top}\left\{{G_{T}}{{\bar{y}}_{G}}+F_{T_{0}}w_{T_{0}}\right\}\\ &\le {\left[{\nabla}{\mathcal{H}}_{T}\left(x_{T}\right)\right]}^{\top}\left\{{G_{T}}{{\bar{y}}_{G}}\right\} +{\left[{\nabla}{\mathcal{H}}_{T}\left(x_{T}\right)\right]}^{\top}\left\{F_{T_{0}}w_{T_{0}}\right\} \\ &=w^{\top}_{G}{{\bar{y}}_{G}}+y^{\top}_{T_{0}}w_{T_{0}} \end{aligned} $$
(71)
Therefore, the overall port-Hamiltonian system verifies the dissipation inequality with Hamiltonian storage function \({\mathcal {H}}_{T}\). Where the term:
-
\({\dot {{\mathcal {H}}}}_{T}\) accounts for the stored power (difference between supplied and absorbed power) in micro-grid;
-
\({\left [{\nabla }{\mathcal {H}}_{T}\left (x_{T}\right)\right ]}^{\top }{\mathcal {R}}_{T}\left [{\nabla }{\mathcal {H}}_{T}\left (x_{T}\right)\right ]\) represents the dissipated power in micro-grid;
-
\(w^{\top }_{G}{{\bar {y}}_{G}}+y^{\top }_{T_{0}}w_{T_{0}}\) represents the supplied power in micro-grid.