Documente Academic
Documente Profesional
Documente Cultură
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
___________________________________ 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.
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.
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
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
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.
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
11
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
() ()
() 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
PV PV or PQ Bus?
PQ
Pj=Pacc+Ploss+Pgen
Pj=Pacc+Ploss+Pgen Qj=Qacc+Qloss+Qgen
Find Vj (Eq. 2)
Qgen violation?
No Find (Eq. 3)
Yes
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.
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
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
cos 0.90
0.90
graphic
21
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
24
25
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.
27
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.
11
21
81
91
11
21
81
91
11
21
81
91
11
21
81
91
11
81
91
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
81
91
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
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