Understudy microgrid
The primary components of the proposed HMG system in this work are PV, WT, and battery energy storage (PV/WT/BES) according to Fig. 1. The batteries are depleted to fulfill the load with high reliability in the case of a system power outage. Batteries are used to store solar power surplus above load demands. After accepting DC power, the inverter is also responsible to supply the AC power to the AC demand. This technology is intended to first supply the HMG load and then introduce extra power into the network to enhance the network’s operation.

Schematic of the PV/WT/BES microgrid system.
PV model
The following is a thorough model to calculate the PV array power considering the irradiance irradiated to the array’s surface, the radiation’s horizontal element, the surrounding temperature, and a few key technical features32:
$$P_{PV} \left( {S_{p} ,T_{c} } \right) = N_{pv} \times P_{r,pv} \times \frac{{S_{p} }}{{S_{STC} }} \times Et_{IE} \left( {S,T} \right)$$
(1)
$$S_{p} = \frac{S}{{{\text{sinh}}}} \times {\text{sin}}\left( {h + \beta } \right)$$
(2)
$$Et_{IE} \left( {S,T} \right) = 1 + k_{1} logS + k_{2} \left( {logS} \right)^{2} + T\left( {k_{3} + k_{4} logS + k_{5} \left( {logS} \right)^{2} } \right) + k_{6} T$$
(3)
$$T = T_{a} + \frac{{\left[ {\left( {NOCT – 20^{^\circ c} } \right).S_{p} } \right]}}{800} – T_{STC}$$
(4)
where \({P}_{r,pv}\) is rated PV power, \({Et}_{IE}\) is PV MPPT efficiency, \(\beta\) is the PV surface angle versus the surface of horizontal, \({S}_{p}\) is the part of the solar radiation strength that is effectively radiated vertically on a plane that is inclined, \(S\) displays the proportion of the radiation′s intensity to \({S}_{p}\) and nominal conditions (\({S}_{STC}\) = 1000 W/m2)32, \({S}_{t}\) corresponds to the irradiation that the array’s sloped surface emits, \(h\) represents the irradiance head’s angle, \({T}_{a}\) denotes the ambient temperature, \(NOCT\) refers to the operation temperature normally (°C). \({k}_{1}-{k}_{6}\) are coefficient of \({Et}_{IE}\left(S,T\right)\) this is acquired by using actual data taken from one or more places to stabilize the model.
Wind turbine model
The wind speed-based WT generating power model is a multi-parameter, nonlinear model. A combination of cut-in, cut-out, and nominal wind speed, the power generated by WT (\({P}_{WT}\)) is calculated by Szostok and Stanek3, Javad Aliabadi et al.13 and Moghaddam et al.21
$$P_{WT} = \left\{ {\begin{array}{*{20}l} {P_{rtd,WT} \times \left. {\left( {{ }\frac{{V^{2} – V_{ci}^{2} }}{{V_{rtd}^{2} – V_{ci}^{2} }}} \right.} \right);} \hfill & {V_{ci} \le V \le V_{rtd} } \hfill \\ {P_{rtd,WT} ;} \hfill & {V_{rtd} \le V \le V_{co} } \hfill \\ 0 \hfill & {Otherwise} \hfill \\ \end{array} } \right.$$
(5)
where \({P}_{rtd,wt}\) is the PV nominal power, V is the wind speed, \({V}_{ci}\), \({V}_{rtd}\) and \({V}_{co}\) stand for cut-in, rated, and cut-out wind speeds (m/s). The wind data is recorded at a 40-m wind tower height, with an installation height of 15 m. The definition of wind speed under these circumstances is as follows Szostok and Stanek3, Javad Aliabadi et al.13 and Moghaddam et al.21:
$$V_{H} = V_{Href} \times \left. {\left( {{ }\frac{{\text{H}}}{{H_{ref} }}} \right.} \right)^{\alpha }$$
(6)
where \({V}_{H}\) represents wind speed at height H, \({V}_{Href}\) represents wind speed at height \({H}_{ref}\), and α represents the surface’s smoothness value, which ranges from 0.14 to 0.253,13,21.
Battery model
To maintain continuous load demand and offset PV power variations, battery storage has been employed. When there is excess power, the battery is charged with 40% of the power, with the remaining 40% being sent to the network. By draining the batteries, the load supply is kept at the appropriate level during a system power outage11,14,15,18:
Charging mode
When the electricity required for the load exceeds the PV production power \((P_{PV} \left( t \right) \times \eta_{DC/DC} > P_{LD} \left( t \right)/\eta_{Inv} )\; and\; E_{Batt} \left( {t – 1} \right) < E_{Batt}^{max}\), 40% of the extra power is fed into the batteries, which are charged to providing the full load. 60% of the surplus power is still delivered to the distribution system. The battery bank energy at t is defined by
$${ }E_{Batt} \left( t \right) = E_{Batt} \left( {t – 1} \right) \times \left( {1 – \sigma } \right) + \left[ {(P_{PV} \left( t \right) \times \eta_{DC/DC} ) – \frac{{(P_{LD} \left( t \right))}}{{\eta_{Inv} }}} \right] \times \eta_{ch} \times \Delta t$$
(7)
where σ represents the rate of self-discharge, \({P}_{LD}
(8)
where \({\eta }_{disch}\) denotes discharging efficiency of the battery.
No charging and discharging mode
The demand is entirely provided and the saved energy remains constant when the PV output power and the demand are equal \((P_{PV} \left( t \right) \times \eta_{DC/DC} = P_{LD} \left( t \right)/\eta_{Inv} )\). The battery energy at t is modeled by
$${ }E_{Batt} \left( t \right) = E_{Batt} \left( {t – 1} \right)$$
(9)
Objective function
The optimization of a PV/WT/BES microgrid system is implemented for energy losses, voltage deviations, and HMG power cos minimization.
Minimization of the energy losses
The first aim in optimization of the PV/WT/BES microgrid system in the network is presented the energy losses cost (\({C}_{loss}\)) minimization which can be calculated by Hassan et al.12, Wong et al.14 and Saini, and Gidwani19
$$OF_{1} = \min (C_{loss} ) = \mathop \sum \limits_{{{\text{h}} = 1}}^{{\text{T}}} \mathop \sum \limits_{{{\text{l}} = 1}}^{{N_{l} }} {\text{P}}_{{{\text{loss}}}}^{{{\text{l}},{\text{h}}}} \times {\text{C}}_{{{\text{elect}}}}^{{\text{h}}}$$
(10)
where \({C}_{loss}\), \({\text{P}}_{\text{loss}}^{\text{l},\text{h}}\) and \({\text{C}}_{\text{elect}}^{\text{h}}\) denote the costs of losses, line l losses in hour h, and cost of electricity in hour h, respectively.
Minimization of the voltage deviations
The second aim in the PV/WT/BES microgrid system optimization in the network is voltage deviations (\(\text{VSD}\)) minimization33 in the network buses which can be computed by
$$OF_{2} = \min ({\text{VSD}}) = \sqrt {\frac{1}{{N_{bus} }} \times \mathop \sum \limits_{i = 1}^{{N_{bus} }} \left( {v_{i} – v_{p} } \right)^{2} }$$
(11)
$$v_{p} = \frac{{\mathop \sum \nolimits_{i = 1}^{{N_{bus} }} v_{i} }}{{N_{bus} }}$$
(12)
where \(\text{VSD}\) is the network voltage profile, vi is voltage of ith bus, vp is the buses mean voltage, and Nbus indicate bus numbers.
Minimization of the HMG cost
The third aim in the PV/WT/BES microgrid system optimization in the network is minimizing the of total purchased power cost from the HMG (\({C}_{HMG}\)) for the network which is calculated by
$$OF_{3} = \min (C_{HMG} ) = \mathop \sum \limits_{h = 1}^{{\text{T}}} P_{Extra}^{h} \times C_{Extra}^{h} )$$
(13)
where \({P}_{Extra}^{h}\) is injected extra power to the network, and \({C}_{Extra}^{h}\) is cost of per kW for purchasing the extra power for the network.
Multi-objective function
The problem of multi-objective optimization is formulated as follows in Lotfipour and Afrakhte34 and Nowdeh et al.35: It has many conflicting objective functions as well as equality and inequality constraints that must be simultaneously optimized.
$$Min{ }F\left( x \right) = \left[ {f_{1} \left( x \right){ }f_{2} \left( x \right){ } \ldots { }f_{n} \left( x \right)} \right]^{T}$$
(14)
$$Subject\;\;{ }to:{ }\left\{ {\begin{array}{*{20}c} {g_{i} \left( x \right) < 0 i = 1,2, \ldots ,N_{ueq} } \\ {h_{i} \left( x \right) = 0 i = 1,2, \ldots ,N_{eq} } \\ \end{array} } \right.$$
(15)
where the number of objective functions is denoted by n, \(F\left(x\right)\) is the vector of objective functions, and \({g}_{i}\left(x\right)\) and \({h}_{i}\left(x\right)\) are the constraints on inequality and equality. There are two possible solutions to a multi-objective optimization issue: x and y. One will either outweigh the other, or none of the other options will. Consequently, an answer x will win out more than an answer y if the next two conditions are met.
$${\forall j\in \left\{\text{1,2},\dots ,n\right\}, f}_{j}\left(x\right)\le {f}_{j}\left(y\right)$$
(16)
$${\exists k\in \left\{\text{1,2},\dots ,n\right\}, f}_{k}\left(x\right)<{f}_{k}\left(y\right)$$
(17)
Therefore, Pareto set solutions (PSSs) can be found via the non-dominant answers inside the search field. Ultimately, the earlier saved non-dominant answers contain the solution. To select the best answer among the best possible options, the fuzzy function is investigated using a membership function in which the exact variables number can be provided input. In this case, \({\mu }_{i}^{k}\), which has the following definition34,35, denotes for the objective function i value that corresponds to the PSS k:
$$\mu_{i}^{k} = \left\{ {\begin{array}{*{20}l} 1 \hfill & {f_{i} \le f_{i}^{min} } \hfill \\ {\frac{{f_{i}^{max} – f_{i} }}{{f_{i}^{max} – f_{i}^{min} }}} \hfill & {f_{i}^{max} < f_{i} < f_{i}^{min} } \hfill \\ {0 } \hfill & {f_{i} \ge f_{i}^{max} } \hfill \\ \end{array} } \right.{ }$$
(18)
where the maximum and lower limits of the objective function I are, respectively, represented by \({f}_{i}^{max}\) and \({f}_{i}^{min}\). The recommended method of computing these values makes use of the optimization results for each objective function. Given that \({\mu }_{i}^{k}\) is a number between 0 and 1, a value of 0 denotes incompatibility between the answer and the operator’s goals, while 1 denotes complete compliance.
The fuzzy decision-making process is designed to handle multiple conflicting objectives by assigning a membership function to each objective. This allows for a more flexible evaluation of trade-offs between objectives. For each solution in the Pareto front, the fuzzy decision-making process aggregates the fuzzy values of all objectives. This aggregation helps in ranking the solutions based on their overall performance across all objectives. Each objective is normalized, and membership functions are defined to convert the objective values into fuzzy values. This step ensures that different objectives are comparable and can be aggregated meaningfully. The fuzzy decision-making process identifies the solution with the highest aggregated membership value as the best compromise solution. This method helps in selecting a balanced solution that considers all objectives, rather than focusing on just one or a few. By employing the fuzzy decision-making process, the study ensures a comprehensive evaluation of all non-dominant solutions, leading to a final solution that best satisfies the multiple, often conflicting, objectives of minimizing energy losses, voltage oscillations, and power purchased from the grid, while optimizing the location and capacity of HMG components based on forecasted data.
Constraints
The items that follow limitations should apply to the objective function. The problem’s restrictions are taken into account as follows Arasteh et al.10, Wong et al.14 and Saini, and Gidwani19:
Power balance
Throughout the whole study time, the network’s production and consumption balance constraint is as outlined below:
$$\mathop \sum \limits_{h = 1}^{24} P_{slack}^{h} + P_{HMG}^{h} – P_{loss}^{h} – P_{D – DN}^{h} = 0$$
(19)
where \({P}_{slack}^{h}\), \({P}_{loss}^{h}\) and \({P}_{D-DN}^{h}\) refer to the power provided by the post, network losses and network demand at time h, and \({P}_{HMG}^{h}\) is transferred power for the network by the HMG at time h.
Renewable resources
The following restrictions should be met by the PV and wind urce sizes, with the PV panel’s tilt with relation to the ground:
$$P_{PV}^{min} \le P_{PV} \le P_{PV}^{max}$$
(20)
$$0 \le \beta_{PV} \le 90$$
(21)
$$P_{WT}^{min} \le P_{WT} \le P_{WT}^{max}$$
(22)
where \({P}_{PV}^{min}\) and \({P}_{WT}^{min}\) are lower size of PVs and WTs sizes, \({P}_{PV}^{max}\) and \({P}_{WT}^{max}\) are upper size of PVs and WTs, and \({\beta }_{PV}\) is the panel surface angle with respect to the earth surface.
Battery SOC
The battery SOC should be satisfied by
$${{SOC}_{Batt}^{max}\left(1-DOD\right)=SOC}_{Batt}^{min}\le {SOC}_{Batt,h}\le {SOC}_{Batt}^{max}$$
(23)
where \({SOC}_{Batt}^{min}\) and \({SOC}_{Batt}^{max}\) are minimum and maximum values of battery SOC.
Bus voltage
Network bus voltages should fall between the following allowed ranges:
$${V}_{b}^{min}\le {V}_{b}\le {V}_{b}^{max}$$
(24)
where \({V}_{b}^{min}\) and \({V}_{b}^{max}\) are lower and upper limits of bus voltage.
Allowable current
The value of permitted current to flow via the network branches should satisfy the following constraint:
$$\left|{I}_{i}\right|\le \left|{I}_{i}^{max}\right| i=\text{1,2}, \dots , {N}_{l}$$
(25)
where \({I}_{i}^{max}\) is maximum allowable passed current from the network lines.
Data forecasting based on the machine learning
In order to optimize the microgrid in the electrical network, the method of forecasting described utilizes a machine learning-based methodology that utilizes the multilayer perceptron artificial neural network (MLP-ANN) for daily load forecasting (Fig. 2). The machine learning-based method is applied to forecast temperature, wind speed, and radiation. Precisely predicting the electrical network’s demand for load conditions and weather circumstances is essential for optimizing the energy microgrid within the network, especially when patterns of consumption get more intricate and dynamic. Nevertheless, forecasting weather errors leads to uncertainty, which deviates from microgrid optimization. The concentration of this research is on day-ahead microgrid optimization in the networks. To solve these difficulties, a machine learning-based technique for load demand and meteorological parameter predictions is employed.

The MLP-ANN approach for forecasting the meteorological data and load demand.
MPL-ANN algorithm
In this study, by forecasting future sampling utilizing previous data, the MLP-ANN is utilized to anticipate time-series values for load and weather parameters. This technique was chosen because, in contrast with additional complicated hybrid computations, it is easier to construct and has more technological maturation, thus being available to other academics who may be interested in using a similar approach. In recent research that focused on predicting certain parameters, it is usual practice to compare the predictions derived from this machine learning method in order to assess their efficacy36,37,38. Using the MLP-ANN technique, this study offers a multi-objective optimization of the microgrid in an electrical network, producing the most accurate predicted layout for each parameter (irradiance, wind speed, ambient temperature, and load demand). It is believed that a pattern that repeats itself once every 24 h is the ideal one. The mean squared error (MSE) measure is used for contrasting each anticipated pattern produced by the MPL-ANN method with the reality patterns. The patterns with the lowest MSE36,37 are selected for optimization. Figure 2 presents a summary of the recommended method and the pattern selection procedure.
This technique supports microgrid optimization by choosing exact patterns, which is in line with the present tendency of using machine learning techniques for predicting particular parameters.
$${\partial }_{Data}^{Best}=min\left\{MSE({\partial }_{Data-f}^{h},{\partial }_{Data-r}^{h})\right\},\forall \partial =\left\{S, V, {T}_{a}, Dmd\right\}$$
(26)
where for each parameter, \({\partial }_{Data}^{Best}\) represents the choice of the best-predicted pattern, \({\partial }_{Data-f}^{h}\) is predicted data at time t, \({\partial }_{Data-r}^{h}\) denotes real data at time t, \(S\), \(V\), \({T}_{a}\), and \(Dmd\) refers to the radiation, wind speed, temperature and load demand, respectively. It computes the least mean square error (MSE) between the real pattern (\({\partial }_{Data-f}^{h}\)) and the predicted pattern (\({\partial }_{Data-r}^{h}\)).
Predictive accuracy of the ANN
In this research, the predictive accuracy of the Artificial Neural Network (ANN) model is thoroughly assessed through various statistical parameters. These parameters include root mean square error (RMSE), mean squared error (MSE), standard deviation (STD), and linear regression (R). The focus is primarily on optimizing prediction performance, with Mean Squared Error (MSE) serving as the benchmark for identifying the most effective prediction pattern. ANN models learn patterns from historical data and adjust their parameters during training to minimize prediction errors. Their accuracy depends on factors like dataset size, quality, network architecture complexity, and optimization algorithms. ANN models leverage past data to make predictions on unseen data, offering powerful forecasting tools across various domains with their accuracy assessed through rigorous statistical analysis and validation techniques like cross-validation.
The suggested technique finds the best pattern for prediction via the Mean Squared Error (MSE).
$$R=\sqrt{\frac{\sum_{p=1}^{N}{({Y}_{p}-{X}_{p})}^{2}}{\sum_{p=1}^{N}{({X}_{p}-{Y}_{ave})}^{2}}}$$
(27)
$$MSE=\frac{1}{N}\sum_{p=1}^{N}{({Y}_{p}-{X}_{p})}^{2}$$
(28)
$$RMSE=\sqrt{\frac{1}{N}\sum_{p=1}^{N}{({Y}_{p}-{X}_{p})}^{2}}$$
(29)
According to recent studies Nguyen et al.36, the MLP-ANN is implemented for the prediction of time series data as it generates more satisfactory results. To analyze temporal information effectively, MLP-ANN requires a certain amount of memory. In ANN, memory is implemented through the use of time delays, and several different approaches have been devised to do this. In reality, these lags are employed to fine-tune ANN’s learning process parameters. The layers that are input, hidden, and output are the three layers that make up this framework. Figure 2 shows single variation inputs, denoted as i(n-1),i(n-2)…i(n − p) match samples of earlier data, where O(n) represents the forecast’s outcome value, while p indicates the prediction order.
