## 3 Generation of Equations
### Realizability Analysis
#### 3.2.1 A Criterion for Realizability  
In Section 3.1, the set of edges \(\mathsf{B}\) has been partitioned based on the differentiation between _internal edges_ (or component edges \(\{\mathsf{B}_{\mathsf{S}},\mathsf{B}_{D}\}\), grey) and _external edges_ (or ports edges \(\mathsf{B}_{P}\), white), in order to build the complete graph from the netlist. In this section, we are interested in the PHS Formulation (5) associated to a given complete graph. To that end, we leave out from here the differentiation between internal and external edges in order to focus on the differentiation between voltage-controlled and current-controlled edges.  
Suppose the control type of every edge is known, and the set of edges is split according to \(\mathsf{B}=\{\mathsf{B}_{1},\mathsf{B}_{2}\}\), with \(\mathsf{B}_{1}\) the set of \(n_{1}\)_voltage-controlled_ edges and \(\mathsf{B}_{2}\) the set of \(n_{2}\)_current-controlled_ edges (see Table 2). Correspondingly, the sets of power variables are split as \(\mathbf{v}=(\mathbf{v}_{1},\mathbf{v}_{2})^{\mathsf{T}}\) and \(\mathbf{i}=(\mathbf{i}_{1},\mathbf{i}_{2})^{\mathsf{T}}\), and we define \(\tilde{\mathbf{a}}=(\mathbf{v}_{1},\mathbf{i}_{2})^{\mathsf{T}}\) and \(\tilde{\mathbf{b}}=(\mathbf{i}_{1},\mathbf{v}_{2})^{\mathsf{T}}\). Since the reference potential \(e_{0}\) defined on node \(\mathsf{N}_{0}\) does not influence the voltages nor the currents, it is not considered in the sequel, and the incidence matrix splits as follows:  
\[\Gamma=\left(\begin{array}{c|c}\gamma_{0}\\ \hline\gamma_{1}&\gamma_{2}\end{array}\right),\quad\text{with }\gamma_{0}\in \mathbb{R}^{1\times n_{B}},\ \gamma_{1}\in\mathbb{R}^{n_{N}\times n_{1}},\ \gamma_{2}\in\mathbb{R}^{n_{N}\times n_{2}}.\]  
This leads to a rewrite of the Kirchhoff laws (8) as:  
\[(\gamma_{1},\gamma_{2})^{\mathsf{T}}\,\mathbf{e} = \mathbf{v}, \tag{9}\] \[(\gamma_{1},\gamma_{2})\ \mathbf{i} = 0. \tag{10}\]  
**Proposition 1** (**Realizability)**.: _If \(\gamma_{2}\) is invertible, then the port-Hamiltonian structure (5) provides a realization of the graph \(\mathsf{G}=\{\mathsf{N},(\mathsf{B}_{1},\mathsf{B}_{2})\}\)._  
Proof.: From the relation on the voltages in (9), we get \(\mathbf{v}_{1}=\gamma_{1}^{\mathsf{T}}\,\mathbf{e}\) and \(\mathbf{v}_{2}=\gamma_{2}^{\mathsf{T}}\,\mathbf{e}\). From the relation on the currents (10), we get \(\gamma_{2}\,\mathbf{i}_{2}=-\gamma_{1}\,\mathbf{i}_{1}\). Now, if \(\gamma_{2}\) is invertible, we denote \(\gamma=\gamma_{2}^{-1}\gamma_{1}\) and  
\[\underbrace{\left(\begin{array}{c}\mathbf{v}_{1}\\ \mathbf{i}_{2}\end{array}\right)}_{\tilde{\mathbf{a}}}=\underbrace{\left( \begin{array}{cc}0&\gamma^{\mathsf{T}}\\ -\gamma&0\end{array}\right)}_{\tilde{\mathbf{J}}}\underbrace{\left(\begin{array} []{c}\mathbf{i}_{1}\\ \mathbf{v}_{2}\end{array}\right)}_{\tilde{\mathbf{b}}}. \tag{11}\]  
The PHS (5) is obtained by rearranging the edges according to their role with respect to the power balance, according to the permutation of vector elements \(\Pi(\tilde{\mathbf{a}})=\big{(}\frac{\mathsf{a}\mathbf{x}}{\mathsf{d}t}, \mathbf{w},\mathbf{y}\big{)}^{\mathsf{T}}=\mathbf{a}\) (and correspondingly \(\Pi(\tilde{\mathbf{b}})=(\
abla\mathcal{H},\mathbf{z},\mathbf{u})^{\mathsf{T }}=\mathbf{b}\)), which is also applied on rows and columns of \(\tilde{\mathbf{J}}\) to yield \(\mathbf{a}=\mathbf{J}\,\mathbf{b}\).  
From the invertibility condition on \(\gamma_{2}\) in Proposition 1, we state the following remark, which is used in the sequel to derive the _realizability analysis algorithm_.  
**Remark 3** (**Necessary condition for realizability**).: _A necessary condition for the graph \(\mathsf{G}\) to be realizable as a PHS (5) is that it includes as many current-controlled edges as nodes \(n_{N}\), with \(\gamma_{2}\in\mathbb{R}^{n_{N}\times n_{N}}\)._