Design of Multivariate PID Controller for Power Networks Using GEA and PSO

— The issue of proper modeling and control for industrial systems is one of the challenging issues in the industry. In addition, in recent years, PID controller design for linear systems has been widely considered. The topic discussed in some of the articles is mostly speed control in the field of electric machines, where various algorithms have been used to optimize the considered controller, and always one of the most important challenges in this field is designing a controller with a high degree of freedom. In these researches, the focus is more on searching for an algorithm with more optimal results than others in order to estimate the parameters in a more appropriate way. There are many techniques for designing a PID controller. Among these methods, meta-innovative methods have been widely studied. In addition, the effectiveness of these methods in controlling systems has been proven. In this paper, a new method for grid control is discussed. In this method, the PID controller is used to control the power systems, which can be controlled more effectively, so that this controller has four parameters, and to determine these parameters, the optimization method and evolutionary algorithms of genetics (EGA) and PSO are used. One of the most important advantages of these algorithms is their high speed and accuracy. In this article, these algorithms have been tested on a single-machine system, so that the single-machine system model is presented first, then the PID controller components will be examined. In the following, according to the transformation function matrix and the relative gain matrix, suitable inputs for each of the outputs are determined. At the end, an algorithm for designing PID controller for multivariable MIMO systems is presented. To show the effectiveness of the proposed controller, a simulation was performed in the MATLAB environment and the results of the simulations show the effectiveness of the proposed controller.


I. INTRODUCTION
Controller design is one of the most important part in the various properties of the linear and nonlinear systems. The most popular and most operational controller used in the industry is the PID controller, due to its structure simplicity and resisting, so that about 90% of all controllers used in the industry are PID, or are used in other control structures. The PID controller is one of the most common examples of the feedback control algorithm, which is used in many control processes such as DC motor speed control, pressure control, temperature control, etc.
The purpose of using the PID controller in the closed loop control system is to accurately and quickly control the output of the system in different conditions without knowing the exact behavior of the system in response to the input. The PID controller consists of three separate parts called proportional, integral and derivative parts. Each of them receives the error signal from the input and performs an operation on it, and finally their output is added together. The output of this set, which is the PID output, is sent to the system to correct the error.
Contrary to the simple appearance of PID, the design of this controller actually goes beyond the setting of its three main parameters. Various factors influence the performance of this controller, such as the controller structure, process degree, the constant ratio of the dominant time of the system to the dead time of the process, the dynamics of the driving element, the filter type of the derivative section and its parameter setting, nonlinear behavior in the system, etc. Each of these factors has a role in the process of designing and setting the PID controller. Optimum control performance is only possible after adjusting the best set of coefficients of proportional (Kp) and derivative (Kd) and integral (Ki).
Many researches have been done to find the methods of designing and setting the PID controller to have the best possible performance, some of which we will mention below. In the design, construction and maintenance of any engineering system, engineers must consider many technological and managerial decisions in several stages.
The ultimate goal of such decisions is considered to minimize the required effort or maximize the intended profit in any practical situation. Evolutionary algorithms (Genetics, PSO, Cuckoo, etc.), which have a significant convergence rate, can be used to optimize. In recent years, there has been most researches on designing a controller in power systems, but due to the lack of a proper target function, complete operational methods are not presented yet. So, researchers always seek to simplify these methods.
Resistant PID controller for controlling the frequency of power systems is investigated using the algorithm (ICA) in  [1]. In this paper, the controller is designed in order to overcome the load disturbance problem based on filtering method, that eliminates the effect of this kind of turbulences. In reference [2], to solve the problem of not accurately converging to the solution and improve the population diversity, the method of optimizing insect-fruit food search is taken from the mentioned method. The proposed algorithm for performance testing is first applied to a test function. The design of a resistant PID controller to stabilize the power system using genetic algorithm is investigated in [3].
The proposed parameters for the PID controller are optimized applying the genetic algorithm. Absolute-error integral and square-error integral are used as performance indexes to determine PID controller parameters for the stability of the power system. The proposed PID controller function under various loads and small disturbance conditions is investigated on the single-machine power system connected to the infinite bus, and the resistant impact of the proposed controller is inspected to improve the stability of the desired power system.
In reference [4], the optimal design of the PID controller is studied for improving the rotor angle stability using the BBO algorithm. The purpose of this method is to minimize deviation angle the rotor by optimally adjusting the PID controller and the power stabilizer parameters.
In this paper, the considered target function is selected based on absolute-error integral and square-error integral of the rotor deviation angle. In [5], the stabilization of a synchronous machine connected to the infinite bus using particle swarm algorithm and PID controller is presented. The controller parameters are adjusted using the particle swarm algorithm. The optimal controller parameters obtained by minimizing a target function, transfer unstable special values from the right of the imaginary axis to the left side.
In [6], a PID controller is designed to control the load frequency of the power system, that such controller coefficients are based on a two-degree of freedom control model. In [7], the control of STATCOM based on fuzzy PID control is also studied.
In this method, proportional profit and integral time are obtained by determining the response error and its rate of change and using them as input variables of phase regulator. In [8], the problem of PID and LQR controller design in the load frequency control system is investigated using refugee's algorithm [9]. In this method, firstly the load change in refugee's algorithm is considered, and a PID controller is designed by presenting a target function, then designing a LQR controller is considered, and in the following the results of these two controllers are compared with together.
In [10], in the design of the controller parameters, the prey-predator algorithm (PIO) intelligent algorithm inspired by pigeon nesting is used to increase the diversity of the population. For validation on a second-order test system, three algorithms PPPIO, PIO, and PSO have been used in setting PID parameters. The three mentioned algorithms have a response of similar quality to the step input; but the convergence speed of PIO and PPPIO is faster than PSO.
In [11], for the modified MPSO particle swarm algorithm, the particle velocity formula is changed to increase the computational efficiency. Also, variable coefficients with time have been entered. As a result, the dependence of the next location of the particle on the previous best location decreases with time, and the dependence of the next location of the particle on the best comprehensive location increases with time.
In [12], a type of fuzzy controller has been used to control the frequency load in a power system. Also, in reference [13], the authors have used the fuzzy controller based on PSO to control automatic production in a restructured two-zone power system.
In [14], a new modified optimization algorithm named Bacteria Feeding is presented. This algorithm models E.Coli feeding as an optimization process; in the way that an animal tries to maximize the energy it has gained in a unit of time. This algorithm is a type of intelligent group methods.
In this article, the single machine system is controlled by the PID controller in a closed loop system with unit feedback, the related PID controller parameters are set by different methods and the results are simulated by MATLAB software. First, the single machine system model is presented. Then the components of the PID controller will be examined.
In the following, according to the transformation function matrix and the relative gain matrix, suitable inputs for each of the outputs are determined. At the end, an algorithm for designing PID controller for multivariable MIMO systems is presented. The controller design method in this article is in the form of algorithms that can be implemented directly. These algorithms have been tested on a single machine system.

II. EVOLUTIONARY ALGORITHM
Applying combination and mutation creates a new collection that competes with the previous collection (parents), so that the winners eventually appear in the next generation.
This process can be persisted to get a candidate with sufficient features (answers), or to satisfy the constraints that we already defined for the problem. In this operation there are two main forces that are the basis of the evolutionary system: The change operators (combination and mutation) that create the necessary variations and come to innovation -Selection, which is the force that develops the quality. The combination of change and selection improves suitability in populations by observing the population movement, the evolution towards optimality is remarked.
Evolution is expressed as a process of matching. Evolution is expressed as a process of matching. In this view, competence as the main objective that needs to be optimized is not considered, but it expresses the need for the whole environment; the more these needs are satisfied, the result will be shown in a greater number of population members. The evolutionary process makes the population more consistent with its environment. The general scheme of evolutionary algorithms is presented in Fig. 1 [15].

Fig. 1. General design of the Evolutionary Algorithm [15]
A

. Standard Genetic Algorithm
The standard genetic algorithm uses the haploid reproduction model. In GA, the standard population is a set of binary numeric types such as 1101011.Each type shows a chromosome string [16]. There are a number of functions that indicate the appropriateness amount of each type. There is another function that selects species for reproduction from the population. The two selected chromosomes reproduce together and then redistribute. After that, two new species mutate. This is repeated in a number of times. In Fig. 2, we can see the schematic of the genetic algorithm [17].

B. Particle Swarm Optimization (PSO) Algorithm
The template the particle swarm optimization method is a social search algorithm modelled based on the social behavior of bird flocks. Initially, this algorithm was used to explore the patterns governing the simultaneous flight of birds and their sudden change of direction and optimal deformation of the flock [18]. In the particle swarm optimization algorithm, particles are flown in the search space. The particle movement in the search space is influenced by the experience and knowledge of themselves and their neighbors.
Therefore, the position of other swarm particles affects on the way that a particle searches. The result of the modelling of this social behaviour is the search process that the particles tend toward the successful areas. Particles learn from each other in a swarm, and based on their knowledge, they move towards their best neighbors. The basis of the PSO algorithm is established on the principle that, at any given time, each particle adjusts its location in the search space according to the best location that it has been so far and the best location that is there in its entire neighborhood. In PSO, every solution is just one bird in the search space and is called a member. All birds have a worthy value that is evaluated by the merit function that needs to be optimized [19]. In addition, each i ، bird has a position in the next D dimensional space of the problem, which, in t th repeating, is represented by a vector as (1).
Also, this bird has a speed that directs its flight, and in the repetition of tth, the vector can be shown as (2) [20].
In each search repetition, each member is updated with the two best values. The first is about the best solution that the bird has ever experienced (The suitability value of this best solution is also saved.). This value is called the best P or so called Pbest (Pi). The second best followed by the PSO is the best situation ever achieved in the population. This optimal value is general, and is so called Gbest (Pg). Once two best values are found, the position and speed of each member are updated by using following formulations (3) and (4) [21].
In the above formulas, t expresses the number of repetitions; and C1 and C2 variables are learning factors. Often C1 and C2 equal 2 (C1 = C2 = 2), that control the movement of a bird at one repetition. r1 and r2 are two random integers in range [0,1]. And w is an algebraic weight that is typically initialized at the range [ Consider the power system in the Fig. 3. The system includes a generator. The load connected to the network is a constant active and reactive load [23]. Fig. 3. Structure of a Power System [23] You can see the simplified structure of this system as shown in Fig. 4. The general description of the power system, which includes the equation of the generator dynamics, can be modelled as (5). The single-axis dynamics of the generator can be modelled as (6) [24]. Where, Where, , , are respectively the generator power angle (in radians), and generator rotor speed (in radian per second), 0 = 2 0 . And ′ is the transient voltage of the internal qaxis of the generator (in the per-unit), and is the generator circuit voltage, which is the control input (in the per-unit), and is mechanical power that assumed to be constant (in the per-unit). ′ is transient reactance of the daxis of generator (in the per-unit), and is the reactance of d-axis (in the per-unit), and is moment inertia coefficients of the generator (in seconds). is damping constant (in the per-unit), and 0 ′ is the time constant of the transverse open circuit d-axis (in seconds) [36]. Now, if = ( , , ′ ) and considering the control parameter as = , the behavior of the system it can be described as the following model (7).
Which, is the states of the system and being as (8) [25].
This model is a model of power systems that in some cases can also be linearized. A more complete model is considered as follows. It is needed a general approach in order to stabilize such models in linear and nonlinear states, both by having exact system equations and without having these system equations [26].

A. Providing a Comprehensive Model of Power Systems-
The switching algebraic-differential model of power systems.
Consider the same power system in Fig. 3. This is a switching singular hybrid system without impact control. The system includes a generator and an on-load tap changer (OLTC). The load connected to the network is a constant active and reactive load [27]. In general, an OLTC operates by a switch device, and when the steady-state load voltage difference ( ) and the voltage difference of its reference ( ) exceeds, the device selects a higher step or a lower step (9) [28].
Where, ∆n is the size of the OLTC step. It is assumed that OLTC has no energy losses. In accordance with the switching of tap ration, the general description of the power system with nonlinear load is a set of differential-algebra switched equations that include generator dynamics equations, power flux equations in the generator bus and load bus. That is modelled in three modes as (10) [29]. a) One-axis dynamic of the generator can be modelled as (10) [30].
b) The power flux equations on the generator bus side can be written as (12) and (13) c) The power flux equations on the load bus side are equal to relations as (14) and (15) [33].
Where, is the generator power angle (in radian unit), is the generator rotor speed, (in radian per second), ′ transient voltage of inside q-axis of the generator (in perunit), is circuit voltage of the generator ,that is the input control ( in per-unit), is the mechanical power that is assumed to be constant (in per-unit), ′ is the transient reactance of d-axis of the generator, is the d-axis reactance (in per-unit), is the generator inertia moment coefficients (in seconds), is damping constant (in perunit), ∘ ′ is the time constant of the d-axis transient open circuit (in second), and are respectively bus voltage of the generator side and the load side (in per-unit), and are respectively the generator bus phase and the load bus phase (in radians), is the ratio of pulse. Also = 2 + that and , are respectively reactance of the transmission line and transformer (in per-unit), and are the amount of the active and reactive power demand. Now, if = ( , , ′ ) and variable algebraic is chosen = ( , , , ) as = ( ) and = ( ), considering the control parameter, = we can describe the system's behavior with the differential-algebra-switching model as (16) [34].
Where, x and z are system states and algebraic variables. And ( , ) and ( , ) equations can be obtained as (17) and (18) [35].
According to pat ration states, the result system will be a singular-switching combinational system. In the above example, considering = ( , , ′ ) as the differential variables and = ( , , , ) considering the control parameter = , the system behavior can be described with the following singular-switching model as (19) [36] ( Where, , are respectively the generator power angle and generator rotor speed. And ′ is transient voltage of the internal d-axis of the generator, and E fd is the generator circuit voltage, and is mechanical power. ′ is transient reactance of the generator, and is the reactance, and is moment inertia coefficients of the generator. is damping constant, and ، ∘ ′ is the time constant of the transverse open circuit [37]. and are respectively the voltage of the generator bus side and the side of the load, and are respectively the phase of the generator bus and the phase of the load bus, and is the tap ration. and are respectively the transmission line reactance and the transformer reactance; and are active and reactive power demand. This system is a non-linear singularswitching and impact system [38].

IV. DESIGN OF PID CONTROLLER
PID controllers are standard tools for industrial automation. The flexibility of this controller makes it possible to use this type of control in many conditions. Many simple control problems can be thoroughly solved by controlling the PID if the performance requirements are not very high. The PID algorithm is standardized for process control, and is also the basis of many custom control systems. The book's description of this algorithm is as (20) [39].
Where, is the control variable, is the defined error as that = − , is the reference value and is the output of the process.

A. Multivariate Systems
In the analysis of control systems, we are faced with systems that simultaneously have multiple inputs and multiple outputs, and the stability analysis methods that are applicable to one input-one output systems, and are not easily used for such systems. More problematic is the design of a control system for multivariate systems that can satisfy the desirable characteristics of a closed loop system, such as closed loop stability, tracking reference inputs, and eliminating turbulence [40].

B. Interference in multivariate systems
Here, for simplicity of computation and presentation of understandable results, we consider a two-input and output system known as TITO. The display of its open loop boxes as shown in Fig. 5 [41]. If the above system is controlled by using a diameter controller as below, its block diagram is indicated in Fig. 6 [42]. The diameter controller matrix for the two-input and twooutput system is as (21) [43].
Using the figure (6), the output vector will be as (22).
C. Input-Output Pairing Now, it is questioned that which inputs effect more on which outputs, so that they can pair together. The relative maturity matrix known as the RGA matrix and presented by Bristol in 1966 is applied for this process. In fact, the RGA matrix shows the degree of interference model as (23) [44].

D. Multivariate PID Controllers
PID controllers have always been in focus of controlling engineers for simplicity of design and construction, resistance, effective operation in tracking and eliminating turbulence and non-dependence on a precise model of the system, and today they constitute the majority of industrial controllers [46]. Therefore, efforts have been made to apply these controllers to multivariate systems. These controllers can be divided into two parts. Centralized controllers (LQ, LQC, Resilient Control, Fuzzy Control, etc.) and decentralized controllers. Currently, multivariate controllers in the industry often use decentralized control techniques. In this case, an n-input and n-output multivariate system is converted to single input and single output n-system. A square transform ( ) function can be controlled by the below decentralized diameter controller model as (24) [47].
Where being as (25), 11. If the desired criteria are met, the loop should be closed. 12. Otherwise go back to step 8.

A. Study of the Single -Machine System
To obtain a single-machine system model, the parameters of the Table 1 is applied that derived from equation (10). Given the values of the above table parameters, the matrices A and B will be as (26).

B. Simulation Results with GA algorithm
In this section, we determine the controller parameters using the genetic algorithm and using the objective function. The objective function will be (27 Where, are weights and are selected according to the demands of the problem. The definition of the rest of the elements is as is the overshoot, is settling time, is the rise time, and is the stability index.
Considering the above target function and the number of repetitions as 50 times for the GA, the simulation results are presented in Fig. 7 to Fig. 9.  The amount of overshoot, the sitting time, and rise time for each of the responses will be as follows: M p1 = 10.5% Ts1 = 5.62s Tr1 =0.622s Mp2 = 31.6% Ts2 = 27.4s Tr2 = 3.82s The PID parameters in this case will be as follows: KP1=299.5037 Ki1=300 Kd1=-8.3931 Kp2=300 Ki2=31.6399 Kd2= -0.5456 And also, the value of the cost function is as (28).

C. Simulation Results using PSO algorithm
Considering the past target function and the number of repetitions as 50 times for the PSO evolution algorithm, the simulation results are presented in Fig. 10 to Fig. 12. The PID parameters in this case will be as follows:

VI. CONCLUSIONS
In this method, PID controller optimized with genetic algorithm and PSO algorithm is used to reduce rise time, settling time and overshoot of the studied system. The proposed controller has a better performance for damping system disturbances in malfunctioning conditions. The PID controller based on PSO is introduced in this article as the best control tool due to its outstanding features such as zero persistent error, sufficient sensitivity to detect the slope of the system error, etc. In this research, the single-machine system was controlled by a PID controller in a closed loop system with unit feedback, and the parameters of the PID controller were adjusted by different methods and the results were simulated by MATLAB software. It is clear from the comparison of the results that the genetic algorithm and the PSO algorithm are quite successful in adjusting these parameters and reduce the rise time, setting time and overshoot.