Optimization of the Conﬁguration and Operating States of Hybrid AC/DC Low Voltage Microgrid Using a Clonal Selection Algorithm with a Modiﬁed Hypermutation Operator

: The issue of optimization of the conﬁguration and operating states in low voltage microgrids is important both from the point of view of the proper operation of the microgrid and its impact on the medium voltage distribution network to which such microgrid is connected. Suboptimal microgrid conﬁguration may cause problems in networks managed by distribution system operators, as well as for electricity consumers and owners of microsources and energy storage systems connected to the microgrid. Structures particularly sensitive to incorrect determination of the operating states of individual devices are hybrid microgrids that combine an alternating current and direct current networks with the use of a bidirectional power electronic converter. An analysis of available literature shows that evolutionary and swarm optimization algorithms are the most frequently chosen for the optimization of power systems. The research presented in this article concerns the assessment of the possibilities of using artiﬁcial immune systems, operating on the basis of the CLONALG algorithm, as tools enabling the effective optimization of low voltage hybrid microgrids. In his research, the author developed a model of a hybrid low voltage microgrid, formulated three optimization tasks, and implemented an algorithm for solving the formulated tasks based on an artiﬁcial immune system using the CLONALG algorithm. The conducted research consisted of performing a 24 h simulation of microgrid operation for each of the formulated optimization tasks (divided into 10 min independent optimization periods). A novelty in the conducted research was the modiﬁcation of the hypermutation operator, which is the key mechanism for the functioning of the CLONALG algorithm. In order to verify the changes introduced in the CLONALG algorithm and to assess the effectiveness of the artiﬁcial immune system in solving optimization tasks, optimization was also carried out with the use of an evolutionary algorithm, commonly used in solving such tasks. Based on the analysis of the obtained results of optimization calculations, it can be concluded that the artiﬁcial immune system proposed in this article, operating on the basis of the CLONALG algorithm with a modiﬁed hypermutation operator, in most of the analyzed cases obtained better results than the evolutionary algorithm. In several cases, both algorithms obtained identical results, which also proves that the CLONALG algorithm can be considered as an effective tool for optimizing modern power structures, such as low voltage microgrids, including hybrid AC/DC microgrids.


Introduction
Over the last few years, the development of distributed, renewable energy sources (RES) and growing interest in prosumer installations have been observed. The presence of a large number of generation sources and energy storage devices (ESDs) in low voltage distribution networks promotes the creation of microgrids which are capable of synchronous operation with the remaining part of the power system as well as autonomous island operation. A significant part of the ESDs and microsources used in microgrids generate DC voltage. Connecting them to the AC network requires the use of DC/AC electronic power converters (EPCs). Some AC microsources, due to the high voltage frequency, require a connection to the microgrid via AC/AC converters. The use of EPCs between microsource or energy storage device and the AC network results in additional power losses and reduces the efficiency of generation units. Increasing the efficiency of the devices included in the microgrid is possible by connecting energy sources and storage devices generating DC voltage to the DC network and units generating AC voltage to the AC network. Both types of network can be connected with each other by means of a single, bidirectional AC/DC converter, thus creating a low voltage hybrid microgrid.
The complexity of a low voltage microgrid, resulting from a large number of microsources, ESDs, EPCs, and controlled loads, requires the development of an appropriate management system for their operation in order to achieve maximum efficiency of RES. Proper selection of elements forming the microgrid, as well as subsequent determination of the operating states of individual devices in such a way that the microgrid as a whole is in the optimal configuration for the problem under consideration is not an easy task. The complexity of the calculations is directly proportional to the number of devices installed. The creation of an effective control system is possible by using appropriate optimization algorithms, including those that use artificial intelligence methods. The division of optimization algorithms that can be used in problems related to microgrids is shown in Figure 1. distribution networks promotes the creation of microgrids which are capable of synchronous operation with the remaining part of the power system as well as autonomous island operation. A significant part of the ESDs and microsources used in microgrids generate DC voltage. Connecting them to the AC network requires the use of DC/AC electronic power converters (EPCs). Some AC microsources, due to the high voltage frequency, require a connection to the microgrid via AC/AC converters. The use of EPCs between microsource or energy storage device and the AC network results in additional power losses and reduces the efficiency of generation units. Increasing the efficiency of the devices included in the microgrid is possible by connecting energy sources and storage devices generating DC voltage to the DC network and units generating AC voltage to the AC network. Both types of network can be connected with each other by means of a single, bidirectional AC/DC converter, thus creating a low voltage hybrid microgrid.
The complexity of a low voltage microgrid, resulting from a large number of microsources, ESDs, EPCs, and controlled loads, requires the development of an appropriate management system for their operation in order to achieve maximum efficiency of RES. Proper selection of elements forming the microgrid, as well as subsequent determination of the operating states of individual devices in such a way that the microgrid as a whole is in the optimal configuration for the problem under consideration is not an easy task. The complexity of the calculations is directly proportional to the number of devices installed. The creation of an effective control system is possible by using appropriate optimization algorithms, including those that use artificial intelligence methods. The division of optimization algorithms that can be used in problems related to microgrids is shown in Figure 1. Among the methods of artificial intelligence used in solving optimization tasks, the most popular are evolutionary algorithms (EA) and particle swarm optimization (PSO). In article [1], a memory-based genetic algorithm, which is a type of EA, was used to minimize the power generation costs in the smart grid framework. The proposed method shares optimal power generation in a microgrid through different types of microsources. The authors of [2] use differential evolution algorithm (type of EA) for optimal single- Among the methods of artificial intelligence used in solving optimization tasks, the most popular are evolutionary algorithms (EA) and particle swarm optimization (PSO). In article [1], a memory-based genetic algorithm, which is a type of EA, was used to minimize the power generation costs in the smart grid framework. The proposed method shares optimal power generation in a microgrid through different types of microsources. The authors of [2] use differential evolution algorithm (type of EA) for optimal single-objective economic scheduling and bi-objective environmental-economic scheduling of community microgrids. Another popular artificial intelligence method used to solve optimization tasks is the PSO algorithm. In paper [3], PSO was used to find economically optimal solutions for day-ahead scheduling strategy of a microgrid equipped with CHP microsources. Article [4] Energies 2021, 14, 6351 3 of 24 concerns the use of the PSO as a management system of microgrids composed of different types of microsources and energy storage devices to minimize total operating costs of the microgrid.
There are many other artificial intelligence methods that can be used for solving different optimizations tasks, such as Artificial Neural Network, Fuzzy Logic or Artificial Immune Systems (AIS) [5][6][7]. The main objective of the research presented in this paper is to assess whether the AIS, operating on the basis of the CLONALG algorithm, can be used as an effective tool for optimizing the configuration and operating states of low voltage AC/DC hybrid microgrids.

Review of Knowledge in the Field of Hybrid AC/DC Microgrids
The article [8] presents an overview of microgrids cooperating with AC and DC power grids. Advantages and disadvantages of both technologies were discussed in detail in this publication. The differences in the manner of connecting microsources, ESDs, and receivers to the networks were described, and schematic diagrams of EPCs, protection, and monitoring systems were presented. The article also contains an overview of control and optimization systems aimed at ensuring the quality of electricity and stability of the microgrid. The publication was completed with an economic analysis and examples of operating microgrids all over the world.
Hybrid AC/DC systems constitute a separate group of microgrids. An outline of the structure of hybrid microgrid was presented in [9] and the first research works began in 2010 [10]. The simplest hybrid microgrid is composed of AC and DC networks connected to each other by means of a bidirectional AC/DC EPC [11][12][13][14]. In paper [15], the planning process of a hybrid AC/DC microgrid with optimal placement of DC feeders was described. The concept, control paradigm, and implementation of a bus-sectionalized hybrid microgrid was presented in article [16].
Both AC and DC networks in a hybrid microgrid have the same types of microsources and ESDs. The coexistence of AC and DC networks allows for greater efficiency of installed devices than in case of solutions using only one type of voltage. The DC network of the hybrid microgrid is a natural place for connecting photovoltaic panels [17,18], fuel cells [19], wind turbine generation sets equipped with DC generators [19], battery energy storage systems [20], and supercapacitors. The ability to integrate AC and DC networks within a hybrid microgrid can also contribute to the development of V2G technology [21][22][23].
Creating a hybrid microgrid concept allows combining the advantages of DC and AC networks, as well as eliminating some of the disadvantages of these network. The main advantages of using hybrid microgrids are described in [24] and include: • reduction of energy conversion levels in EPCs and associated power losses, • increasing the efficiency of RES, • increasing the level of reliability of energy supply, • increasing flexibility in regulatory services, • limiting the impact of higher current and voltage harmonics, • the ability to simplify the design of some electricity consumers by not having to use a built-in EPCs.
In terms of the method of connecting the hybrid microgrid to the external distribution network, coupled and separated topologies can be distinguished. In coupled topologies, the distribution network and the AC network of the hybrid microgrid are connected directly to each other using an MV/LV transformer. The DC network is connected using a two-way AC/DC converter. This converter can be connected to both low voltage and medium voltage sides of the transformer. In the case of separated topologies, the microgrid DC network is connected to the distribution grid through an AC/DC converter. Depending on the design, this converter can be connected directly to the medium voltage network or using a step-down transformer. In both of these cases, the AC low voltage network does not have a direct connection to the distribution grid. A detailed description of coupled and separated topologies is provided in [25]. As with other types of microgrids, popularization of hybrid microgrids requires the development of appropriate solutions for protection systems, taking into account the specificity of AC and DC networks. Detailed methods for solving problems related to the protection of hybrid microgrids are presented in publications [26][27][28].
In the field of architecture of hybrid microgrid control systems, the same centralized and distributed control solutions are used as in the case of AC and DC microgrids. It should be noted that the hybrid microgrid control system must provide the ability to control the operating states of the AC/DC converter connecting the networks of both types of voltage in order to properly manage energy exchange between them. An example of a hybrid microgrid centralized control system has been described in [29]. Article [30] presents a coordination control strategy for a hybrid microgrid in standalone mode.

Objective and Contribution
The main objective of this paper is the assessment of the effectiveness of the AIS in solving tasks related to the optimization of the configuration and operating states of a hybrid AC/DC low voltage microgrid. Below are the contributions of this paper: • modification of hypermutation operator used in the CLONALG algorithm, • development of an optimization algorithm of operating states of hybrid AC/DC low voltage microgrid, • comparison of the obtained results using classic and modified CLONALG algorithms as well as evolutionary algorithms.
The remainder of this paper is organized as follows: Section 2.1 presents the formulated optimization tasks. The mathematical models of this tasks are presented in Section 2.2. Section 3 describes the proposed microgrid optimization algorithm. The case study, including description of the test hybrid AC/DC low voltage microgrid, results of optimization calculations, as well as comparison of the calculation results obtained using the CLONALG algorithm and the evolutionary algorithm and discussion about these results are presented in Section 4. The summary and main conclusions are included in Section 5. The paper ends with a list of references.

Optimization Problem Formulation
In order to ensure proper operation of the hybrid AC/DC microgrid as a coherent system, it is necessary to implement appropriate strategies for controlling the operation of individual components of this system. The strategy of centralized two-stage control is considered in this article. Each of the microsources, ESDs, EPCs, and controlled loads should be equipped with a local controller. The task of local controllers is to collect information about the status of individual devices and send them to a central controller, which carries out the process of optimal control of the microgrid. Local controllers also receive signals from the central controller and force the appropriate behavior of the devices they control. The adopted control strategy allows the hybrid microgrid to operate in a synchronous mode with an external distribution grid, or autonomously in island mode. In both of these cases, determining the operating states is necessary to meet the given optimization criteria. The central controller must also distinguish between a number of factors affecting the possible operating states of microgrid components, such as power demand values and generation capacities of RES during the optimization period, acceptable regulatory ranges of individual devices in microgrid, instantaneous energy storage state of charge (SOC) levels, technical data of microgrid components, and mode of microgrid cooperation with an external distribution grid.

Optimization Tasks
In this paper, three single-criteria optimization tasks are formulated: • task 1-minimization of total active power losses, • task 2-minimization of costs associated with the operation of the hybrid AC/DC microgrid, • task 3-maximization of level of power generated by RES.
In the first task, the control strategy assumes that the individual devices included in a hybrid microsystem will be controlled to obtain the lowest possible values of total active power losses in the optimization period under consideration. The amount of this losses can be described by the following formula: The reduction of active power losses is achieved by changing the power flow in the microgrid, resulting from the levels of microsources generation, load level and mode of operation of ESDs, as well as the demand for controlled loads. To minimize active power losses, microgrid central controller must have information about the current power flow in the microgrid and determine the expected power flow for subsequent settings of individual microgrid elements.
In the second task, control strategy assumes determination of such operating states of individual components of hybrid microgrid so that the total costs related to the functioning of this microgrid in the considered optimization period will be as low as possible. In order to implement this strategy, a hybrid microgrid operator (HMO) was defined as an intermediary in financial settlements between customers and the distribution system operator (DSO). The costs to be minimized can be written using the following formulas: In the last task, the control strategy consists of determining the operating states of individual components of the hybrid microgrid so that the sum of power generated in microsources using renewable primary energy resources is as high as possible in the considered optimization period. The level of power generated by RES is determined by the following formula:

Mathematical Models of Formulated Optimization Tasks
In order to solve formulated optimization tasks, appropriate mathematical models are defined for each of them, containing a problem representation, the form of objective function, and a set of constraints.
For each of the formulated tasks, a δ vector is defined, which represents a set of solutions to a given optimization problem. This vector contains a binary sequence coding the operating states of individual components of the hybrid microgrid. On the basis of the data contained in the δ vector, load flow calculations on the hybrid microgrid are performed, and then, depending on the considered optimization criterion, the following are determined: active power losses, costs related to the operation of the hybrid microgrid and RES generation levels. The mathematical notation of the objective functions defined for individual tasks is as follows: Determining the optimal operating states of a hybrid microgrid requires that the following constraints be met: • none of the microsources/ESDs connected the hybrid microgrid may operate with output power greater than nominal power of this microsource/ESD: • none of the microsources/ESDs/EPCs connected to the AC part of hybrid microgrid may operate with a power factor cos(ϕ) lower than the nominal power factor of this microsource/ESD/EPC: • current flow in any of the power lines should not be greater than the long-term current carrying capacity of this power line: • voltage level at each of the hybrid microgrid nodes may not exceed the maximum or minimum allowable values: • power flow in the EPC/transformer cannot be greater than the nominal power of this EPC/transformer: • The SOC level of each ESD should be within the limits allowed for that ESD: • the synchronous generator acting as a balancing source in the AC part of the hybrid microgrid cannot go into motor operation:

Description of the Proposed Microgrid Optimization Algorithm
An AIS based on a CLONALG will be used to solve the defined optimization tasks. In order to "build" a properly functioning immune system, it is necessary to determine: • the method of representation of the optimization task solutions, • how to create the initial set of antibodies (candidate solutions), • the method of assessing the solution (formulation of the evaluation function), • how to adapt the AIS during its operation.
A binary representation of the problem is assumed for each of the defined optimization tasks. The antibody should then be understood as the δ vector encoding the operating states of all devices controlled by the immune system within a hybrid microgrid. The δ vector consists of a binary sequence divided into groups of different lengths, coding individual operating states. The number of groups is equal to the number of operating states determined during the operation of AIS. Determining the number of bits belonging to a single group (length of a group) requires knowledge of the allowable adjustment range of individual devices and the expected accuracy (number of decimal digits).
The initial set of antibodies is created as a N × l matrix, where N is the number of antibodies in the set and l is the number of bits encoding the given antibody-size of the antibody. Knowing the number of antibodies and their size, the optimization algorithm randomly assigns the values "0" or "1" to individual bits, creating the initial set of antibodies.
After creating the initial set of antibodies, an optimization algorithm determines the operating states of individual devices installed in the microgrid. The next steps performed by the algorithm are the calculation of the power flow, determining the value of the evaluation function appropriate for the optimization task being solved.
The transformation of the objective functions defined in Section 3 into evaluation functions is necessary due to the development of a universal algorithm for solving minimizing and maximizing optimization tasks. In the case of minimizing tasks, the objective and evaluation functions are identical. For the maximization task 3 evaluation function take the following form: Formulation of the evaluation functions in accordance with the above-mentioned description aims at transforming all defined optimization tasks into minimizing tasks.
The load flow calculation performed by the optimization algorithm also allows to check whether the found solution does not violate the constraints. The algorithm enforces compliance with constraints by introducing appropriate penalty functions whose task is to increase the value of evaluation function in case of violation of constraints. The general mathematical notation of penalty functions is as follows: The operation of the AIS is based on determining the affinity of the antibody to the presented antigen, whose role in optimization tasks is performed by the antibody encoding the best solution found so far for the given task. The determination of affinity is calculated as follows: After determining the affinity, antibodies in the set are sorted in descending order. The next step performed by the algorithm is to select N1 antibodies with the highest affinity and create their clones. The number of clones is directly proportional to the affinity of the antibody and calculated as follows: Created clones are then subjected to a hypermutation process, inversely proportional to the affinity of the antibody. The probability of mutation of an antibody is determined as follows: In the classical variant of the CLONALG, the mutation operator generates r = N·l pseudo-random numbers between 0 and 1. For binary problem representation, mutation of a single bit in an antibody occurs when the generated pseudo-random number is less or equal to the probability of mutation. The presented scheme of the hypermutation operator operation shows that with a sufficiently high probability value, all bits in the analyzed antibody can undergo mutation. This article presents a modification of the hypermutation operator to enable changing the value of only a single bit in a given antibody. The modification consists of the fact that the number of generated pseudo-random numbers on the basis of which the algorithm decides whether to make a mutation has been limited to r = N. In case the generated pseudo-random number is less than the probability of mutation, a second pseudo-random generator is launched, which randomizes an integer ranging from 1 to l. The generated second pseudo-random number is the position of the bit being mutated. The operation diagram of the modified hypermutation operator is shown in Figure 2.
After determining the affinity, antibodies in the set are sorted in descending order. The next step performed by the algorithm is to select 1 antibodies with the highest affinity and create their clones. The number of clones is directly proportional to the affinity of the antibody and calculated as follows: Created clones are then subjected to a hypermutation process, inversely proportional to the affinity of the antibody. The probability of mutation of an antibody is determined as follows: In the classical variant of the CLONALG, the mutation operator generates = • pseudo-random numbers between 0 and 1. For binary problem representation, mutation of a single bit in an antibody occurs when the generated pseudo-random number is less or equal to the probability of mutation. The presented scheme of the hypermutation operator operation shows that with a sufficiently high probability value, all bits in the analyzed antibody can undergo mutation. This article presents a modification of the hypermutation operator to enable changing the value of only a single bit in a given antibody. The modification consists of the fact that the number of generated pseudo-random numbers on the basis of which the algorithm decides whether to make a mutation has been limited to = . In case the generated pseudo-random number is less than the probability of mutation, a second pseudo-random generator is launched, which randomizes an integer ranging from 1 to l. The generated second pseudo-random number is the position of the bit being mutated. The operation diagram of the modified hypermutation operator is shown in Figure 2.  After the hypermutation operation, the modified clones are added to the antibody set. To prevent excessive growth of the set of antibodies, the algorithm removes N2 antibodies with the lowest affinity, and then complements the free spots in the set with new, randomly generated antibodies. Then the algorithm goes to the next iteration by re-determining the operating states of individual devices installed in the microgrid. The algorithm's operation cycle is repeated until the stop condition is reached. The last step performed by the algorithm is to save the results of the optimization calculations.
The optimization algorithm was implemented using the DPL script language included in the PowerFactory v.15.2 software [31]. Ranges of settings of individual devices in the microgrid and ESDs SOC are loaded once after the script has been started. Generation profiles of RES and power demand profiles of consumers are cyclically loaded for each of the optimization periods considered. All mentioned input data are saved in appropriate text files. Changing the settings of parameters controlling the operation of the algorithm and economic quantities, such as electricity purchase prices or per unit fixed costs, is made directly in the source code of the script implementing the optimization algorithm. The general block diagram of the script implementing the optimization algorithm, taking into account the above description, is presented in Figure 3.
rithm's operation cycle is repeated until the stop condition is reached. The last step performed by the algorithm is to save the results of the optimization calculations.
The optimization algorithm was implemented using the DPL script language included in the PowerFactory v.15.2 software [31]. Ranges of settings of individual devices in the microgrid and ESDs SOC are loaded once after the script has been started. Generation profiles of RES and power demand profiles of consumers are cyclically loaded for each of the optimization periods considered. All mentioned input data are saved in appropriate text files. Changing the settings of parameters controlling the operation of the algorithm and economic quantities, such as electricity purchase prices or per unit fixed costs, is made directly in the source code of the script implementing the optimization algorithm. The general block diagram of the script implementing the optimization algorithm, taking into account the above description, is presented in Figure 3.

Case Study
In order to evaluate the possibility of using the CLONALG with a modified hypermutation operator in the process of optimizing the configuration and operating states of the hybrid microgrid, exemplary calculations were carried out in the test microgrid working synchronously with the distribution power grid and in island mode. The optimization calculations were repeated using the CLONALG with the classic variation of the hypermutation operator and the evolutionary algorithm to compare the obtained results and verify the correct operation of modified CLONALG algorithm. Sample results of the calculations carried out are presented later in this paper.

Description of Test Hybrid Microgrid
Optimization calculations were carried out for a hybrid test microgrid supplying a single-family house estate. It is a microgrid consisting of AC and DC networks connected to each other with an EPC. Individual nodes of both types of network were connected by overhead lines. DC power lines were built as double-track AsXS 2 × 70 type lines and AC power lines were built as single AsXS 4 × 70 type lines. The AC network is connected to the external distribution grid via MV/LV transformer and AFL6 35 type medium voltage line. The technical data of individual elements of the hybrid test microgrid are given in Table 1. The schematic diagram of the test microgrid is presented in Figure 4.  In a hybrid test microgrid, 24 non-controlled loads connected only to the AC network were modeled. Each of the load was characterized by assigning to it one of three different daily active and reactive power demand characteristics. The total daily power demand characteristics of the test microgrid are presented in Figure 5.  In a hybrid test microgrid, 24 non-controlled loads connected only to the AC network were modeled. Each of the load was characterized by assigning to it one of three different daily active and reactive power demand characteristics. The total daily power demand characteristics of the test microgrid are presented in Figure 5. In a hybrid test microgrid, 24 non-controlled loads connected only to the AC network were modeled. Each of the load was characterized by assigning to it one of three different daily active and reactive power demand characteristics. The total daily power demand characteristics of the test microgrid are presented in Figure 5.  The hybrid test microgrid was equipped with 9 microsources, divided into three categories (1 reciprocating engine (RE) with synchronous generator connected directly to the AC network, 3 wind microturbine generation sets, and 5 photovoltaic sources connected to the DC network via power inverters). Technical data of installed microsources are presented in Table 2. Daily characteristics of photovoltaic sources and wind microturbine generation sets' generation capacity for two selected days of the year are presented in Figure 6. For microsources owned by the HMO, fixed costs per unit of 0.0014 USD/kW/T were adopted, where T is an optimization period of 10 min. HMO is not charged with fixed costs resulting from the maintenance of microsources owned by individual consumers. Variable costs per unit of the reciprocating engine were adopted at the level of 0.0279 USD/kW/T; it was also assumed that this value constitutes the purchase price of energy generated in microsources owned by individual consumers. Variable costs of the HMOs photovoltaic source are zero. The regulation of the generated power level of photovoltaic sources and wind microturbine generation sets is carried out by detuning the converter connecting the source with the hybrid microgrid from the maximum power operation point (MPP) on the production characteristics of the given source [32].
It depends on the atmospheric conditions prevailing in a given optimization For microsources owned by the HMO, fixed costs per unit of 0.0014 / / were adopted, where is an optimization period of 10 min. HMO is not charged with fixed costs resulting from the maintenance of microsources owned by individual consumers. Variable costs per unit of the reciprocating engine were adopted at the level of 0.0279 / / ; it was also assumed that this value constitutes the purchase price of energy generated in microsources owned by individual consumers. Variable costs of the HMOs photovoltaic source are zero. The regulation of the generated power level of photovoltaic sources and wind microturbine generation sets is carried out by detuning the converter connecting the source with the hybrid microgrid from the maximum power operation point (MPP) on the production characteristics of the given source [32].   The test microgrid was equipped with 9 ESDs with a rated power of 50 kW and a capacity of 37 kWh, owned by individual consumers. The HMO also has one energy storage device with a rated power of 40 kW and a capacity of 160 kWh. All ESDs have been connected only to the DC network. In the process of controlling ESDs, it was assumed that they could operate in the full range of power regulation. However, the charge or discharge power may be reduced if the energy level in the storage device is not within acceptable limits. These limits are: • from 5% to 95% of the storage capacity between 12:00 am to 6:50 pm, • from 40% to 60% of the storage capacity between 7:00 pm to 11:50 pm.
The greater reduction on the SOC of ESDs in the evening is designed to prepare them for operation during the next day, so that they are able to balance the shortage or surplus of generated power in microsources in relation to the power demand of customers. As in the case of microsources, the HMO is not charged with fixed costs resulting from the maintenance of consumers ESDs. Consumers have full freedom in the choice of energy storage technology and capacity, which forces HMO to maintain the appropriate infrastructure enabling the connection of the storage device to the network. It has been assumed that the costs per unit of maintaining a single connection is 0.004 USD/kW/T. The same numerical value is a fixed costs per unit for the energy storage device owned by HMO. HMOs variable costs include per unit costs of discharging energy storage device, amounting to 0.0095 USD/kW/T. The price from the sale of energy taken to charge storage devices belonging to the consumers amounts to 0.0322 USD/kW/T and it is HMO revenue.
It should also be noted that the energy storage device owned by HMO is not subject to optimization. The device works as a source balancing the DC network. The use of energy storage as a balancing element of the DC network allows optimization of the operating states of the EPC connecting both DC and AC networks, which translates into control of power flow between both networks. In the case of island operation of the hybrid microgrid, the reciprocating engine was excluded from the optimization process, also to assign the role of balancing source to this device.

Results of Optimization Calculations Carried out Using the Modified CLONALG Algorithm
In order to obtain the results of optimization calculations, a 24 h microgrid operation simulations were performed for a test microgrid. Simulations were made for both synchronous and island operation. Two different load demand profiles for working day and for holiday were taken into account, as well as two generation profiles for RES for 2 March 2017 and 10 December 2017. In total, eight simulations were carried out for a single optimization task. Each of the simulations was started for the same initial ESDs SOC levels and the following settings of the algorithm control parameters: The number of iterations of the optimization algorithm depended on the chosen optimization tasks and microgrid operation mode; detailed values are given in Table 3. Selected results of optimization calculations (for a single optimization period) are presented in Tables 4-6 Figure 10 presents the changes in the value of the evaluation function in task 1 for a microgrid operating synchronously with the distribution network depending on the selected RES generation capacity profile, and the power demand profile (the figure shows calculation made at 10:50 am). Exemplary daily changes of the operating states of a selected microsource for a microgrid operating synchronously with the distribution network depending on the RES generation capacity profile of 2 March 2017 and the power demand profile for a working day are shown in Figure 11.

Comparison of Calculation Results Obtained Using the CLONALG Algorithm and the Evolutionary Algorithm
Due to the modification of the hypermutation operator used in the CLONALG and the wish to verify the obtained optimization results, a comparative analysis of these results was carried out with the results obtained using the evolutionary algorithm, which is commonly used to solve optimization tasks in the field of power engineering [33][34][35][36][37]. In the evolutionary algorithm used for comparison, a stochastic sampling with replacement was used as a selection method. A binary representation of the problem, identical to the CLONALG, was also assumed. Within the control parameters of the evolutionary algo-

Comparison of Calculation Results Obtained Using the CLONALG Algorithm and the Evolutionary Algorithm
Due to the modification of the hypermutation operator used in the CLONALG and the wish to verify the obtained optimization results, a comparative analysis of these results was carried out with the results obtained using the evolutionary algorithm, which is com-monly used to solve optimization tasks in the field of power engineering [33][34][35][36][37]. In the evolutionary algorithm used for comparison, a stochastic sampling with replacement was used as a selection method. A binary representation of the problem, identical to the CLON-ALG, was also assumed. Within the control parameters of the evolutionary algorithm, a crossover probability of 0.22 and a mutation probability of 0.07 were assumed. The number of chromosomes was equal to the number of antibodies defined in the CLONALG and both algorithms performed the same number of iterations within the considered optimization period. The results of the comparison are shown in Tables 7 and 8. The results of the comparison are shown in Table 9. Figure 12 shows the convergence of the optimization process for tasks 1 and 2.  The results of the comparison are shown in Table 9. Figure 12 shows the convergence of the optimization process for tasks 1 and 2.

Discussion
The concept of a hybrid low voltage AC/DC microgrid controlled by AIS could be an interesting way to integrate renewable energy sources, energy storage units, as well as electric vehicles into an efficient and easy to manage power microsystem.
Analyzing the results of optimization calculations constituting a 24 h simulation of the operation of the hybrid microgrid, it should be stated that the AIS, functioning on the basis of a CLONALG, is able to carry out the process of optimizing the configuration and operating states of the hybrid microgrid, working synchronously with the external distribution network. In case of the island operation, for all formulated optimization tasks, the algorithm was not able to ensure the correct operation of the microsystem for 24 h. Premature termination of optimization calculations is not due to the malfunction of the AIS, but to the structures of test microgrid that were not designed for long-term island operation.
The obtained results also depend on the adopted assumptions regarding RES generation profiles and consumer power demand profiles. Analysis of the results of the optimization calculations shows that there is a relationship between the results obtained and the choice of the power demand profile. Similar conclusions can be drawn based on the analysis of various RES generation capacity profiles. In the example of the task of maximizing the level of power generated by RES, there are clear differences between generation capacities in spring and winter.
Analyzing the progress of the optimization process, it should be stated that it proceeded correctly for all considered cases. Subsequent iterations of the algorithm for solving formulated optimization tasks results in a decrease in the value of the evaluation function. The sharp decline in the value of the evaluation function in the initial iterations of the algorithm testifies to the proper functioning of the AIS and the effective elimination of suboptimal solutions. The advantage of the CLONALG over the evolutionary algorithm in the first stage of the optimization process can be due to two mechanisms: • cloning probability directly proportional to the affinity of the antibody to antigen, combined with inverse proportional hypermutation, • removal from the population antibodies with the lowest affinity to antigen.
The first mechanism operates by selecting a certain number of antibodies with the highest affinity (the best solution in a given iteration) and subjecting them to the cloning and hypermutation processes. The second mechanism is used to protect the algorithm against an excessive increase in population size, and thus a decrease in its efficiency, by removing the worst solutions of the optimization task and, if necessary, supplementing the population with new randomly generated antibodies. Both mechanisms mentioned above cause that in the initial phase of operation, the AIS rejects the worst solutions faster than the evolutionary algorithm.
While searching for optimal solutions for formulated tasks, the AIS changed the operating states of individual devices in the test hybrid microgrid. The way the selected microgrid element works depends to a large extent on the chosen optimization task and on the input data. For example, in task 2, the analyzed microsource (photovoltaic panel) is switched off practically throughout the simulation, while in task 3, it works with the maximum achievable power.
A comparative analysis of optimization calculations carried out using an AIS based on a CLONALG and an evolutionary algorithm showed that for tasks 1 and 2 in most of analyzed cases more favorable results of calculations were obtained using AIS and thus the proposed optimization method is an effective optimization tool. For task number 3, the advantage of AIS is smaller than in previous cases and for some optimization periods, both algorithms obtained identical results. This is especially visible in the case of optimization of microgrid operating in the island mode; however, it should be noted that the number of analyzed optimization periods is relatively low, compared to the optimization of the synchronously operating microgrid. Due to the wish to verify the modification of the hypermutation operator introduced in the CLONALG algorithm, a comparison (only for selected optimization periods) was also made with the classic version of this operator. The obtained calculation results indicate that the change in the mode of operation of the hypermutation operator resulted in an improvement of the results obtained in most of the considered cases.
When assessing the convergence of the examined optimization algorithms, it was noticed that the CLONALG algorithm with the modified hypermutation operator in most of analyzed cases gains an advantage over the other algorithms in the first few iterations of the optimization process. Further observations of the behavior of analyzed algorithms allow us to state that in the final stage of the optimization process, the differences in the obtained results are not relatively high and modified CLONALG rarely obtained worst solution. The complexity of the CLONALG algorithm, compared to the evolutionary algorithm, will require a longer computation time. This fact theoretically acts as a disadvantage of AIS as an optimization tool, but the observed tendency to remove suboptimal solution quickly in an initial stage of optimization process may be an advantage of the method proposed in this paper.

Conclusions
From the obtained results of the optimization calculations, the following conclusions can be made: • It is possible to use an AIS based on the CLONALG algorithm as an effective optimization tool for hybrid AC/DC microgrids operating on both synchronous and island mode, • in most of the considered cases, optimization with the use of an AIS resulted in finding a better solution compared to optimization with an evolutionary algorithm, • the introduced modification of the hypermutation operator contributed to the improvement of the obtained results in relation to the classic version of CLONALG algorithm as well as evolutionary algorithm, • the modified CLONALG algorithm showed a stronger tendency to reject suboptimal solutions in the early phase of the optimization process than its classic version, • the artificial immune system, operating on the basis of the CLONALG algorithm, requires greater computational effort that the commonly used evolutionary algorithm; however, the aforementioned tendency to quickly reject suboptimal solutions at an early stage of the optimization process may be an advantage of the AIS, • both algorithms, due to the way they work, do not guarantee that the solution they find is a global optimum. The analysis of the convergence of these algorithms suggest that the obtained solutions are a quite good approximation of the global optimum. • the optimization tasks formulated and solved in this paper can be implemented in real installations. However, this process requires the construction of an appropriate telecommunications infrastructure that allows monitoring the state of individual microgrid elements and sending control signals to them.
The author of the article considers it advisable to conduct further research on the possibility of using AISs in solving optimization problems in the field of power engineering, especially in the field of optimization of configuration and operating states of hybrid microgrids. Another important direction of future research is also the optimization of the structure of newly design hybrid microgrids in terms of the selection of the composition of generating units, ESDs, and EPCs coupling AC and DC networks. In addition, from the IT side, research is possible to increase the efficiency of the computational algorithms used.

Conflicts of Interest:
The authors declare no conflict of interest.

Abbreviations
The following abbreviations are used in this manuscript. ∆P TOT T total active power losses in the hybrid microgrid during the optimization period N l /N TR /N EPC number of power lines/transformers/EPCs in the hybrid microgrid ∆P l i /∆P TR j /∆P EPC k active power losses in the ith power line/jth transformer/kth EPC belonging to the hybrid microgrid C TOT T total costs related to the operation of hybrid microgrid during the optimization period C FIX T /C VAR T total fixed/variable costs related to the operation of hybrid microgrid during the optimization period C FIX DSO fixed costs related to maintaining the connection of hybrid microgrid with external distribution system C FIX MSHMO /C FIX ESHMO fixed costs related to the maintenance of microsources/ESDs owned by HMO C FIX MEL fixed costs related to maintaining the infrastructure enabling consumers to connect microsources and ESDs to the microgrid C VAR DSO variable costs associated with the purchase of energy from DSO C VAR MSHMO /C VAR ESHMO variable costs related to the operation of microsources/ESDs owned by HMO C VAR MSL /C VAR ESL variable costs related to the purchase of energy generated in microsources/taken from energy storage units owned by individual customers supplied from hybrid microgrid P RES T total active power generated in RES belonging to hybrid microgrid during the optimization period N RES number of RES installed in hybrid microgrid P G i active power generated by ith RES δ vector which coding a candidate solution F O i objective function for ith optimization task S i /P i apparent/active power generated by ith microsource connected to the AC/DC part of hybrid microgrid S n i /P n i nominal apparent/active power of the ith microsource connected to the AC/DC part of hybrid microgrid MS AC /MS DC set of microsources connected to the AC/DC part of hybrid microgrid S ESD AC i /P ESD DC i apparent/active power measured at the connection point of ith ESD connected to AC/DC part of hybrid microgrid S ESD ACn i /P ESD DCn i nominal apparent/active power of the ith ESD connected to AC/DC part of hybrid microgrid SD AC /SD DC set of ESDs connected to AC/DC part of hybrid microgrid cos ϕ MS i /cos ϕ ESD i /cos ϕ EPC i power factor of the ith microsource/ESD/EPC connected to the AC part of hybrid microgrid cos ϕ MS n i /cos ϕ ESD n i /cos ϕ EPC n i nominal power factor of the ith microsource/ESD/EPC connected to the AC part of hybrid microgrid MS AC /SD AC /PC set of microsources/ESDs/EPCs connected to the AC part of hybrid microgrid I i current flow in the ith power line I cc i long-term current capacity of the ith power line L set of power lines belonging to the hybrid microgrid U min i /U max i minimum/maximum allowable voltage level for ith node U i voltage measured in ith node N set of nodes belonging to the hybrid microgrid S EPC AC i /P EPC DC i apparent/active power flow through the alternating/direct current circuits of the ith EPC S EPC ni /P EPC ni nominal apparent/active power of the ith EPC S TR i apparent power flow through the ith transformer S TR ni nominal apparent power of ith transformer PC/TR set of EPCs/transformers belonging to the hybrid microgrid SOC min i /SOC max i minimum/maximum allowable SOC level of the ith ESD SOC i current SOC level of the ith ESD SD set of ESDs belonging to the hybrid microgrid P SG active power generated by a synchronous generator acting as a balancing source eval i evaluation function for ith optimization task C 3 non-negative constant for task 3 eval p i evaluation function after taking into account the penalty functions eval i evaluation function for ith optimization task n number of defined constraints Ψ j general form of the penalty function for jth constraint ψ j detailed form of the penalty function for jth constraint a j /b j non-negative coefficient of sensitivity of the penalty function significant for minor/major exceedances of jth constraint AFF i affinity of ith antibody best_eval value of the evaluation function of the antibody encoding the best solution found so far N CL i number of clones of ith antibody from N1 selected antibodies N CL max /N CL min maximum/minimum number of clones created for a single antibody AFF max /AFF min maximum / minimum affinity of N1 selected antibodies ε → 0 constant value P MUT i probability of mutation of ith antibody among the clones created P MUT min /P MUT max minimum/maximum probability of mutation