50
Implementation and evaluation of a distribution load flow algorithm for networks with distributed generation Semester Work Vanco Janev EEH - Power Systems Laboratory Swiss Federal Institute of Technology, Zurich Supervisors: Dipl.-Ing. Stephan Koch Prof. Dr. Göran Andersson Zurich, in March 2009

Semester Thesis Janev 2009

Embed Size (px)

Citation preview

Page 1: Semester Thesis Janev 2009

Implementation and evaluation of a distribution load flow

algorithm for networks with distributed generation

Semester Work

Vanco Janev

EEH - Power Systems Laboratory

Swiss Federal Institute of Technology, Zurich

Supervisors:

Dipl.-Ing. Stephan Koch

Prof. Dr. Göran Andersson

Zurich, in March 2009

Page 2: Semester Thesis Janev 2009

 

Page 3: Semester Thesis Janev 2009

Statement regarding plagiarism when submitting written work at ETH Zurich By signing this statement, I affirm that I have read the information notice on plagiarism, independently produced this paper, and adhered to the general practice of source citation in this subject-area. Information notice on plagiarism: http://www.ethz.ch/students/semester/plagiarism_s_en.pdf _______________________ ___________________________________ place and date signature

4/4

Page 4: Semester Thesis Janev 2009

 

Page 5: Semester Thesis Janev 2009

Abstract

In this semester project, an existing algorithm for the calculation of power flow in a distribution network with dispersed generation is presented and implemented in MATLAB code. With the developed code a given network is analyzed. Special consideration was given to the voltage profile of the network, active and reactive power losses, and active and reactive power flows. Two cases were taken into account: network with dispersed generation and network without dispersed generation. Different types of representative distribution generation profiles and load profiles were adopted. Code was developed for the calculation of both PQ and PV buses. Comparisons were made in case with and without DG units.

Page 6: Semester Thesis Janev 2009

Preface

This semester thesis was completed under the supervision of Prof. Dr. Göran Andersson and Dipl.-Ing. Stephan Koch from Power Systems Laboratory, Department of Information Technology and Electrical Engineering, ETH Zurich.

I would like to thank my supervisor Prof. Dr. Göran Andersson for his support and help for this work. I am very much indebted to Dipl.-Ing Stephan Koch for his helpful advices and comments during my work. He has always been ready for discussions and his wonderful suggestions helped me to improve my MATLAB programming skills and extend my knowledge of distribution networks.

Vanco Janev

Zurich, March 2009

Page 7: Semester Thesis Janev 2009

Contents

1. List of Figures ........................................................................................................... 5

2. Introduction ............................................................................................................... 7

3. Theoretical Background ............................................................................................ 8

3.1 Basic equations ................................................................................................... 8

3.2 Dynamic data structure algorithm ........................................................................ 9

3.3 Power flow calculation algorithm ........................................................................ 11

4. Case Study ............................................................................................................. 15

4.1. Network topology .............................................................................................. 16

4.2. Load and Generation Profiles ........................................................................... 17

4.3. Results of the load flow calculation ................................................................... 21

5. Conclusion .............................................................................................................. 29

6. Bibliography ............................................................................................................ 30

7. Appendix A ............................................................................................................. 32

8. Appendix B ............................................................................................................. 43

Page 8: Semester Thesis Janev 2009

1. List of Figures

Figure 1: Model of a transmission line

Figure 2: Schematic diagram of a dynamic data structure

Figure 3: Radial system used as an example in this work with all the brunches displayed

Figure 4: Representation of the data structure storing details of branch II

Figure 5: Distribution load flow with distributed generation algorithm

Figure 6: Worked example of distribution network

Figure 7: Active power load per bus

Figure 8: Reactive power load per bus

Figure 9: Active power generation per bus

Figure 10: Reactive power generation per bus

Figure 11: cos𝜑 𝑃

𝑃𝑛 graphic

Figure 12: Active load-generation per bus

Figure 13: Reactive load-generation per bus

Figure 14: Voltage profile without DG

Figure 15: Voltage profile with DG

Figure 16: Voltage angle profile without DG

Figure 17: Voltage angle profile with DG

Figure 18: Active power losses without DG

Figure 19: Active power losses with DG

Figure 20: Reactive power losses without DG

Figure 21: Reactive power losses with DG

Figure 22: Active power flow without DG

Figure 23: Active power flow with DG

Figure 24: Reactive power flow without DG

Figure 25: Reactive power flow with DG

Figure 26: Industry workday load profile

Figure 27: Industry weekend load profile

Figure 28: Household workday profile

Figure 29: Household weekend profile

Figure 30: Workday 2/5 household+3/5industry load profile

Page 9: Semester Thesis Janev 2009

Figure 31: Weekend 2/5 household+3/5industry load profile

Figure 32: PV generation

Figure 33: Wind generation

Figure 34: Small hydro generation

Figure 35: Biomass generation

Page 10: Semester Thesis Janev 2009

7

2. Introduction

Electrical energy is essential for the existence of the civilized world today. The present power system results from a long-term development that has started 120 years ago and is still going on.

The necessity for reduction of 𝐶𝑂2 emissions in the atmosphere, current primary energy shortage, acceptance problems with nuclear power after the nuclear accident in Chernobyl and the new deregulated market trigger more attention to be paid to renewable energy sources and dispersed energy generation. According to different studies such as [1], the share of dispersed generation technology in overall power generation has been increased substantially compared with the share before some years ago. Having dispersed generation close to the loads can reduce transmission and distribution costs, including delayed equipment upgrades and loss reduction and reduced voltage sags.

Distribution systems were designed to operate under radial (unique path from any given bus to the source) and unidirectional power flow conditions, but with dispersed generation in the network the power flow is no longer unidirectional. Wide use of dispersed energy generation units changes the planning as well as the way of operation of the power system. Hierarchical structure of the power system which was the case until now is threatened by the penetration of DG in the system. An existence of DG units in the system results with new tasks for the distribution network. The role of conventional power plants in the power system is to generate energy, but they also participate in the voltage and frequency control. The ancillary services that conventional power plants are providing for the power system are very important for stable operation of the system. A possible threat for stable operation of the power system is the installed capacity of dispersed generation units in the system, which usually does not provide the ancillary services mentioned above and whenever a fault occurs they are disconnected from the network. Disconnection can increase the impact of the disturbance and lead to a power system outage.

However, concluding that the penetration of distributed generation is real and cannot be neglected, deep and detailed studies are needed on dynamic and static analysis of the distribution network. For these studies to be possible an appropriate power flow algorithm is a basic need. Distribution network characteristics are radial or near radial structure, high R/X ratios, unbalanced operation, and nowadays dispersed generation. In this semester work for the sake of simplicity was assumed three-phase balanced operation. According to the distribution network characteristics, suitable methods for load flow calculation in distribution networks are methods that use ladder network theory, which includes the use of basic circuit theories (Kirchhoff's Current Law and Kirchhoff's Voltage Law) and natural feature of the radial networks that there is a unique path from any given bus to the source. The general algorithm used in the ladder network methods consists of two steps: backward and forward sweep. The forward sweep is usually a voltage drop calculation from the main substation bus to the furthest bus and backward sweep is usually current summation based on the voltage updates from the furthest bus to the main substation bus. These two steps are repeated until convergence is met. In this semester work was implemented a distribution load flow method [2, 4] which is in the group of ladder network theory methods, but is slightly

Page 11: Semester Thesis Janev 2009

8

different, namely in this method both sweeps are backward and instead of branch current a power flow in the branches is used. The reason why I chose this method is because of the noticeable low number of iterations needed to solve the equations and its convenience with network reconfiguration [2, 3].

3. Theoretical Background

The following part explains the theoretical background of load flow algorithm used in this semester thesis.

3.1 Basic equations

It is assumed that the three-phase distribution system is balanced and can be represented by an equivalent single line diagram. The line-to-ground capacitance at the distribution voltage level is small and thus neglected [2, 4]. A simple model of a transmission line, which has been used in the algorithm, is shown in Figure 1:

Figure 1: Model of a transmission line

A number of methods for power flow calculation use recursive equations in different forms considering sending end (𝑖 − 𝑡ℎ end) or receiving end (𝑗 − 𝑡ℎ end). Those equations are proposed in [2, 3, 5, 6, and 7] and will also be used in this work. The equations are given below:

The receiving end bus voltage considering sending end powers of the line is given

below:

𝑉𝑗2 = 𝑉𝑖

2 − 2 𝑟𝑖𝑗𝑃𝑖 + 𝑥𝑖𝑗𝑄𝑖 + 𝑟𝑖𝑗

2 + 𝑥𝑖𝑗2 (𝑃𝑖

2 + 𝑄𝑖2)

𝑉𝑖2 1

The receiving end bus voltage considering receiving end powers of the line is given

below:

𝑉𝑗2 = −(𝑟𝑖𝑗𝑃𝑗 + 𝑥𝑖𝑗𝑄𝑗 −

𝑉𝑖2

2)2 + (𝑟𝑖𝑗𝑃𝑗 + 𝑥𝑖𝑗𝑄𝑗 −

𝑉𝑖2

2)2 − 𝑟𝑖𝑗

2 + 𝑥𝑖𝑗2 (𝑃𝑗

2 + 𝑄𝑗2) 2

Page 12: Semester Thesis Janev 2009

9

Using the value of receiving end bus voltage, the receiving end bus angle can be

calculated through the equation given below:

𝛿𝑗 = 𝛿𝑖 − 𝑐𝑜𝑠−1 1 − 𝑥𝑖𝑗𝑃𝑗 + 𝑟𝑖𝑗𝑄𝑗

𝑉𝑖𝑉𝑗

2

3

The line losses between the receiving and sending end buses 𝑃𝑙𝑜𝑠𝑠 and 𝑄𝑙𝑜𝑠𝑠 can

be calculated using equations (4) and (5):

𝑃𝐿𝑖𝑗 = 𝑟𝑖𝑗 𝑃𝑗

2 + 𝑄𝑗2

𝑉𝑗2 4

𝑄𝐿𝑖𝑗 = 𝑥𝑖𝑗 𝑃𝑗

2 + 𝑄𝑗2

𝑉𝑗2 5

3.2 Dynamic data structure algorithm

The method used to store dynamic data structure details of a branch is explained below. The following attributes were taken in to account when this method was developed [4]:

1. Dynamic nature of data structures is such that it may be created and altered in the execution stage

2. Dynamic data structure required for holding the information of a branch must be compact and addressable from any function.

3. Dynamic data structure must be flexible to accommodate any number of buses within a branch.

4. Dynamic data structure must be flexible also to address data structures of branches that emanate from the end of a branch.

The data structure of a branch needs to hold the following information according to [3]:

Parent bus to which the branch is connected;

Number of buses in the branch;

An array to store IDs of all the buses in the order of their location from the head of the branch;

Number of branches emanating from the last bus of this branch;

An array of pointers pointing to the data structures that store information of emanating branches;

An array to store IDs of buses at the head of emanating branches;

Page 13: Semester Thesis Janev 2009

10

The schematic diagram of the dynamic data structure is shown in Figure 2. Starting from the main substation, branches are sequentially stored in the data structure using a recursive function.

Number of buses in branch Number of branches emanating

Arre

y of b

us id

s

Arra

y of h

ea

d b

us id

s

of e

ma

na

ting

bra

nch

es

Po

inte

rs to stru

cture

of

em

an

atin

g b

ran

che

s

Parent bus id

Figure 2: Schematic diagram of a dynamic data structure

The method creates the branch structures by starting at the main substation

bus and then recursively calling a function that forms the first branch by sequentially considering buses until it finds one that has several branches emanating from it. Referring to Figure 3, which presents the radial system used as an example in this work taken from reference [4], it builds the first branch from bus 1 up to bus 3, where two branches emanate. Therefore the data structure created for the branch labeled I, starts with bus 1 and ends with bus 3, comprising three buses. It has two branches emanating from it, namely II and III. In the structure labeled I pointers that point towards the structures storing details of branches II and III are stored. The recursive function calls itself five times, once for each branch. This process proceeds until data structures for all the branches are built.

Page 14: Semester Thesis Janev 2009

11

1

8

7

9

10

11

6

5

4

3

2

V

IV

III

II

I

Figure 3: Radial system used as an example in this work with all the branches

displayed

A representation of the data structure storing details of branch I is shown in Figure 4.

Number-of-buses-in-

branch 3

1

3

2

Parent-bus-id 3

Number-of-branches-emanating 2

4

8

II

III

Figure 4: Representation of the data structure storing details of branch II

Page 15: Semester Thesis Janev 2009

12

3.3 Power flow calculation algorithm

The dynamic data structures presented above are highly flexible and very convenient for usage by a recursive function that solves the power flow in the radial distribution network. The recursive algorithm computes voltage magnitudes and phase angles at all buses of a radial distribution system. It starts by computing the voltage at the furthest end of the first branch using equation 2 . If there are branches emanating from this end bus, this algorithm recursively calls itself to compute the state of the buses in these branches and the power they draw from the furthest bus. This recursive call is continued until a branch is reached from which other branches do not emanate. Then, the algorithm computes the voltage at the furthest bus using voltage equation 2 , with knowledge of its load. Using the expressions for line losses

equations 4 and 2 between the receiving and sending end buses, power loss in the transmission line is computed connecting this bus and the next bus in a direction leading to the first bus of the branch 𝑖. With load known at bus 𝑗 and transmission

power loss in the line between buses 𝑖 and 𝑗 known, the algorithm computes the line

load at bus 𝑖. This process continues until the voltage has been computed for the first

bus. The phase angle of the voltage phasor at the 𝑖 − 𝑡ℎ bus could be computed using the equation 3 . In this work for convergence is checked whether the sum of powers flowing out of the lines connected to each bus equals (or equals within a tolerable limit) the net power injected into that bus by the connected generators and loads.

Mathematically, this convergence criterion is described in equations 6 and 7 where 휀 is a tolerance value.

𝑃𝐺𝑖 + 𝑃𝐷𝑖 − 𝑉𝑖𝑉𝑗𝑌𝑖𝑗 𝑐𝑜𝑠 𝛿𝑖 − 𝛿𝑗 − 𝜃𝑖𝑗

𝑗

≤ 휀 6

𝑄𝐺𝑖 + 𝑄𝐷𝑖 − 𝑉𝑖𝑉𝑗𝑌𝑖𝑗 𝑠𝑖𝑛 𝛿𝑖 − 𝛿𝑗 − 𝜃𝑖𝑗

𝑗

≤ 휀 7

In the MATLAB implementation, the net power injected in the equations 6 and 7 is in a slightly different form, which is explained below. The following part explains the derivation of the net apparent power in case of three bus network.

1 2 3

The basic voltage equations between buses 1 and 2 and buses 2 and 3 are:

Page 16: Semester Thesis Janev 2009

13

𝑉1 = 𝑉2 + 𝐼12𝑍12 (𝑖)

𝑉2 = 𝑉3 + 𝐼23𝑍23 (𝑖𝑖)

The net apparent power injected 𝑆𝑛𝑖2 into the bus 2 is:

𝑆𝑛𝑖2 = 𝑉2𝐼12∗ − 𝑉2𝐼23

∗ (𝑖𝑖𝑖)

From the equations (𝑖), (𝑖𝑖) and 𝑖𝑖𝑖 the following equation for 𝑆𝑛𝑖2 is derived:

𝑆𝑛𝑖2 = 𝑉2 𝑉1 − 𝑉2

𝑍12

− 𝑉2 𝑉2 − 𝑉3

𝑍23

(𝑖𝑣)

The final equation for calculation of the net apparent power injected, in which the self impedance is contained, is given below. This form of the equation is implemented in the code.

𝑆𝑛𝑖2 = 𝑉1 𝑉2

𝑍12 𝑒𝑗 𝛿2−𝛿1+𝜃12 +

𝑉2 𝑉3

𝑍23 𝑒𝑗 𝛿2−𝛿3+𝜃23 − 𝑉2

2 𝑒 𝑗 𝜃12

𝑍12 +

𝑒 𝑗 𝜃23

𝑍23

So far, a method for the calculation of a distribution load flow without PV buses in a network has been presented. A modification of this method is possible in order to calculate the load flow in a distribution system with distributed generation with controllable bus voltage [2]. Any bus containing a generator with voltage control possibility is represented as a PV bus. All other buses in the distribution system are represented as PQ buses. The known variables and those to be calculated during a load flow for PV and PQ buses are as follows:

PV buses:

known variables are active power and voltage magnitude; unknown variables are reactive power and voltage angle;

PQ buses:

known variables are active and reactive power; unknown variables are voltage magnitude and angle;

Equation 2 is used to calculate the voltage of a PQ bus, since the real and

reactive powers are known. A different method is used for calculating the reactive power injected into a PV bus 𝑄𝑗 . With rearrangement of the previously given

equation 2 , 𝑄𝑗 can be a variable to solve and 𝑉𝑗 to be a known variable. Another

method for calculating 𝑄𝑗 is to use the reactive power injection equation, as given

below:

𝑄𝑗 = 𝑉𝑗𝑉𝑘𝑌𝑗𝑘 𝑠𝑖𝑛 𝛿𝑗 − 𝛿𝑘 − 𝜃𝑗𝑘

𝑘

(8)

Page 17: Semester Thesis Janev 2009

14

Due to real and reactive power limits of the generator, it is not sufficient to use the above equation to calculate the 𝑄𝑗 of a PV bus. Once calculated, this value of 𝑄𝑗

can be used to determine the amount of reactive power produced by the generator at that PV bus. The actions that need to be taken for maximum and minimum reactive power generator limits 𝑄𝑚𝑎𝑥 ,𝑄𝑚𝑖𝑛 violations are outlined below:

1. 𝑵𝒐 𝒗𝒊𝒐𝒍𝒂𝒕𝒊𝒐𝒏 Then 𝑷𝒓𝒐𝒄𝒆𝒆𝒅 𝒃𝒚 𝒖𝒔𝒊𝒏𝒈 𝑸𝒋 𝒕𝒐 𝒄𝒂𝒍𝒄𝒖𝒍𝒂𝒕𝒆 𝜹𝒋

2. 𝑸𝒋 < 𝑸𝒎𝒊𝒏 Then

𝑺𝒆𝒕 𝑸𝒈𝒆𝒏 = 𝑸𝒎𝒊𝒏

𝑭𝒊𝒏𝒅 𝑸𝒋𝒏𝒆𝒘 = 𝑸𝒈𝒆𝒏 −𝑸𝒍𝒐𝒂𝒅

𝒕𝒉𝒆𝒏 𝒖𝒔𝒆 𝑸𝒋𝒏𝒆𝒘 𝒕𝒐 𝒓𝒆𝒄𝒂𝒍𝒄𝒖𝒍𝒂𝒕𝒆 𝑽𝒋 𝒂𝒏𝒅 𝜹𝒋 𝟗

3.𝑸𝒋 > 𝑸𝒎𝒂𝒙 Then

𝑺𝒆𝒕 𝑸𝒈𝒆𝒏 = 𝑸𝒎𝒂𝒙

𝑭𝒊𝒏𝒅 𝑸𝒋𝒏𝒆𝒘 = 𝑸𝒈𝒆𝒏 −𝑸𝒍𝒐𝒂𝒅

𝒕𝒉𝒆𝒏 𝒖𝒔𝒆 𝑸𝒋𝒏𝒆𝒘 𝒕𝒐 𝒓𝒆𝒄𝒂𝒍𝒄𝒖𝒍𝒂𝒕𝒆 𝑽𝒋 𝒂𝒏𝒅 𝜹𝒋

The distribution load flow algorithm for networks with distributed generation is shown as a flow chart in Figure 5. The subscript 𝑗 refers to the index of the current "receiving end bus" (refer to Figure 1). The "start bus" should be the last bus at the end of a radial branch, as was mentioned previously in the text, since the load flow iterates from the end of a radial branch up to the top-most bus (which typically represents the substation bus). The values of 𝑉𝑗 and 𝛿𝑗 are calculated with previously given

equations 2 and 3 . The reactive power 𝑄𝑗 injected into bus 𝑗 is calculated for PV

buses by using the above equations. 𝑄𝑗 Then can be used for calculation of the

reactive power generated at that bus 𝑄𝑔𝑒𝑛 . The procedures for generator reactive

power limit violations are given above. The convergence criteria remain the same as previously explained.

Page 18: Semester Thesis Janev 2009

15

Go to “Start Bus” Go to next bus (next j value)

Use Qj-new to calculate Vj (Eq. 2)

Find Ploss, Qloss ( Eq. 4 and 5)

Find 𝛿 (Eq. 3)

Find Vj (Eq. 2)

Pj=Pacc+Ploss+Pgen

Qj=Qacc+Qloss+Qgen

End print solution

Chose Qgen-new to get Qj-new

Find Qj Eq. (8),

Use Qj to Find Qgen

Pj=Pacc+Ploss+Pgen

START

PV or PQ

Bus?

PV PQ

Qgen

violation?

End bus?

Convergence

criteria met? (Eq.

6 and 7 )

Yes

No

No

No

Yes

Yes

Figure 5: Load flow algorithm for networks with dispersed generation

4. Case Study

In this chapter the above presented algorithm implemented in MATLAB code was employed for a case study. A typical distribution network with DG units shown on Figure 6 taken from reference [3] was used and the following studies were made:

Study of the impact of DG units on network voltage profile;

Study of the impact of DG units on active and reactive power flows in the lines;

Study of the impact of DG units on line losses in the network. In the studies two cases were considered: the network with DG units and

without DG units. Representative load profiles used in this work were taken from VDEW association of the electrical energy industry in Germany [8] available on their web page. Representative generation profiles except wind infeed were taken from EnBW Energie Baden-Württemberg Regional AG from Germany [9] available on-line on their internet web page. The wind infeed profile used here was taken from E.on Netz

Page 19: Semester Thesis Janev 2009

16

(Germany) [10] available on-line on their internet web page. More detailed figures of load profiles used are given in Appendix B.

4.1. Network topology

The distribution network used in this case study is taken from reference [4]. Bus 3 is considered as PV bus the rest of the buses are PQ buses with bus 1 as a slack bus. Bus 1 is main substation bus, it is assumed that its voltage magnitude and angle are constant 1 𝑝.𝑢 and 0 𝑑𝑒𝑔 respectively. This network is derived from a German MV distribution network. The network has rural character and supplies a small town and the surrounding rural area. The rated voltage level of the network is 20 kV. It is supplied from a 110 kV transformer station with apparent power 1 MVA. Most connections are made with cables, but there are also sections of overhead lines. The original network had 30 nodes. To reduce the size to a level that is suitable for DG integration studies while maintaining the realistic character, the original network number of nodes is reduced [4]. The resulting network from reference [4] proposed as a benchmark in this semester work is shown in Figure 6. The total length of the lines in this distribution network is equal to about 15 km. Due to the fact that different countries have varying distribution network parameters, the original values given for the German network were transferred into the per unit system. This facilitates the adaptation of the benchmark to regionally varying parameters. In Figure 6 the distribution of generation and loads per bus is given and is slightly different from the one given in reference [4]. Installed power per bus and per DG type is given below Table 1.

Generation Type Installed power in

[p.u]

Installed power in [kW]

PV bus 1 0.05 p.u 50 kW

Wind bus 1 0.05 p.u 50 kW

Small Hydro bus 3 0.15 p.u 150 kW

PV bus 4 0.05 p.u 50 kW

Biomass bus 4 0.05 p.u 50 kW

PV bus 5 0.1 p.u 100 kW

PV bus 6 0.1 p.u 100 kW

Wind bus 7 0.1 p.u 100 kW

Biomass bus 8 0.1 p.u 100 kW

Biomass bus 9 0.05 p.u 50 kW

Wind bus 9 0.05 p.u 50 kW

Wind bus 10 0.1 p.u 100 kW

Wind bus 11 0.1 p.u 100 kW

Table 1: Dispersed generation installed power

Page 20: Semester Thesis Janev 2009

17

4.2. Load and Generation Profiles

1

8

7

9

10

11

6

5

4

3

2

Households+

Industry

Households+

Industry

Households+

Industry

Households

Households

Households

Households

Households

Industry

Photo

voltaic

Wind

Power

Wind

Power

BiomassPV

Small

Hydro

PV

PV

Wind

Power

Wind

Power

Biomass

Wind

PowerBiomass

Main Substation

Industry

Figure 6: Distribution network used as a benchmark

First, on Figure 7 and 8 active and reactive power loads on every bus during one working day are shown. Reactive power loads are calculated from active power

loads by assuming a power factor of cos𝜑 = 0.9. Active and reactive power generation on every bus in the period of one working day is shown in Figures 9 and 10. Reactive

power generation is calculated using the graphic shown in Figure 11. In that graphic 𝑃 is the active power generation in a certain moment of the day at a certain bus and 𝑃𝑛 is nominal active power generation in that bus. In our case 𝑃𝑛 is 0.1 𝑝.𝑢 for all PQ buses. This method for DG unit’s reactive power generation is required by the grid codes [8]. According to them DG units should be helpful and convenient in voltage and frequency control in the network. With reactive power generation according to the curve shown on Figure 11 required helpful behavior from DG units for voltage control is achieved. This procedure for calculation of reactive power generation was used for PQ buses. For PV buses this is different, reactive power generation is calculated using equations 8 and 9 .The difference between active load and active generation per bus is shown on Figure 12 and the difference between reactive load and reactive generation is shown on Figure 13.

Page 21: Semester Thesis Janev 2009

18

Figure 7: Active power load per bus

Figure 8: Reactive power load per bus

Page 22: Semester Thesis Janev 2009

19

Figure 9: Active power generation per bus

Figure 10: Reactive power generation per bus

Page 23: Semester Thesis Janev 2009

20

cos φ

1P/Pn

0.90

0.90

10.1 0.9

Figure 11: cos𝜑 𝑃

𝑃𝑛 graphic

Figure 12: Active load-generation per bus

Page 24: Semester Thesis Janev 2009

21

Figure 13: Reactive load-generation per bus

4.3. Results of the load flow calculation

In the next figures, a voltage magnitude and angle profile comparison is made between the cases without and with dispersed generation. In Figures 14 and 15, voltage magnitudes are shown, respectively without and with dispersed generation. Buses 1, 2 and 3 are in branch I as you can see from Figure 3. Branch II is consists of buses 4, 5 and 6, branch III is consists of bus 8, branch IV is consists of buses 9, 10 and 11 and branch V is consists of bus 7. With comparison of voltage profiles given on Figures 14 and 15 it can be concluded that the voltage drop in the case without DG is larger than in the case with DG. In the case without DG can be noticed that the voltage curve is following the load profile curve and in the period of the day with increased load, the voltage drop is increased too. While in the case with DG can be noticed improvement in the voltage profile. In some periods of the day when there is low load, voltage goes even beyond 1 𝑝.𝑢 value but in the given tolerance limits. Voltage angles profile is shown in Figure 16 and 17 respectively without and with dispersed generation.

Page 25: Semester Thesis Janev 2009

22

Figure 14: Voltage profile without DG

Figure 15: Voltage profile with DG

Page 26: Semester Thesis Janev 2009

23

Figure 16: Voltage angles profile without DG

Figure 17: Voltage angles profile with DG

Page 27: Semester Thesis Janev 2009

24

In Figures 18, 19, 20 and 21 power losses in the lines are shown in case without and with DG. From the figures can be noticed that power losses in the lines are much larger if the network is without DG. Active and reactive energy losses in the lines during 24h are given in the Table 2. From there could be seen that when the network is without DG energy losses in the lines are larger than when DG units are present in the network. Energy supplied in the system is given in Table 2 and energy lost percentage from overall active energy consumption is given on Table 3.

Table 2: Line losses comparison

Energy supply in the system during 24h

Active energy supply in the system during 24h [kWh]

Rective energy supply in the system during 24h [kVArh]

Total supplied energy in case without DG

15.6 × 103 5.13 × 103

Total supplied energy in case with DG units

From the DG units

11.58 × 103

15.53 × 103

0.94 × 103

5.10 × 103 From the

mainsubstation 3.94 × 103 4.15 × 103

Table 3: Energy supply during 24h

Active energy lost percentage

from overall active energy consumption

Reactive energy lost percentage

from overall rective energy consumption

Without DG units 0.43% 0.30%

With DG units 0.22% 0.15%

Table 4: Percentage of lost energy in total energy supply during 24h

Energy lost in lines during 24h

1-2 line

2-3 line

3-4 line

4-5 line

5-6 line

8-7 line

3-8 line

8-9 line

9-10 line

10-11 line

Total

Active Energy Losses [kWh]

Without DG

25.55 25.55 3.16 1.40 0.35 0.27 7.56 2.71 1.28 0.35 68.18

With DG

4.31 4.31 1.90 0.88 0.22 0.18 2.31 0.88 0.46 0.11 15.56

Reactive Energy Losses [kVArh]

Without DG

12.77 12.77 1.58 0.70 0.17 0.13 3.78 1.35 0.64 0.17 34.06

With DG

2.15 2.15 0.95 0.44 0.11 0.09 1.15 0.44 0.23 0.05 7.76

Page 28: Semester Thesis Janev 2009

25

Figure 18: Active power losses without DG

Page 29: Semester Thesis Janev 2009

26

Figure 19: Active power losses with DG

Figure 20: Reactive power Losses without DG

Page 30: Semester Thesis Janev 2009

27

Figure 21: Reactive power losses with DG

Figures 22, 23, 24 and 25 are showing the power flows per line in case without and with DG. Impact of DG unit’s presence in the network could be seen from these figures too. Power flow per line is also decreased because of the presence of DG units.

Figure 22: Active power per line without DG

Page 31: Semester Thesis Janev 2009

28

Figure 23: Active power per line with DG

Figure 24: Reactive power flow without DG

Page 32: Semester Thesis Janev 2009

29

Figure 25: Reactive power flow with DG

5. Conclusion

In this semester work the distribution load flow algorithm presented in [2] and [4] was implemented in MATLAB. The implemented code in MATLAB was used to perform analyses of the impact of DG units on network voltage profile, on active and reactive power flows in the lines and the impact of DG units on line losses in the network. A representative example of distribution network in this work was analyzed. Different types of representative distribution generation profiles and load profiles were used in all the studies and comparisons are made between the cases without and with presence of DG units in the network. The results from comparisons were shown graphically and structured by bus from where part of the overall impact of the presence of DG units in the network can be seen.

Page 33: Semester Thesis Janev 2009

6. Bibliography

[1] N.I. Voropai: Distributed Generation in Electric Power Systems The DIGESEC CRIS Workshop, Magdeburg, Germany, Dec. 6-8, 2006

[2] A. Rost, B. Venkatesh and C. P. Diduch: Distribution System with Distributed Generation Load Flow Department of Electrical and Computer Engineering New Brunswick, NB, Canada

[3] B. Venkatesh and R. Ranjan: Data Structure for Radial Distribution System Load Flow Analysis IEE Proc.-Gener. Transm. Distrib. Vol 150 No.1 January 2003

[4] K. Rudion, A. Orths, Z. A. Styczynski, K. Strunz: Design of Benchmark of Medium Voltage Distribution Network for Investigation of DG Integration

[5] G. Renato Cespedes: New Method for the Analysis of Distribution Network IEEE Transactions on Power Delivery, Vol. 5, No. 1, January 1990

[6] S. Ghosh and D. Das: Method for Load-Flow Solution of Radial Distribution Networks IEE Proc.- Gener. Transm. Distrib., Vol. 146, No. 6, November 1999

[7] G. B. Jasmon and L. H. C. C. Lee: Stability of Load-flow Techniques for Distribution System Voltage Stability Analysis IEE Proceedings-C, Vol. 138, No. 6, November 1991

[8] „BDEW“: Technische Richtlinie “Erzeugungsanlagen am Mittelspannungsnetz” BDEW, June 2008

[9] „EnBW Energie Baden-Württemberg Regional AG“: http://www.enbw.com

[10] „E.on Netz (Germany)“: http://www.eon-energie.com

Page 34: Semester Thesis Janev 2009

7. Appendix A

Following is the MATLAB code that implements the presented load flow calculation algorithm.

File: start.m

Network = build_network; Profiles = build_profiles;

Voltages(Profiles.time_intervals, Network.num_buses)=0; Angles(Profiles.time_intervals, Network.num_buses)=0; Ploads(Profiles.time_intervals, Network.num_buses)=0; Qloads(Profiles.time_intervals, Network.num_buses)=0; Pgen(Profiles.time_intervals, Network.num_buses)=0; Qgen(Profiles.time_intervals, Network.num_buses)=0; Plosses(Profiles.time_intervals, Network.num_buses)=0; Qlosses(Profiles.time_intervals, Network.num_buses)=0; Pbus(Profiles.time_intervals, Network.num_buses)=0; Qbus(Profiles.time_intervals, Network.num_buses)=0; for i=1:Profiles.time_intervals Results = compute_DLF(Network, Profiles, i); for k=1:Network.num_buses Voltages(i,k)=Results.buses(k).V; Angles(i,k)=Results.buses(k).delta; Ploads(i,k)=Results.buses(k).P_load; Qloads(i,k)=Results.buses(k).Q_load; Pgen(i,k)=Results.buses(k).P_gen; Qgen(i,k)=Results.buses(k).Q_gen; Plosses(i,k)=Results.P_loss(k); Qlosses(i,k)=Results.Q_loss(k); Pbus(i,k)=Results.P_per_bus(k); Qbus(i,k)=Results.Q_per_bus(k); end end

plot_results(Voltages, Angles, Ploads,

Qloads,Pgen,Qgen,Plosses,Qlosses,Pbus,Qbus);

File: build_network.m

function [Network] = build_network

file1 = 'incidence_matrix_11.dat'; file3 = 'resistance_11.dat'; file4 = 'reactance_11.dat'; A=load(file1); C=load(file3); D=load(file4); clear file1 file3 file4

Network.S_B = 1000; % kVA Network.V_B = 20; % kV

Page 35: Semester Thesis Janev 2009

branches=struct('ID',0,'parent_bus_ID',0,'num_buses_in_branch',0

,'array_bus_IDs',0','num_branches_em',0,'array_head_busIDs_em_br

anches',[],'neigh_branches',[]); branches = create_structure(branches, 1, 1, A, 0); Network.branches = branches; s=size(branches,2); for i=1:s branches(i) end

clear branches; Network.num_branches=size(Network.branches,2); Network.num_buses=size(A,2);

resistance=C; resistance=resistance+resistance'; %make it symmetric resistance=resistance./400; % divide by impedance base reactance=D; reactance=1*(reactance+reactance'); %make it symmetric reactance=reactance./400; % divide by impedance base

Network.resistance = resistance; Network.reactance = reactance;

Network.z=zeros(Network.num_buses); Network.teta=zeros(Network.num_buses); for i=1:Network.num_buses for j=1:Network.num_buses

Network.z(i,j)=sqrt(Network.resistance(i,j)^2+Network.reactance(

i,j)^2); if Network.resistance(i,j)~=0

Network.teta(i,j)=atan(Network.reactance(i,j)/Network.resistance

(i,j)); end end end clear resistance reactance A B C D

File: build_profiles.m

function [Profiles] = build_profiles

Pload=load('P_load_work.dat'); Profiles.P_load = Pload; Profiles.Q_load = Profiles.P_load*tan(acos(0.95)); PVPQinfo=load('PV_PQ_info11.dat'); Profiles.PVPQinfo=PVPQinfo; Voltages_init=load('Voltages_init11.dat'); Profiles.Voltages_init=Voltages_init; Pgen=load('Pgen.dat'); Pn=0.7; Profiles.P_gen = Pgen; for i=1:size(Pgen,1)

Page 36: Semester Thesis Janev 2009

for j=1:size(Pgen,2) if((Profiles.P_gen(i,j)/Pn)==0) Profiles.Q_gen(i,j)=0; elseif ((Profiles.P_gen(i,j)/Pn)<=0.1)

Profiles.Q_gen(i,j)=Profiles.P_gen(i,j)*tan(acos(0.9)); elseif ((Profiles.P_gen(i,j)/Pn)>=0.9) Profiles.Q_gen(i,j)=-

Profiles.P_gen(i,j)*tan(acos(0.9)); elseif ((Profiles.P_gen(i,j)/Pn)>0.1) &&

((Profiles.P_gen(i,j)/Pn)<=0.5)

Profiles.Q_gen(i,j)=Profiles.P_gen(i,j)*tan(acos(0.9+0.25*((Prof

iles.P_gen(i,j)/Pn)-0.1))); else Profiles.Q_gen(i,j)=-Profiles.P_gen(i,j)*tan(acos(1-

0.25*((Profiles.P_gen(i,j)/Pn)-0.5))); end end end Profiles.time_intervals=size(Pload,1);

File: compute_DLF.m

function [Results] = compute_DLF(Network, Profiles, t)

fprintf('*******************************\n\t\tTime Interval:

%d\n*******************************\n', t)

%%%%%%%%%%%%%%%%%%%%%%%%%%% %%specify number of iterations num_itr=100;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%% % Inititalize the result structure %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%% Results.buses=struct('ID',0,'P_load',0,'Q_load',0,'P_gen',0,'Q_g

en',0,'V',1,'delta',0,'isPV',0); for i=1:Network.num_buses if ~isempty(Results.buses) && isstruct(Results.buses)

Results.buses(i)=struct('ID',i,'P_load',Profiles.P_load(t,i),'Q_

load',Profiles.Q_load(t,i),'P_gen',Profiles.P_gen(t,i),'Q_gen',P

rofiles.Q_gen(t,i),'V',Profiles.Voltages_init(i),'delta',0,'isPV

',Profiles.PVPQinfo(i)); end end clear i

Results.dP(1:Network.num_buses)=0; Results.dQ(1:Network.num_buses)=0;

Page 37: Semester Thesis Janev 2009

%Initialize vectors containing data Results.P_per_branch(1:Network.num_branches)=0; Results.Q_per_branch(1:Network.num_branches)=0; Results.P_loss(1:Network.num_buses)=0; Results.Q_loss(1:Network.num_buses)=0; Results.P_per_bus(1:Network.num_buses)=0; Results.Q_per_bus(1:Network.num_buses)=0; Results.P_gen(1:Network.num_buses)=0; Results.Q_gen(1:Network.num_buses)=0; Results.V(1:Network.num_buses)=0; Results.delta(1:Network.num_buses)=0;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%% % Start the iterations %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%

for itr = 1:num_itr % fprintf('*******************************\n\t\tIteration

number: %d\n*******************************\n', itr)

%call the function that calculates the load for every bus.

The %calculation starts for the first branch but inside the

function %calculate_load.m it is called recursivly for all the

branches [Results.buses, Results.P_per_branch, Results.Q_per_branch,

Results.P_loss, Results.Q_loss, Results.P_per_bus,

Results.Q_per_bus]=calculate_load(Network.branches(1),

Results.buses, Network, Results.P_per_bus, Results.Q_per_bus,

Results.P_loss, Results.Q_loss, Results.P_per_branch,

Results.Q_per_branch);

P(1:Network.num_buses)=0; % P receiving (used for

convergence check) Q(1:Network.num_buses)=0; % Q receiving (used for

convergence check)

%For all the buses calculate the differences. for br=1:Network.num_branches for n=1:Network.branches(br).num_buses_in_branch m=Network.branches(br).array_bus_IDs(n); if (n<Network.branches(br).num_buses_in_branch)

%calculation for all but last bus in a branch % k-m-l busses l=Network.branches(br).array_bus_IDs(n+1); if((n==1)&&(br==1)) P(m)=0; Q(m)=0; elseif ((n==1)&&(br>1)) k=Network.branches(br).parent_bus_ID;

Page 38: Semester Thesis Janev 2009

P(m)=Results.buses(m).V*Results.buses(k).V*cos(Results.buses(m).

delta-

Results.buses(k).delta+Network.teta(m,k))/Network.z(m,k)+Results

.buses(m).V*Results.buses(l).V*cos(Results.buses(m).delta-

Results.buses(l).delta+Network.teta(m,l))/Network.z(m,l)-

Results.buses(m).V^2*(cos(Network.teta(m,k))/Network.z(m,k)+cos(

Network.teta(m,l))/Network.z(m,l));

Q(m)=Results.buses(m).V*Results.buses(k).V*sin(Results.buses(m).

delta-

Results.buses(k).delta+Network.teta(m,k))/Network.z(m,k)+Results

.buses(m).V*Results.buses(l).V*sin(Results.buses(m).delta-

Results.buses(l).delta+Network.teta(m,l))/Network.z(m,l)-

Results.buses(m).V^2*(sin(Network.teta(m,k))/Network.z(m,k)+sin(

Network.teta(m,l))/Network.z(m,l)); else k=Network.branches(br).array_bus_IDs(n-1);

P(m)=Results.buses(m).V*Results.buses(k).V*cos(Results.buses(m).

delta-

Results.buses(k).delta+Network.teta(m,k))/Network.z(m,k)+Results

.buses(m).V*Results.buses(l).V*cos(Results.buses(m).delta-

Results.buses(l).delta+Network.teta(m,l))/Network.z(m,l)-

Results.buses(m).V^2*(cos(Network.teta(m,k))/Network.z(m,k)+cos(

Network.teta(m,l))/Network.z(m,l));

Q(m)=Results.buses(m).V*Results.buses(k).V*sin(Results.buses(m).

delta-

Results.buses(k).delta+Network.teta(m,k))/Network.z(m,k)+Results

.buses(m).V*Results.buses(l).V*sin(Results.buses(m).delta-

Results.buses(l).delta+Network.teta(m,l))/Network.z(m,l)-

Results.buses(m).V^2*(sin(Network.teta(m,k))/Network.z(m,k)+sin(

Network.teta(m,l))/Network.z(m,l)); end

else %calculation for last bus in a branch for nl=1:Network.branches(br).num_branches_em;

%for all the neighbor busses from the emanating neighbor

branches

l=Network.branches(br).array_head_busIDs_em_branches(nl);

P(m)=P(m)+Results.buses(m).V*Results.buses(l).V*cos(Results.buse

s(m).delta-

Results.buses(l).delta+Network.teta(m,l))/Network.z(m,l)-

Results.buses(m).V^2*cos(Network.teta(m,l))/Network.z(m,l);

Q(m)=Q(m)+Results.buses(m).V*Results.buses(l).V*sin(Results.buse

s(m).delta-

Results.buses(l).delta+Network.teta(m,l))/Network.z(m,l)-

Results.buses(m).V^2*sin(Network.teta(m,l))/Network.z(m,l); end if(n==1) k=Network.branches(br).parent_bus_ID;

Page 39: Semester Thesis Janev 2009

else k=Network.branches(br).array_bus_IDs(n-1); end

P(m)=P(m)+Results.buses(m).V*Results.buses(k).V*cos(Results.buse

s(m).delta-

Results.buses(k).delta+Network.teta(m,k))/Network.z(m,k)-

Results.buses(m).V^2*cos(Network.teta(m,k))/Network.z(m,k);

Q(m)=Q(m)+Results.buses(m).V*Results.buses(k).V*sin(Results.buse

s(m).delta-

Results.buses(k).delta+Network.teta(m,k))/Network.z(m,k)-

Results.buses(m).V^2*sin(Network.teta(m,k))/Network.z(m,k); end end end

%For all the buses calculate the differences. for i=2:Network.num_buses dP(i)=P(i) - Results.buses(i).P_load +

Results.buses(i).P_gen; dQ(i)=Q(i) - Results.buses(i).Q_load +

Results.buses(i).Q_gen; Results.P_gen(i)=Results.buses(i).P_gen; Results.Q_gen(i)=Results.buses(i).Q_gen; Results.P_load(i)=Results.buses(i).P_load; Results.Q_load(i)=Results.buses(i).Q_load; Results.V(i)=Results.buses(i).V; Results.delta(i)=Results.buses(i).delta; end

end

fprintf('Error for Active Power: \n') dP P fprintf('Error for Reactive Power: \n') dQ Q

File: calculate_load.m

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%This function is called recursivly: if the parent branch has

children %%branches that are no calculated, then calculate for them fist. %%P_branch,Q_branch contain the calculated P and Q powers

starting from the %%last bus and going up to the top of the branch. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function [buses, P_branch, Q_branch, P_loss, Q_loss, P_bus,

Q_bus] = calculate_load(branch, buses, Network, P_bus, Q_bus,

P_loss, Q_loss, P_branch, Q_branch )

k=branch.ID; % id of the branch that is being calculated

Page 40: Semester Thesis Janev 2009

P_branch(k)=0; Q_branch(k)=0;

%if the branch has children if (branch.num_branches_em~=0) for i=1:branch.num_branches_em % for each child child_branch=branch.neigh_branches(i); [buses, P_branch, Q_branch, P_loss, Q_loss, P_bus,

Q_bus] = calculate_load(child_branch, buses, Network, P_bus,

Q_bus, P_loss, Q_loss, P_branch, Q_branch); %recusivly calculate

about the child P_branch(k)=P_branch(k)+P_branch(child_branch.ID); %

add the total absorbed P of the child branch Q_branch(k)=Q_branch(k)+Q_branch(child_branch.ID); %

add the total absorbed Q of the child branch end end

% fprintf('********** Calculating for branch: %d **********

\n', k) % if (branch.num_buses_in_branch>1) % if the branch has more

than 1 buses for n=branch.num_buses_in_branch:-1:1 % start from the

last bus until the second one j=branch.array_bus_IDs(n);

%%The following part is needed in order to calculate

the powers between %%the fist bus of each branch and the parent bus of

it. Exception is %%only the first branch of the network, where the

current power is summed up. if n == 1, if

(branch.array_bus_IDs(branch.num_buses_in_branch)~=Network.branc

hes(k).parent_bus_ID) % now calculate for the fist bus of the branch

and the parent bus i=Network.branches(k).parent_bus_ID; else i = 0; end else i=branch.array_bus_IDs(n-1); end if (i~=0) if (buses(j).isPV) %if the bus is PV bus Qmin=-buses(j).P_gen*tan(acos(0.9)); Qmax=buses(j).P_gen*tan(acos(0.9)); P_branch(k)= P_branch(k) + buses(j).P_load -

buses(j).P_gen; % add the load of the bus to the total absorbed

P of the branch Qs=Q_branch(k); %

Q_branch(k)=calculate_Q(j,n,k,Network,buses);

Page 41: Semester Thesis Janev 2009

%

Q_branch(k)=(P_branch(k)*Network.reactance(i,j)-

buses(j).V*buses(i).V*sin(buses(i).delta-

buses(j).delta))/Network.resistance(i,j);

w=buses(j).V^2*Network.reactance(i,j)/(Network.reactance(i,j)^2+

Network.resistance(i,j)^2); q=(buses(j).V^4-

buses(j).V^2*buses(i).V^2+2*buses(j).V^2*P_branch(k)*Network.res

istance(i,j)+P_branch(k)^2*Network.resistance(i,j)^2+P_branch(k)

^2*Network.reactance(i,j)^2)/(Network.reactance(i,j)^2+Network.r

esistance(i,j)^2); Q_branch(k)=-w+sqrt(w^2-q); buses(j).Q_gen=Qs-

Q_branch(k)+buses(j).Q_load; % fprintf('Calculation for bus : %d \n',j) % fprintf('Calculation for Qs: %6.5f

\n',Qs) % fprintf('Calculation for Qj: %6.5f

\n',Q_branch(k)) % fprintf('Calculation for Qload: %6.5f

\n',buses(j).Q_load) % fprintf('Calculation for Q gen=Qs-

Qj+Q_load: %6.5f \n',buses(j).Q_gen) violation=0; if (buses(j).Q_gen>Qmax) buses(j).Q_gen=Qmax; Q_branch(k)=Qs+buses(j).Q_load-

buses(j).Q_gen; violation=1; elseif (buses(j).Q_gen<Qmin) buses(j).Q_gen=Qmin; Q_branch(k)=Qs+buses(j).Q_load-

buses(j).Q_gen; violation=1; end if (violation) % recalculate the voltage of the bus in

case of Qgen violation

a=(Network.resistance(i,j)*P_branch(k)+Network.reactance(i,j)*Q_

branch(k)-buses(i).V^2/2)^2;

b=(Network.resistance(i,j)^2+Network.reactance(i,j)^2)*(P_branch

(k)^2+Q_branch(k)^2);

c=(Network.resistance(i,j)*P_branch(k)+Network.reactance(i,j)*Q_

branch(k)-buses(i).V^2/2); buses(j).V=sqrt(sqrt(a-b)-c); end else % if the bus is PQ bus P_branch(k)= P_branch(k) + buses(j).P_load -

buses(j).P_gen; % add the load of the bus to the total absorbed

P of the branch

Page 42: Semester Thesis Janev 2009

Q_branch(k)= Q_branch(k) + buses(j).Q_load -

buses(j).Q_gen; % add the load of the bus to the total absorbed

Q of the branch % calculate the voltage of the bus

a=(Network.resistance(i,j)*P_branch(k)+Network.reactance(i,j)*Q_

branch(k)-buses(i).V^2/2)^2;

b=(Network.resistance(i,j)^2+Network.reactance(i,j)^2)*(P_branch

(k)^2+Q_branch(k)^2);

c=(Network.resistance(i,j)*P_branch(k)+Network.reactance(i,j)*Q_

branch(k)-buses(i).V^2/2); buses(j).V=sqrt(sqrt(a-b)-c); end P_bus(j)=P_branch(k); Q_bus(j)=Q_branch(k); buses(j).delta=buses(i).delta-

asin((P_branch(k)*Network.reactance(i,j)-

Q_branch(k)*Network.resistance(i,j))/(buses(i).V*buses(j).V)); P_loss(j)=

Network.resistance(i,j)*(P_branch(k)^2+Q_branch(k)^2)/buses(j).V

^2; Q_loss(j)=

Network.reactance(i,j)*(P_branch(k)^2+Q_branch(k)^2)/buses(j).V^

2; P_branch(k)=P_branch(k)+P_loss(j); Q_branch(k)=Q_branch(k)+Q_loss(j); else P_bus(j)=P_branch(k)+buses(j).P_load-

buses(j).P_gen; Q_bus(j)=Q_branch(k)+buses(j).Q_load-

buses(j).Q_gen; end end

File: plot_results.m

function plot_results(Voltages, Angles, Ploads,

Qloads,Pgen,Qgen,Plosses,Qlosses,Pbus,Qbus)

figure(1) for i=1:size(Voltages,2) subplot(3,4,i); plot(Voltages(:,i),'--bs','LineWidth',2,... 'MarkerEdgeColor','k',... 'MarkerFaceColor','b',... 'MarkerSize',3); xlabel('Intervals') ylabel('Voltage') axis([0 100 0.9 1]) ttl=['Bus ' int2str(i)]; title(ttl); end

Page 43: Semester Thesis Janev 2009

figure(2) for i=1:size(Angles,2) subplot(3,4,i); plot(Angles(:,i),'--bs','LineWidth',2,... 'MarkerEdgeColor','k',... 'MarkerFaceColor','b',... 'MarkerSize',3); xlabel('Intervals') ylabel('Angles') axis([0 100 -0.014 0.014]) ttl=['Bus ' int2str(i)]; title(ttl); end

figure(3) for i=1:size(Ploads,2) subplot(3,4,i); plot(Ploads(:,i),'--bs','LineWidth',2,... 'MarkerEdgeColor','k',... 'MarkerFaceColor','b',... 'MarkerSize',3); xlabel('Intervals') ylabel('P loads') ttl=['Bus ' int2str(i)]; title(ttl); end

figure(4) for i=1:size(Qloads,2) subplot(3,4,i); plot(Qloads(:,i),'--bs','LineWidth',2,... 'MarkerEdgeColor','k',... 'MarkerFaceColor','b',... 'MarkerSize',3); xlabel('Intervals') ylabel('Q loads') axis([0 100 0 0.4]) ttl=['Bus ' int2str(i)]; title(ttl); end

figure(5) for i=1:size(Pgen,2) subplot(3,4,i); plot(Pgen(:,i),'--bs','LineWidth',2,... 'MarkerEdgeColor','k',... 'MarkerFaceColor','b',... 'MarkerSize',3); xlabel('Intervals') ylabel('P generation') ttl=['Bus ' int2str(i)]; title(ttl); end

Page 44: Semester Thesis Janev 2009

figure(6) for i=1:size(Qgen,2) subplot(3,4,i); plot(Qgen(:,i),'--bs','LineWidth',2,... 'MarkerEdgeColor','k',... 'MarkerFaceColor','b',... 'MarkerSize',3); xlabel('Intervals') ylabel('Q generation') ttl=['Bus ' int2str(i)]; title(ttl); end figure(7) for i=2:size(Plosses,2) subplot(3,4,i-1); plot(Plosses(:,i),'--bs','LineWidth',2,... 'MarkerEdgeColor','k',... 'MarkerFaceColor','b',... 'MarkerSize',3); xlabel('Intervals') ylabel('P losses') axis([0 100 0 0.25]) ttl=['Line between buses ' int2str(i)]; title(ttl); end figure(8) for i=2:size(Qlosses,2) subplot(3,4,i-1); plot(Qlosses(:,i),'--bs','LineWidth',2,... 'MarkerEdgeColor','k',... 'MarkerFaceColor','b',... 'MarkerSize',3); xlabel('Intervals') ylabel('Q losses') axis([0 100 0 0.25]) ttl=['Line between buses ' int2str(i)]; title(ttl); end figure(9) for i=1:size(Pbus,2) subplot(3,4,i); plot(Pbus(:,i),'--bs','LineWidth',2,... 'MarkerEdgeColor','k',... 'MarkerFaceColor','b',... 'MarkerSize',3); xlabel('Intervals') ylabel('P per line') axis([0 100 0 10]) ttl=['Bus ' int2str(i)]; title(ttl); end figure(10) for i=1:size(Qbus,2) subplot(3,4,i); plot(Qbus(:,i),'--bs','LineWidth',2,... 'MarkerEdgeColor','k',...

Page 45: Semester Thesis Janev 2009

'MarkerFaceColor','b',... 'MarkerSize',3); xlabel('Intervals') ylabel('Q per line') axis([0 100 0 10]) ttl=['Bus ' int2str(i)]; title(ttl); end

8. Appendix B

In the following more detailed Figures from load profiles and generation profiles will be given.

Figure 26: Industry workday load profile

0

0.2

0.4

0.6

0.8

1

1.2

1 11 21 31 41 51 61 71 81 91

Act

ive

Po

we

r in

pe

r u

nit

s

15 minutes time intervals during one day

Industry Workday Load Profile

Page 46: Semester Thesis Janev 2009

Figure 27: Industry weekend load profile

Figure 28: Households workday load profile

0

0.2

0.4

0.6

0.8

1

1.2

1 11 21 31 41 51 61 71 81 91

Act

ive

Po

we

r in

pe

r u

nit

s

15 minutes time intervals during one day

Industry Weekend Load Profile

0

0.2

0.4

0.6

0.8

1

1.2

1 11 21 31 41 51 61 71 81 91

Act

ive

Po

we

r in

pe

r u

nit

s

15 minutes time intervals during one day

Households Workday Load Profile

Page 47: Semester Thesis Janev 2009

Figure 29: Household weekend load profile

Figure 30: Workday 2/5 household+3/5industry load profile

0

0.2

0.4

0.6

0.8

1

1.2

1 11 21 31 41 51 61 71 81 91

Act

ive

Po

we

r in

pe

r u

nit

s

15 minutes time intervals during one day

Household Weekend Load Profile

0

0.2

0.4

0.6

0.8

1

1.2

1 11 21 31 41 51 61 71 81 91

Act

ive

Po

we

r in

pe

r u

nit

s

15 minutes time intervals during one day

Workday 2/5Household+3/5Industry Load Profile

Page 48: Semester Thesis Janev 2009

Figure 31: Weekend 2/5households+3/5industry load profile

Figure 32: PV generation

0

0.2

0.4

0.6

0.8

1

1.2

1 11 21 31 41 51 61 71 81 91

Act

ive

Po

we

r in

pe

r u

nit

s

15 minutes time intervals during one day

Weekend 2/5Household+3/5Industry Load Profile

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1 11 21 31 41 51 61 71 81 91

Act

ive

Po

we

r in

pe

r u

nit

s

15 minutes time intervals during one day

PV Generation

Page 49: Semester Thesis Janev 2009

Figure 33: Wind generation

Figure 34: Small hydro generation

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1 11 21 31 41 51 61 71 81 91

Act

ive

Po

we

r in

pe

r u

nit

s

15 minutes time intervals during one day

Wind Generation

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1 11 21 31 41 51 61 71 81 91

Act

ive

Po

we

r in

pe

r u

nit

s

15 minutes time intervals during one day

Small Hydro Generation

Page 50: Semester Thesis Janev 2009

Figure 35: Biomass generation

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1 11 21 31 41 51 61 71 81 91

Act

ive

Po

we

r in

pe

r u

nit

s

15 minutes time intervals during one day

Biomass Generation