You are on page 1of 12





Power flow studies, commonly known as load flow, are the important part of power system analysis and design. They are necessary for planning, operation, economic scheduling and control of an existing system as well as planning its future expansion. In addition, power flow analysis is required for many other analyses such as transient stability and contingency studies.

The power flow solution is used to evaluate the bus voltage, branch current, real power flow, reactive power flow for the specified generation and load conditions. The results are used to evaluate the line or transformer loading and the acceptability of bus voltages.


Slack Bus

One bus, known as slack or swing bus, is taken as reference where the magnitude and phase angle of the voltage are specified. This bus makes up the difference between the scheduled loads and generated power that are caused by the losses in the network.


Load Buses

At these buses the active and reactive powers are specified. The magnitude and the phase angle of the bus voltages are unknown. These buses are called P-Q buses.


Regulated Buses

These buses are the generator buses. They are also known as voltage-controlled buses. At these buses, the real power and voltage magnitude are specified. The phase angles of the voltage and reactive power are to be determined. The limits on the value of the reactive power are specified. These are called P-V buses.

3.2 Test System






Figure 3.1 Six bus system

The technique for this project is tested on a six bus test system which was obtained from IEEE as shown in Figure 3.1. The bus consists of four load buses, one slack bus and one generator bus which can be seen from Figure 3.2 that is the bus data and line data for six bus system.

Figure 3.2 Bus data and line data for six bus system


Power flow in MATLAB

Power flow in MATLAB contains several contains several topic that is covered here which is firstly the data preparation, bus data file, line data file and lastly the power flow programs. The power flow programs are divided into lybus, busout and lineflow programs.


Data Preparation

In order to perform a power flow analysis by the Newton-Raphson method in the MATLAB environment, the following variables must be defined: power system base MVA, power mismatch accuracy, acceleration factor and maximum number of iterations. The name (in lowercase letters) reserved for these variables are basemva, accuracy,
accel and maxiter, respectively. Typical values are as follows:

Basemva Accel

= 100; = 1.6;

accuracy = 0.001; maxiter = 80;

The initial step in the preparation of input file is the numbering of each bus. Buses are numbered sequentially. Although the numbers are sequentially assigned, the buses need not be entered in sequence. In addition, bus data file and line data file are required.


Bus Data File

The format for the bus entry is chosen to facilitate the required data for each bus in a single row. The information required must be included in matrix called busdata. Column 1 is the bus number. Column 2 contains the bus code. Column 3 and 4 are the

voltage magnitude in per unit and phase angle in degrees. Column 5 and 6 are load MW and Mvar. Columns 7 through 10 are MW, Mvar, minimum Mvar and maximum Mvar of generation, in that order. The last column is the injected Mvar of shunt capacitors. The bus code entered in column 2 is used for identifying load, voltage-controlled, and slack buses as outlined below:

1 This code is used for the slack bus. The only necessary information for this bus

is the voltage magnitude and its phase angle.

0 This code is used for the load buses. The loads are entered positive in

megawatts and megavars. For this bus, initial voltage estimate must be specified. This is usually 1 and 0 for voltage magnitude and phase angle, respectively. If voltage magnitude and phase angle for this type of bus are specified, the will be taken as the initial starting voltage for the bus instead of a flat start of 1 and 0.

2 This code is used for the voltage-controlled buses. For this bus, voltage

magnitude, real power generation in megawatts, and the minimum and maximum limits of the megavar demand must be specified.


Line Data File

Lines are identified by the mode-pair method. The information required must be included in a matrix called linedata. Columns 1 and 2 are the line bus numbers. Columns 3 through 5 contain the line resistance, reactance, and one-half of the total line charging susceptance in per unit on the specified MVA base. The last column is for the transformer tap setting; for lines, 1 must be entered in this column. The lines may be entered in any sequence or order with the only restriction being that if the entry is a transformer, the left bus number is assumed to be the tap side of the transformer.


Power Flow Programs

Power flow programs are the programs that have been developed for the power flow solution of practical system. Each method of solution consists of four programs. The program for the Newton-Raphson method is lfnewton, which is then preceded by lfybus and is followed by busout and lineflow. Programs lfybus, busout and lineflow are designed to be used with the power flow programs.


This program requires the line and transformer parameters and transformer tap setting specified in the input file named linedata. It converts impedances to admittances and obtains the bus admittance matrix. The program is designed to handle parallel lines.


This program produces the bus output result in a tabulated form. The bus output result includes the voltage magnitude and angle, real and reactive power of generators and loads, and the shunt capacitor/reactive Mvar. Total generation and total load are also included as outlined in the sample case.


This program prepares the line output data. It is designed to display active and reactive power flow entering the line terminals and line losses as well as the net power at each bus. Also included are the total real and reactive losses in the system. The output of this portion is also shown in the same case.


This program obtains the power flow solution by the Newton-Raphson method and requires the busdata and the linedata files. It is designed for the direct use of load and generation in MW and Mvar, bus voltages in per unit, and angle in degrees. Loads and generation are converted to per unit quantities on the base MVA selected. A provision is made to maintain the generator reactive power of the voltage-controlled buses within their specified limits. The violation of reactive power limit may occur if the specified voltage is either too high or too low. In the second iteration, the var calculated at the generator buses are examined. If a limit is reached, the voltage magnitude is adjusted in steps of 0.5 percent up to 5 percent to bring the var demand within the specified limits.


Artificial Immune System (AIS)


Flow Chart


Initial Population






Figure 3.3: Flow chart for AIS technique


Initial Population

This is the part where a certain number is generate randomly to initialize the early value of a population which the value of reactive power dispatch. A value between one and fifty is generate using equation:


The value of x is then being use to calculate the fitness.



The clone selection principle is an algorithm used by the immune system to describe the basic features of an immune response to an antigenic stimulus. The main features of the clone selection principle are:-

New cells are copies of their parents (done) subjected to a mutation mechanism.

Elimination of newly differentiated lymphocytes carrying self-reacting receptors.

Proliferation and differentiation on contact of mature cells with antigens. The persistence of forbidden clones provides resistant to early elimination by self-antigens as the basis of autoimmune diseases.

The clone selection algorithm reproduces those individuals with higher affinity and selects their improved matured offspring, where single members will be locally optimized and the newcomers yield a broader exploration of the search space. This characteristics makes the clone selection algorithm is suitable for solving multi-modal

optimization problems. When the clone selection algorithm is implemented for solving optimization problem, a few adaptations have to be made as follows:-

There is no explicit antigen to be recognized, but an objective function is to be optimized. Therefore the affinity of an antibody refers to the evaluation of the objective function.

All antibodies are to be selected for cloning. The number clones generated by the antibodies are equal.

Figure 3.4: The clone program

The clone program is shown in figure 3.4. Data A is the data that is obtained after a random number is generated and the fitness is calculated. Data B is the data that selects only data for row two and three which is minimum Tloss (Vm) and maximum (Vm). Repmat is a function to duplicate and tile and array. Data C is the data that is cloned ten times of data B.

For this project, the size of reactive power dispatch and losses values has to be cloned ten times the amount of the fitness so the values of losses and the size of reactive power dispatch will be one hundred. This is for the accuracy of the program to optimize the reactive power dispatch size



Mutation aims to re-introduce variability in a solution population and to avoid search stagnation in a non appropriate region of the search space. Calculated fitness value will be used for the mutation process. The random number, n was performed on mutation to produce offsprings.

Figure 3.5: The mutation program

The mutation program is shown on figure 3.5. Firstly f selects only the second row of the cloned data which is from data C. Further f is use to generate a selection probability, then f should have positive or zero value. Next the maximum value of losses is defined and the process is repeated for the selection of row one from data C

which is defined as Xj and it is the value of the size of RPD. Then the maximum and minimum value of RPD is search for the calculation process.



In selection, the offsprings produced by mutation process will be sort and the best ten values is chosen from a hundred values of the offsprings subject.



Convergence describes limiting behavior, particularly of an infinite sequence or series toward some limit. To assert convergence is to claim the existence of such a limit, which maybe itself unknown. For any fixed standard of accuracy, however, you can always be sure to be within that limit, provided you have gone far enough. Stopping criteria or convergence criterion is specified when the value of difference between maximum total loss and minimum total loss is less than 0.0001. The mathematical equation is given as:-

total loss (max) total loss (min) 0.0001