## 2 System Layout
### Bi-Directional Current Flow  
Utilizing a synchronous boost converter, illustrated in Figure 5, allows for the control of the current in both direction, this is particularly necessary when working with electrical energy storage that requires bi-directional capabilities for charging and discharging. The gate signal on the high and low side are complimentary to one another, they can also be designed such that in boost mode, only the low side switch works and vice versa, in buck mode, only the high side switch is active [21]. It was shown that the reference current is the sum of the measured load current and the output of the voltage regulator (Equation (21)), when an arbitrary source participates in voltage regulation, a fraction of the current reference is passed to its controller. When the reference current has positive values the energy flows from the source to the load, hence the synchronous converter is in step-up or boost mode as shown in Figure 6. Conversely, when the reference value has negative values, in this case dictated by a batter charging manager block, the flow of energy reverses and the converter is set to step-down or buck mode illustrated in Figure 7. For applications like charging a battery, the battery side voltage must be precisely regulated. A charging battery can be modeled as a non-linear resistor, where its value depends on the integral of the current passing through it. \[R_{\text{bat}}=f(\int_{t_{0}}^{t}I_{\text{charging}}(\tau)d\tau) \tag{39}\]  
\[E_{\text{charging}}^{*}=R_{\text{bat}}I_{\text{charging}}^{*} \tag{40}\]  
Figure 4: Global control loop for single source model. Where Equation (36) is the voltage controller, Equation (24) the transfer function (\(I_{\text{s}}/I_{\text{s}}\)ref) and Equation (3) the transfer function (\(V_{\text{out}}\) /\(I_{\text{source}}\)). Figure 5: Synchronous bi-directional converter. Equation (39) does not serve as a predictive model for battery behavior; rather, it simulates the change in load during charging. By utilizing historical data, an electronic load can emulate a battery if it is computer-controlled. For instance, a programmable load can be employed to replicate the charging process of a battery. This approach is frequently used in testing and development to simulate various battery conditions and behaviors without the need for an actual battery [22]. Starting from Equation (17) through (23) and adding the relevant Equations (41) through (47) pertaining to the transition between the buck and boost mode denoted \"m\" where \(\delta_{\rm o}\) is the threshold duty cycle for buck-boost operation mode and lowercase letter m the mode of operation. \[{\rm E_{s}=\delta\cdot R_{load}I_{s-discharging}} \tag{41}\]  
\[{\rm V_{out}=(1-\delta)^{-2}\cdot R_{bal}I_{s-charging}} \tag{42}\]  
\[{\rm m=\frac{1}{2}sgn(\delta-\delta_{\rm o})+\frac{1}{2}} \tag{43}\]  
\[\delta_{\rm o}=1-\frac{{\rm E}}{{\rm V_{out}}} \tag{44}\]  
Figure 7.0  
Figure 7.1  
Figure 7.2  
The complete buck-boost version of Equation (17)  
Figure 7.3  
Figure 7.4 Synchronous converter in boost mode. Figure 7.5 Synchronous converter in buck mode. And the transfer function relating the reference current in the bi-directional flow of current  
Figure 7.6  
Continuing with the theme of this study, the hypothetical residential complex under analysis is modeled as parallel current-controlled sources (CCS) connected to a common bus according to the schematics in Figure 7.7 The primary sources involved in powering the load include solar panels, wind turbines, an electrical energy storage system (EESS or ESS), and a link converter (LCG) connected to the grid. These sources are the main producers of electrical energy. To enhance system reliability, backup sources such as ultra-capacitors, fuel cells, or diesel-powered generators may be included. The use of super-capacitors is particularly beneficial for stability, especially during transients, and can also provide short-term inertial response.