Multithreaded Multiswarm Model for Intelligent Economic Prosumer Load Dispatch for Battery Supported DC Microgrid

School of Electrical Engineering, Vellore Institute of Technology, Vellore, Tamil Nadu, India Department of Electrical and Electronics Engineering, Kongu Engineering College, Perundurai, Tamil Nadu, India Centre for Innovative Manufacturing and Research, Vellore Institute of Technology, Vellore, Tamil Nadu, India Department of Electrical Computer and Telecommunications Engineering, Botswana International University of Science and Technology, Palapye, Botswana


Introduction
Background. In addition to delivering a consistent and high-quality supply, every power system model must be prepared to satisfy demand while expending the least amount of operational and capital resources. e task described above is termed as economical load dispatch [1]. Economic load dispatch is an inventory management technology in which the system chooses discrete combination energy sources from all accessible sources to achieve the lowest possible costs [2]. ese challenges must be investigated in grid-connected microgrid models that comprise a diverse set of distributed energy sources (DESs) [3].
Depending on their socio-techno-economic restrictions, any residential, industrial, or commercial operator could utilize different energy sources [4]. Each source will have its own set of operating costs, capital expenditures, start-up delay, integration complexity, power-generating capacity, efficiency, pollution scale, operational lifetime, consumption time, dependability, and stability, to name a few [5]. Some characteristics improve responsiveness, while others reduce system quality, performance, and economy. All these factors should be addressed by an intelligent demand response system without sacrificing steady supply to demand [6,7]. In traditional systems, electricity flows unidirectional from a main source to the load. However, if the system supports DES, even though the user is generally a load point, it may occasionally function as a source point. When a user's power output exceeds demand, the energy can be pooled and sold to the grid. As a result, a diverse set of sources and loads will be dispersed over the microgrid, with heterogeneous multidirectional power flow between them [8,9]. In order to make a combinatorial optimal decision among all of these attributes, a sophisticated mathematical model is necessary [10]. e DRS aims to identify the optimal solution by evaluating the fitness of these attributes by emphasizing positive features while minimizing negative traits within a reasonable range of alternatives.

Literature Review.
Wen et al. examined the state of DES research in three areas: applications, assessments, and regional support measures [11]. ey also analyzed the current status of DES approaches focusing on a number of variables such as energy, environment, society, and economy. e prior study offers information on the factors that impact DES. Tolmasquim et al. investigated electrical distributor techniques in the context of distributed energy resources, including SWOT assessments for internal and external electricity distributors in the DES distribution scenario [12].
is research examines the advantages and disadvantages of DES in detail. Wolsink focused on the sociopolitical layer for societal acceptance of DES, which combines high DES dispersion in intelligent microgrids to produce polycentricity rather than hierarchy [13]. is research contributes to the qualitative modeling of DRS based on the influence of consumer interactions on power systems. After determining the qualitative and quantitative properties of distributed energy sources, demand response models based on these inputs are established. McIlwaine et al. examined global electrical market trends, which include a majority of DES, as well as a global evaluation of energy storage, with a focus on power quality services at the distribution level [14]. Ehsan and Yang discussed active distribution network planning as well as distribution network planning in general [15]. Iqbal et al. used a nonlinear programming technique to model a DC microgrid system with peer-to-peer sharing, which allows users to share surplus energy from distributed energy resources with minimal system losses, including distribution and conversion losses, in comparison to the traditional factory-warehouse transportation method [16]. Zeng et al. presented a state-of-charge (SoC) dynamic balancing control approach for DES in DC microgrids that takes into account energy storage capacity disparity to achieve SoC balancing [17]. e aforementioned publications provide information on demand response strategies. e next step is to figure out how to put this concept into action.
Ramadhani et al. reviewed the most up-to-date load flow methodologies for DES in great detail, including recommendations for the best modeling methodology for distribution networks with PV generating and EV charging [18]. Ullah et al. investigated the advantages and disadvantages of various integration approaches centered on interconnection challenges and opportunities for DC microgrids [19]. Holari et al. constructed a hybrid AC/DC microgrid system with variable demand and unknown characteristics in order to provide a coordinated performance strategy for power electronic converters in grid-connected and islanding operational scenarios for hybrid microgrid power management [20]. Liaquat et al. examines into a multitude of dispatch challenges as well as the nature of the objective functions in consideration. e study also includes recommendations on demand management problems as well as the underlying constraints associated with each optimization function [21]. Luna et al. showcased an energy management system for coordinating distributed household prosumer activities [22]. Zia et al. proposed a case study for a standalone marine microgrid system as well as a paradigm for smart demand management [23]. Ali et al. offered " e Day Ahead Shifting" approach for cost and peak load optimization on the demand side [24]. Iqbal et al. outlines an effective home energy management system for residential clients in research, which allows them to properly organize demandresponsive appliances in the context of local solar and energy storage systems [25]. Bhamidi and Sivasubramani presented the framework for a two-stage optimization model for smart home renewable energy resources and battery integration, as well as the association of prosumer-based energy management [26]. e two preceding articles provide technical information for developing a load flow analysis within a DC microgrid. e next phase is to provide a framework for power management optimization. Mbuwir et al. optimized the power exchange between a microgrid and utility grid using the Jacobi-alternating direction multiplier approach, which assists in congestion management by breaking down the optimization problem into subproblems that are addressed locally and in parallel using fitted Q iteration [27]. Gunantara conducted a thorough examination of multiobjective optimization methods and applications [28]. Molzahn et al. focused research on distributed algorithms and their applications in optimized power system control [29]. Fan et al. provided a thorough and realistic assessment of recent developments in bioinspired algorithms, bioinspired swarm intelligence algorithms, bioinspired ecological algorithms, and multiobjective bioinspired algorithms [30]. e above three publications provide guidance for the application of bioinspired swarm intelligence in power system challenges. Chaudhari utilized ant colony optimization (ACO), particle swarm optimization (PSO), artificial bee colony (ABC), firefly algorithm (FA), and genetic algorithm (GA) to solve the travelling salesman problem, and provided an overview of the performance of the various algorithms using some standard benchmarks [31]. Shareef and Srinivasa Rao shown the combination of two swarming algorithms, ABC and FA, to improve the performance, and this hybrid algorithm is to regulate variables that are adjusted to get the best outcomes [32].

Motivation.
e responsibility of a demand management system is to ensure uninterrupted power supply to the load while also taking into account heterogeneous socialtechno-economic conditions. Distributed energy sources of diverse capacity, its type, and manufacturer are used in modern microgrid models. Furthermore, different sources may experience a delay in integrating with the grid due to technological hurdles, and they have a temporal limitation on how long they may be used. Each source will produce varying levels of pollution and have varying environmental implications. Due to the operational characteristics of the sources and coupling transience, the system will encounter certain dynamic disturbances that will influence the power quality. Every source needs a certain amount of upfront investment as well as ongoing operational costs. e operational and capital investment in the electric grid has a substantial influence as well. e impact of these sources on the overall quality of the power system is assessed using a variety of socio-techno-economic factors. As a result, DRS cannot expect the sources to behave in the homogeneous way when modeling demand responses.
Because energy networks are typically designed to stave off peak demand, the aggregate capacity of installed sources is always substantially greater than the average demand. In the significant majority of situations, only a modest portion of the total installed capacity sources is required to fulfill demand. As previously stated, the DRS need to use sophisticated mathematical techniques to select the best sources from among all those accessible. Transmission line characteristics, particularly transmission loss and transmission cost, should be given further consideration when constructing an optimal load flow analysis. In addition to the fundamental qualities, a prosumer model may be layered on top of the previously stated models. A prosumer is a person who consumes as well as generates energy. Extra energy generated by a user can be pooled and shared with other users or the grid. When energy is pulled from the nearest accessible source, transmission loss is reduced, resulting in a more cost-effective and energy-efficient system. Hence, the DRS should be built to handle all of these aspects and make the best combinatorial decision possible between the sociotechno-economic factors mentioned above. e most adaptable approach for dealing with such a challenge is to combine bioinspired algorithms with a range of mathematical techniques. As previously stated, this paper supports the use of multiple optimization models in parallel threads.
is research employs the artificial bee colony (ABC) and particle swarm optimization (PSO) methods. Every method will have its own set of benefits and drawbacks. PSO is significantly more profitable when there are multiple local optimum models to choose from, the global best is less desirable, or convergence is delayed. PSO, on the other hand, may fail if the preliminary parameters are mistakenly inputted or if there is a high-dimensional search space.
e ABC has several advantages, including fast convergence, cognitive speed, and flexibility, but it can also lead to premature convergence or erroneous global best selection. As a result, deciding on the optimal strategy is a complex process and a reward-penalty ranking systemassisted reinforcement learning model that may be used to distinguish between the techniques. Each optimization strategy is assessed using reinforcement learning based on the reward -penalty contributions of each source/component. e upper confidence bound method is used to rank components with a balanced exploration-exploitation ratio.

Contributions.
e main objective of this paper is to present a smart economic load dispatch model for a demand response system that combines a multithreaded swarm model with a reward-based reinforcement model to assure optimal source selection and power flow management.
e swarm models employed in the study are PSO and ABC, which run in parallel and independently. e swarm model is used in two phases in two applications: economic modeling and optimum source allocation. e benefits and limitations of each model vary, as do the computer processing power and time. Different optimization techniques may demonstrate varying efficiency for different factors and operating ranges. Itis a waste of time and computing resources to run all of the models. Hence, only one model is chosen at a time using a semisupervised reinforcement learning approach. An upper confidence bound (UCB) is used to rate each approach in a reward-penalty scenario. Each method is evaluated after each outcome computation, and the data are submitted to UCB. Time and iterations are used as performance criteria to evaluate the models. e last phase comprises a weighted Boruvka model for optimal power flow analysis. e boundaries, constraints, and equalities will be built using the prosumer microgrid model, which will include the following features: (1) A consumer may only use the main utility grid to meet their needs (2) A user may be separated from the utility grid if they are capable of satisfying their own demand using their own resources. Swarm models will aid in the choice of the appropriate providers from all available sources in such scenarios. (3) Users with the ability to generate more energy than their demand can trade it to the utility grid or nearby users. Adding more power to the grid through a prosumer model has numerous benefits. ere are three options for prosumers.
(a) e user can sell their excess power to the grid in exchange for a monetary reward for each unit they provide. Swarm models can be used to create a monetization scheme as well as trade of ratio. (b) ere is also a supplement option, in which the user can pool additional energy into the grid or other users and then take it back whenever they need it for free or at a modest compensatory cost.

Mathematical Problems in Engineering
Both a monetization and a trading strategy can be created using swarm models. (c) Many users may have batteries installed in order to store energy for future usage. e surplus energy may be used to charge the battery or pool to the grid. Even though the user has more power, if it is more cost effective, the user can utilize electricity from the grid while conserving his own. Swarm models are used to assess how much power is shared and to simulate the economics of sharing.
e swarm model will aid in source selection as well as the trading ratio between consumers and producers, depending on socio-techno-economic limitations.

Adaptive Multiswarm Economic Demand
Response Model is study aims to develop an intelligent demand response model based on a multithreaded swarm model and an exploitation-exploration model. Figure 1 shows a block diagram of the entire model. e architecture of the system is divided into two segments. e first layer has two elements. One is an edge computing hardware model that comprises an energy monitoring circuit to track energy consumption and generation. As an energy monitoring circuit, a potential divider supported a ZMPT101B DC voltage sensor and a MAX471 based current sensor that are combined with an MKL25Z128VLK4 MCU. e second element is a centralized data processing unit (CDPU) made up of a 1 GHz BCM2835 single-core CPU with 512 MB RAM that serves as the system's central hub and is linked to the edge controller through WPWAN. For ease of implementation, the data are acquired from a real-time environment, but the load scheduling is carried out by manual switching. e system will keep track of each user's energy output and consumption. e data are transmitted to a central database for further analysis. e second layer is the software layer, which contains all of the mathematical models as well as their code. e second layer is made possible by the CDPU itself. Multiple swarm models, UBC, and Boruvka analysis are used in the software layer at various phases. e entire presentation is divided into four blocks. UBC will be able to operate only if there are enough readily available inputs for modeling. As a consequence, the system will only use UBC after the first six iterations as indicated in the previous paragraph.
Computational Block I -Power system models: the power system constraints, limits, and objective function are all set up in this block. ere are four subblocks in this block. For an i th user, P i L is the load demand, P i SG is the solar generation, P i B is the battery supply, P i DG is the generation from diesel generator, P i W is the generation from wind, P i MS is the generation from miscellaneous units, P i UG is the i th user consumption from utility grid, and P j X is the generation from j th user so that j can be varied for each user except j � i, and x is the type of source. To begin, the system makes certain that the total supply constantly exceeds the load. To do this, four options are available. Sub-block I Case I: as seen in equation (1), all power is drawn from the user's own sources if they are sufficient. If the user's demand is not met by their own sources, the main grid delivers all of the power, as shown in equation (2).
Sub-block I Case II: as previously stated, under some circumstances, some energy is pulled from the utility grid and some from local sources linked to the utility grid. e percentage share of each source is calculated using a swarm optimization approach based on economic and transmission network factors. e swarm approach attempts to reduce total power sharing while lowering overall costs. Equations (3)-(5) provide the boundaries and constraints for power sharing where W represents the weight of each source, while C represents the cost of each share.
Sub-block III Case III: even though a user is self-sufficient, if electricity is available at a reduced cost from the utility grid or nearby sources, the user may utilize it. is may also be used to store lower-cost grid energy or current power production from the user to the battery for later use when prices rise. e boundaries and constraints for power sharing are defined by equations (6)- (8) where W Ext and W User represent the grid and user power contributions, respectively, whereas C Ext and C User reflect the cost constraints of both the grid and the user.
C Ext + C User ⇒Min, Sub-Block IV Case IV: the user can offer their excess power to the grid/nearby users in return for a monetary benefit for each unit provided. Equations (9)- (12) illustrate trading strategies and proportions based on technological and economic aspects. e system will seek to maintain user contribution weights X i as low as possible, while keeping the user revenue Z OUT as high as possible and the cost of power acquired from the grid, Z IN as low as possible.
Z Out ⇒Max, Z Intake , whereas P out determines the power pooled and P user is local power drawn. Even though the system maximizes the cost of income to users, it will always try to reduce overall cost. Computational Block II -Optimization: mathematical models of optimization systems are included in this section. Even when the identical data are fed into both swarm models, PSO and ABC, outcomes will differ. As a result, each block is considered as a separate subchapter, with only one chosen for implementation based on its performance. Sub-block I PSO: the first input vector is set to the overall population. Optimization issues are now defined by suitable equality constraints, inequality constraints, and boundary problems. e cost function, loss factor, and objective function for each of the earlier cases have now been established. Using the aforementioned criteria, the fitness of each particle in terms of velocity and position is now evaluated. New values of the global best (G Best ) and local best (L Best ) are tested for each cycle. is approach is continued until the exit iteration criteria or the lowest cost are satisfied. e G Best is utilized as the output. Sub-block II ABC: initially, input variables are specified in terms of the general population. As explained in the prior section, optimization problems are now given with proper constraints, boundary problems, and objective functions. e next two steps entail the creation of employer and out-looker bees, followed by a fitness evaluation based on food sampling at each level. Each cycle, new values for the global best (G Best ), and local best (L Best ) are evaluated. is process is repeated by new scout bees until the conditions for the lowest cost or exit iteration are met.
e G Best is taken as the output. To begin, the system will use ABC and PSO to calculate the exchange of ratios between sources. e next phase will result in the optimum source combination based on economic factors. Based on this data, power flow analysis is performed using Boruvka load flow analysis.
Computational Block III -Optimal Power Flow: initially, each user's linkages to neighbors and the grid, as well as the grid architecture, are identified. Each transmission station is now weighted (K) based on maximum capacity and transmission line cost. Equation (13) explains the power equation, where U is the voltage and Y is the transmission line impedance.
e method is now repeated until the least loss path is identified by selecting the lightest weighted node for a user. is procedure is repeated until a user is connected to at least one other user or grid. e following step is to utilize UCB to determine the best swarm model. Computational Block IV -UCB: after a number of iterations, this block is utilized to identify the best swarm optimization model. is is split down into sections. Sub-block I: e models receive a credit or penalty based on the number of times their divergence between real and planned is less than 5%. Sub-block II: we compute the average reward R i , maximum range N, deviation delta, and the machine's confidence interval up to n rounds at a time, and range r i is found as shown in equations (14) and (15) Sub-block III: the machine with the maximum UCB is selected:

Results and Discussions
A simulation framework is created to put the notion into action. A proteus design suite simulation is used to generate sample data. Some of the sample information comes from the real world and is fed into the simulation. Figure 2 shows a distribution system consisting of 20 homes each of whom is connected to one or more of their neighbors. Each user is connected to a battery, a solar photovoltaic (SPV), a diesel generator (DG), a microwind source (MWG), and different miscellaneous sources (MS) such as a natural gas turbine. ere is also a direct or indirect link to the main grid (MG). e sample status of connected sources for a set of users is shown in Table 1. Each source has a maximum capacity of 1 kW.
As such, each user will have access to a variety of sources, and each user may connect to one or more sources at the same time. Analysis is performed based on this data. Table 2 Mathematical Problems in Engineering displays the example source generation status of five users whose load is smaller than the production capacity. Table 3 displays the example source generation status of five users whose load exceeds production capacity. e next step is to calculate transmission line factors. Each transmission line has its own transmission loss, which is denoted by a per unit value ranging from 0 to 1. Table 4 shows the sample transmission line per unit loss for three different sample consumers across five different interconnections.    e next step is to design the cost factor for transmission between the users. For the transmission between user, for each side, the cost of transmission will be different. is is due to the fact that a user may sell energy at a separate price while purchasing energy at a different price. Bidirectional cost variations for five transmission elements are shown in Table 5. Table 6 depicts the cost of pooling as determined by each user over a 24-hour period, whereas Table 7 depicts the individual cost factor split of five users during a defined time period. As a result, each user (HG), node, and grid (MG) will have a unique price indexing, and the system will have to select the optimal economic model from among all potential ones.

DATA PREPROCESSING AND THREADING
In the following stage, the optimization method must be implemented. e first step is to establish how much power will be pulled from the grid and how much from local users.
is was done first for ABC and then for PSO. UBC will use this information later to choose the best approaches. For preliminary purposes, the load is adjusted from no load to full load. For home grid (HG) and main grid (MG), the performance of each approach across these values is determined by calculation time and iterations. Table 8 depicts the performance analysis of the swarm models as the load step varies for 100 W. It has been discovered that when it comes to low load, PSO has demonstrated the best performance; thus, G Best is a suitable choice, whereas lower load may utilize ABC. However, this is not always the case; thus, a UCB is used at this stage to select the best model. e number of iterations has an effect on the computations as well. As a result, the influence of iterations is discovered in the following step. Figure 3 shows the effects of iterations in terms of RMSE, whereas Figure 4 shows the consequences of iterations in terms of time. It should be emphasized that as the number of iterations rises, so does the accuracy. However, this is not a linear deviation, and if required, an early stop is possible, as inaccuracy beyond a certain number of repetitions is less effective. When it comes to iterations and time, though, it resembles a stepped linear curve.
After assessing the impact of iterations and time, the exit criteria were defined. As shown in Table 9, after 100 iterations of the PSO technique, the optimal solution shifts from local to global best. Hence, it is set as the exit point.
At this point, a comparison of PSO and ABC solution convergence might be considered. As previously stated, the optimal output is typically achieved in fewer than 200 iterations. Different techniques will indicate different fitness convergence in distinct ranges. As previously stated, ABC has a superior impact over PSO in a number of scenarios.
is does not imply, however, that ABC is always the better choice. Figure 5 depicts the comparison of PSO and ABC solution convergence for three different cases for both methods.
So, once the cost functions and source status have been determined, the following step is to select a trading ratio between users and grid. e fixed cost (FC) and operating cost (OC) for both the home grid and the main grid, as well as the transmission line cost, have all been specified. It is expressed in a scale of 0 to 1. e cost of pooling is determined by the user and the main grid. After meeting his own needs, the user will constantly seek to contribute as much energy to the grid as feasible. e user will also make an effort to reduce supply while boosting cost. Table 10 depicts trade pooling for five users. e same procedure will be followed for nearby houses that will be replaced by the utility grid if the cost exceeds the grid's cost. Table 11 depicts grid pooling among individual houses while also taking transmission line characteristics into consideration.
Once the trade of ratio and percentage share of each user has been determined, the following stage is to locate the best sources. In most situations, the system will be built to satisfy peak demand, but because peak load occurs only for a        portion of the day, alternative source combinations will be available to meet the need. Both PSO and ABC are being used at this time. Implementation involves two phases: bounding and nonbounding paradigms.
As long as power generation is fixed, boundary models are employed to calculate power. Solar and wind energy are unreliable, and additional power must be obtained through a grid connection as necessary. In this situation, an       unbounded model is employed. Source selection using PSO is shown in Table 12. Table 13 compares the efficacy of PSO and ABC when it comes to selecting sources. When the source optimization is complete, the power flow analysis is carried out using the specified sources and transmission line factors. Table 14 provides the nodes and transmission line factors that were chosen, whereas Figure 6 depicts the optimum power flow between sources. e UBC is now being used to determine the optimal optimization model for the next iteration. UBC is used to assess each model's output in terms of both time and accuracy. As a result, the system will continually evaluate the results of each model. Whenever a new value arrives for execution, the UBC will choose the best model based on the incentives and penalties from previous stages. Table 15 shows example of each model's rewards and penalties,    and Figure 7 provides 360-instances of selections of the swarm model.

Conclusion
is work developed a smart economic load dispatch model for a demand response system by combining a multithreaded swarm model with reward-based reinforcement learning. Particle swarm optimization and artificial bee colony (ABC) optimization methods were used to analyze users, the grid, and neighboring users in order to determine the most cost-effective power sharing model. An upper bound confident (UBC) model is used as a semisupervised reinforcement model for each input data point to choose the best swarm model. e weighted Boruvka's Algorithm is used to determine the optimal power flow depending on transmission line costs and transmission losses. Each model's efficiency is assessed using the identical data for both models, and an error analysis is carried out. RMSE is used to verify the effectiveness of the findings. When it comes to economic trade calculations, ABC is proven to have an advantage over PSO in the majority of cases. PSO is still more accurate for optimal power sharing. A multithreaded model with improved accuracy, processing time, and efficiency was constructed supported by UBC.

Data Availability
e grid data used to support the findings of this study are available from the corresponding author upon request.