## 1 Introduction
A PI-based current control loop has been used to enable rapid battery response to DC-link deviations. The BESS could also help balance harmonic power in multi-frequency systems by absorbing oscillatory components, acting as an active damping element against low-frequency voltage oscillations caused by 5 th or 7 th harmonic interactions [19]. The integration of PV-BESSs in a properly coordinated way improves microgrid reliability through peak shaving, load leveling, and frequency regulation. Including additional storage components such as supercapacitors and flywheels can enhance the dynamic response by handling fast transients. A holistic energy management strategy is required to dispatch multiple storage units effectively so that PV operates at maximum power, BESS maintains DC-link stability, and both respond to grid-side or EMS requirements [20; 21]. The grid-side bidirectional inverter controls the DC-link voltage and controls AC-side power quality. It operates in grid-following mode and uses a PI-controlled dq-frame or resonant controller to inject the required currents. Standard controllers regulate fundamental currents, but specialized harmonic compensators are needed to control significant harmonic components at frequencies like 5 th or 7 th. Therefore, the inverter can cancel distortion or precisely control harmonic power flow [9; 19]. The extraction and control of specific harmonic components requires multiple techniques. The proportional-resonant (PR) controllers operate in the stationary frame to extract specific harmonic frequencies such as 250 Hz (the 5 th harmonic) and 350 Hz (the 7 th harmonic). The PR controllers provide easier tuning procedures and successful harmonic targeting compared to multi-reference-frame transformations. The repetitive control (RC) method provides harmonic cancellation of integer harmonics across cycles, yet it experiences slow responses and stability problems. The standard implementation in practice involves using a PI controller for fundamental 50 Hz frequency control alongside PR controllers for specific harmonic frequencies [22; 23; 24]. The load side of the DC link consists of a load inverter that functions in grid-forming mode to regulate voltage and frequency for supplying local loads with a pure 50 Hz sinusoidal output. It provides voltage isolation from multi-frequency distortions during grid-connected operation and creates a stable AC subsystem and decouples the load-side from grid-side disturbances (e.g., unbalance, harmonics, voltage sags and swells, or over- and undervoltage). This setup is often called a back-to-back converter system or AC/AC isolation via DC link [9; 10]. The control of grid-forming inverters has been studied extensively because inverter-based resources need to regulate the grid voltage. A grid-forming inverter has an inner current loop and an outer voltage loop, which is often based on droop control or virtual synchronous machine (VSM) principles. For single-inverter systems, stable voltage reference and fast transient response are key, while droop control becomes more important when paralleling sources. Virtual impedance or damping further improves stability when supplying nonlinear or motor loads [10]. A key scenario occurs when the main grid connection is lost. The load-side grid-forming inverter must continue to supply the local loads using the PV and BESS through the DC link, effectively forming an islanded microgrid. This requires close coordination between the grid-forming inverter and the BESS. Recent studies have shown that a BESS inverter can switch from current-controlled to voltage-controlled mode during islanding, allowing a smooth transition without large transients. Also, PV-battery inverters with suitable control algorithms can maintain stable operation through such mode changes [12; 25]. The load-side grid-forming inverter needs to separate loads from upstream harmonic disturbances during typical operation. The system filters higher-frequency disturbances through voltage controllers that operate at a 50 Hz bandwidth.