## 4 Simulation
### Results  
The simulated CP alongside renewables profile and battery current of the multi-source MG can be observed in Figure 15. In this iteration the valley filling current is set to 0.1 pu while peak shaving is set to 0.5 pu. The negative values of purple line representing the current of the ESS signifies the charging whereas positive values are for discharging. It could be seen that the charging starts after mid night mostly from wind energy and stops around 7 a.m., while discharging start at 3 p.m. and ends at 7:30 p.m.  
Figure 16 discloses the evolution of the bus's voltage in time with a reference voltage of 60 V. Even though there are multiple sources participating in power production (Figure 17) at fluctuating rates, the voltage maintains its stability and does not deviate beyond tolerance. That being said, this structure of control is highly dependent on communications between the sources and the central command block which is a major drawback [36].  
Figure 16: MATLAB SIMULINK simulated output voltage of a multi-source MG.  
Figure 15: General diagram of the simulation.  
The voltage and SOC of the battery are shown in Figure 18, the curves are quite typical showing the expected increase and decrease in both voltage and SOC following charging and discharging. It is noteworthy that the initial SOC in quite close to its final value which could be taken as an indicator of good performance.  
Table 1 showcases the cost function correlation with the choice of VF&PS currents and the resulting local cost. The currents I \({}_{\text{VF}}\) and I \({}_{\text{PS}}\) are normalized to I \({}_{\text{max}}\) the maximum current of the bus, the local cost is normalized to cost of an absolute flat CP, similarly a value of 1 for J flat index represent a completely flat line. Although the total amount of energy stays practically the same (not considering losses in the ESS), the local cost index decreases as the curve approaches resembling a flat profile. The data collected is fed to a machine learning process in order to enhance system performance, as well as building a forecasting model to keep the end-user well informed about the consumption patterns expected. For the effective analysis of these latter different time scales must be adopted (Daily, weekly, monthly and seasonal).  
Another critical factor that must be taken into consideration is the rate of change of the CP. A fast change in load current puts strain on utility grid as production ramping takes place. An inertial response to abrupt or steep variation in load's current gives the utility grid enough time to respond properly and keep both quality and stability up to norms. In the case of the work conducted in this paper, an inertial factor denoted K is used to determine the supply of energy in proportion to variation. In Figure 19, At time t = 9:00 am, a surge of load current  
Figure 17: MATLAB SIMULINK simulation CP and sources contributions.  
Figure 18: MATLAB SIMULINK simulation voltage and SOC of a battery.  
is simulated and the counterreaction of the ESS is recorded. For K =1000 no reaction is observed from the ESS on the contrary for K = 2, the ESS largely mitigates the effect of the load surge.  
The proper management of inertial response is paramount, and unnecessary depletion or Repletion effect negatively the performance and operation of VF&PS. Supercapacitors can help immensely during inertial response due to their high discharge current burst capabilities. This in turn assures the longevity of the ESS.