Electrical Grids Based on Power Routers: Definition, Architecture and Modeling

Recent studies have developed a power electronic device known as the power router, able to fully control the power flows over the connected power lines. The present paper aims to extend the application of power routers to an electrical grid and explore its characteristics and limitations. It defines the power router grid concept, including the conditions for interconnection and architecture; it proposes a mathematical modelling methodology, analyses its operational requirements, and explores the degree of flexibility the proposed grid architecture provides. Finally, two case studies are presented to show the application of the power router grid in a practical example.


I. INTRODUCTION
The integration of Distributed Energy Resources (DERs) is transforming the way the traditional electric power system has been operated for years. Nowadays, electrical power is not only generated in large and remote generation plants but also in locally, i.e. in consumption areas. As a result, the traditional passive distribution networks with unidirectional power flows are evolving into active systems with more complex architecture and operation that allows for bidirectional power flows, demand response and controllable microgrids [1], [2], [3]. This transition to a smart grid system requires new concepts in control, operation or market structures capable of using upcoming technologies that have been developed over the recent years [4].
One of the mentioned technologies that have been evolving due to the advances in power electronics is the power router (PR) concept, which is currently being defined as a disruptive solution that changes completely the way smart grids are operated [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18]. The PR concept was presented in 2010 in [5] The associate editor coordinating the review of this manuscript and approving it for publication was Alexander Micallef . as a power electronic device with multiple ports that is capable of routing the electrical power from one port (input) to an arbitrary port of the same router (output). Combined with the PR concept, new forms of thinking the energy management appeared, with power packets consisting of i) a header signal containing the address of the sender, the start signal and the destination address to the load; ii) the payload, an amount of power to deliver during a period of time and iii) a footer, which contains an end signal. This concept was initially developed for home applications [5] and extended to active distribution networks to optimally manage the power flows [6]. In [14] and [15], the power packet definitions have been further developed and two advanced algorithms are designed to improve the route of power packets to the destination loads, increasing the distribution system efficiency and network capacity. Then, the classical optimal power flow formulations for active distribution networks were extended, including PR devices in [16]. A power dispatching protocol for packetized-power network 1 has been presented in [17]. Related to these previous works, few patents have been granted, e.g. [19] and [20], proving the growing interest in this new concept.
Although having many similarities, i.e. a multi-port device interfacing other electrical elements either in DC or AC and different voltage levels, the name given to such devices mostly depends on the purpose of the research and the interfaced elements. For example, [21] defined it as a 'dynamic energy router' as it focuses on managing energy storage and interfacing the usage of different types of energy resources such as fuel cells and super-capacitors. More recently, [22] proposed a new electrical design to what authors named 'electric energy router', which could increase the amount of reactive power flow by up to 200% without increasing the power capacity of converters. Reference [23] analysed the power routing capabilities of interconnection of photovoltaic (PV), storage systems and AC loads, naming it simply 'DC microgrid'. Reference [24] describes an energy-sharing structure for microgrids using 'energy routers' and proposes a model of battery operation for improving prosumer's revenue in a peer-to-peer energy trading market. Due to the focus being on AC power flow routing, this paper adopts the early mentioned nomenclature of power router (PR). The interconnection of multiple PRs leads to the concept of a digital power grid defined in [7]. In [6], [8], [9], [10], and [11] the PR has been further explored, presenting new network architectures, namely 'controlled-delivery power grid' [8] and 'pulsed power network' [10], which are experimentally tested in [9] and [11]. Moreover, a single-phase 4-port PR is studied in [12], where the different control modes at each port are analysed and validated experimentally.
Until now, the PR device and its control modes have been defined [12], [13], [25], [26] and its use in power networks has been studied [8], [9], [10], [11], [14], [15], [16], [25], [26]. The analysed networks in the literature are simple and limited study cases where the control modes of the PR ports are straightforward to establish, i.e. only one power router interconnects different grid elements, and the interaction between PRs is not sufficiently described to establish a network architecture description with a high number of PRs. This paper's main contributions are as follows: 1) To expand the analysis of [6], [12], [27], [28], [29], and [30] on PR by proposing a network of interconnected PRs in which each network node is based on a PR. This network is called in this paper the Power Router Grid (PRG). 2) To define how PRs can be interconnected in such a network, under what conditions they must operate and how many degrees of freedom for controlling AC power flows in steady-state such a network has. 3) To create a mathematical model to describe the PRG with a high number of PRs, scalable to an arbitrary number of routers and present an algorithm methodology for solving the power flow computation. 4) Finally, to validate the proposed model and definitions aforementioned through simulations for two different case studies with 4 and 10 PRs.
The groundbreaking concept of PR is certainly introducing many research questions and challenges regarding protection, reliability, efficiency, and technical and economic feasibility, which should be investigated deeply [31], [32]. The same applies to the details of energy management systems and strategies of electrical energy transfer: both for continuous or discrete strategies [7], [8], [9], [10], [11]. However, in this paper, the before-named research questions are out of the scope, as its primary aim is the establish a common description and modelling of such grids, which will enable to address these questions in further research.
The paper is organised as follows: the context, state of the art and contributions are presented in section I. Then, the PR concept and its operational modes are explained in section II. Section III defines the PRG, and the control requirements, as well as the degrees of flexibility for determining the power flow routes, are studied. Subsequently, sections IV and V develop a method for determining the power flow route, where the test results are presented in section VI. Finally, the conclusions are summarised in section VI.

II. DEFINITION OF A POWER ROUTER
The concept of PR has been the subject of several studies in the literature. In [33], [34], and [35], PRs are utilised by coupling direct AC converters to three-winding transformers in order to reduce congestion and increase system reliability. Other PR concepts utilise several power converters, each of them connected to a different output port of the PR, sharing a common bus [12], [26], [27], [28]. A comparative evaluation of different topologies integrating classical AC substations and multi-port DC PRs can be found in [36]. Other PR definitions are presented in [11] and [37], where data routing strategies, typically used in telecommunications, are applied to power distribution systems and home applications. Despite the differences among all these concepts, the PR fundamental aspect remains represented as a power electronic device able to reinforce, support or improve the grid behaviour by providing the capacity to redirect the power flows as desired. Furthermore, a PR should be able to coordinate and individually control multiple bidirectional branch power flows, for both active and reactive power, at different voltage levels.
In this paper, the concept presented in [12], [27], and [28] is adopted, whose scheme is depicted in Fig. 1. It consists of coupling a set of Voltage Source Converters (VSC) to a common DC bus, in which each converter act as a power input/output port that can be connected to a power line, to a generator, to a load or to an external AC grid. This concept allows the possibility of controlling the active and reactive power flows from any port independently.
Any port can be treated as input or output accordingly and also have different electrical connections, i.e. Direct Current (DC), 1 phase Alternating Current (AC 1ph ) or 3 phase AC (AC 3ph ), enabling efficient integration of different grids at different voltage levels and DERs technologies while offering new possibilities for power management. For the purpose of the work presented here, all the PRs are considered to be AC 3ph operating in a traditional symmetrical three-phase system represented in a single-line diagram. Also, since the objective is to study the interface possibilities between such devices, the internal characteristics of the PR, such as AC filtering, DC bus management, internal losses etc., will not be considered as they were already discussed in [12].
To achieve these functionalities, there are different control modes in which the ports can operate, and some operational constraints must be considered. The control mode to which a port operates is closely related to the type of equipment it is connected to. Therefore, it will perform a specific role in the PR operation. Within this paper, three control modes are defined as necessary to establish a PRG: slack, voltage control and power control. Other operation modes were introduced in [12], for different DC bus regulation or the usage of droop control; these will not be detailed here as they are not relevant for the purpose of this work. Table 1 summarises the requirements and also the controlled and non-controlled variables for each operation mode. The description of each variable is the following: • P ac is the active power output at the AC side of the port • Q is the reactive power output at the AC side of the port • E dc is the DC voltage at the common bus • V ac is the AC voltage at the AC side of the port • f is the frequency of the grid at the AC side of the port Fig. 2 depicts an example of a three-port AC PR in which each operation mode is present. The details and implications of each operation mode will be discussed next.

1) SLACK MODE
Coupling various AC ports to a common DC bus requires one of the connected elements to operate as a slack. This external element is responsible for providing the electrical power necessary to ensure the net power balance within the PR, i.e. the input power through all ports must be equal to the output power. Considering the notation that was defined in Fig. 1 and that the PRs have no internal losses, the power balance of a single PR is defined in equation (1), where P ac is the power leaving the PR through the port p of a set of all n ports. Note that the sign of P ac is only a convention, so its value can also be negative, meaning that the power could also flow from the external element inside to the PR.
The mismatch between the power input and output leads to voltage variations at the DC bus, increasing its voltage in case the power input is higher than the output and decreasing its voltage otherwise. Even though the net power balance condition cannot be guaranteed during transients, the slack must ensure the condition is met during the steady-state operation. Doing so, the slack port prevents the DC bus voltage from reaching unacceptable voltage levels that would lead to a malfunction of the PR. The slack is fundamental for the operation of the PR and, therefore, the PRG. For every PR inside a PRG, at least one of their ports must be operating under slack mode. The PR port operating under slack mode is therefore responsible for controlling the common DC bus voltage (E dc ) by injecting or extracting power at the AC side. The DC bus regulation by the slack port is made using a classical PI controller operating in a closed loop and designed to reject power disturbances introduced by the other ports [12]. To ensure the power balance, the slack port must be connected to an element capable of providing this mismatched power. Once the net power balance is secured, the rest of the ports can be set to operate under two control modes: power and voltage.

2) VOLTAGE CONTROL MODE
A port operating under voltage control mode is responsible for controlling the AC voltage (V ac ) and frequency (f ) for connecting external elements. Since the PR creates the grid, i.e. the port sets the voltage and frequency, the external elements connected to ports under this control mode are usually passive elements (power lines, loads) or non-controllable generators (PV). Therefore the requirement for a port to be operated in voltage control mode, besides the presence of a slack element in the PR, is that the external element connected is not itself regulating the voltage and frequency, such as an external grid, microgrids or controllable generators. This requirement is particularly relevant when creating a PRG in which the PR ports are connected through the same external element (power line). In an AC power line in which each of its ends is connected to different ports of different PRs, only one of them can be responsible for regulating the voltage and frequency. It would otherwise be technically unfeasible, for example, to have each end of these lines operating at different frequencies. For this reason, only one of the ports connected to an AC power line can operate in voltage control mode, the  other port must be either operating in slack mode or power control mode.

3) POWER CONTROL MODE
For ports under power control mode, the goal is to control active and reactive power. As opposed to the voltage control mode, this mode requires that the external element connected to the port is capable of providing reference signals for both voltage and frequency. Two control loops are designed so that the PR is able to control the active and reactive power fully. In the case of power control mode, an outer loop is responsible for controlling the power setpoints based on measured non-controlled variables (V ac and f ). These variables are obtained through a phase-locked loop (PLL) using two first-order filters. The output of the outer loop is then sent to an inner current control loop that performs the port current regulation [12].

III. POWER ROUTER GRID
After defining the main concepts behind PR and its operation, this section investigates how these devices can be interconnected to create a PRG and how it can be defined and conceptualised. Furthermore, it will describe the implications of the operational requirements of the PRs in the design and configuration of a PRG.

A. PRG DEFINITION
Together with the PR, the concept of a PRG has also been under investigation for the past years [6], [7], [8], [9], [10], [11], [16]. With the ongoing improvement of power converters, the PRs usage can be split into two main categories: local aggregation and integration of devices; and broad integration of different grids. An example of the former category, [29], investigates the usage of PRs integrating different types of energy prosumers with a hierarchical control operation based on fuzzy logic. Reference [30] utilises PRs for enhancing the traditional PV-battery grid-connected structure. The PRG envisioned within this paper falls under the second category, which focuses on the operation of distribution grids in the presence of PRs. It includes power routers at different locations of a standard active distribution network based on AC lines. Fig. 3 depicts an example of the proposed PRG composed of four PRs. A fundamental characteristic to be noticed in this proposed configuration is that it requires every connection to be interfaced with a different port. This is because the number of ports also determines the operation flexibility, and having different lines or devices connected to the same port would lead to decreased operational flexibility. Moreover, having a line interfaced by more than one port or a port controlling more than one line would increase the complexity of the power flow analysis. These more sophisticated layouts are expected to be investigated in future work.
Another important aspect of Fig. 3 are the terminal ports. A terminal port is an interface between the PR and a local element or an aggregated equivalent representation of it, e.g. the connection to a local smart grid at the point of common coupling (PCC). Depending on the terminal element connected, the terminal port can operate under one of the three previously defined operation modes. For example, when a passive load is connected to a terminal port, it can provide a voltage reference operating under voltage control mode. This is also true for other configurations, such as DC loads connected to the DC bus of the PRG. When connected to a generation unit, it can control the amount of active and reactive power by operating under power control mode or even act as slack when connected to an external grid. In general, terminal ports are not a requirement for the operation of the PRG and are considered outside of the boundaries of the PRG. For this reason, they are treated solely as an injection or consumption of electrical power.

B. PORTS CONFIGURATIONS WITHIN A PRG
This section aims to establish rules to easily define the control mode configuration of the PR's ports within a PRG. This is made based on the elements of the proposed PRG layout of Fig. 3. Despite the number of possible configurations and cases, as a starting point for the PRG analysis within this paper, the following hypotheses are considered: H1: No port can be connected to more than one line, and every line is interfaced by two ports of different PRs. H2: At least one of the ports connected to a line must be a voltage control port. H3: The PRG has at least one terminal connected with an external grid or strong generator able to operate as a slack.
The first hypothesis is essential for the definition of PRG layout. Having all lines composed of two ports will increase the degree of flexibility of the PRG and simplify the analysis for port configurations. It also simplifies the power flow analysis by avoiding non-conventional layouts such as internal PR loops (a line connecting two different ports of the same PR) and ports interfacing many lines. In summary, the connection between two PRs must be interfaced with one line and two ports. This leads to the second hypothesis, which defines that at least one of these two ports must be operating under voltage control mode. This is necessary to ensure that no more than one element will be responsible for controlling the line voltage and frequency.
The final hypothesis is relevant to the overall operation of the PRG. The terminal element operating as a slack can be either an external grid or a strong generator with grid-forming capabilities that are able to maintain the power balance within the PRG. Remember that, as previously mentioned, all the terminal elements are seen by the PRG as an input or output of power and are not interfaced by lines.

C. MATHEMATICAL REPRESENTATION OF THE PRG LAYOUT
The PRG layout defines all the connection paths between all the network nodes. Knowing the network layout, the degree of flexibility and the number of ports operating under slack, power control, and voltage control modes can be derived. The PRG layout is defined by the combination of three matrices (L, T , E) of dimension N pr xN pr , in which N pr is defined as the number of PRs that compose the PRG. The L matrix represents the line connections between two different PRs i and j, and since no internal loops are allowed, the value of the diagonal elements of this matrix is always 0. The T matrix represents all the local terminal connections for each PR. Similar to E, all the non-diagonal values are zero; however, the values of the T matrix diagonal can be zero or any integer value depending on the number of terminal ports connected to the PR. Lastly, the E matrix represents all the connections with slack elements (external grids); thus, all non-diagonal values are set to zero. As explained before, E cannot be a zero matrix; that is, at least one slack element must be connected to the PRG. The following are examples of the layout matrices for the PRG scheme depicted in Fig. 3. Another important characteristic of the lines matrix L is that it is a symmetrical matrix. This means that for any PRs i and j if L ij = 1 then L ji = 1. Another important characteristic is that this is a matrix of binary values. Therefore, the lines matrix aims to map the presence of electric connections between PRs and not their directions. The number of lines N l can be directly derived from L using (3).
In a similar way, the number of external connections N ext and the number of terminal ports N tp can be respectively derived by E and T by using equations (4) and (5).
Finally, the total number of ports inside the PRG is the summation of all elements of the three layout matrices and is defined by equation (6).

D. TECHNICAL REQUIREMENTS FOR THE PRG CONFIGURATION
For the proper configuration of the PRG, a set of requirements must be considered complementing the hypothesis H1-H3 previously defined, which are the following: R1: each PR must have one port operating under slack mode. This slack mode port must be connected to an external grid or to a line part of the slack tree (see Section III-E). R2: Terminal ports can operate as power or voltage control depending on the type of equipment to which the port is connected. R3: each power control port requires to be connected to a node in which the voltage and frequency are already controlled. R4: on the opposite side, each voltage control port requires to be connected to a node in which the voltage and frequency are not being controlled. R5: the lines within the PRG that are not connected to the external grid must have one, and only one, of the two ends connected to a voltage control port. From the PRG scheme and the three matrices layout, we can derive the amount of each type of port based on the internal PR operation requirements discussed in section II and the hypothesis established for the PRG definition. To start, since each PR must have a port responsible for controlling the DC bus, the number of slack ports N slack is always equal to the number of PRs.
Also, from the hypothesis H2, it was already defined that each line must have one of its ends connected to a voltage control port. Therefore, the number of voltage control ports N vf equals the number of lines. Note that terminal ports operating under voltage control mode are not considered since they do not connect lines and.
After the definition of the required slack, terminal and voltage control ports, the rest of the ports are set to operate in power control mode. Therefore the number of power control ports, N pq , can be simply obtained from equation (9).
From equation (6), the number of ports can alternatively be described as (10).
By applying (8) and (10) in (9), the number of power control ports can also be defined as (11) Fig. 4 shows two examples of PRG schemes, while Table 2 provides the corresponding characterisation of the PRG VOLUME 11, 2023 according to what was defined in (3)- (9). Adding one additional PR to the left scheme makes it possible to create more line interconnections. A more interconnected PRG is also more flexible from an operation point of view, which has more power control ports capable of managing power flows as desired, thus increasing the degree of freedom. This can be seen by the number of controllable lines available, which are the lines where the power flow can be set.

E. SLACK TREE DEFINITION
In graph theory, a spanning tree represents a unique path of a connected graph without forming any cycles [38]. The connection path between the slack ports of the PRs up to the external grid is defined as the Slack Tree (ST). Therefore, the ST is a spanning tree of the connected graph connecting all the PRs that compose the PRG. This definition illustrates an important characteristic to notice in the schemes of Fig. 4, which is that not all the PRs inside the PRG must have a local terminal directly connected to the slack element; it can also be connected indirectly through the slack lines.
The total amount of ST possibilities k in a PRG is given by the combination of slack lines in the set of lines that connect the PRs. A graph analysis through the Matrix Tree Theorem (MTT) [39], [40] determines k in a connected graph. The Laplacian matrix λ can be easily derived by the lines matrix (L) by simply multiplying its values by −1 and adding the number of connections each PR have to its diagonal. Equation (12) shows an example of such a matrix for the PRG scheme shown in Fig. 3.
Then, a sub-matrix of λ is created by deleting one arbitrary row and column. Finally, k is computed as the determinant of this sub-matrix. Equation (13) shows the results of the number of slack trees possible by removing the first row and The value of k says a lot regarding not only the characteristics of the PRG scheme but also the system of equations that describe the power flow solution. When computing the value of k using the MTT, there are three possible scenarios: • k < 1: there are no spanning trees, so the system of equations is unfeasible.
• k = 1: there is only one possible spanning tree. In this case, the system of equations is determined, i.e. no line controllability.
• k > 1: there are many possible spanning trees. In this situation, the system of equations has many solutions.
The first case describes a scenario in which the ST cannot be formed; therefore, the conditions set in H1-H3 do not hold, making the PRG unfeasible. The second case relates to when only a single spanning tree is present, which happens only if no ports are operating under power control mode. The PRG in this scenario would have no degree of freedom and be similar to a standard grid. Instead, we propose to focus on the third scenario, when the primary benefits of the PRG can be shown. Notice that there are two decision levels the PRG operator has: first, it has to decide which lines inside the PRG will operate as slack (define the ST), and then how much active and reactive power the controllable lines will carry. Only after these two definitions are set can the power flow solution be found. The methodology to operate the PRG, as well as the equations that describe the power flow in a PRG, is described in the next section.

IV. POWER ROUTER GRID MODELLING
The main objective of the PRG is to control the power flows in specific lines as desired. However, as previously established, not all line power flows can be controlled simultaneously. The operator can only define the power flow routing through the power control ports. The power flows through lines that do not have an associated power control port are addressed indirectly through a power flow analysis.
As discussed in Section III-E, a PRG layout can have many slack tree configurations. For the purposes of this paper, only one slack tree configuration is considered. This means that the comparison of operation, losses, costs etc., for different slack trees, as well as the operation optimisation, are out of scope and will be discussed in future work. The scenario described here is of a PRG operation conditioned, for example, by bilateral contracts between consumers and generators in which the system operator must establish the operation. This means that the PRG would have lines in which external factors already establish the power flow before the real-time operation. So, is not only the slack tree configuration established but also the amount of power flowing through the power control ports.
Note that all the configuration requirements established in III-D must be satisfied, especially R1, which is directly related to the feasibility of the power flow analysis. At least one power flow through one port of each PR must be undefined, being the slack port. This guarantees the power balance in the PR, as the power flow solution will determine the undefined power flows.

A. POWER FLOW PROBLEM
In a traditional electric power system, the power flow analysis determines the complex voltages in all the buses in the network necessary for an equilibrium between generation and demand. Once the voltages are known, all the other secondary variables, such as currents, losses and power flows, can be computed. This is made using the classical non-linear power balance equations for active and reactive power, which have as input the power injections in each bus, and the variables are the complex voltages. In a PRG, however, the power flow of some lines can be controlled (power control ports) and some voltages (voltage control ports) based on the nature of the PRs. For this reason, the power flow problem becomes easier to solve, as the lines connecting PRs can be seen as entirely different grids. For the power flow problem to have a single and unique solution, the slack tree must be predefined together with the operation modes of each PR port.

1) VARIABLES
For a PRG, the system's variables are all the complex power flows, S ij , and its number is expressed in (14). These represent all power injections (active and reactive power) from generators or loads connected to the terminal ports and the power flowing in the lines.
If it is considered that all the terminals ports, represented by the diagonal of the T matrix, are connected to a load or generator with a fixed value and known profile, N var can be simplified to (15).

2) SYSTEM EQUATIONS
The number of power balance equations in a PRG equals the number of PRs as determined by (16). Each PR will have a power balance for active power, forming a set of linear time-invariant equations. Moreover, due to the symmetrical characteristic of the L matrix, the equations that describe the power flow of the element L i,j are correspondent to the element L j,i . Therefore, there can be a number of non-linear dependent equations in the power flow problem.

3) DEGREE OF FREEDOM
The degree of freedom (DoF) of the PRG will be mainly determined by the number of ports operating under the power control mode since ports operating in slack and voltage control mode are unable to control the power flow. However, as described in II, not all ports can be configured to operate in this mode, considering that the PR requires some specific setup. The system's DoF can be derived by the difference between the total amount of variables and the dependent equations that were previously described in (15) and (16) VOLUME 11,2023 respectively, and it is defined in (17).
If we apply the definitions already established in (11) and (7) in the equation (17), the DoF of the PRG can be simplified to equation (18). (18) This confirms that, as mentioned in Section III, the number of ports operating under power control mode will determine the amount of controllable power flows inside the PRG and, therefore, the overall degree of flexibility. That is if there is only one port operating in power control mode (such as the scheme defined in Fig. 3), the DoF is two: the control of active and reactive power in that line.

B. POWER FLOW EQUATIONS
Two sets of equations are used to solve the power flow problem within a PRG: One is the power balance equations for each power router, similar to that was already defined in (1). Assuming that the nominal power of the elements connected to the terminal ports is known, as well as the power setpoint of the power control ports, the power of the slack port can be defined. The second set of equations is the well-known power flow equations that are applied to the PRG to find the voltage magnitudes and angles of the lines.
Within this paper, the line modelling will follow the one presented in Fig. 6 for all the lines connecting power routers. The traditional line shunt capacitance is neglected since it is assumed that the power router operates in the distribution grid in which lines have a short length (≤80 km). Therefore, the admittance of a line that connects two power routers i and j is defined as Y ij = G ij + iB ij . Also, since each power router can have different ports with different voltages, the notation V i,p is used to represent the voltage at the port p of the PR i. Finally, since there is no shunt element, the current I i,p that leaves the port p of the PR i is equal to the current flowing in the line, and that enters the port q of PR j, so that I i,p = I ij = −I j,q . Notice that the convention adopted in equation (1) is maintained, meaning that the complex power S i,p that flows from power router PR i through port p is positive when leaving the port and negative otherwise. P loss,i is the internal losses of the PR i; P i,p represents the power that leaves the PR i through the port p. The presence or absence of a line or terminal is determined by whether or not there is a port connection which is derived by the layout matrices (L, T , E). Based on these notations, the set of equations related to the power balance inside each PR can be defined as the summation of all the ports p multiplied by the active power flow as described in (19). Since every PR has a common DC bus, there is no PR balance equation for reactive power. Instead, each voltage control port can provide the reactive power required by the line they are connected to, independently of the other ports. N p p=1 P i,p = P loss,i ∀i in N pr (19) If the technical requirements of the PRG previously defined in III-D are met, there will always be at least one PR in which only one line will be uncontrolled (which is part of the slack tree). This is true under the assumption that all the controllable lines must have their power flow fixed and the local terminal ports connected to a load or generator of a known profile. In the way the PRG is here defined, these PRs will always be the ones located at the last vertices of the slack tree, that is, have only a single connection to it.
After all the power flows of all ports in a power router are computed, the traditional power flow equations can be used to compute the voltages and angles. Equations (20) and (21) define the active and reactive power flows between two power routers i and j, respectively. where, • P i,p is the active power flowing from PR i through port p • Q i,p is the reactive power flowing from PR i through port p • V i,p is the voltage magnitude at the port p of PR i • V j,q is the voltage magnitude at the port q of PR j • G ij is the conductance of the line connecting PR i to PR j • B ij is the susceptance of the line connecting PR i to PR j • ϕ i,p is the angle of the complex voltage V i,p • ϕ j,q is the angle of the complex voltage V j,q If we consider that the rules previously defined in section III-D are met, for controllable lines, the power flow equations become a set of two non-linear equations and two unknown variables, and therefore it has a unique solution. That is because, as specified in R5, at least one of ports p or q must be operating in voltage control mode and therefore, either V i,p and ϕ i,p or V j,q and ϕ j,q are known variables that can be set. Also, P i,p can be computed with equation (19) or set by the power control port together with Q i,p . This leaves the system with only two unknowns which are the voltage magnitude and phase angle of the port that is not operated under voltage control mode. Once the power flow equations are solved and the complex voltage is computed, the same equations can be used to compute the active and reactive powers of PR j that flow through port q at the other end of the line since now both complex voltages are known. The results can then be applied to compute the variables of other lines until all the voltages and power flows of the PRG are computed.
An algorithm made in Python language using symbolic mathematics was developed to solve power flow equations for any PRG, granted the layout matrices and line characteristics are known. The main idea behind this computation is presented in Algorithm 1 below. The algorithm's goal is to keep scanning the PRG to find lines in which equations (20) and (21) can be applied and solved. Then, equation (19) is applied to find new variables as the algorithm repeats these operations until all unknown variables are computed (active and reactive power flows as well as the complex voltages of slack and power control ports). The algorithm takes less than two seconds to run for the layouts presented here; future work can be done to evaluate its applicability and efficiency when applied to larger PRGs.

V. CASE STUDIES AND RESULTS
In order to investigate the feasibility of the PRG layout as well as the mathematical modelling proposed here, two case studies were developed. The 4-PR layout proposed in Fig. 3 was chosen as the PRG for the first case study and a more complex structure of 9 PR is presented in the second. For the sake of simplicity, the following assumptions were made for both cases: • Computations were made using the real voltage, but the results are shown in p.u. for a base voltage of 100 kV.
• All the voltage control ports are set to operate at 1 p.u. and 0 phase degrees.
• All the power routers were assumed to be ideal, i.e., no internal losses were considered (in Eq. (19) P loss,i = 0).
• The loads connected to terminal ports have all a power factor of 1. All reactive power flow is used to compensate for the reactances of lines. For the goal of the proposed case studies, which is to demonstrate the feasibility of the concepts defined here, these assumptions do not impact the final result. For example, the internal losses of the PR can be incorporated into the power demand connected to its terminal ports, as it would not change the overall operation of the PRG. Adding a constant power to the right side of Eq. (19) would not change the modelling or the other power flow equations already defined. Similarly to the power factor, the line characteristics were chosen the same in order to focus on the power routing aspect of the PRG, which becomes more evident in this scenario.
With the assumptions established, the power flow equations and algorithm proposed in IV-B were applied. It took the algorithm four steps (iterations) to find all the PRG variables and 0.6637 s to run the first case study and five steps and 0.8592 s for the second; both running in a PC with processor i7-1165G7 at 2.80 GHz and 16 GB of RAM using Python 3.9. The first and final steps are depicted in Fig. 7 whereas, for the second case study, only the final steps of two different scenarios are shown in Fig.8. The circles are the ports with an assigned identification number and colour referring to each operation mode. The red lines represent the slack tree, whereas the green line represents the controllable line, with a defined active power setpoint. This value was set arbitrarily to exemplify a possible operation decision. Note also the sign of the power; positive means leaving the PR, while negative means a power flow entering the PR.
For the first case study, on the right side of Fig. 7, we have the final step of the algorithm, with all power flows computations shown in red and the input powers in black. It can be seen that due to the operator setpoint of the line L 2,3 , most of the power is flowing through the upper part of the PRG (L 1,2 ). Also, since it was assumed that the PRs have no internal losses, the PRG losses due to the lines can be easily computed as 0.22 MW (around 1%) and 0.284 Mvar. The complete summary of each step of the algorithm and each variable found is described in Tables 3-6. We can see that in every iteration of the algorithm, a different voltage is computed starting with the power control port (V 3,2 ). This is then used to compute the power flows in the other side of the line (P 2,2 ), and finally the power balance equation is used for PR 2 and PR 3 to compute P 2,1 and P 3,1 . This process repeats until all variables are found. Another characteristic is that since the power setpoint is chosen as P 3,2 is -5 MW; all the line power flows from the voltage control ports to the slack or power control port. This is also demonstrated by the complex VOLUME 11, 2023     voltages found, which are always lower than the 1 p.u. and consequently, the power flows are determined.
For the second case study a bigger and more complex layout was chosen. The goal of this case study is to demonstrate the possibilities of the PRG in terms of managing power flows. The layout presented in Fig. 8 resembles a traditional distribution grid composed of three feeders, which are here modelled as the slack line (in red), and four controllable lines (in green) interconnecting these feeders. The purple values represent the solved variables and the black values are the input variables. Fig. 8 (a) shows the standard scenario, in which there is no power flow in the controllable lines, and thus the power flows only on the slack lines. By using the controllable lines, however, the operator could distribute the power generated in the terminal port of PR 6 in an easier way, which is shown in Fig. 8 (b). This results in having lines with overall less load and if necessary it can even invert the power flow direction, as seen in L 4,5 . Tables 7 and 8 describe the   Fig. 8 (a).  Fig. 8 (b).
results for the magnitudes of the voltages in p.u. and angles in radians. Since the voltage magnitude for voltage control ports are set or also externally controlled in terminal ports, only slack and power control ports are shown.

VI. CONCLUSION
In this paper, the novel concept of the Power Router Grid (PRG) has been presented. This paper has proposed a set of hypotheses that results in operation, configurations, and restrictions for the PRG, which consists of a grid whose nodes are integrated by Power Routers. Moreover, a mathematical representation has been presented in which the PRG layout can be described. From this representation, the equations that establish the number of ports, configuration, and operation mode have been defined. This paper also has introduced the concept of slack tree applied to the PRG, a necessary condition for the operation of the grid. Furthermore, an electrical grid model was defined in which the traditional concepts of power flow analysis have been adapted to the PRG, resulting in a set of power flow equations. These equations have been integrated into a Python algorithm, showcasing several examples of such grids. The results show the proposed methodology of power flow analysis is generally applicable in PRGs. The results show that the PRG definition is coherent with the model proposed, validated through power flow analysis.
Finally, it is essential to note that studies regarding the technical and economic efficiency or reliability of such a grid are out of the scope of this paper and are further research. Future work will benefit from the proposed operation conditions and mathematical modelling presented in this paper.   Fellow). Since 2010, she has been with CITCEA-UPC. Her main research interests include data science applications to power systems, HVDC and HVAC transmission, active distribution grids, microgrids, renewable power generation, and its grid integration. VOLUME 11, 2023