Distributed renewable generation has changed the operating problem of distribution networks. Photovoltaic (PV) and other inverter-based sources reduce fuel dependence and shorten the path between generation and load, but they also reduce the rotating inertia and controllable reserve available to a local network. A microgrid can coordinate distributed generators, storage, and loads as a single entity, yet coordination becomes difficult after a disturbance. Frequency and voltage at the point of common coupling (PCC) must be returned to steady state before protection operates, while the diesel generator, PV unit, and battery converter have different response times and limits.
The configuration considered here is compact: a diesel synchronous generator, a PV system, and a battery energy storage system (BESS) connected to the PCC through a voltage-source converter (VSC). The diesel unit supplies dispatchable power and rotating inertia; the PV unit supplies renewable energy without mechanical inertia; the BESS supplies bidirectional active and reactive power. A proportional–integral (PI) controller acts on the BESS converter. Differential evolution (DE) selects controller gains offline, and a neural network maps operating conditions to gains online. The separation is the architectural idea: optimization handles nonlinear tuning, learning handles real-time gain selection, and the converter handles fast actuation.
Microgrid Architecture and the PCC Control Problem
At the PCC, frequency is a system-wide indicator of active-power balance, while voltage is local and depends on reactive-power flow and network impedance. A disturbance creates deviations in both. The BESS can inject or absorb active power to oppose frequency excursions and inject or absorb reactive power to support voltage. The diesel governor responds more slowly, and the PV unit in this model is not treated as a controllable reserve. The BESS therefore supplies the transient component that the slower sources cannot provide.
Because a microgrid can operate grid-connected or islanded, the reference conditions differ. In grid-connected mode, the utility grid can define voltage and frequency, and the microgrid may appear as a controllable load or generator. In islanded mode, the microgrid must establish its own PCC reference. The restoration problem is most demanding in the latter case, but the controller structure is relevant whenever the local BESS must correct PCC deviations. The energy battery storage system is not a passive reserve in this architecture; it is the controlled actuator for both frequency and voltage restoration.

Battery Energy Storage and Converter Actuation
The VSC is the interface between the BESS and the PCC. The PI output does not directly command watts and vars; it sets the modulation index \(m\) and phase angle \(\psi\) of the converter. These quantities shape the converter voltage relative to the PCC, and the resulting power flow determines the active power \(P\) and reactive power \(Q\) exchanged by the battery. Active-power injection or absorption adds damping to the electromechanical oscillations and drives frequency back toward its reference. Reactive-power injection or absorption changes the voltage profile and drives the PCC voltage back toward its reference.
This division of labor matters. The diesel generator provides sustained energy and inertia, while the BESS provides fast bidirectional correction. The battery converter can reverse power flow and change its output far more quickly than a diesel governor can change mechanical input. The BESS therefore improves dynamic damping and voltage support without replacing the energy supply from the diesel and PV units. Its effectiveness depends on the converter control law and on the gains selected for the prevailing disturbance level.
PI Control and the Optimization Objective
Let \(e(t)=\omega_0-\omega(t)\) be the frequency error, where \(\omega_0\) is the reference frequency and \(\omega\) is the system frequency. The PI control law is
$$u(t)=K_p e(t)+K_i\int_0^t e(\tau)\,d\tau$$
where \(u(t)\) is the controller output that is translated into the VSC modulation index and phase angle. The gains are tuned by minimizing the integral squared frequency error over the disturbance interval:
$$\min_{K_p,K_i} J=\int_0^t(\omega_0-\omega)^2\,d\tau$$
The search is bounded to
$$50\le K_p\le 300,\qquad 50\le K_i\le 300$$
The objective is intentionally frequency-centric. It measures how quickly and smoothly frequency returns to its reference, not how well voltage is regulated. Voltage restoration is achieved through the reactive-power channel and is assessed in the time-domain simulations. A controller that minimizes \(J\) can still produce unacceptable voltage if the reactive-power loop is poorly coordinated, so both frequency and PCC voltage must be checked. This distinction is important when interpreting the optimization results: a low frequency-error objective is necessary but not sufficient for complete PCC restoration.
Differential Evolution Tuning
DE is a population-based global optimizer. Each individual is a floating-point vector of gain values. Mutation forms a difference vector from two population members and adds it to a third; crossover mixes the mutant with the target; selection keeps the better of the target and trial according to the objective. The algorithm does not require gradient information, which makes it suitable for a microgrid model represented by nonlinear differential equations.
In this design, DE is run offline for each operating condition. For a given disturbance level, the optimizer searches the bounded gain space and returns a pair \((K_p,K_i)\) that reduces the frequency error. The optimized pairs and their corresponding disturbance levels form the training set. DE is not executed in real time; its role is to generate high-quality targets for the learning stage. This matters for implementation because repeated population-based optimization would be difficult to embed directly in a fast converter control loop.
Neural Network for Online Gain Adaptation
The neural network is trained on the DE-generated input–output patterns. The disturbance level is supplied as the input, and the optimized \(K_p\) and \(K_i\) values are the targets. During training, the network output is compared with the target, and the error signal is fed back to adjust the weight matrices. Once trained, the network can produce gains for a new disturbance within the sampled range without rerunning DE.
The reported training performance reached a mean-squared error of 0.07649 at the third epoch. A low error at an early epoch indicates that the sampled mapping was fitted quickly, but it does not by itself prove generalization beyond the sampled envelope. The network inherits the accuracy and limitations of the DE training set. Its practical value is that it replaces an expensive offline search with a fast online approximation for conditions represented in training.
Simulation Evidence and Operating Range
Two tests summarize the evidence. First, a 0.1 p.u. disturbance was applied with and without the PI controller. Without control, frequency and PCC voltage were highly oscillatory and the system approached severe instability. With the PI controller, both returned to their normal ranges in a short time. Second, after training, a randomly selected disturbance of 0.4246 p.u. inside the 0.1–0.9 p.u. envelope was applied. The trained network produced \(K_p=154.3038\) and \(K_i=143.6580\), and the PI-controlled system restored frequency and voltage without violating the specified constraints.
| Item | Setting or result |
|---|---|
| Controlled variables | PCC frequency and voltage |
| Actuator | BESS through a VSC, exchanging active and reactive power |
| Controller | PI with gains \(K_p\) and \(K_i\) |
| Gain bounds | \(50\le K_p\le 300\); \(50\le K_i\le 300\) |
| Optimization objective | Minimize integral squared frequency error |
| Disturbance set | 0.1–0.9 p.u., 0.008 increments, 100 training conditions |
| Neural-network training error | MSE 0.07649 at the third epoch |
| Validation disturbance | 0.4246 p.u. |
| Gains from trained network | \(K_p=154.3038\); \(K_i=143.6580\) |
The 0.1 p.u. comparison isolates the effect of the PI loop: the uncontrolled response is oscillatory, while the controlled response is damped and restored. The 0.4246 p.u. test exercises the online path: the neural network selects gains, and the converter applies them without a new DE run. Together, the two tests support the claim that the learned mapping can replace repeated optimization for disturbances inside the training envelope.
Interpretation, Limits, and Design Implications
The results support three conclusions. First, BESS converter control can provide effective post-disturbance restoration in the modeled PV–diesel microgrid. Second, DE is a practical offline method for generating gain targets for a nonlinear model. Third, a trained neural network can approximate the gain-selection map quickly enough to support online adaptation within the sampled range. The combination is hierarchical: DE handles slow, computationally expensive tuning; the neural network handles fast gain selection; and the PI loop handles converter-level actuation.
Several boundaries qualify the result. The evidence is simulation-based; hardware-in-the-loop and field validation are outside the evidence set. The tested configuration contains one diesel generator, one PV unit, and one BESS, so interactions among multiple converters, communication delays, and protection coordination are not represented. The gain search is bounded to 50–300, and the disturbance envelope is 0.1–0.9 p.u.; behavior outside these limits is not established. The objective penalizes frequency error only, so voltage restoration is an observed outcome rather than an optimized quantity. Finally, robustness here means recovery for the tested disturbances, not guaranteed stability for every possible disturbance, fault, or topology change. Extending the method to wind turbines, fuel cells, short-circuit faults, and PV uncertainty would require retraining and revalidation.
Conclusion
The control architecture combines offline DE optimization, neural-network gain selection, and PI converter control. In the modeled microgrid, this chain restored frequency and voltage after a 0.1 p.u. disturbance and after a 0.4246 p.u. test disturbance, with the trained network producing \(K_p=154.3038\) and \(K_i=143.6580\). The design’s value lies in separating computationally expensive tuning from fast online action. Its validity is bounded by the modeled configuration, the 50–300 gain range, and the 0.1–0.9 p.u. training envelope. Within those bounds, battery energy storage acts as the fast actuator that makes the restoration strategy feasible.
