Reactive power optimisation of distribution network with distributed generation based on genetic and immune algorithm

With the rapid development of new energy technologies, distributed power generation technology has attracted widely attention. The advantages of them are small investment, clean and environmental protection, reliable, and flexible power supply. They can output (or absorb) continuously adjustable reactive power and participate in the reactive power optimisation, which can keep the balance of reactive power and optimise the distribution of reactive power flow. In this study, firstly, the power flow model of typical distributed power supplies: wind power, solar power, and gas turbine power generation are researched. Then, the distributed power supply as a continuously adjustable reactive power device, combined with the traditional equipment, participate in reactive power optimisation. An objective function considering system loss is proposed to find optimal solution. Finally, the IEEE33 node system is used for verification. Results show that the distributed power supply can effectively reduce the system loss and improve the voltage stability. Meanwhile, the effectiveness and feasibility of the improved algorithm are verified. The optimisation of this study is the combination of genetic algorithm and immune algorithm. It can make up for the lack of local optimisation ability of genetic algorithm. Compared with the single algorithm, the global optimisation ability is greatly enhanced.


Introduction
Distributed power supply has the characteristics of modularity, small dispersion, energy conservation and environment protection, energy diversification [1][2][3]. Reasonable configuration for access point and capacity of the distributed power supply can balance the load on-site, support system voltage, and reduce the system loss. Meanwhile, by adjusting the output of the reactive power to participate in the reactive power optimisation of distribution network, distributed power supply can help reduce operating costs and improve operating efficiency to some extent [4,5].
At present, there are many model algorithms for parallel network optimisation of the distributed power supply, such as multi-objective function normalisation weighting method, environmental benefit incentive factor method, and annual investment running cost fuzzy expected minimum method [6]. The optimisation algorithm [7][8][9] includes internal point method, genetic algorithm, particle swarm algorithm, fuzzy algorithm and so on. In Zhao and Geng [10], the non-linear mathematical model of the power system is introduced, which is based on the minimum weighted sum of the system loss, the out of limit value of node voltage, and the amount of reactive power generation. The if-then rules to accelerate the convergence of genetic operation effect based on natural selection and genetic mechanism of genetic algorithm is introduced, however, the local search ability of the genetic algorithm is weak, thus it will lead to problems such as early maturity when iteration times are huge. Early maturity makes the algorithm difficult to meet the needs of the actual operation optimisation. Zhong et al. [11] propose an immune algorithm for reactive power optimisation of the power system. The algorithm adopts the selection mechanism of affinity calculation and avoids the local optimal solution effectively. Through the mechanism of antigen memory, local search ability and calculation speed are improved. However, the convergence rate is slow and timeconsuming.
In this paper, the power flow model of wind power, photovoltaic power, and micro gas turbine is established [12][13][14][15], then, this paper proposes an objective function basing on loss reduction. Meanwhile, this paper takes two constraints into consideration. Firstly, whether the basic voltage is within the reasonable range. Secondly, the limits of the number of shunt capacitors and the voltage regulating transformers. The optimisation problem is solved by using genetic immune algorithm to discrete the solution space of the optimisation problem. The advantages of genetic immune algorithm are as follows. Firstly, it is easy to realise. Secondly, the objective function limit is less, so it makes dealing with discrete variables easier, and makes searching to the global optimal solution to a larger probability. The disadvantages are that the local search ability is weak, more iteration, and time-consuming. As for the immune algorithm the advantages are that the local search ability is strong, the calculation speed is faster. The disadvantages are that the convergence speed is low, the calculation precision is not high and it is easy to produce early maturity. The combination of these two algorithms can improve the optimisation speed effectively to meet the need of actual operation optimisation.

Wind power generation
The asynchronous motor directly connected to the grid generator system and the doubly fed power generation system are commonly seen in the wind power system. The equivalent node types are different in the power flow calculation due to different operation modes and control strategies.
2.1.1 Asynchronous motor directly connected to the grid: Asynchronous motor directly connected to the grid is often used in the early stage of wind generation. Since the asynchronous generator has no excitation system itself, it relays on absorbing the reactive power form the power grid to build the magnetic field, and it has no voltage regulation capability. So asynchronous generator outputs active power and absorbs certain reactive power from the system at the same time, the amount of the reactive power absorbed is determined by the slip ratio and node voltage. In order to reduce losses, the principle of the local compensation of reactive power are generally adopted, it is realised by switching the parallel capacitor group in wind generations. Simplified model of the asynchronous generator are shown in Fig. 1. The parameters are explained as follows: X m is the excitation reactance, X s is the stator leakage reactance, X r is the rotor leakage reactance, X c is the machine terminal parallel capacitor, r r is the rotor resistance, s is the slip ratio, the stator resistance is negligible.
For the wind field, the output of the active power is related to the wind area, wind speed, and air density of the blades, which can be expressed as (5) The parameters are explained as follows: ρ represents the air density in kg/m 3 ; S represents for the swept area of rotor; C represents for rotor power coefficient which can reach 0.67 theoretically.
In the power flow calculation, P can be considered as a given value so the reactive power Q absorbed is related to the terminal voltage U and the slip ratio s, so the function relation of the absorption Q of the asynchronous wind generator with U and s can be introduced as (6) It can be seen that the active power generated by the asynchronous generator is a fixed value, and the reactive power is related to the terminal voltage and the slip ratio. In the power flow calculation, this kind of power node is called voltage static characteristic node. During the calculation, the voltage is modified, and the reactive power absorbed by the asynchronous generator is calculated according to the modified voltage amplitude. In this way, the node is transformed into a node which can be processed by the traditional load flow algorithm, and the equivalent represents the difference between the reactive power absorbed by the generator and the original compensation reactive power. The advantages of this method are that it has good accuracy, the calculation quantity is small, and the speed calculation is fast.
2.1.2 Doubly fed power generation system: The steady-state equivalent circuit of the doubly fed wind generator is shown in Fig. 2. The parameters are explained as follows: X m represents for the excitation reactance, X s represents for the stator leakage reactance, X r is the rotor leakage reactance, r r is the rotor resistance, r s is the stator resistance, r m is the excitation resistance. The total active power P e injected to the power system by the generator consists of two parts, one part is the active power generated by the stator winding P S , which can be obtained by the wind speed power characteristic. The other part is the active power generated or absorbed by the rotor winding P r , which is injected to the system when the rotating speed is higher than the synchronous speed. When the speed is lower than the synchronous speed, the rotor winding absorbs the active power from the system. Reactive power also consists of two parts, one part emits or absorbs reactive power generator by the stator side and the other part emits or absorbs reactive power from the rotor side. According to the different control modes, the doubly fed power generation can be equivalent to different power nodes. The control modes are controlled by constant power factor and controlled by constant voltage.
According to the equivalent circuit model of the double-fed wind motor, in the case of ignoring the stator winding resistance, the active power generated on the rotor winding is represented as (7) The total active power injected to the system: In the above formula, x = x s + x r , P s can be obtained by the wind speed power characteristic, and the slip ratio can be obtained by the speed control law of the double-fed wind turbine s = ω 1 − ω /ω 1 .
In which ω 1 represents the synchronous speed of the generator, and it is generally a fixed value, represents the rotor speed. When controlled by constant power factor, the reactive power of the stator windings is Q s = P s tan φ. Due to the small amount of active power transmitted by the converter, the reactive power emitted or absorbed by the converter is also small, and the reactive power of the wind turbine Q e is approximately equal to Q s Q e = Q s = P s tan φ (9) At this time, in the power floe calculation, the double-fed wind turbine controlled by constant power factor is equivalent to the PQ node. When controlled by constant voltage, wind field node can be used as a PV node in power flow calculation, but due to the reactive power on stator side is effected by stator winding, rotor winding, and the limitation of the maximum current of the converter, so various constraints should be considered.

Photovoltaic power generator
The photovoltaic power generation system is shown in Fig. 3: U PV is DC voltage of the battery output; m is the adjusting parameter of the inverter; φ is the leading angle of inverter; U AC is the AC voltage output from the converter; X T represents for the transformer equivalent reactance; U g Is the system bus voltage; δ and θ are the phase angles of voltage, and meets φ = δ − θ. The amplitude of U AC and U PV have the following relationship: According to the above equations, the control of active power and reactive power of the photovoltaic power generation system are realised by controlling parameters φ and m. Therefore, in power flow calculation, photovoltaic power generation system can be regarded as PV node. Photovoltaic power station does not need to absorb reactive power from the system during normal operation, the lower limit value can be zero. If the reactive power of the grid node is out of limit, the node can be treated as PQ node, and the reactive power injected into the system is ether the upper limit or the lower limit of reactive power output.

Gas turbine power generation
There are two main structures of micro gas turbine generator system, one is the split shaft structure and the other is uniaxial structure. The power turbine and gas turbine of the split shaft use different rotating shafts. The power turbine is connected with the generator through the transmission gear, so it can be directly connected to the power grid. Uniaxial compressor, gas turbine, and generator are coaxial, the generator speed is higher than the grid, so it is necessary to use a converter to convert the generator frequency to the power frequency before connected to the power grid. Split shaft micro gas turbine is directly connected to the power grid through a synchronous generator. In general, a synchronous generator with excitation regulation capacity is used as the interface, the excitation control adopted is controlled by voltage and power factor. Distributed power supply with voltage control can be used as a PV node in power flow calculation, and the distributed power supply with power factor control can be used as PQ node. Therefore, the split shaft micro gas turbine can still be processed in the traditional way in the power flow calculation. In the power flow iteration process, if the reactive power of PV node is out of limit, it should be converted to the corresponding PQ node. If the node voltage is out of the limit in subsequent iterations, it should be re-transformed into a PV node.
The single shaft micro gas turbine system speed is higher than the grid, so it is necessary to use a converter to convert the generator frequency to the power frequency before connecting to the power grid. Network circuit diagram is shown in Fig. 4.
If the rectifier side uses diode uncontrolled rectifier, K R , K DC are the equivalent coefficient of the AC part and the DC part; λ R is the current calculation coefficient; I R is the current amplitude of the rectifier; I DC is the current amplitude of the DC equivalent.
The power supply can be equivalent to the active power output and the power grid input current constant PI node. The corresponding reactive power can be calculated by the voltage, constant current amplitude, and active power calculated by the previous iteration.
where Q k + 1 is the reactive power value of the k + 1 time, e k and f k represent real and imaginary parts of distributed power supply for the kth iteration; I is the amplitude of constant phase current injected into the power grid; P is the constant active power value. Therefore, the value of reactive power injected into the PI node can be calculated before each iteration, and the PI node can be processed into PQ nodes in the k + 1 iteration.

Mathematical model
Considering the losses, the scheme of reactive power optimisation which includes distributed generation (DG) is proposed, and optimal solution is obtained through genetic algorithm and immune algorithm. The specific mathematical models conclude objective function, constraint conditions, evaluation index and so on.

Constraint conditions: The allowable range of each node voltage is
where V i represents for voltage of node i, V imin represents for the allowable minimum voltage of node i, V imax represents for the allowable maximum voltage of node i, in this paper, V imin is set to 0.95 p.u., and V imax is set to 1.05 p.u. In addition to the fundamental voltage, constrain conditions of tap number and capacitor groups should also be considered due to the reactive power optimisation is obtained with the regulating transformer, distributed power supply, and parallel capacitor. The constraints of compensation devices are as follows: where TR i is the tap position of the transformer i, TR imax and TR imin represent for the upper and lower limits of the tap position. CP i is the group number of parallel capacitor i, CP imax and CP imin represent for the upper and lower limits of the group number. Q i is the reactive power of the ith DG, Q imax and Q imin represent for the upper and lower limits of the reactive power. Note that TR i and CP i are determined mainly by the tap position and capacitor group number, reactive power output is discrete, reactive power output of DG can change continuously, so the solution conducted by using DG is better, this is why DG should be introduced into reactive power regulation.

Objective function:
Considering the losses, the scheme of reactive power optimisation which includes DG is proposed. In addition to the losses, the four constraints mentioned above should also be included. The specific formula is shown below: f A = P loss + P V + P TR + P CP + P DG (18) where P loss represents the network loss value, and the remaining items are the penalty functions related to the constraint conditions. The subscripts correspond to each other without elaboration. The specific method of penalty function can be determined according to the actual project. This paper chooses to represent the product of the more limited times and the penalty factor. The value of the penalty factor can be determined according to the proportion of equipment invested in the actual project. According to the above formula, the variables of each group are >0 regardless of the actual situation. The value of the objective function is also >0. The smaller the value, the better the effect of this configuration when using the network losses as the objective function.

Fitness evaluation:
As can be seen from above, the objective function value is always >0 and the smaller the better. In the following process of solution, if the objective function values are very similar in different configurations, it is difficult to determine whose effect is better and which solution is better. So the concept of fitness evaluation is introduced. Combining with the discussion above, the fitness evaluation function is defined as the reciprocal of the objective function, as (19) Then the measure becomes a decimal from zero to one, and the larger the value, the better the configuration.

Reactive power optimisation scheme based on genetic immune algorithm
Using the mutation of the gene in biology and the cross mutation of the chromosome, genetic algorithm can make devices participate in the reactive power optimisation directly. It avoids the high requirement of derivability, continuity and so on of traditional optimisation algorithm functions, and it is not necessary to iterate through all feasible solutions which means plenty time and space can be saved. By simulating the survival of the fittest in the evolutionary process, it retains a better solution after comparison, without setting explicit parameters, so that it can consciously search for better space. The probability of producing the optimal solution is increased multiply after the propagation of the optimal solution is multiplied, and the cost of time is greatly reduced. The disadvantage is that local search capability is weak. In this paper, on the basis of genetic algorithm combined with antibody affinity index of immune algorithm, using immune algorithm and local optimisation, after a number of optimal solutions are selected by the genetic algorithm, to further speed up the optimisation process. Based on the specific process of genetic immune algorithm described above, the practical scheme of this paper is designed.

Coding scheme:
The reactive power devices researched in this paper have different types of variables, some are continuous and others are discrete. In order to unify the different variables, and make them easy to calculate, this paper used the binary method to encode variables. That is to say the output of continuous reactive power is divided into several parts. In order to get closer optimal solution, the reactive power should be divided as many parts as possible. Combining with practical engineering experience, the reactive power is divided into 256 parts, which means to encode distributed power supply, voltage regulating transformer and series capacitor compensator with eight bits. Due to the number of transformer taps and capacitor groups are far <256, the low digit is normally used, and the high digit is replaced by 0. For example, all possible scenarios of the input of 6 × 200 kvar capacitor bank, can vast from 000 to 110. All the possible output scenarios of can be expressed in 00000000 to 11111111. The corresponding relationship between the code and the actual reactive value is calculated by (20), is the decimal number that is converted from the code.
In this way, the reactive power output from is divided into 256 parts, each unit has the value of (Q max − Q min )/256.

Adaptive population size:
The genetic immune algorithm selects the optimal solution by comparing the fitness evaluation value of each individual. That is to say, each time an individual is generated, the load flow should be analysed, and the evaluation index should be gained. Therefore, the number of individual population will affect the progress of the whole algorithm, which is closely related to the occupancy of time and space. If a small initial population is chosen for a quick calculation, the space of the optimal solution will be small, and the accuracy of the result cannot be guaranteed. If a large initial population is selected to ensure the correctness of the results, the computational speed will be significantly reduced. In order to take account of the calculation speed and the search space, a method to automatically change the population size according to the calculation stage is proposed. The method proposed above can be realised by several steps: firstly, establish an initial population collect ion with two times of the total number of the actual individual. Secondly, cross breed the first generation, the total number of the second generation is consistent with the actual number. The second generation is a group of upgraded individuals, compared with the direct application of the actual individuals, the amount remains the same but the search scopes, which makes it easier to find the optimal solution. Thirdly, cut half of the original population. Useless works will be done if the full size of the population is still being used in the following calculation procession, since the difference in evaluation between individuals is negligible. In this way, both the computational speed and the search space are taken into account, which is more conducive to optimisation.

Genetic operations:
The basic steps of genetic manipulation include selection, crossover, and mutation. If the methods of crossover and mutation remain the same all the time, it can lead to results such as being trapped in local optimum while wasting a huge amount of time.
Therefore, this paper puts forward the concrete method of adjusting cross-exchange according to the total number of individuals. When the population is large, e.g. which shows that there would still be a long period before optimal solution can be gained. This is the time that cross-exchange should be made in the unit of equipment to search the optimal solution in a wide range. When the population is small, which illustrates the difference between individual fitness values is small, the single point crossover and mutation method should be made to jump out of local optimum. The probability of cross mutation is set according to the actual situation of the calculation example.
Immune manipulation in the paper mainly considers double cloning and high-frequency mutation. In order to maintain the diversity of the population, the best individuals in each generation will be copied, then choose a few of them for high-frequency mutation. Avoid falling into the local optimum.

Case study
This paper uses the node system IEEE33 to verify the feasibility of the proposed algorithm. The base power of the system is 10 MW and the reference voltage is 12.66 kV.
Combine the optimisation algorithm proposed in this paper, on the basis of the other parameters remain the same, add one on-load voltage regulating transformer whose adjusting range is set to 0.9-1.1 (p.u.) in the node distribution system IEEE33. The tap adjusting range is + 8, that is to say, the unit adjustment amount is 1.25%. In addition, add 2 with the ability of reactive power compensation, and both active outputs are 1 MW, and the range of reactive output is within the range of −100-500 kvar. Add two sets of parallel capacitors with, respectively, four and seven groups, which means that the maximum reactive output can reach 600 and 1050 kvar, respectively. Put the on-load voltage regulating transformer between the source and node 1, then two distributed power supplies are added to nodes 2 and 13, respectively. The parallel capacitor groups are added to access to nodes 6 and 31 [20], respectively.
The node system after adding devices is shown as Fig. 5.
In order to verify that distributed power access distribution network can effectively reduce system loss, power flow calculations are carried out for DG node-containing power distribution system and original node power distribution system, respectively. The comparison results are shown in Table 1.
As is shown in Table 1, distributed power access distribution network can effectively reduce network loss.
To verify the feasibility of the reactive power optimisation algorithm based on genetic immune algorithm, the example presented above is programmed and power flow is calculated.
The calculated results are compared with those based on traditional genetic algorithm. To ensure the veracity of the comparison results, multiple calculations should be made. The comparison results are shown in Table 2.
As is shown in Table 2, the veracity of genetic immune algorithm is verified by comparing the results from five experiments with those recorded from the traditional genetic algorithm since little differences can be seen in between.
Verification of the phenomenon that the algorithm can speed up the optimisation. The calculated results are compared with the traditional genetic algorithm though run time and network loss. The results are shown in Tables 3 and 4.
By comparing the results of Tables 3 and 4, it can be found that proposed algorithm consumes less time and reduces the system loss more effectively than the traditional one, if optimisation proceeds to the same algebra.

Conclusion
A typical trend of distributed power supply model is built in this paper, regarded as a continuous adjustable reactive power device, the distributed power can optimise reactive power of the power grid combined with the traditional reactive power compensation equipment. Based on the objective function of network loss, the genetic algorithm is combined with the immune algorithm to enhance the global optimisation ability of the algorithm. Finally using the IEEE33 node system for verification, the comparison results show that the participation of distributed power supply can effectively reduce the system network loss and improve the voltage stability, meanwhile, the feasibility and effectiveness of the improved algorithm is also verified.