## 2 Modeling Grounding Electrodes with Internal Resistance: Backgrounds
Thus, it can be stated  
\[U_{k}=\sum\limits_{m=1}^{B}I_{m}\cdot Z_{km} \tag{8}\]  
where the impedance \(Z_{km}\) (sometimes called transverse impedance [19]) has the following expression for a multi-layered soil,  
\[Z_{km}=\frac{\rho_{m}}{\lambda\pi}\int\limits_{I_{m}}dl_{m}\left[\frac{1}{| \overrightarrow{j_{k}-j_{m}}|}\delta_{km}+\int\limits_{0}^{\infty}(f_{km}( \lambda)e^{-\lambda(z_{k}-z_{m})}+g_{km}(\lambda)e^{\lambda(z_{k}-z_{m})})J_{ 0}(\lambda\tau)d\lambda\right] \tag{9}\]  
The expressions (8) and (9) are completely equivalent to (5) with \(I_{m}=\mu_{m}\cdot\Delta I_{m}\). Moreover, \(\rho_{m}\) is the soil resistivity around the branch \(m\) and as it was already mentioned before, the functions \(f(\lambda)\) and \(g(\lambda)\) are calculated by imposing the boundary conditions at each interface [12]. From the expressions (8) and (9) it is shown that the absolute potential acquired by the branch \(k\) as a result of the current filtered to the ground, can be put in the matrix form \((U)_{B,1}=(Z_{T})_{B,B}(I)_{B,1}\), where the subscripts indicate the dimension of the matrices (\(B\) will denote the number of branches and \(N\) will denote the number of nodes) and the square matrix (\(Z_{T}\)) is the matrix of transverse impedances. For a proper application of circuit analysis, it is necessary to establish a relationship between leakage currents and potentials in the branches and nodes. In Figure 3, two types of currents are shown, the leakage current of the branch \(I_{i}\) and those that go from the nodes  
Figure 3: An outline of some of the magnitudes used on the \(k\) branch. of the branch \(J_{k+}\) y \(J_{k}\), both towards the surrounding medium. It will be agreed that both node and branch currents to the surrounding medium are related by the matrix equation  
\[(J)_{N,1}=(C)_{N,B}\cdot(I)_{B,1} \tag{10}\]  
where (\(C\)) is a matrix of \(N\) rows (nodes) and \(B\) columns (branches) whose elements are  
\[c_{ij}=\left\{ \begin{array}{ll}1/2\;\;\text{if the node i is connected to the branch j}\\ 0\;\;\text{otherwise}\end{array} \right. \tag{11}\]  
This means that each branch leakage current \(I_{i}\) is divided into two halves that go to the currents of nodes \(J_{i+}\) and \(J_{i-}\). With regard to the branch potential \(U_{i}\) and the potentials of the branch nodes \(V_{i}{}^{+}\) and \(V_{i}{}^{-}\),  
\[(U)_{B,1}=(K)_{B,N}\cdot(V)_{N,1} \tag{12}\]  
with (\(K\)) being a matrix of \(B\) rows (branches) and \(N\) columns (nodes), whose elements are  
\[k_{ij}=\left\{ \begin{array}{ll}1/2\;\;\text{if the branch i is connected to the node j}\\ 0\;\;\text{otherwise}\end{array} \right. \tag{13}\]  
which really means that the branch potential is the average value of the potentials of its nodes \(U_{i}=\frac{V_{k}+V_{k+1}}{2}\). With Equations (7), (8), (10) and (12) a system of matrix equations can be proposed,  
\[ \begin{array}{ll}(J)_{N,1}+(G)_{N,N}\cdot(V)_{N,1}=(F)_{N,1}\\ (U)_{B,1}=(Z)_{B,B}\cdot(I)_{B,1}\\ (J)_{N,1}=(C)_{N,B}\cdot(I)_{B,1}\\ (U)_{B,1}=(K)_{B,N}\cdot(V)_{N,1}\end{array}  \tag{14}\]  
Defining a vector of unknowns consisting of currents and potentials \(I_{n}\) y \(V_{n}\)  
\[(W)_{B+N,1}=\left( \begin{array}{ll}(I)_{B,1}\\ (V)_{N,1}\end{array} \right) \tag{15}\]  
the system of Equation (14) can be written as  
\[\left( \begin{array}{ll}(Z)_{B,B}&-(K)_{B,N}\\ (C)_{N,B}&(G)_{N,N}\end{array} \right)\cdot(W)_{N+B,1}=\left( \begin{array}{ll }(0)_{B,1}\\ (F)_{N,1}\end{array} \right) \tag{16}\]  
which allows us to find the solution of the problem in terms of potentials and currents. The electrode potential is the one corresponding to the node through which the current enters the electrode and the grounding resistance is the quotient between this potential and the injected current. Note that both depend on the parameters of the multilayer model chosen through \(\rho_{m}\) and the functions \(f(\lambda)\) and \(g(\lambda)\) in (9).