## INTRODUCTION – HARMONIC LAOD FLOW ANALYSIS SOFTWARE

Power Systems of today are very large, complex interconnected network of various components. Major components of a power system can be subdivided into: a. Generation b. Transmission and Sub transmission c. Distribution

Conventional ac electric power systems are designed to operate with sinusoidal voltages and currents. However, nonlinear and electronically switched loads distort steady state ac voltage and current waveforms. It is important to calculate these distortions for safe and reliable operation of the power system. Periodically distorted waveforms can be studied by examining the harmonic components of the waveforms. The text here presents method of 3 – phase harmonic analysis for industrial distribution systems with the aid of a personal computer using the harmonic analysis software.

This software uses C++ for analysis and Visual C++ based GUI as front end. It performs following analyses. * Load Flow Analysis * 3 – Phase Harmonic Analysis The software allows the user to draw and model a distribution network and input the injected harmonic currents. It performs load flow analysis using backward- forward sweep method. Same method is used for 3- phase harmonic analysis. Finally harmonic voltages and total harmonic distortion (THD) at various buses is calculated. Objective of this project was to build software for designing a 3- phase distribution system and its harmonic load flow analysis.

Backward- Forward Sweep method was used due to its efficacy in radial distribution systems. This software works for a non branched network and can be easily extended into a complete radial network.

## POWER SYSTEM HARMONICS

A harmonic of a wave is a component frequency of the signal that is an integer multiple of the fundamental frequency, i. e. if the fundamental frequency is f, the harmonics have frequencies 2f, 3f, 4f . . . etc. The harmonics have the property that they are all periodic at the fundamental frequency; therefore the sum of harmonics is also periodic at that frequency.

In relation to power systems, harmonics are used to represent the multiple frequencies of voltage and current waveforms. The following sections discuss the concept of power system harmonics, their sources and effects.

### Concept of Power System Harmonics

Nonlinear and switched loads and sources can cause distortion of the nominal sinusoidal current and voltage waveform in an ac power system. In this section, basic definitions and concepts associated with the analysis of periodic steady state waveform distortion are discussed.

### Fourier Series and Harmonics

Under periodic steady state conditions, distorted voltage and current waveforms can be expressed in the form of a Fourier Series. The Fourier series for a periodic function f(t) with fundamental frequency ? can be presented as: ft= C0+ n=1? Cncos(n? t+? n) Equation 1 Fourier series for a periodic function The coefficients Cn and phase angles n for n-th harmonic are given by: Cn= An2+ Bn2 Equation 2 ?n= tan-1-BnAn Equation 3 where T=2? /? and C0 is the dc component of the function. The rms value of ft is defined as: An= 2T0Tf(t)cos(n? t)dt Equation 4 Bn= 2T0Tf(t)sin(n? t)dt Equation 5 C0= 1T0Tf(t)dt

Equation 6 RMS= C02+ n=1? Cn22 Equation 7 RMS value In general, one can think of devices that produce distortion as exhibiting a nonlinear relationship between voltage and current. Such nonlinear relationships can lead to several forms of distortion as summarized below: * A periodic steady state exists and the distorted waveform can be expressed as a Fourier series with a fundamental frequency equal to the power frequency. * A periodic steady state exists and the distorted waveform can be expressed as a Fourier series with fundamental frequency that is a sub multiple of power frequency. The waveform is aperiodic but perhaps almost periodic. A trigonometric series expansion may still exist (as an exact representation or as an approximation). The first case is commonly encountered in harmonic studies. There are several advantages to decomposing waveforms in terms of harmonics. Harmonics have a physical interpretation and an intuitive appeal. As discussed later, the transmission network is usually modeled as a linear system. Thus the propagation of each harmonic can be studied independent of others in the frequency domain.

Generally, the number of harmonics to be considered is small which simplifies computation. Consequences such as losses can be related to harmonic components and measures of waveform quality can be developed in terms of harmonic amplitudes. Certain types of pulsed or modulated loads and integral cycle controllers can create waveforms corresponding to the second category. The Fourier representation, when applicable, can be advantageous for the reasons cited above and measures of waveform quality can be adapted to such systems, although standards do not yet exist.

Some practical situations correspond to the third case. For example, dc arc furnaces consist of a conventional rectifier input but the underlying process of melting is not a periodic process. When reference is made to harmonics in this instance it corresponds to the periodic waveform that would be obtained if furnace conditions were to be maintained constant over a period of time. While such modeling obviously does not predict the exact response, it can, to a certain extent, lend insight into some of the potential problems caused by the distortion producing devices. .

### Distortion Indices

The most commonly used measure of deviation of a periodic waveform from a sine wave is called total harmonic distortion (THD) or distortion factor. THD=1C1n=2? Cn2 Equation 8 Total Harmonic Distortion The term distortion factor is more appropriate when the summation in the equation above is taken over a selected number of harmonics. IEEE Std. 519 [l], specifies limits on voltage and current THD for ‘Low Voltage, General Distribution, General Sub transmission, and High Voltage systems and Dispersed Generation and Cogeneration’.

Other distortion factors such as Telephone Influence Factor (TIF), the C-message weighted indices are also used. Only THD is discussed in this report.

### Characteristics of Harmonics in Power Systems

Most devices operate in an identical manner in the positive and negative half cycle, thus eliminating even order harmonics. In balanced three-phase systems, under balanced operating conditions, harmonics in each phase have specific phase relationships. For example, in the case of the third harmonic, phase b currents would lag those in phase a by 3×1200 or 3600, and those in phase c would lead by the same amount.

Thus, the third harmonics are in phase and appear as zero-sequence components. As such, in a grounded wye system these harmonics flow in the lines and neutral/ground circuits, while in delta or ungrounded systems they cannot exist in line current at all. Similar analysis shows that fifth harmonics appear to be of negative sequence, seventh are of positive sequence, etc. Therefore, the impedances and manner of connection of rotating machines, transmission lines, and transformers must be modeled carefully for each harmonic.

The harmonics produced by many devices, particularly solid-state power converters are well-defined ‘characteristic harmonics’. An ideal, p-pulse, line commutated, converter, for example, produces ac side harmonic currents of order np+1, n=1, 2, 3…. The interpretations discussed above do not apply to the unbalanced cases. When supplied with unbalanced voltage, most three-phase power electronic converters can generate non characteristic harmonics. In many cases, the three-phase harmonics do not follow the sequence order of the balanced cases.

Furthermore, the nature of some harmonic problems requires the assessment of unbalanced harmonics. For example, zero sequence harmonic currents generally cause much more interference with telephone circuits than positive or negative sequence harmonics. Systems with unbalanced loads and components need to be studied using a three-phase model with proper representation of neutral and ground circuits.

## HARMONIC SOURCES

Prior to the appearance of power semiconductors, the main sources of waveform distortion were electric arc furnaces, accumulated effect of fluorescent lamps, and to lesser extent electrical machines and transformers.

The increasing use of power electronic devices for the control of power apparatus and systems has been the reason for greater concern about waveform distortion in recent times. As sources of harmonics non-linear devices can be classified as: * Traditional (Classical) types: * Transformers * Rotating machines * Arc furnaces * Modern (Power- Electronic) types: * Fluorescent lamps * Electronic controls and switched mode power supplies widely used these days in industry and modern office electronic equipment * Thyristor controlled devices which include * Rectifiers Inverters * Static VAR compensators * Cycloconverters * HVDC transmission The thyristor family includes: * Reverse blocking triode thyristors or silicon controlled rectifiers “SCR’s” * Bidirectional triode thyristors known as triacs * Bidirectional diode thyristors known as diacs * Reverse conducting triode thyristors * Light- activated SCR’s * Asymmetrical SCR’s * Static inductive thyristors * Gate turn-off thyristors “GTO’s” AC/DC rectifiers are used in: * DC motor drives * Regulated dc power supplies * Battery chargers * HVDC transmission

## EFFECT OF HARMONICS

Each element of the power system must be examined for its sensitivity to harmonics as a basis for recommendations on the allowable levels. The main effects of voltage and current harmonics within the power system are: * The possibility of amplification of harmonic levels resulting from series and parallel resonances. * A reduction in the efficiency of the generation, transmission and utilization of electric energy. * Ageing of insulation of electric power plant components with consequent shortening of their usual life. * Malfunctioning of system or plant components.

Among the possible external effects of harmonics is degradation in communication systems performance, excessive audible noise and harmonic-induced voltage and currents.

### Thermal losses in harmonic environment

Harmonics increase the equipment copper, iron and dielectric losses and cause thermal stress. The per unit increase in the copper loss is obtained from the total voltage distortion. ?PRpu= THD2v Iron losses consist of eddy-current and hysteresis loss and result in reducing the efficiency and increasing the core temperature thus limiting the output.

Dielectric loss in a capacitor or insulation loss in a cable is due to the fact that there is not practically any capacitor whose current leads the voltage by 900.

### Effects on power system equipment

Harmonics result in increased losses and equipment loss-of-life. Triplen harmonics result in the neutral carrying a current which might equal or exceed the phase currents even if the loads are balanced. Moreover, harmonics-caused resonance might damage equipment and interfere with protective relays, metering devices, control and communication circuits, and customer electronic equipments. . 3. 3 Capacitor banks * Capacitors are overloaded by harmonic currents, since their reactance decreases with frequency they act as sinks for harmonic currents. Also harmonic voltages produce large currents causing capacitor fuses to be blown. * Harmonics tend to increase dielectric loss. * Capacitors combine with source inductance to form a parallel resonant circuit. In presence of resonance, harmonics are amplified. The resulting voltages highly exceed the voltage rating and result in blown fuses.

### Transformers

Transformers operating in harmonic environment suffer from: Increased load losses due to copper and stray losses. * Increased hysteresis and eddy-current loss. * The possibility of resonance between transformer inductance and power factor correction capacitors. * Increased insulation stress due t o increased peak voltage. Rotating machines * Copper and iron losses are increased resulting in heating, * Pulsating torques are produced due to the interaction of the harmonics-generated magnetic fields and the fundamental.

## HARMONIC LOAD FLOW ANALYSIS

Harmonic load flow analysis of the 3- phase system fundamental load flow analysis and harmonic analysis.

Fundamental load flow analysis is used to evaluate the fundamental voltages at various buses within a specified tolerance value. Harmonic analysis uses the injected harmonic currents to evaluate harmonic voltages and total harmonic distortion at various buses.

## LOAD FLOW ANALYSIS

In power engineering, load-flow study is an important tool involving numerical analysis applied to a power system. Unlike traditional circuit analysis, a load flow study usually uses simplified notation such as a one-line diagram and per-unit system, and focuses on various forms of AC power (i. e. reactive, real, and apparent) rather than voltage and current. It analyses the power systems in normal steady-state operation. There exist a number of software implementations of power flow studies. The great importance of power flow or load-flow studies is in the planning the future expansion of power systems as well as in determining the best operation of existing systems. The principal information obtained from the power flow study is the magnitude and phase angle of the voltage at each bus and the real and reactive power flowing in each line.

### Load flow problem formulation

The goal of a power flow study is to obtain complete voltage angle and magnitude information for each bus in a power system for specified load and generator real power and voltage conditions. Once this information is known, real and reactive power flow on each branch as well as generator reactive power output can be analytically determined. Due to the nonlinear nature of this problem, numerical methods are employed to obtain a solution that is within an acceptable tolerance. The solution to the power flow problem begins with identifying the known and unknown variables in the system.

The known and unknown variables are dependent on the type of bus. A bus without any generators connected to it is called a Load Bus. With one exception, a bus with at least one generator connected to it is called a Generator Bus. The exception is one arbitrarily-selected bus that has a generator. This bus is referred to as the Slack Bus. In the power flow problem, it is assumed that the real power PD and reactive power QD at each Load Bus are known. For this reason, Load Buses are also known as PQ Buses. For Generator Buses, it is assumed that the real power generated PG and the voltage magnitude |V| is known.

For the Slack Bus, it is assumed that the voltage magnitude |V| and voltage phase ? are known. Therefore, for each Load Bus, the voltage magnitude and angle are unknown and must be solved for; for each Generator Bus, the voltage angle must be solved for; there are no variables that must be solved for the Slack Bus. In a system with N buses and R generators, there are then 2(N ? 1) ? (R ? 1) unknowns. In order to solve for the 2(N ? 1) ? (R ? 1) unknowns, there must be 2(N ? 1) ? (R ? 1) equations that do not introduce any new unknown variables.

The possible equations to use are power balance equations, which can be written for real and reactive power for each bus. The real power balance equation is: 0= -Pi+ k=1NViVK(Gikcos? ik+ Biksin? ik ) Equation 9 Real power balance where Pi is the net power injected at bus i, Gik is the real part of the element in the Ybus corresponding to the ith row and kth column, Bik is the imaginary part of the element in the Ybus corresponding to the ith row and kth column and ? ik is the difference in voltage angle between the ith and kth buses. The reactive power balance equation is: 0= -Qi+ k=1NViVK(Giksin? k- Bikcos? ik ) Equation 10 Reactive power balance where Qi is the net reactive power injected at bus i. Equations included are the real and reactive power balance equations for each Load Bus and the real power balance equation for each Generator Bus. Only the real power balance equation is written for a Generator Bus because the net reactive power injected is not assumed to be known and therefore including the reactive power balance equation would result in an additional unknown variable. For similar reasons, there are no equations written for the Slack Bus.

### Backward forward sweep method

Load flow problem formulated above can be solved using different methods such as Newton Raphson method, Gauss- Seidel method etc. In this report backward forward sweep method is used to solve the three phase fundamental load flow problem. This particular method is useful for radial distribution systems because it reaches the desired tolerance level in less number of iterations. Moreover, 3- phase impedance matrix is not to be built for the entire network, instead 3- phase impedance matrix is built for each feeder as shown below which is easier. Also, the impedance matrix need not be inverted saving considerable computational effort.

Since the report deals with a distribution system the buses in the network are PQ buses. There are no PV buses as it is assumed that no generators are present in the network. Feeder line modeling The following figure shows the three phase transmission series impedance. A 4 ? 4 matrix is formed using Carson’s formulation, which takes into account the self and mutual coupling terms. Ig Va In Vn Zag-n Zbg-n Zcg-n Ia Ib Ic Zaa-n Zab-n Zac-n Zba-n Zbb-n Zbc-n Zca-n Zcb-n Zcc-n ?Va ?Vb ?Vc ?Vg Zga-n Zgb-n Zgc-n = Zgg-n Ig Iabc ZA ZB ?Vg ?Vabc Ig ZC ZD =

Using Kron’s reduction the 4? 4 matrix can be converted into a 3? 3 matrix as shown below. Zaa-n| Zab-n| Zac-n| Zba-n| Zbb-n| Zac-n| Zca-n| Zcb-n| Zcc-n| [Zabc] = [ZA]- [ZB][ZD]-1[ZC] = The 3? 3 impedance matrix of the feeder line is used for calculations. In the software a 3 phase balanced line is modeled. Hence the per unit length reactance and resistance values are taken as constant reference values. However the length of the different feeders in the network can be varied. Algorithm The root node is taken as the slack node with known magnitude and angle, and the initial voltage of all nodes is taken equal to the root node voltage.

The iterative algorithm for solving the radial system consists of three steps. At iteration k: 1. Nodal current calculation IiaIibIic(k)=SiaVia(k-1)*SibVib(k-1)*SicVic(k-1)* Equation 11 Nodal current where Iia , Iib , Iic are current injections at node I corresponding to constant power load elements. Sia, Sib, Sic are scheduled (known) power injections at node i Via , Vib ,Vic are voltages at node i 2. Backward Sweep Backward sweep is used to sum up line section current; starting from the line section in the last layer and moving towards the root node, the current in section l is JlaJlbJlck= -IjaIjbIjck+m?

MJmaJmbJmck Equation 12 Backward Sweep where Jia ,Jib and Jic are the current flows in the line section l and M is the set of line sections connected to node j. The negative sign before injected currents is to keep consistent with nodal current calculation formula. 3. Forward Sweep Forward sweep is used to update nodal voltage; starting from the first layer and moving towards the last layer. At each node, the change in the nodal voltage with respect to previous iteration is calculated for each phase. If this deviation exceeds the provided tolerance value in any case the backward forward sweep is carried out again.

VjaVjbVjck= ViaVibVick- zaa,nzab,nzac,nzba,nzbb,nzbc,nzca,nzcb,nzcc,nJlaJlbJlck Equation 13 Forward Sweep The following flowchart depicts the steps to be carried out for fundamental load flow analysis. Start Input system data Assign initial condition values Calculate injected currents at nodes followed by backward sweep Is voltage deviation <tolerance or no of iterations >max_iterations Calculate bus voltages using forward sweep No Stop Yes

## THREE PHASE HARMONIC ANALYSIS

The report presents a fast harmonic load flow method for industrial distribution systems using forward backward sweep technique.

The proposed method saves computational time and accomplishes real- time harmonic analysis. Based on the network structures of distribution systems, current- injection formulation and the Kirchoff’s law, the relationships between the bus voltages, branch currents and harmonic sources can be formulated and then the harmonic voltage for each bus can be calculated using simple forward backward sweep techniques. The total harmonic distortion can also be calculated easily. The presented method is very efficient since the computational time for the LU decomposition of the Jacobian matrix (or Admittance matrix) can be saved.

The conventional harmonic load flow methods use load flow program, employ the frequency- based component model, update the Jacobian matrix (or Admittance matrix), decompose the matrix and rerun the load flow program for each harmonic order. However the decomposition of the Jacobian matrix (or Admittance matrix) is a time consuming process making the conventional methods difficult for real time analysis. The fast harmonic load flow method saves computational time making it suitable for real time analysis.

### Components model

The feeder is modeled as mentioned above in the load flow section.

The reactance matrix is however multiplied with the harmonic order for different harmonics. Harmonic sources are modeled as constant current injection sources. Harmonic data is obtained from the harmonic analyzers. In industrial distribution systems, the industrial loads are usually driven by six pulse converters. Since the six pulse converters produce harmonics of the order 6k 1, the dominant harmonic components in the system are of order 5, 7, 11, 13 etc. Hence in the software harmonics of order 5, 7, 11, 13, 17, 19, 23 and 25 are considered.

The ac source transformers in a plant are installed with wye- delta and delta-wye alternatively to eliminate the harmonic components of order 3n.

### Algorithm

The algorithm consists of backward current sweep and forward voltage implementation. Backward sweep is used to sum up line section current; starting from the line section in the last layer and moving towards the root node, the current in section l is JlaJlbJlc(k)= -IjaIjbIjc(k)+m? MJmaJmbJmc(k) Equation 14 Backward Sweep where Jia ,Jib and Jic are the current flows in the line section l and M is the set of line sections connected to node j.

The negative sign before injected currents is to keep consistent with nodal current calculation formula. Forward Sweep Forward sweep is used to update nodal voltage; starting from the first layer and moving towards the last layer. At each node, the change in the nodal voltage with respect to previous iteration is calculated for each phase. If this deviation exceeds the provided tolerance value in any case the backward forward sweep is carried out again. VjaVjbVjck= ViaVibVick- zaa,nzab,nzac,nzba,nzbb,nzbc,nzca,nzcb,nzcc,nJlaJlbJlck Equation 15 Forward Sweep Calculation of THD

Total harmonic distortion of voltages at each bus is calculated using the formula: THD=1V1n=2? Vh2 Equation 16 Voltage THD The following flow chart represents the steps carried for harmonic load flow analysis. Start Read 3 phase harmonic currents for h=5,7,11,13,17,19,23,25 Calculate branch currents using backward sweep Calculate bus voltages using forward sweep Calculate THD for each bus h=25? No Yes Stop

## INTERNAL FUNCTIONING OF HARMONIC LOAD FLOW ANALYSIS SOFTWARE

Theory of various analyses and their computer implementation algorithms have been discussed in details in previous section.

The software implementation of these algorithms has been done using C++ language and the GUI has been developed in Visual C++ 6. 0. The complete software has two main components. They are – 1. Display and control using Visual C++6. 0 This is mainly a Graphical user Interface (GUI) which is developed using Visual C++ 6. 0 and is used for display purposes as well as for control I. e. simulate the distribution system model and further to carry out the Harmonic Load Flow analysis on the simulated system. This is, thus, the front-end of our application. 2. Running Analysis using C++ language

C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. As one of the most popular programming languages ever created, C++ is widely used in the software industry. Several groups provide both free and proprietary C++ compiler software, including the GNU Project, Microsoft, Intel and Borland making our software an open source.

## CHOICE OF SOFTWARE – VISUAL C++ 6. 0 & C++ LANGUAGE

An interactive GUI and a reliable programming language led to the choice of Visual C++ and C++ language. 1. Visual C++ 6. 0

When talking about developing a GUI the names that instantly come to the mind are JAVA and Visual C++. VC++ 6. 0 is quite popular and often used to maintain legacy projects. Further it is easier to develop a GUI in it and was easier to learn. Since the background analysis program was already developed in C++ language so the choice was obvious as it supports the developed C++ code and smoother inter process communication as both uses the same compiler. It has tools for developing and debugging C++ code, especially code written for the Microsoft Windows API, the DirectX API, and the Microsoft .

NET Framework. So, we decided to use Microsoft Visual 6. 0 Enterprise edition and used help at MSDN, a great site for developers. 2. C++ language It is a favored language by all programmers for development of any open source software application. Prior knowledge of the language and the courses taken on C++ language before led to an easy decision of developing the software in this language. The Integrated Development environment used for the development was NetBeans IDE 6. 8, the latest release of NetBeans.

It lets C/C++ developers use their specified set of compilers and tools in conjunction with NetBeans IDE to build native applications for Windows, Mac OS X, Linux, and Solaris. It is easy to use and has features of auto-completion, listing the classes defined along with their variables and methods thus giving a clear insight of current development status of the software. The software models the distribution system as non branched network i. e. a radial network without any branches, though any branched network can be derived from the same network and the same can be extended for implementing a normal radial network.

A flow diagram is shown to understand the control flow in the software

## IMPLEMENTATION OF HARMONIC ANALYSIS SOFTWARE

As said before the software has two major parts first is the GUI developed in Microsoft Visual C++ 6. 0 IDE and the other part though integrated in the GUI itself but is coded in core C++ language and embedded in CProjectView class OnRun() function. 4. 2. 1 The GUI: To begin working with the software user has to simulate the distribution network using a simple Graphical User Interface developed for the software in Microsoft Visual C++ 6. 0 IDE. List of classes and their member variable and functions –

The GUI is an MDI application which has some inbuilt classes and some later on added ones. Its inbuilt classes listed as follows- * The CWinApp derived class – CProjectApp * The CMDIFrameWnd derived class – CMainFrame * The CMDIChildWnd derived class – CChildFrame * The CDocument derived class – CProjectDoc – The CDocument class houses the document. This class is where we build the data structures necessary to house and manipulate the data that makes up the document. This class receives input from the CScrollView class and passes display information to the CScrollView class.

This class is also responsible for saving and retrieving the document data from files. The data members of the class are (only the important classes and changes made in them are explained)– * CTypedPtrArray<CObArray, CBus*>m_BusArray; * CTypedPtrArray<CObArray, CLine*>m_LineArray; * CTypedPtrArray<CObArray, CLoad*>m_LoadArray; * CTypedPtrArray<CObArray, CHcurr*>m_HcurrArray; These arrays as clear by their names store the data of Bus, Line, Load and Harmonic current which are used by the view class to display and the main analysis function to carry out the Load Flow and Harmonic Load Flow analysis.

The member functions of the class are – * Void Serialize(CArchive& ar)- This function takes advantage of the functionality of the CObArray class. This object array passes down its array of objects, calling the Serialize function on each of the objects. * int GetNumBus() – returns the existing total number of buses in the system. * int GetBusIndex(CString busno) – returns the location of the bus in m_BusArray identified by its bus number. * CBus* GetBus(int index) – returns the CBus object at index position in m_BusArray. * CBus* GetBus(CString busno) – returns the CBus object from the array identified by its bus number. BOOL CheckNotBus(int BusNo) – checks whether the specified bus number is present in the network system or not. It returns TRUE is bus is present and FALSE is not present. * BOOL CheckBus(int BusNo) – function restricts user to add the same bus twice into the system. * BOOL AppendBus(int index, int x1, int y1, int x2, int y2, int BusNo) – function replaces already present bus at index location in m_BusArray with a new bus with modified data. * BOOL AddBus(int x1, int y1, int x2, int y2, int BusNo) – function adds a new bus into the system using m_BusArray. Add(pBus) and returns true if success.

Similarly all other functions involving manipulations on m_LineArray, m_LoadArray and m_HcurrArray carry out tasks that can be deduced by their declaration itself. * The CScrollView derived class – CProjectView – The CProjectView class is the class that displays the visual representation of document for the user. This class passes input information to the CDocument class and receives display information from the CDocument class. The class also holds the code of the main analyzing program under the function void CProjectView::OnRun() whose functioning and control flow will be discussed later.

The important member functions of this class are – * void CProjectView::OnBus() – responsible for assigning the data members of the class related to the bus from the values entered in the Add Bus dialogue and assigning TRUE to bCheckBusOpt (a Boolean flag to state whether the bus is to be drawn or not when left mouse button is released. * void CProjectView::OnLoad() – does the same work as OnBus() function but for a load and edits the Boolean flag bCheckLoadOpt. * void CProjectView::OnHarmocurr() – same work as OnBus() function but for a Harmonic Current Injector and assigns TRUE to bCheckHcurrOpt. void CProjectView::OnFeeder()- does the same work as that of OnBus() function but for a Feeder and assigns TRUE to bCheckLineOpt to enable drawing of a 3 phase feeder on mouse move and release mouse button actions. * void CProjectView::OnLButtonDown(UINT nFlags, CPoint point) – this function checks the corresponding flags and accordingly assigns TRUE to other flags (as in case of a line) or calls the respective draw functions. Partial Code: if(bCheckBusOpt==TRUE) DrawBus(); if(bCheckLineOpt==TRUE) { draglinedraw=TRUE; m_PointOld. x=x2; m_PointOld. y=y2; } if(bCheckLoadOpt == TRUE)

DrawLoad(); if(bCheckHcurrOpt== TRUE) DrawHcurr(); * void CProjectView::OnMouseMove(UINT nFlags, CPoint point) – is mainly responsible for the drawing of feeder on the movement of mouse. It checks if draglinedraw flag is TRUE or not. If TRUE it draws else it doesn’t. * void CProjectView::OnLButtonUp(UINT nFlags, CPoint point) – draws the 3 phase feeder from the point on document where mouse button was pressed to the point where mouse button is released and also draws the bus in case it is being dragged from previous location further modifies the m_BusArray variable of CProjectDoc class. void CProjectView::DrawBus() – calls the member function of CBus class that draws the final Bus on document and can be seen by the user i. e. it calls void CBus::Bus_Draw(CDC *pDC) . * void CProjectView::DrawHcurr() – calls void CHcurr::Hcurr_Draw (CDC *pDC) that draws the Harmonic current injector.. * void CProjectView::DrawLine() – calls void CLine::Line_Draw (CDC *pDC) which draws the 3 phase feeder. * void CProjectView::DrawLoad() – calls void CLoad::Load_Draw(CDC *pDC). * void CProjectView::OnRun() – this is called when the run button on the tool bar is pressed.

This asks for the tolerance value and then executed the background analysis of the data to carry out the harmonic load flow analysis of the simulated system. The main flow of the function is discussed later. Apart from the above classes and the changes that have been made in them, new classes are added to give the software GUI desired look. New classes added are – * The CObject derived classes – * CBus – Its member function void CBus::Bus_Draw(CDC *pDC) does the work of drawing Bus on the canvas where the mouse click is released. CHcurr – Its member function void CHcurr::Hcurr_Draw (CDC *pDC) draws the harmonic current injector on the corresponding bus as soon as mouse click is released. * CLine – Its member function void CLine::Line_Draw (CDC *pDC) draws the 3 phase feeder on mouse movement and as the mouse button is released from the FromBus to ToBus specified. * CLoad – Its member function void CLoad::Load_Draw(CDC *pDC) draws the load on mouse button release on the LOnBus specified. * The CDialog derived classes – CDlgBus – is responsible for getting the data for the bus from user and then passing it to the CProjectView class data members. * CDlgFeeder – responsible for input of data for Feeder. * CDlgLoad – its dialogue box takes the data from user and then assigns them to the corresponding variables of load in CProjectView class. * CDlgHCurr – for the data input of a Harmonic current injector. * CTol – this class inputs the tolerance of the system and then passes it directly to the OnRun() function to carry out the analysis.

The view and usage of GUI visible to user – When the program is run the first window looks like (with a blank document) To the existing predefined MDI application’s CMainFrame class a new toolbar with ID IDR_MyToolBar is been added which helps user to simulate bus feeder model using different buttons as displayed below. Each button triggers display of a corresponding dialogue box to enter the relevant data and is responsible for addition of an element to the network except last one (Run) which asks for tolerance of the system and executes the analysis.

Corresponding dialogue boxes and their class files are- 1. Add a bus – DlgBus. cpp 2. Add Load – DlgLoad. cpp 3. Add 3 phase feeder – DlgFeeder. cpp 4. Harmonic Current – DlgHcurr. cpp Figure 1 Harmonic Current Dialog Box 5. Run – Tol. cpp Note: The values shown in the dialogue boxes are completely arbitrary and no results or conclusions are based using these. An example of working of GUI and adding elements To begin with we added a bus with bus no 1 and clicked on canvas to get the bus drawn and then added another bus with bus no 2.

After adding one more bus with bus no 3 a feeder with line no 1 was added between bus no 1 and 2 and further adding another feeder with line no 2 between 2 and 3 bus. After that a load is being added on bus 2 followed by a harmonic current injector at bus 3. Adding one more load at bus no 3. Finally a sample simulation of a radial distribution system can be seen as: 4. 2. 2 The main background code and its flow of control The main code that analyses the network and carries out the harmonic load flow analysis by the algorithms discussed before resides in the OnRun() function of CProjectView class.

After the run button is pressed the complete network that is saved in for of four arrays CBus*>m_BusArray, CLine*>m_LineArray, CLoad*>m_LoadArray and CHcurr*>m_HcurrArray is available for analysis. Classes used zline – Member variables – int startbus, endbus; float rBij[3],iBij[3];//real and imaginary branch currents for harmonic load flow float rbc[3],ibc[3]; //real and imaginary branch currents for fundamental load flow float rnew[3][3],xnew[3][3];//3×3 matrix for line impedance The rnew and xnew matrices are reduced from 4×4 matrices to 3×3 by using kron’s reduction which have already been discussed.

Member functions – void zline_init(int i, int j, float length)//to initialize the member variables of the class this function takes values from three arrays from_bus[], to_bus[] and length[] which are being initialized from the m_LineArray obect’s member variables till no_lines {no_lines=pDoc->GetNumLine()}. bus – Member variables – float rpower[3], ipower[3];//initialized by the m_LoadArray if present on the bus float rvolt[3],ivolt[3];//real and imaginery voltages after harmonic analysis float rvoltf[3],ivoltf[3];//real and imaginery voltages after fundamental load flow float bus_volt[8][3]; // to store harmonic oltages of each phase at each bus float THD[3]; // to store THD of each phase float bus_voltf[3];//magnitude of bus voltages float ric[3],iic[3]; //fundamental injected current at bus float Ih[8][6];//injected harmonic current at respective buses int busno; bus * prev ,* next;//nodes for creation of network as doubly linked list Member functions – bus(int bn) – The constructor of class bus. It initializes all the member variables to null and busno to bn so that there are no garbage values in the object of bus at the time of declaration. 4. 3 Program Flow

In the program the first step involved is implementing the network which is to be analyzed. The network is created as simulated using a doubly linked list which is pointed to by a head pointer (bus class type) that always points to the reference bus. Partial code: bus *head; head = new bus(0); int bus_no; int prev_bus=0; bus *termbus, *temp1, *temp2; /*code to create the network*/ bus_no = terminal_bus[0]; termbus = new bus(bus_no); //insert other values for the bus head->next[0] = termbus; termbus->prev = head; while(prev_bus! =1) { for(int i=0;i<no_lines;i++) { f (to_bus[i] == bus_no) { prev_bus = from_bus[i]; break; } } bus *newbus = new bus(prev_bus); temp1 = head->next[0]; temp2 = head; head->next[0]->prev = newbus; head->next[0] = newbus; newbus->prev = temp2; newbus->next[0] = temp1; bus_no = prev_bus; /*code to create the network ends*/ Further the Class instances of both zline and bus class types are initialized using zline_init(int i, int j, float length) and bus(int bn) member functions followed by initialization of bus member variables Ih[][] and rpower[], ipower[] for the buses which have the harmonic load injector or a load present.

Once the modeled system is built in form of doubly linked list and all input data is assigned to bus and zline class, Harmonic Load flow analysis is carried out. Current injected at each node is calculated using Eqn. 11. This is followed by an iteration of backward current sweep and forward voltage sweep. The deviation in node voltages between two iterations should be less than tolerance specified. If not the process is repeated until number of iterations exceed the maximum number used (10 in the software).

After the fundamental voltage values have been calculated in rvoltf[3],ivoltf[3] (float data members of the bus class, representing real and imaginary voltages for the fundamental load flow analysis) the program moves on to harmonic load flow analysis. The harmonics that are considered are 6n±1 and thus are index wise stored in an array – int harmonics[8] = {5,7,11,13,17,19,23,25}; Algorithm for harmonic load flow analysis is used to perform backward current sweep and forward voltage sweep separately for each harmonic.

It saves the harmonic voltages for each bus in float bus_volt[][] array member variable of bus class for each harmonic. Further after the fundamental bus voltages and harmonic bus voltages have been calculated, total harmonic distortion is calculated using equation 16 as discussed before. 4. 4 Software testing of a sample system: A system was simulated having 5 buses and 4 feeders. The length of feeders was taken to be 10 kms. A load and harmonic current injector was added at bus number 2, 3 and 5. A snapshot showing addition of harmonic current is displayed below.

The data was input in the form of load and harmonic current values and the simulation was run. The output of the simulation was generated in “output. txt”. The contents of the file are as listed. Fundamental load flow output Bus No. Voltage aVoltage bVoltage c 1111 20. 9820. 9770. 956 30. 9580. 94020. 951 40. 9450. 9430. 923 50. 9320. 9350. 934 Harmonic load flow output Bus Number2 THD aTHD bTHD c 0. 6850. 6610. 640 H orderVolt aVolt bVolt c 50. 00520. 00430. 0057 70. 00410. 00390. 0053 110. 00340. 00320. 0032 130. 00230. 00220. 0022 170. 00130. 00130. 012 190. 00110. 00100. 0011 230. 00100. 00160. 0012 250. 00080. 00100. 0007 Bus Number3 THD aTHD bTHD c 1. 1611. 1541. 167 H orderVolt aVolt bVolt c 50. 00850. 00800. 0083 70. 00680. 00630. 0067 110. 00340. 00320. 0039 130. 00240. 00250. 0021 170. 00250. 00280. 0023 190. 00270. 00290. 0021 230. 0023 0. 00220. 0026 250. 00120. 00170. 0012 Bus Number4 THD aTHD bTHD c 1. 9591. 9461. 965 H orderVolt aVolt bVolt c 50. 01340. 01380. 0129 70. 01030. 01070. 0112 110. 00660. 00620. 0059 130. 00430. 00440. 0050 170. 00330. 00350. 0032 190. 00370. 00320. 0040 230. 0220. 00190. 0024 250. 00270. 00240. 0029 Bus Number5 THD aTHD bTHD c 2. 4362. 3282. 342 H orderVolt aVolt bVolt c 50. 01620. 01570. 0165 70. 01320. 01240. 0136 110. 00730. 00760. 0067 130. 00570. 00530. 0052 170. 00450. 00470. 0039 190. 00420. 00490. 0050 230. 00350. 00320. 0037 250. 00320. 00390. 0031 5. Conclusion The software developed for harmonic load flow analysis performs two most important analyses in power systems- load flow analysis and harmonic analysis. Moreover the provision for three phase harmonic analysis can be used for unbalanced systems.

The backward /forward sweep method saves computational time. This software has been designed for non branched networks but it can be easily extended for radial distribution systems. The use of interactive GUI makes it easier to model a distribution system by choosing bus, feeder, load and harmonic current source from the toolbar. The software has been tested on a five bus network with 3- phase harmonic current injection. The results are within acceptable limits. However, due to lack of availability of 3 phase harmonic data the results could not be cross checked against a reference.

The software can be easily extended for commercial use. In its present state it can be a valuable tool for teaching and self study purposes. The possibilities and suggestions of further modification have been provided in the upcoming chapter. 5. Further work/improvement Commercial software is a result of years of refinement and improvement and researches. Software projects are always meant for further expansion. It’d be pompous to say that this is complete software with no errors and limitations and needs no expansion. Various limitations have been discussed in different chapters.

When this software was being developed, we realized lots of issues were there that need to be answered further. But, given the time-constraints, modifications were, unfortunately, not possible. Few areas where this software can be improved are discussed below. 1. Further enhancements in GUI: Currently the Graphical user interface developed is just about satisfying basic needs for simulation of a 3 phase distribution network. It may be noted that once entered the value change is not permitted nor is the dragging of elements of network is allowed once placed on the canvas.

Once a network is made it becomes static and more elements can be added but deletion is not allowed. These restrictions can be removed to make the GUI more user friendly and easy to use. 2. Analysis for branched network: Currently, only a network with no branches can be analyzed with the software. If a branched radial network is drawn then the network will be treated as a non branched network ignoring the other lines added after addition of a line on a node. The same algorithm can be used to implement analysis of branched network itself. This enhancement would be highly useful for implementing use of the software for industries. . Designing of filter for the harmonics: Software calculates harmonic voltages and total harmonic distortions corresponding to each bus. This data can be utilized in design of filter for the network. This software has the capability to carry out harmonic load flow analysis for a very large system and since the algorithm used is forward backward sweep ,developed in core C++, thus memory and processor requirements is not too much. We would strongly advise interested students to study this software and extend it further. 6. Bibliography 1. F. D. Martzloff and T. M.

Gruz~“, Power Quality Site Survey: Facts, Fiction and Fallacies,” IEEE Trans. on IA Vol 24, 1988, pp. 1005-1018. 2. A. Domijan, G. T. Heydt, A. P. S. Meliopoulos, S. S. Venkata and S. West, “Directions in Research in Electric Power Quality,” IEEE Trans. PWRD, Vol. PWRD-8, Jan 1993, pp. 429-436. 3. “Effects of the Harmonics on Equipment, ” Report of the IEEE Task Force on Harmonic Impacts. ” IEEE Trans. on PWRD, Vol. 8, No. 2, April 1994, pp. 672- 680. 4. J. Arrilliaga, D. A. Bradley, P. S. Bodger, “Power System Harmonics,” John Wiley and Sons, New York, 1985. . George. G. Wakileh, “Power System Harmonics, Fundamentals, Analysis and Filter design”, Springer. 6. “Modeling and Simulation of the Propagation of Harmonics in Electric Power Network Part I: Concepts, Models and Simulation Techniques,” Task Force on Harmonics Modeling and Simulation, IEEE Trans. on PWRD, Vol. 11, No. 1, Jan. 1996, pp. 452- 465. 7. “Modeling and Simulation of the Propagation of Harmonics in Electric Power Network Part 11: Sample Systems and Examples,” Task Force on Harmonics Modeling and Simulation, IEEE Trans on Power Delivery, Vol. 1, No. 1, pp. 466-474, Jan. 1996. 8. D. Xia and G. T. Heydt, “Harmonic Power Study PartI – Formulation and Solution,” IEEE Trans. on PAS,Vol. PAS 101, No. 6, June 1982, pp. 1257-1265. 9. D. Xia and G. T. Heydt, ‘‘Harmonic Power Study Part II – Implementation and Practical Application,” IEEE Trans. on PAS, Vol. PAS 101, No. 6, June 1982, pp. 1266-1270. 10. Y. H. Yan, C. S. Chen, C. S. Moo and C. T Hsu, “Harmonic analysis for industrial customers,” IEEE Trans. on IAS, Vol. 30, No. 2, March-April 1994, pp. 462 -468. 11. G. T. Heydt and A. W.

Galli, “Transient Power Quality Problem Analyzed Using Wavelet,” IEEE Trans. on PWRD, Vol. 12, No. 2, Apr. 1997, pp. 908-915. Appendix List of Equations Equation 1 Fourier series for a periodic function4 Equation 24 Equation 34 Equation 45 Equation 55 Equation 65 Equation 7 RMS value5 Equation 8 Total Harmonic Distortion6 Equation 9 Real power balance13 Equation 10 Reactive power balance13 Equation 11 Nodal current15 Equation 12 Backward Sweep16 Equation 13 Forward Sweep16 Equation 14 Backward Sweep18 Equation 15 Forward Sweep19 Equation 16 Voltage THD19