Sunteți pe pagina 1din 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. Gran Andersson

Zurich, in March 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

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.

Preface
This semester thesis was completed under the supervision of Prof. Dr. Gran 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. Gran 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

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

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

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

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
7

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 )

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
8

Using the value of receiving end bus voltage, the receiving end bus angle can be calculated through the equation given below:

+ 1

The line losses between the receiving and sending end buses and can be calculated using equations (4) and (5):

= =

2 + 2 2 2 + 2 2

4 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;
9

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.

Parent bus id

Number of buses in branch

Number of branches emanating

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.

Arrey of bus ids

Pointers to structure of emanating branches

Array of head bus ids of emanating branches

10

I 1

3 III 4 II IV 5 V 6 9 10 8 7

11

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.
Parent-bus-id 3

Number-of-buses-inbranch 3

Number-of-branches-emanating 2

1 4 2 8 3 III II

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

11

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.

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.

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

1 = 2 + 12 12 2 = 3 + 23 23

() ()

The net apparent power injected 2 into the bus 2 is:


2 = 2 12 2 23

() 2 3 23

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

2 = 2

1 2 12

()

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

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)

13

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 = = Then = = Then

2. <

3. >

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.

14

START

Go to Start Bus

Go to next bus (next j value)

PV PV or PQ Bus?

PQ

Pj=Pacc+Ploss+Pgen

Pj=Pacc+Ploss+Pgen Qj=Qacc+Qloss+Qgen

Find Qj Eq. (8), Use Qj to Find Qgen

Find Vj (Eq. 2)

Qgen violation?

No Find (Eq. 3)

Yes

Chose Qgen-new to get Qj-new

Find Ploss, Qloss ( Eq. 4 and 5)

No Use Qj-new to calculate Vj (Eq. 2) End bus?

Yes No Convergence criteria met? (Eq. 6 and 7 ) Yes

End print solution

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-Wrttemberg 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
15

(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] 0.05 p.u 0.05 p.u 0.15 p.u 0.05 p.u 0.05 p.u 0.1 p.u 0.1 p.u 0.1 p.u 0.1 p.u 0.05 p.u 0.05 p.u 0.1 p.u 0.1 p.u Installed power in [kW] 50 kW 50 kW 150 kW 50 kW 50 kW 100 kW 100 kW 100 kW 100 kW 50 kW 50 kW 100 kW 100 kW

PV bus 1 Wind bus 1 Small Hydro bus 3 PV bus 4 Biomass bus 4 PV bus 5 PV bus 6 Wind bus 7 Biomass bus 8 Biomass bus 9 Wind bus 9 Wind bus 10 Wind bus 11

Table 1: Dispersed generation installed power


16

4.2. Load and Generation Profiles


Main Substation Photo voltaic Wind Power

1
Households+ Industry

3
Small Hydro Households+ Industry

4
PV Biomass Households Biomass Households

8 7

5
PV Households

9
Biomass Wind Power Industry

Wind Power

Industry

6
PV Households

10
Wind Power Households+ Industry

11
Wind Power Households

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 units 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.

17

Figure 7: Active power load per bus

Figure 8: Reactive power load per bus


18

Figure 9: Active power generation per bus

Figure 10: Reactive power generation per bus


19

cos 0.90

1 0.1 0.9 1 P/Pn

0.90

Figure 11: cos

graphic

Figure 12: Active load-generation per bus 20

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.

21

Figure 14: Voltage profile without DG

Figure 15: Voltage profile with DG 22

Figure 16: Voltage angles profile without DG

Figure 17: Voltage angles profile with DG 23

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.
Energy lost in lines during 24h Active Energy Losses [kWh] Reactive Energy Losses [kVArh] Without DG With DG Without DG With DG 1-2 line 25.55 4.31 12.77 2.15 2-3 line 25.55 4.31 12.77 2.15 3-4 line 3.16 1.90 1.58 0.95 4-5 line 1.40 0.88 0.70 0.44 5-6 line 0.35 0.22 0.17 0.11 8-7 line 0.27 0.18 0.13 0.09 3-8 line 7.56 2.31 3.78 1.15 8-9 line 2.71 0.88 1.35 0.44 9-10 line 1.28 0.46 0.64 0.23 1011 line 0.35 0.11 0.17 0.05

Total 68.18 15.56 34.06 7.76

Table 2: Line losses comparison


Energy supply in the system during 24h Total supplied energy in case without DG From the DG Total supplied units energy in case From the with DG units mainsubstation Active energy supply in the system during 24h [kWh] 15.6 103 11.58 103 15.53 3.94 103 103 4.15 103 Rective energy supply in the system during 24h [kVArh] 5.13 103 0.94 103 5.10 103

Table 3: Energy supply during 24h


Active energy lost percentage from overall active energy consumption Without DG units With DG units 0.43% 0.22% Reactive energy lost percentage from overall rective energy consumption 0.30% 0.15%

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

24

Figure 18: Active power losses without DG

25

Figure 19: Active power losses with DG

Figure 20: Reactive power Losses without DG

26

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 units 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

27

Figure 23: Active power per line with DG

Figure 24: Reactive power flow without DG


28

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.

29

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-Wrttemberg Regional AG: http://www.enbw.com [10] E.on Netz (Germany): http://www.eon-energie.com

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

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)

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(10.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;

%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;

P(m)=Results.buses(m).V*Results.buses(k).V*cos(Results.buses(m). deltaResults.buses(k).delta+Network.teta(m,k))/Network.z(m,k)+Results .buses(m).V*Results.buses(l).V*cos(Results.buses(m).deltaResults.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). deltaResults.buses(k).delta+Network.teta(m,k))/Network.z(m,k)+Results .buses(m).V*Results.buses(l).V*sin(Results.buses(m).deltaResults.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). deltaResults.buses(k).delta+Network.teta(m,k))/Network.z(m,k)+Results .buses(m).V*Results.buses(l).V*cos(Results.buses(m).deltaResults.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). deltaResults.buses(k).delta+Network.teta(m,k))/Network.z(m,k)+Results .buses(m).V*Results.buses(l).V*sin(Results.buses(m).deltaResults.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).deltaResults.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).deltaResults.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;

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).deltaResults.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).deltaResults.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

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);

% Q_branch(k)=(P_branch(k)*Network.reactance(i,j)buses(j).V*buses(i).V*sin(buses(i).deltabuses(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^4buses(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=QsQ_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=QsQj+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_loadbuses(j).Q_gen; violation=1; elseif (buses(j).Q_gen<Qmin) buses(j).Q_gen=Qmin; Q_branch(k)=Qs+buses(j).Q_loadbuses(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

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).deltaasin((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_loadbuses(j).P_gen; Q_bus(j)=Q_branch(k)+buses(j).Q_loadbuses(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

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

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',...

'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.

1.2 1 Active Power in per units 0.8 0.6 0.4 0.2 0 1

Industry Workday Load Profile

11

21

31 41 51 61 71 15 minutes time intervals during one day

81

91

Figure 26: Industry workday load profile

1.2 1 Active Power in per units 0.8 0.6 0.4 0.2 0 1

Industry Weekend Load Profile

11

21

31 41 51 61 71 15 minutes time intervals during one day

81

91

Figure 27: Industry weekend load profile


1.2 1 Active Power in per units 0.8 0.6 0.4 0.2 0 1 11 21 31 41 51 61 71 15 minutes time intervals during one day 81 91

Households Workday Load Profile

Figure 28: Households workday load profile

1.2 1 Active Power in per units 0.8 0.6 0.4 0.2 0 1

Household Weekend Load Profile

11

21

31 41 51 61 71 15 minutes time intervals during one day

81

91

Figure 29: Household weekend load profile

1.2 1 Active Power in per units 0.8 0.6 0.4 0.2 0 1

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

11

21

31 41 51 61 71 15 minutes time intervals during one day

81

91

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

1.2 1 Active Power in per units 0.8 0.6 0.4 0.2 0 1

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

11

21 31 41 51 61 71 15 minutes time intervals during one day

81

91

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

0.9 0.8 Active Power in per units 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 1 11 21

PV Generation

31 41 51 61 71 15 minutes time intervals during one day

81

91

Figure 32: PV generation

0.9 0.8 Active Power in per units 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 1 11 21 31 41 51 61 71 15 minutes time intervals during one day 81 91

Wind Generation

Figure 33: Wind generation


0.9 0.8 Active Power in per units 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 1 11 21 31 41 51 61 71 15 minutes time intervals during one day 81 91

Small Hydro Generation

Figure 34: Small hydro generation

0.9 0.8 Active Power in per units 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 1 11 21 31 41 51 61 71 15 minutes time intervals during one day 81 91

Biomass Generation

Figure 35: Biomass generation

S-ar putea să vă placă și