Co-Simulation Framework for Optimal Allocation and Power Management of DGs in Power Distribution Networks Based on Computational Intelligence Techniques

: The paper researches the impact of the input data resolution on the solution of optimal allocation and power management of controllable and non-controllable renewable energy sources distributed generation in the distribution power system. Computational intelligence techniques and co-simulation approach are used, aiming at more realistic system modeling and solving the complex optimization problem. The optimization problem considers the optimal allocation of all distributed generations and the optimal power control of controllable distributed generations. The co-simulation setup employs a tool for power system analysis and a metaheuristic optimizer to solve the optimization problem. Three different resolutions of input data (generation and load proﬁles) are used: hourly, daily, and monthly averages over one year. An artiﬁcial neural network is used to estimate the optimal output of controllable distributed generations and thus signiﬁcantly decrease the dimensionality of the optimization problem. The proposed procedure is applied on a 13 node test feeder proposed by the Institute of Electrical and Electronics Engineers. The obtained results show a huge impact of the input data resolution on the optimal allocation of distributed generations. Applying the proposed approach, the energy losses are decreased by over 50–70% by the optimal allocation and control of distributed generations depending on the tested network.


Introduction
The optimal allocation and power control of distributed generations (DGs) in electrical power systems has been the focus of researchers in recent years, especially in the context of the smart grid concept. In the project planning phase of DGs installation in the power network, the optimal allocation should determine the system nodes/buses and sizes/powers of the DGs. After the DGs are installed, in the operational phase of the projects, the optimal control of the controllable DGs outputs is of interest. There are different approaches to solve such optimization problem, considering these two parts simultaneously or separately. Besides this question, there is a research challenge regarding the input data resolution used in the optimization process. Generally speaking, the simultaneous approach and higher input data resolution require more computational effort to solve the problem. As far as modeling of the system in the optimization problem is concerned, there are two approaches used in the research. One is based on the usage of an analytical model (a system of equations) of the power network, and the other uses the simulation tool to calculate the objective and constraint functions of the optimization problem. The analytical approach usually means more approximations, and neglecting will be included in the model of the system, decreasing the realistic representation of the system. On the other hand, nowadays, the simulation tool for power system analysis ensures less neglecting, resulting in more realistic modeling of the system. The results obtained using more realistic model in the optimization process are more reliable for practical implementation. These two research issues in this topic are the research subject of this paper. Besides the single or multi-objective approach, the different objective functions as well as the problem constraints of the optimization problem are used in research studies of optimal allocation and the control of DGs. A brief overview of the literature on the topic concerning the above-mentioned issues and research challenges is presented below in the section.
In [1] the authors used the fuzzy system to aggregate the multi-objective problem into single-objective optimization, considering the economic and environmental objective functions and technical constraints. The objective functions were calculated from analytical expressions, and node sensitivity analysis (gradient-based optimization) was used to find the optimal DG allocations. The optimization assumed constant (static) load powers in the power network. The load powers dependent on a bus voltage were considered in [2] to find the optimal allocation of DGs. However, the nominal loads were taken to be constant-not changing in time. The single-objective objective function value and technical constraints were used and solved by the metaheuristic optimization method (Harmony Search Algorithm-HAS). The calculation of the objective function values was coded in the programming environment in which the optimization method was implemented. The multiobjective optimization problem of optimal allocation and control of Battery Energy Storage Systems (BESS) is presented in [3]. Particle Swarm Optimization (PSO), which belongs to the metaheuristic techniques, was used to solve the problem with two objectives: power losses and total power of installed BESS. Optimal allocation was performed with constant nominal load values. After the optimal BESS allocations were found, the optimal charging/discharging control of BESSs with the hourly resolution was determined, using the proposed analytical method. In [4], the single optimization problem considering the DG penetration level as objective and total harmonic distortion (THD) as the problem constraint were investigated again with static load values. The problem was solved by metaheuristic optimization techniques, namely Genetic Algorithm (GA) and Differential Evolution (DE). In addition, in [3,4], objective function values were coded together with the optimization method. In [5], the multiobjective optimization of the optimal power generation of Virtual Power Plant (VPP, including DG and EV (Electrical Vehicle) charging stations) power generation was solved, using the PSO method. The daily load shape with the hourly resolution was used in the simulations. Two-objective optimization, considering the operational cost and which are the pollutants emission, was presented in [6]. The problem was solved using the Ant Lion Optimizer (ALO) metaheuristic method, and variable loads on a daily level with hourly resolution were used. The optimization procedure, as well as the problem, were coded together inside the same programming tool. The single objective optimization dealing with losses minimization and DG penetration level maximization was presented in [7] to find optimal allocation of DGs. The daily profile of load, Photovoltaic (PV), and Wind (W) generations DG units with minute resolutions for 12 typical days were used in the research. The objective function values were calculated by coding the problem in a programming tool, and it is not clear what optimization method was used here. The single objective optimization problem of optimal DG allocation was solved by applying the metaheuristic optimizer, Grey Wolf Optimizer (GWO) in [8]. The optimization was performed for a constant load value, and methods for power flow calculations and optimization itself were coded with the same computational tool. In [9], single-objective optimization, considering the optimal allocation of DG for reactive power control, was solved by using GA. The co-simulation approach was used here, employing the external power system simulator to calculate the objective function value. As in most literature considering the topic, the optimization was performed for constant load value. The constant loads were considered in [10] during single-objective optimization, aiming to find the optimal DG allocations with power losses minimization. The objective function values were calculated based on the backward/forward sweep power flow method which was coded alongside the optimization method in the same programming environment. Different metaheuristic techniques, HAS, Artificial Bees Colony (ABC), and PSO, were used to solve the optimization problem. The research [11] presented a co-simulation approach to solve the optimal DG allocation problem considering one objective function and constant loads. The single objective optimization of DG allocation was solved by using the Sensitivity Analysis (SA) method in [12]. The optimization method and calculation of the objective function value were implemented in the same programming tool. The yearly profile (at hourly data resolution) of wind DG production was considered, but it is not clear if the load profile was used too or if the loads were assumed to be fixed. In [13] the multiobjective optimal DG allocation problem was solved by using the metaheuristic optimization method Ant Lion Optimizer (ALO). The optimal allocation of DGs, BESS, and reactive power control devices was found, considering constant loads. The paper [14] dealt with optimal DG and BESS allocations, solving the problem by using mixed-integer conic programming (MICP) as an optimization technique. The optimal allocation problem was defined in a form of single-objective optimization. The optimization problem was modeled in the specific modeling tool, and an existing external optimization tool was interfaced to the model to find the optimal solution. The optimization problem considered load and DG production profiles with hourly resolution at the yearly level. However, the clustering technique was used to generate typical 48 profile patterns to decrease the dimensionality of the problem. The authors in [15] used PSO to solve the single optimization problem of optimal DG allocation. The optimization process considered constant load and power flow calculation, as well as the optimization algorithm, and was coded in the same programming tool. In [16], the hybridization of two metaheuristic methods, PSO-SFL (Shuffled Frog Leap), was used to solve the single optimization problem of optimal DG allocation. The constant load values were considered and power flow calculations were implemented in the programming tool used for the optimization method performing. The research presented in [17] solved the optimal allocation of DGs, Shunt Capacitors (SC), and Electrical Vehicle (EV) charging stations by using the Grasshopper Optimization Algorithm (GOA), which belongs to the class of metaheuristic methods. The proposed procedure solved the singleobjective optimization problem (with four objectives aggregated into one objective function) in two separated steps considering the optimization of DG and SC allocations separately for the optimization of the EV charging station allocation. The constant load values were used during the solving of the optimization problem, and the impact of the load and DG production changes was investigated once the optimal DG and SC allocations were determined. The power flow analysis was performed in the same programming tool, which was used for the optimization method implementation. A hybrid metaheuristic method, GA-PSO, was applied in [18] to solve a single-objective problem with the aggregated objective function consisting of three parts. The load values were assumed to be constant, and the power flow calculation was implemented in the optimization method objective function value calculation. The authors in [19] applied GA optimization to solve the single optimization problem of optimal DG and BESS allocations, considering the daily load shapes with hourly resolution. The objective function calculation was coded inside the optimization procedure in the PYTHON programming environment. In [20], the single-objective optimization problem of optimal DG allocation was solved by the DE optimization algorithm. The optimal DG allocation, as well as the DG power factor, were decision variables of the optimization problem. The load and DG production profiles were considered during the optimization. The daily profiles with hourly resolution were used, and these profiles were obtained by averaging values from the seasonal profiles. The DIgSILENT simulation tool was employed for the power flow calculation based on which the objective function value was calculated. Although not clearly stated, if the optimization method was implemented inside (built-in) the DIgSILENT or in some external programming tool, it seems that the co-simulation approach was used here.
Based on the above-given brief overview of research studies dealing with optimal DG allocation, the description of the reviewed literature can be summarized as follows: • Most of the literature considers constant/static load and DG production in the distribution network. • If a variable load/DG production is considered, then the changes are usually observed on a daily level with hourly averaged values/resolution. • Much of the literature used an approach in which both the power flow calculations (which is the base for objective function values calculation) and an optimization algorithm were coded in a programming environment. • The optimal allocation of DGs and optimal control (power management/dispatch) problems were solved separately.
The above literature review yields three main issues considering the optimal allocation of DGs: • The influence of choosing constant or variable load and generation values on DG optimal allocation results. • The choice of a proper approach for applying the optimization solver and objective calculations-one simulation tool or co-simulation tools. • An approach to solve the optimization of the allocation and power management of DGs-separately or simultaneously, the optimization of the allocation and power management.
These previously mentioned are detected as open research questions, challenges, and gaps in the topic of optimal DG allocation. The presented research aims to decrease the research gaps and make a contribution to the topic through the following: • Propose the framework for the co-simulation approach, using in the optimization of DG allocation the power distribution network with the aim of more realistic distribution system modeling. • Propose (inside the co-simulation framework) the application of the computational intelligence techniques to decrease the dimensionality of the optimization problem and handle uncertainties in the power system. • Simultaneously perform allocation optimization and DG power management.
The existing literature includes the above-listed aspects (some or all). The optimal DG allocation problem considered in this paper can be summarized as follows: • Literature [6,7] dealt with variable load values. • Literature [9,11,14] dealt with the co-simulation approach. • Literature [20] dealt with variable load and generation profiles as well as the cosimulation approach.
The approach of simultaneously considering the location, size, load, and DG production profiles during the optimization used in this research study is similar and with similar aims as that presented in [20], which was one of the inspirations for this research.
The rest of the paper is organized as follow: the optimization problem formulation is given in Section 2; Section 3 describes the applied research methodology and proposed framework, including a brief overview of the used specific simulation tools; the results of different scenarios aiming to validate the proposed framework applied on a test power distribution network are presented in Section 4; the discussion about the obtained results concerning the stated research question regarding the input data resolution impact is given in Section 5; and at the end, some general remarks/conclusions are presented in Section 6.

The Optimization Problem of the DGs Allocation
The optimization problem is defined to address the research gaps mentioned above, in the previous section. In the literature, different objectives are considered; here, two objective functions that are important from the point of view of the power distribution system operator and the owners of the DGs are used. As one of the main interests of the power distribution system operator is decreasing the losses, the first objective function used in optimization is the active energy losses W loss . Generating as much energy from DGs as possible is the main interest of the DG owners to shorten the investment payback period and increase the profit. This leads to increasing the penetration level of DGs in the power distribution system. Such an objective is formulated here in the form of the total exchange of the total apparent energy W S in the power coupling point of the distribution network on the upstream network. Because these two objective functions are conflicted, the multiobjective (two-objective) optimization approach is used in the research. The technical constraints regarding the nodal voltage range and line current limits as well as the box constraints of the decision variable ranges are applied in the optimization problem.
The mathematical notation of the multiobjective optimization problem, including the previously described objective functions and constraints, is as follows: with the following notations: F-two objective problem function consisting of W loss , yearly energy losses in the network, and W S , yearly exchange of the apparent energy between a network with DG and upstream system; x lb -lower bounds of the decision variable values; x ub -upper bounds of the decision variable values; V min -lower bounds of the nodal voltage value; V max -upper bounds of the nodal voltage value; V i,e -calculated nodal voltage in the i-th network node; I k,max -maximum allowed currents in the k-th network line; and I k,e -calculated current in the k-th network line.
The objective functions represent energies over the timespan and for N time segments t i are calculated from active power losses (P loss ), active (P exc ) and reactive (Q exc ) powers exchanged with the upstream network as follows: Optimization Problem (1) has a two-objective function that consists of two objectives: yearly energy losses in the network (W loss ) and yearly exchange of the apparent energy between a network with DG and upstream system (W S ). The problem constraints in (1) are related to the decision variable ranges (box constraints) and the network operational constraints. The box constraints represent ranges of the decision variable values. The operational constraints are related to the standardized nodal voltage ranges (V min − V max ; usually nodal voltage limits are given in range ±5% or ±10% depending on the relevant standard) and rated currents of the network lines (I k,max ).
Optimization Problem (1) is solved by using the Pareto dominance definitions resulting from the solution set known as the Pareto set [21]. Except for the multiobjective optimization, the two single objective optimizations considering each of the objective functions individually are performed also to check if the multiobjective approach can find reliable edges of the Pareto set. The three different problem setups are used in the research, each of them resulting in a different number of decision variables. This being the case, the contents of the decision variables vector is detailed later in the text in Section 3, describing the proposed procedures. The co-simulation setup of the distribution power system simulation and tools of the computational intelligence methods are used to solve the black-box optimization problem model.
The simulation tool for electrical power system simulation is used to calculate the objective function values. Both DGs types with controllable and non-controllable primary energy sources are considered in the distribution system model. The non-controllable DGs used in the research are Photovoltaic (PV) and wind (WD) plants; as controllable DGs, Biogas (BG) plants are used in the distribution power network. For non-controllable energy sources, the production profiles (the DGs outputs) are involved in the model; for the controllable source, the DGs outputs are subject to optimization. In addition, the load profiles (costumers load shapes) are considered in the optimization. The base case in the simulations supposes DG production and load profiles on a yearly level with hourly resolution, i.e., with 8760 data.

A Brief Overview of the Used Tools in Co-Simulation
The optimization tool applying the metaheuristic optimization technique MIDACO solver (Mixed Integer Distributed Ant Colony Optimization) [22] is used to solve the optimization problem. The advantage of this tool is its applicability in a general case of complex optimization problems, including continuous (linear (LP) and nonlinear (NLP)), integer (discrete) (IP), and mixed-integer (MINLP) problems. This tool is based on the Ant Colony Optimization (ACO) [23] which belongs to the metaheuristic methods. The MIDACO can handle single as well as multiobjective optimization.
The artificial neural network (ANN) is applied in the optimization problem, aiming to decrease the number of the decision variables, reducing the dimensionality of the problem. The Multilayer Perceptron (MPL) ANN with one hidden layer is used here. The ANN is modeled by usage of the TensorFlow tool [24] by applying the Keras API [25].
The OpenDSS simulation tool [26] is used in the study with the purpose of solving the power flow calculations of the model of the distribution network and obtain the objective function values needed for the performing optimization procedure. The usage of the power network simulation tool enables including more details in the network model, decreasing the approximations and neglecting in the model, compared to an analytically defined objective function. This ensures more realistic power distribution network modeling, resulting in more reliable results obtained through the optimization.
As mentioned before, all three of these computational tools are implemented in the Python programming environment and employed in the co-simulation setup to solve the black-box optimization problem.

Co-simulation Framework for DG Allocation and Power Management Optimization
The research methodology used in the study is based on the implementation of different scenarios for optimization and the investigation of the input data resolution impact on the solution of the optimization problem. The optimization scenarios are related to variable or fixed power factors of each DG and directly determine the number of decision variables in the optimization problem. The three cases described in Table 1 are used as optimization scenarios. As can be seen in Table 1, the values of the DG power factor can be directly included as a decision variable, and in that case, the fixed value of the power factor is optimized and does not change with DG power output changes. The other scenario investigates application of the ANN to estimate the optimal DG power factor and in this case, the DG power factor changes over time. For all scenarios, the output power of controllable DG is determined by the ANN. These three basic cases will result in different types and numbers of decision variables in the optimization problem. In Table 2, an overview of the decision variables that occur in the described optimization scenarios is presented. In all scenarios, the consumers' load shapes and energy source profiles are used to model the time variability of the primary energy sources and consumption.
In Figures 1-3, the proposed frameworks according to the previously described scenarios are shown. Application of the ANN to estimate the optimal DG power output and DG power factor values is one of the main contributions of this research. The purpose of the ANN is to decrease the number of decision variables in the optimization problem. Without the proposed usage of the ANN for each controllable (in some scenarios, also for uncontrollable (Table 2)) source, the number of decision variables will be equal to the input data resolution, e.g., for yearly input data with the hourly resolution it will be an additional 8760 decision variables per DG for scenarios Opt 1, i.e., twice for scenario Opt 2 or four times for scenario Opt 3 ( Table 2).
Based on the scenarios overview given in Table 1 and Figures 1-3, the similarity and differences between the optimization models Opt 1-Opt 3 can be summarized as follows. For all optimization scenarios, uncontrollable DG outputs are considered variable in time and defined by energy source profiles. The controllable DG output is managed by the ANN in all scenarios. The differences among the scenarios are related to the power factor variability for controllable and uncontrollable DGs. In Opt 1, the fixed DGs power factors of both controllable and uncontrollable DGs are optimized. The fixed and ANN managed power factors of the controllable and uncontrollable DGs, respectively, are optimized in scenario Opt 2. In Opt 3, modeling the power factors of all DGs (controllable and uncontrollable) is managed by ANN.
The details about the ANN inputs and outputs are given in Figure 4, and the ANN parameters (weights and biases) are optimized by the MIDACO solver simultaneously with DGs allocation optimization. The simple Multilayer Perceptron (MLP) ANN consists of one hidden and output layer. Because the usage of the ANN has the purpose of significantly decreasing the number of decision variables, this simple ANN configuration is implemented in the framework. The purpose of ANN is to significantly decrease the number of problem decision variables. If the ANN is not used, the number of decision variables would be increased for the number of the input data (depending on the data resolution, e.g., in case of yearly data with hourly resolution the optimization problem would have 8760 data only for the DG power management). The ANN takes as inputs the i-th data from each load shape and each uncontrollable DG output profile. Training of the ANN was performed in this way (without application of standard built-in ANN optimizer presents in the used ANN tool) because the training process, in this case, is slightly different than ordinary. Usually, when ANN is used for regression purposes, the difference between the target and ANN estimated values is objective in the ANN optimization process (training). However, this is not the case here; the ANN target outputs are not known in advance, as they need to be determined during the optimization of the whole problem defined by (1). Such configuration of the proposed framework and purpose of the ANN prevents performing common ANN training procedures.    The two different workflows are applied to investigate the possible improvement of the solution quality for scenarios Opt 2 and Opt 3 ( Figure 5). The difference between the workflows is about the initial solution that the optimization algorithm starts with. In both workflows (WF1 and WF2), the initial solution is randomly generated in Opt 1 optimization scenarios. In workflow W1 the initial solution is also randomly chosen for scenarios Opt 2 and Opt 3, while in workflow WF2 the starting optimization point for Opt 2 and Opt 3 is the solution of solved Opt 1. In the case of WF2 workflow, the locations, and sizes of all DGs and trained ANN for controlling the power output of controllable DG are the solution from Opt 1, and only parameters of the ANN are used to optimize the DG power factors. The purpose of the WF2 workflow is to check if the optimal solution obtained by solving Opt 1 can be additionally improved by managing the DGs power factor.
The above-described optimizations and workflows are performed with input data on yearly level with hourly resolution, i.e., with 8760 input data modeling changes of primary energy source intensity and loads over a year. After the research done according to the workflows, the final workflow and optimization model will be proposed based on a comparison of the obtained solutions for different optimization scenarios. In the continuation of the proposed procedure, the previously chosen optimization scenario and workflow will be repeated with the different decreased resolutions of input data to research the impact of data resolution on the optimization problem solution. The two decreased input data resolutions with 12 and 365 input data are used here. These input data are obtained by averaging the basic input data (hourly resolution, 8760 input data) on monthly (12 input data) and daily (365 input data) levels. The schematic overview of this part of the research methodology is given in Figure 6.  At the end of the research methodology used in this study, the chosen optimization procedure optimized with hourly input data was applied, using input data with a resolution of 15 min (four times higher resolution than one used in optimization procedure) steps, i.e., with 35,040 input data. The load shapes are one of the inputs into the ANN (Figure 4). Usually, the load shapes are forecasted, based on the historical consumption data, and consequently include more or less uncertainty. Due to this uncertainty, the later application of the load shape can give a load value that is different from the real load value. This procedure part is performed with two scenarios: one supposing an unknown real load value at the moment and the other with a known specific load value at the specific time step. If the real load value is not known/measured, the load value is estimated according to the load shapes used in the optimization process. The previously described is visualized in Figure 7. The purpose of this is to investigate the robustness of the proposed framework. In addition, with the development of the smart grid concept, it is expected more and more the usage of smart energy meters at the costumers' point of common coupling. These conditions allow obtaining the load values with more accuracy as input data during the implementation of the proposed framework.

Application of the Framework on Test Distribution Power Systems-Case Study
The very well-known and often used IEEE 13 node IEEE 37 node test feeders [27] are used as a case study to demonstrate the application of the proposed framework for optimal DG allocation and power management. These distribution power systems are chosen because they represent the most general examples of the power networks. Some features of the used power networks are an unbalanced system (one, two, and three-phase lines and loads), different load models (constant power, constant impedance, constant current ...), voltage regulators, load in wye (star), and delta connection configurations and two voltage levels (4.16 kV and 0.48 kV). All details about the used test systems can be found in [27]. The next modification in the original IEEE 13 node and IEEE 37 node bus test feeders is made to adapt the systems for performed research: the capacitor banks are turned off, the taps of the voltage regulators are reset to the middle position before the simulation for each possible solution in the optimization is started, and three different load shapes are assigned to the consumers according to

Input Data Preparation
The input data regarding the load shapes and PV and wind plant power profiles are obtained by usage of the existing tools for prediction/forecasting load consumption and PV and wind DG production. The computer tool Load Profile Generator (LPG) (https://www.loadprofilegenerator.de/ (accessed on 8 April 2021)) [28] is used to synthesize the three different load profiles used in the simulations. The built-in (LPG) load shape types, namely "H01 in HT 14", "H01 in HT 11", and "H01 in HT 07", are used to generate load profiles LP 01, LP 02, and LP 033, respectively. The normalized load shapes are given in The online platform (tool) named "Renewables.ninja." (Available online: https:// www.renewables.ninja/ (accessed on 8 April 2021) based on research presented in [29,30] is used to produce the output profile of PV and wind DGs. The generated normalized DG production profiles are shown in Figure 9.
The above-described input data, the yearly load, and DG production profiles with the hourly resolution are generated as basic input data cases. The input data with monthly and daily resolutions used as input into part of conducted research study shown in Figure 6 are generated from the base input data by averaging data on monthly and daily levels, respectively. These input data with the decreased resolution are presented in Figures 10-13.
The input data used at the end of the conducted research shown in Figure 7 are produced by adding randomly generated noise (X according to uniform distribution U ) to the base data for each time step (1 h) four times. The repeated random number generation four times for each hour produces load and DG output profiles with a resolution of 15 min (1 h = 4 × 15 min). The noise range is set in the range ±z% of the hourly value. The mathematical formulation of the 15 min resolution data is the following: In this case, it is important to highlight that hourly data are not averages of 15 min data. Due to higher data resolution, the 15 min resolution data are not visualized for the whole year, but only for the first day in a year (in comparison with basic input data (hourly resolution)) as can be seen in Figures 14 and 15 (for example, for ±20% uncertainty used in the 15 min data generation).

Results for Different Optimization Models-Workflow WF1
In this subsection, the results obtained according to workflow W1 (Figure 5a) for the optimization models proposed in Figures 1-3 and Table 1 are presented. Figures 16-18 visualize solutions of optimization models Opt 1 (Figure 1), Opt 2 ( Figure 2) and Opt 3 (Figure 3), respectively, showing the Pareto front of the solved optimization Problem (1).
In Tables 4-6, the numerical values for the solutions obtained for all three proposed optimization models (Opt 1, Opt 2 and Opt 3) applied on multi-objective and single objective optimizations are given. For multiobjective optimization, the values for the Pareto edges (for solutions giving the lowest energy losses and energy exchange) are shown in these Tables.

Results for Different Optimization Models-Workflow WF2
The results obtained according to workflow WF2 (Figure 5b) for the optimization models Opt 2 and Opt 3 are presented in this subsection. In WF2, the workflow of the optimal allocations of DGs and trained ANN obtained as a solution of Opt 1 model are used as the initial (starting) solution for the optimization of the Opt 2 and Opt 3 models. In this case, the problem solutions are trained ANNs for controlling DGs power factors. In this workflow, only a single-objective optimization approach is applied based on the results obtained in the previous subsection. As can be seen from the results obtained in workflow WF1, the single-objective optimization finds the Pareto front edges of better quality. The results obtained according to workflow WF2 are shown in Tables 7 and 8 for optimization models Opt 2 and Opt 3, respectively.

Comparison of Optimal DG Allocations for Different Optimization Models and Workflows
This subsection presents the optimal allocations of DGs obtained according to different optimization models and workflows used in the research study. The DG locations (bus) in the network and nominal DG apparent powers (S n ) are presented in Table 9 to give a comparable overview of the obtained solutions of the optimization problem, according to the different research scenarios used in the study. Table 9. Results comparison for optimization models and workflows in case of single-objective optimizations.

Impact of Input Data Resolution on the Optimization Problem Solution
The previous procedures used in the presented research are analyzed to propose a suitable optimization model for the next steps in the study. Based on the results presented in the three previous subsections, the optimization model Opt 1 is chosen as the one with the best results (more details about the choice are given in the Discussion section below) for the application in the rest of the study. In this subsection, the results of the performing research step presented in Figure 6 are presented. The purpose of this step is to investigate the impact of the input data resolution on the solution of the optimization problem. The solutions for yearly input data with daily and monthly resolutions are compared against the solutions for the data with hourly resolution (as the base case). The input data with daily and monthly resolutions are generated as described in Section 4.1. Table 10 shows objective function values without installed DGs for different resolutions of input data. In Tables 11 and 12, an overview of solution comparisons presented in Figure 6 are shown for optimization model Opt 1 and single optimization problems (with W loss and W S objectives separately).  Table 11. Impact of the input data resolution (Opt 1 optimization problem with W loss objective).

Robustness of the Proposed Optimization Model
Based on the presented results, the optimization model Opt 1 is proposed as a framework for optimal DG allocation and power management. Let us recall that Opt 1 model results with solutions of the optimal allocation of DG, constant optimal power factors of DGs, and trained ANN for power management of the controllable DGs (Figure 1). After the optimal solution with hourly input data is found, the optimal allocation of uncontrollable DGs (PV and wind plants) and the trained ANN is implemented in the simulation model to drive the output power of the controllable DG (the bio-gas plant) with input data with higher resolution than the one used during the optimization process. The 15 min resolution data are used here, applying two scenarios. The ANN inputs are normalized PV and wind plant power outputs and load shape values. The 15 min PV and wind plant outputs, as well as the load shapes, are generated according to the procedure given in Section 4.1. Both scenarios assume the known real PV and wind plant power outputs. The one scenario (S1) assumes unknown real load shape values, in this case, the load shape ANN inputs are defined, according to the given load shapes (used during the optimization) and different from the real load shape value. In this scenario, for each four real load data in the load shape, the load inputs to ANN are the same (according to the given hourly load shape). The other scenario (S2) assumes known load shape values are used as ANN inputs. Both scenarios S1 and S2 are visualized in Figure 7. The results for these two scenarios for ±20% uncertainty (according to (3)) of load shapes and the DG profile are given in Table 13. In this subsection, the proposed procedure is applied on the IEEE 37 Node Test Feeder as an example of the distribution network of middle size. Based on the results and analysis of the procedure implementation on the IEEE 13 Node Test Feeder (given in previous subsections), the optimization model Opt 1, workflow WF 1, yearly profiles with hourly data and single objective (W loss ) optimization are applied on the IEEE 37 network. The obtained results are presented in Tables 14 and 15. The two optimization processes are performed: one for allocation of a total of three DGs (1xPV DG, 1xW DG, 1xBG DG), and the second for a total of six DGs (2xPV DG, 2xW DG, 2xBG DG).

Discussion
Due to the extensive material (caused by many steps in the proposed research framework) presented in the previous section, comments about the obtained results are given in this section instead of in the previous one. The comments below are sorted, concerning the specific framework step referred to in Sections 4.2-4.6. The results obtained by investigation of the different optimization models and used workflow (Section 4.2) indicate that the simplest proposed model (Opt 1) gives the best results. The Opt 1 model finds optimal allocations of DGs, fixed values of DG power factors, and the trained ANN that generates the production profile of the controllable DG. Comparing results of single-objective and multiobjective optimizations (Table 4), it can be stated that the single-objective approach finds a better solution than two-objective optimization for the WS objective. In the case of single-objective optimization with the Wloss function, the solution is the same as that obtained by the two-objective optimization. Comparing the solutions obtained for different optimization models (Opt 1, Opt 2, and Opt 3) in Tables 4-6, unexpected results occur. As mentioned before, the best results are obtained for the Opt 1 model, but the authors expected models Opt 2 and Opt 3 to be better. In the Opt 2 and Opt 3 models, the DG power factors are also controlled (variable in time); the hypothesis was that this scenario would give better solutions. There is a need for further research to determine the reason for these unexpected results. Comparing the results in Tables 7 and 8 with those in Tables 4-6, it can be concluded that the initial solution has a low impact on the solution quality. The results presented in Tables 10-12 emphasize the importance of the input data resolution. Except for the difference in objective function absolute amounts, the important difference is in the optimal DG allocations obtained for different data resolution. The results in Table 13 show the possibility of the proposed framework application in the case of using real data with a resolution higher than that used in the optimization model tuning. The input of different data into ANN give close obtained objective values.
As mentioned before in the Introduction section, there are a few research studies that considered all three optimization problem issues (time changes of load and production profiles, co-simulation approach, together with optimization of the optimal allocation and power control of DGs) simultaneously. It is difficult to compare the research results with the existing studies directly because different objective functions and distribution power networks are used in the literature. Ref. [6,7] considered variable load and production profiles without a co-simulation approach, and only optimal allocation of DGs was solved. In Ref. [6], the example of the microgrid (from the literature) is used to present the results of the DG power outputs optimization (with DG locations given in advance). The objective functions are the minimization of operational costs and pollutants emission. The presented results show conflicted objective values in ranges of USD 760-870 and 960-1115 kg for the operational costs and the emission amount, respectively. In [7], the objective function is losses minimization, and the proposed method is applied to the example of the IEEE 14 bus test network. The obtained results show a decrease in the network losses to about 38% of losses for the basic case (without installed DGs). Refs. [9,11] deal with the co-simulation approach to find the optimal allocation of DGs. Ref. [9] solves the optimal allocation problem (without considering the DGs power management) using constant loads, and the proposed method is applied on the IEEE 37 node test network. The objectives are minimizing the nodal voltage variations and installation costs of DGs. The results show a reduction in value of the objective function to about 64% of its initial value (without DGs). In [11], the objective function is minimizing the network power losses, and the constant load and DG outputs are considered. The proposed procedure is applied to the IEEE 123 bus distribution network. The obtained results give about 79% power loss reduction of the initial losses (without DGs). As stated above in the Introduction section, the research study presented in [20] is closest to the research presented here. In [20], the variable load and DG production profiles, as well as optimal allocation and power management, are considered. The external simulation tool is used to calculate energy loss as the objective function. The presented method is applied to a power distribution network consisting of 69 buses. The presented results show power loss reductions in ranges (depending on numbers of DGs) of 63-69% and 89-98% of the initial power losses (with no DGs) for constant load and the unity power factor and constant load and the optimized power factor, respectively. In the scenario, with variable load, the energy loss reduction is in the range (depend on objectives impacts in the objective function) of 72-95% of the initial energy loss. Ref. [20] also considers the active energy infeed from the upstream network, and the obtained results for this objective are in the range of 60-90%, reducing the basic case value (without installed DGs). Because the study [20] considers similar problem aspects as those in this research (the initial data and tested network are not the same), the research presented here can be relatively compared with [20]. The results presented here (Sections 4.2-4.6) show the next obtained values. The range (depending on the applied optimization model Opt 1-Opt 3) of energy loss reduction is 60-79% of values with no installed DGs. The reduced exchanged apparent energy is in the range of 74-94% of the amount without DGs. The proposed method shows an energy loss reduction for 15 min resolution data of 77% of the initial value. This shows the applicability of the method in the case of using input data different from the data used in the optimization procedure.
Further research will be directed to investigation procedures for the estimation of DG power factor controls to additionally increase the optimal solution quality.

Conclusions
The presented framework for optimal allocation and power management of DGs emphasizes the importance of the resolution of the input data that needs to be considered during the optimization process. The proposed estimation of the controllable DG output by the ANN significantly decreases the number of the decision variables in the optimization problem, especially in the case of the high input data resolution. The results obtained for the case study indicate that knowing the hourly input data can be used to successfully tune the optimal model, which can be used later with increased input data resolution (15 min data).
This research study, compared to the existing literature, investigates the problem of the optimal allocation and power management of DG, makes contributions considering all three aspects of the problem detected in the Introduction section (load and DGs variable profile, co-simulation approach, and simultaneous consideration of the optimal allocation and power management of DGs). As stated in the Introduction section, there are a few research papers that consider these three problem aspects, simultaneously. Only (considering here the reviewed literature) in [20] did the authors apply variable profiles of load and DG production, external software for the calculation of the objective values, and variable DG power factor (optimized for optimal allocation determined in advance) to manage the DG output. Unlike the existing literature on the topic, the research presented here dealt with simultaneous optimization of the DG allocation and power management, considering the yearly (with hourly resolution) load and DG production profiles, using a co-simulation approach. Besides this, the research proposed the application of ANN to manage DG outputs, which significantly decreases the number of decision variables that appear when yearly profiles are used.
The presented solution framework shows that it is possible to optimize the allocation and variable power outputs of DGs simultaneously in the case of high resolution input data. The high resolution of input data over a long time span (a year) produces a very high number of decision variables that need to be optimized. The demonstrated application of the ANN makes it possible to significantly decrease the number of decision variables with simultaneous consideration of the optimal allocation and power management of the DGs. For successful optimization of the DG power factor management, additional investigations of the procedures are required, which will be included in the optimization process simultaneously with the here-applied problem aspects.

Conflicts of Interest:
The authors declare no conflict of interest. The founders had no role in the design of the study; in the collection, analyses, or interpretation of data; in the writing of the manuscript, or in the decision to publish the results. Hourly load factor value LS 1,i i-th data in the first load shape LS n,i i-th data in n-th load shape m Number of wind plants n Number of load shapes N Number of data in load shapes (same as number of time steps) and DG production profiles P BG,1,i i-th output of the first BG plant P BG,j,i i-th output of the j-th BG plant P exc,i Active power exchange at the i-th time step P loss,i Total network active power losses at the i-th time step P PV,1,i i-th data in the first production profile of PV plant P PV,k,i i-th data in k-th production profile of PV plant P wind,1,i i-th data in the first production profile of wind plant P wind,m,i i-th data in m-th production profile of wind plant Q exc,i Reactive power exchange at the i-th time step t i Duration of the i-th time step U Probability density function of the uniform distribution V i,e Calculated nodal voltage in i-th network bus V max Maximum of the nodal voltage value V min Minimum of the nodal voltage value W loss Energy of yearly losses as one of objectives in F W S Apparent yearly energy exchanged between the distribution and upstream network x Decision variable vector X The random number generated according to U x lb Lower bounds of the decision variables x ub Upper bounds of the decision variables