搜档网
当前位置:搜档网 › matlab潮流计算工具箱使用手册

matlab潮流计算工具箱使用手册

matlab潮流计算工具箱使用手册
matlab潮流计算工具箱使用手册

MATPOWER

A M ATLAB? Power System Simulation Package

Version 3.2

September 21, 2007

User’s Manual

Ray D. Zimmerman Carlos E. Murillo-Sánchez rz10@https://www.sodocs.net/doc/473987926.html, carlos_murillo@https://www.sodocs.net/doc/473987926.html, ? 1997-2007 Power Systems Engineering Research Center (PS ERC)

School of Electrical Engineering, Cornell University, Ithaca, NY 14853

Table of Contents

Table of Contents (2)

1Introduction (3)

2Getting Started (4)

2.1System Requirements (4)

2.2Installation (4)

2.3Running a Power Flow (4)

2.4Running an Optimal Power Flow (4)

2.5Getting Help (4)

3Technical Reference (6)

3.1Data File Format (6)

3.2Modeling (8)

3.3Power Flow (11)

3.4Optimal Power Flow (12)

3.4.1AC OPF Formulation (13)

3.4.2DC OPF Formulation (21)

3.5Unit Decommitment Algorithm (22)

3.6MATPOWER Options (22)

3.7Summary of the Files (28)

4Acknowledgments (33)

5References (33)

Appendix A: Notes on LP-Solvers for M ATLAB (34)

Appendix B: Additional Notes (34)

Appendix C: Auction Code (35)

1Introduction

What is MATPOWER?

MATPOWER is a package of M ATLAB M-files for solving power flow and optimal power flow prob-lems. It is intended as a simulation tool for researchers and educators that is easy to use and modify. MATPOWER is designed to give the best performance possible while keeping the code simple to understand and modify. The MATPOWER home page can be found at:

https://www.sodocs.net/doc/473987926.html,/matpower/

Where did it come from?

MATPOWER was developed by Ray D. Zimmerman, Carlos E. Murillo-Sánchez and Deqiang Gan of PSERC at Cornell University (https://www.sodocs.net/doc/473987926.html,/) under the direction of Robert Thomas. The initial need for M ATLAB based power flow and optimal power flow code was born out of the computational requirements of the PowerWeb project (see https://www.sodocs.net/doc/473987926.html,/powerweb/).

Who can use it?

?MATPOWER is free. Anyone may use it.

?We make no warranties, express or implied. Specifically, we make no guarantees regarding the correctness MATPOWER’s code or its fitness for any particular purpose.

?Any publications derived from the use of MATPOWER must cite MATPOWER https://www.sodocs.net/doc/473987926.html,/matpower/.

?Anyone may modify MATPOWER for their own use as long as the original copyright notices remain in place.

?MATPOWER may not be redistributed without written permission.

?Modified versions of MATPOWER, or works derived from MATPOWER, may not be distrib-uted without written permission.

2Getting Started

2.1System Requirements

To use MATPOWER you will need:

?M ATLAB version 6 or later1

?M ATLAB Optimization Toolbox (required only for some OPF algorithms)

Both are available from The MathWorks (see https://www.sodocs.net/doc/473987926.html,/).

2.2Installation

Step 1: Go to the MATPOWER home page (https://www.sodocs.net/doc/473987926.html,/matpower/) and follow the download instructions.

Step 2: Unzip the downloaded file.

Step 3: Place the files in a location in your M ATLAB path.

2.3Running a Power Flow

To run a simple Newton power flow on the 9-bus system specified in the file case9.m, with the de-fault algorithm options, at the M ATLAB prompt, type:

>> runpf('case9')

2.4Running an Optimal Power Flow

To run an optimal power flow on the 30-bus system whose data is in case30.m, with the default algo-rithm options, at the M ATLAB prompt, type:

>> runopf('case30')

To run an optimal power flow on the same system, but with the option for MATPOWER to shut down (decommit) expensive generators, type:

>> runuopf('case30')

2.5Getting Help

As with M ATLAB’s built-in functions and toolbox routines, you can type help followed by the name of a command or M-file to get help on that particular function. Nearly all of MATPOWER’s M-files have such documentation. For example, the help for runopf looks like:

1Although it is likely that most things work fine in M ATLAB5, this is not supported due to limited testing resources. MATPOWER 3.0 required M ATLAB 5 and MATPOWER 2.0 and earlier required only M ATLAB 4.

>> help runopf

RUNOPF Runs an optimal power flow.

[baseMVA, bus, gen, gencost, branch, f, success, et] = ...

runopf(casename, mpopt, fname, solvedcase)

Runs an optimal power flow and optionally returns the solved values in the data matrices, the objective function value, a flag which is true if the algorithm was successful in finding a solution, and the elapsed time in seconds. All input arguments are optional. If casename is provided it specifies the name of the input data file or struct (see also 'help

caseformat' and 'help loadcase') containing the opf data. The default

value is 'case9'. If the mpopt is provided it overrides the default

MATPOWER options vector and can be used to specify the solution

algorithm and output options among other things (see 'help mpoption' for details). If the 3rd argument is given the pretty printed output will be appended to the file whose name is given in fname. If solvedcase is

specified the solved case will be written to a case file in MATPOWER

format with the specified name. If solvedcase ends with '.mat' it saves the case as a MAT-file otherwise it saves it as an M-file. MATPOWER also has many options which control the algorithms and the output. Type:

>> help mpoption

and see Section 3.6 for more information on MATPOWER's options.

3Technical Reference

3.1Data File Format

The data files used by MATPOWER are simply M ATLAB M-files or MAT-files which define and re-turn the variables baseMVA, bus, branch, gen, areas, and gencost. The baseMVA variable is a scalar and the rest are matrices. Each row in the matrix corresponds to a single bus, branch, or generator. The columns are similar to the columns in the standard IEEE and PTI formats. The details of the specifica-tion of the MATPOWER case file can be found in the help for caseformat.m:

>> help caseformat

CASEFORMAT Defines the MATPOWER case file format.

A MATPOWER case file is an M-file or MAT-file which defines the variables

baseMVA, bus, gen, branch, areas, and gencost. With the exception of

baseMVA, a scalar, each data variable is a matrix, where a row corresponds

to a single bus, branch, gen, etc. The format of the data is similar to

the PTI format described in

https://www.sodocs.net/doc/473987926.html,/research/pstca/formats/pti.txt

except where noted. An item marked with (+) indicates that it is included

in this data but is not part of the PTI format. An item marked with (-) is

one that is in the PTI format but is not included here. Those marked with

(2) were added for version 2 of the case file format. The columns for

each data matrix are given below.

MATPOWER Case Version Information:

A version 1 case file defined the data matrices directly. The last two,

areas and gencost, were optional since they were not needed for running

a simple power flow. In version 2, each of the data matrices are stored

as fields in a struct. It is this struct, rather than the individual

matrices that is returned by a version 2 M-casefile. Likewise a version 2

MAT-casefile stores a struct named 'mpc' (for MATPOWER case). The struct

also contains a 'version' field so MATPOWER knows how to interpret the

data. Any case file which does not return a struct, or any struct which

does not have a 'version' field is considered to be in version 1 format.

See also IDX_BUS, IDX_BRCH, IDX_GEN, IDX_AREA and IDX_COST regarding

constants which can be used as named column indices for the data matrices.

Also described in the first three are additional columns that are added

to the bus, branch and gen matrices by the power flow and OPF solvers.

Bus Data Format

1 bus number (1 to 29997)

2 bus type

PQ bus = 1

PV bus = 2

reference bus = 3

isolated bus = 4

3 Pd, real power demand (MW)

4 Qd, reactive power demand (MVAr)

5 Gs, shunt conductance (MW (demanded) at V = 1.0 p.u.)

6 Bs, shunt susceptance (MVAr (injected) at V = 1.0 p.u.)

7 area number, 1-100

8 Vm, voltage magnitude (p.u.)

9 Va, voltage angle (degrees)

(-) (bus name)

10 baseKV, base voltage (kV)

11 zone, loss zone (1-999)

(+) 12 maxVm, maximum voltage magnitude (p.u.)

(+) 13 minVm, minimum voltage magnitude (p.u.)

Generator Data Format

1 bus number

(-) (machine identifier, 0-9, A-Z)

2 Pg, real power output (MW)

3 Qg, reactive power output (MVAr)

4 Qmax, maximum reactive power output (MVAr)

5 Qmin, minimum reactive power output (MVAr)

6 Vg, voltage magnitude setpoint (p.u.)

(-) (remote controlled bus index)

7 mBase, total MVA base of this machine, defaults to baseMVA

(-) (machine impedance, p.u. on mBase)

(-) (step up transformer impedance, p.u. on mBase)

(-) (step up transformer off nominal turns ratio)

8 status, > 0 - machine in service

<= 0 - machine out of service

(-) (% of total VAr's to come from this gen in order to hold V at remote bus controlled by several generators)

9 Pmax, maximum real power output (MW)

10 Pmin, minimum real power output (MW)

(2) 11 Pc1, lower real power output of PQ capability curve (MW)

(2) 12 Pc2, upper real power output of PQ capability curve (MW)

(2) 13 Qc1min, minimum reactive power output at Pc1 (MVAr)

(2) 14 Qc1max, maximum reactive power output at Pc1 (MVAr)

(2) 15 Qc2min, minimum reactive power output at Pc2 (MVAr)

(2) 16 Qc2max, maximum reactive power output at Pc2 (MVAr)

(2) 17 ramp rate for load following/AGC (MW/min)

(2) 18 ramp rate for 10 minute reserves (MW)

(2) 19 ramp rate for 30 minute reserves (MW)

(2) 20 ramp rate for reactive power (2 sec timescale) (MVAr/min)

(2) 21 APF, area participation factor

Branch Data Format

1 f, from bus number

2 t, to bus number

(-) (circuit identifier)

3 r, resistance (p.u.)

4 x, reactance (p.u.)

5 b, total line charging susceptance (p.u.)

6 rateA, MVA rating A (long term rating)

7 rateB, MVA rating B (short term rating)

8 rateC, MVA rating C (emergency rating)

9 ratio, transformer off nominal turns ratio ( = 0 for lines )

(taps at 'from' bus, impedance at 'to' bus, i.e. ratio = Vf / Vt)

10 angle, transformer phase shift angle (degrees), positive => delay

(-) (Gf, shunt conductance at from bus p.u.)

(-) (Bf, shunt susceptance at from bus p.u.)

(-) (Gt, shunt conductance at to bus p.u.)

(-) (Bt, shunt susceptance at to bus p.u.)

11 initial branch status, 1 - in service, 0 - out of service

(2) 12 minimum angle difference, angle(Vf) - angle(Vt) (degrees)

(2) 13 maximum angle difference, angle(Vf) - angle(Vt) (degrees)

(+) Area Data Format

1 i, area number

2 price_ref_bus, reference bus for that area

(+) Generator Cost Data Format

NOTE: If gen has n rows, then the first n rows of gencost contain

the cost for active power produced by the corresponding generators.

If gencost has 2*n rows then rows n+1 to 2*n contain the reactive

power costs in the same format.

1 model, 1 - piecewise linear,

2 - polynomial

2 startup, startup cost in US dollars

3 shutdown, shutdown cost in US dollars

4 n, number of cost coefficients to follow for polynomial

cost function, or number of data points for piecewise linear

5 and following, cost data defining total cost function

For polynomial cost:

c2, c1, c0

where the polynomial is c0 + c1*P + c2*P^2

For piecewise linear cost:

x0, y0, x1, y1, x2, y2, ...

where x0 < x1 < x2 < ... and the points (x0,y0), (x1,y1),

(x2,y2), ... are the end- and break-points of the cost function. Some columns are added to the bus, branch and gen matrices by the solvers. See the help for idx_bus, idx_brch, and idx_gen for more details.

3.2Modeling

AC Formulation

Fixed loads are modeled as constant real and reactive power injections,

!P

d

and

!Q

d

specified in col-

umns 3 and 4, respectively, of the bus matrix. The shunt admittance of any constant impedance shunt

elements at a bus are specified by G

sh and B

sh

in columns 5 and 6, respectively, of the bus matrix

!Y

sh

=

G

sh

+jB

sh

baseMVA

Each branch, whether transmission line, transformer or phase shifter, is modeled as a standard π-model transmission line, with series resistance R and reactance X and total line charging capacitance

!

B

c

, in series with an ideal transformer and phase shifter, at the from end, with tap ratio

!

" and phase shift angle

!

"

shift

. The parameters R, X,

!

B

c

,

!

" and

!

"

shift

, are found in columns 3, 4, 5, 9 and 10 of the branch matrix, respectively. The branch voltages and currents at the from and to ends of the branch are related by the branch admittance matrix

!

Y

br

as follows

!

I

f

I

t

"

#

$

%

&

'=Y br

V

f

V

t

"

#

$

%

&

'(1) where

!

Y

br

=

Y

s

+j

B

c

2

"

#

$

%

&

'

1

(2

)Y

s

1

(e j*shift

)Y

s

1

(e)j*shift

Y

s

+j

B

c

2

+

,

-

-

-

.

/

and

!

Y

s

=

1

R+jX

.

The elements of the individual branch admittance matrices and the bus shunt admittances are com-bined by MATPOWER to form a complex bus admittance matrix

!

Y

bus

, relating the vector of complex bus voltages

!

V

bus

with the vector of complex bus current injections

!

I

bus

!

I

bus

=Y

bus

V

bus

Similarly, admittance matrices

!

Y

f

and

!

Y

t

, are formed to compute the vector of complex current injec-tions at the from and to ends of each line, given the bus voltages

!

V

bus

.

!

I

f

=Y

f

V

bus

I

t

=Y

t

V

bus

The vectors of complex bus power injections, and branch power injections can be expressed as

!

S

bus

=diag(V

bus

)I

bus

*

S

f

=diag(V

f

)I

f

*

S

t

=diag(V

t

)I

t

*

where

!

V

f

and

!

V

t

are vectors of the complex bus voltages at the from and to ends, respectively, of all branches, and diag() converts a vector into a diagonal matrix with the specified vector on the diagonal.

DC Formulation

For the DC formulation, the same parameters are used, with the exception that the following assump-tions are made:

?Branch resistances R and charging capacitances

!B

c

are negligible (i.e. branches are lossless).

?All bus voltage magnitudes are close to 1 p.u.

?Voltage angle differences are small enough that

!sin"

ij

#"

ij

.

Combining these assumptions and equation (1) with the fact that

!S=VI*, the relationship between the

real power flows and voltage angles for an individual branch can be written as

!

P

f

P

t

"

#

$

%

&

'=B br

(

f

(

t

"

#

$

%

&

'+

P

f,shift

P

t,shift

"

#

$

%

&

'(2)

where

!B

br

=

1

X"

1#1

#11

$

%

&

'

(

)(3)

!

P

f,shift

P

t,shift

"

#

$

%

&

'=

(

shift

X)

1

*1

"

#

$

%

&

'.(4)

The elements of the individual branch shift injections and

!B

br

matrices are combined by MATPOWER

to form a bus

!B

bus

matrix and

!

P

bus,shift

shift injection vector, which can be used to compute bus real

power injections from bus voltage angles

!P

bus

=B

bus

"

bus

+P

bus,shift

Similarly, MATPOWER builds the matrix

!B

f

and the vector

!

P

f,shift

which can be used to compute the

vectors !P

f

and

!P

t

of branch real power injections

!

P

f

=B

f

"

bus

+P

f,shift

P

t

=#P

f

3.3Power Flow

MATPOWER has five power flow solvers, which can be accessed via the runpf function. In addition to printing output to the screen, which it does by default, runpf optionally returns the solution in out-put arguments:

>> [baseMVA, bus, gen, branch, success, et] = runpf(casename);

The solution values are stored as follows:

bus(:, VM)bus voltage magnitudes

bus(:, VA)bus voltage angles

gen(:, PG)generator real power injections

gen(:, QG)generator reactive power injections

branch(:, PF)real power injected into “from” end of branch

branch(:, PT)real power injected into “to” end of branch

branch(:, QF)reactive power injected into “from” end of branch

branch(:, QT)reactive power injected into “to” end of branch

success 1 = solved successfully, 0 = unable to solve

et computation time required for solution

The default power flow solver is based on a standard Newton’s method [10] using a full Jacobian, up-dated at each iteration. This method is described in detail in many textbooks. Algorithms 2 and 3 are variations of the fast-decoupled method [9]. MATPOWER implements the XB and BX variations as described in [1]. Algorithm 4 is the standard Gauss-Seidel method from Glimm and Stagg [3], based on code contributed by Alberto Borghetti, from the University of Bologna, Italy. To use one of the power flow solvers other than the default Newton method, the PF_ALG option must be set explicitly. For example, for the XB fast-decoupled method:

>> mpopt = mpoption('PF_ALG', 2);

>> runpf(casename, mpopt);

The last method is a DC power flow [11], which is obtained by executing runpf with the PF_DC op-tion set to 1, or equivalently by executing rundcpf directly. The DC power flow is obtained by a di-rect, non-iterative solution of the bus voltage angles from the specified bus real power injections, based on equations (2), (3) and (4).

For the AC power flow solvers, if the ENFORCE_Q_LIMS option is set to 1 (default is 0), then if any generator reactive power limit is violated after running the AC power flow, the corresponding bus is converted to a PQ bus, with the reactive output set to the limit, and the case is re-run. The voltage magnitude at the bus will deviate from the specified value in order to satisfy the reactive power limit. If the generator at the reference bus reaches a reactive power limit and the bus is converted to a PQ bus, the first remaining PV bus will be used as the slack bus for the next iteration. This may result in the real power output at this generator being slightly off from the specified values.

Currently, none of MATPOWER’s power flow solvers include any transformer tap changing or han-dling of disconnected or de-energized sections of the network.

Performance of the power flow solvers, with the exception of Gauss-Seidel, should be excellent even on very large-scale power systems, since the algorithms and implementation take advantage of M ATLAB’s built-in sparse matrix handling.

3.4Optimal Power Flow

MATPOWER includes several solvers for the optimal power flow (OPF) problem, which can be ac-cessed via the runopf function. In addition to printing output to the screen, which it does by default, runopf optionally returns the solution in output arguments:

>> [baseMVA, bus, gen, gencost, branch, f, success, et] = runopf(casename);

In addition to the values listed for the power flow solvers, the OPF solution also includes the follow-ing values:

bus(:, LAM_P)Lagrange multiplier on bus real power mismatch

bus(:, LAM_Q)Lagrange multiplier on bus reactive power mismatch

bus(:, MU_VMAX)Kuhn-Tucker multiplier on upper bus voltage limit

bus(:, MU_VMIN)Kuhn-Tucker multiplier on lower bus voltage limit

gen(:, MU_PMAX)Kuhn-Tucker multiplier on upper generator real power limit

gen(:, MU_PMIN)Kuhn-Tucker multiplier on lower generator real power limit

gen(:, MU_QMAX)Kuhn-Tucker multiplier on upper generator reactive power limit

gen(:, MU_QMIN)Kuhn-Tucker multiplier on lower generator reactive power limit

branch(:, MU_SF)Kuhn-Tucker multiplier on MVA limit at "from" end of branch

branch(:, MU_ST)Kuhn-Tucker multiplier on MVA limit at "to" end of branch

f final objective function value

MATPOWER can make use of a number of different OPF solvers. There are two legacy solvers from early versions of MATPOWER, namely the constr and LP-based solvers, that have been deprecated and will be removed from future versions. The details of the problem formulation and solution algo-rithms used by these solvers can be found in the user's manual included with previous versions of MATPOWER.

The current generation of solvers use the generalized AC OPF formulation described below. MATPOWER includes one based on fmincon from M ATLAB’s Optimization Toolbox and there are two optional packages, MINOPF2 and TSPOPF3, that implement higher performance OPF solvers us-ing MEX files. MINOPF, based on the MINOS [7] solver, has been available since mid-2004 and is distributed separately because it has a more restrictive license than MATPOWER. TSPOPF is a collec-tion of three solvers developed by Hongye Wang [11] and is currently distributed separately as well. The performance of MATPOWER’s OPF solvers depends on several factors. First, for problems of this general nature, fmincon does not exploit and preserve sparsity, so it is inherently limited to solving small power systems. The MEX based solvers, on the other hand, do exploit sparsity and are suitable for much larger problems. MINOPF is coded in FORTRAN and evaluates the required Jacobians us-ing an optimized structure that follows the order of evaluation imposed by the compressed-column sparse format which is employed by MINOS. In fact, the new generalized OPF formulation included in MATPOWER 3.0 and later is inspired by the data format used by MINOS. The solvers in the TSPOPF package are implemented in the C language.

MATPOWER’s OPF implementation is not currently able to handle unconnected or de-energized sec-tions of the network.

2 See https://www.sodocs.net/doc/473987926.html,/minopf/.

3 See https://www.sodocs.net/doc/473987926.html,/tspopf/.

Piecewise linear costs using constrained cost variables (CCV)

The OPF formulations in MATPOWER allow for the specification of convex piecewise linear cost

functions for active or reactive generator output. An example of such a cost curve is shown below.

This non-differentiable cost is modeled using an extra helper cost variable for each such cost curve and additional constraints on this variable and Pg , one for each segment of the curve. The constraints build a convex “basin” equivalent to requiring the cost variable to lie in the epigraph of the cost curve. When the cost is minimized, the cost variable will be pushed against this basin. If the helper cost vari-able is y , then the contribution of the generator’s cost to the total cost is exactly y . In the above case, the two additional required constraints are

1) !

y "m 1(P g #x 0)+c 0

(y must lie above the first segment) 2) ! y "m 2(P g #x 1)+c 1 (y must lie above the second segment)

where m 1 and m 2 are the slopes of the two segments. Also needed, of course, are the box restrictions on P g : P min ≤ P g ≤ P max . The additive part of the cost contributed by this generator is y .

This constrained cost variable (CCV) formulation is used by all of the MATPOWER OPF solvers for handling piecewise linear cost functions, with the exception of two that are part of the optional TSPOPF package, namely the step-controlled primal/dual interior point method (SCPDIPM ) and the trust region based augmented Lagrangian method (TRALM ), both of which use a cost smoothing tech-nique instead.

3.4.1 AC OPF Formulation

The AC optimal power flow problem solved by MATPOWER is a “smooth” OPF with no discrete variables or controls. The generalized AC OPF formulation, used by the current generation of MATPOWER ’s OPF solvers, offers a number of extra capabilities relative to the traditional formula-tion of minimizing the cost of generation subject to voltage, flow and generator limits, used by the first generation of MATPOWER OPF solvers:

? mixed polynomial and piecewise linear costs

? dispatchable loads

? generator P-Q capability curves

? branch angle difference limits ? additional user supplied linear constraints

? additional user supplied costs

New in MATPOWER 3.2 are the generalized user supplied cost formulation, the generator capability curves, the branch angle difference limits and a simplification of the general linear constraint specifi-cation used in version 3.0.

The problem is formulated in terms of two groups of optimization variables, labeled x and z . The x variables are the OPF variables, consisting of the voltage angles ! " and magnitudes V at each bus, and real and reactive generator injections P g and Q g .

! x ="V P g Q g # $ % % % % & '

( ( ( ( Additional user defined variables are grouped in z .

The optimization problem can be expressed as follows: ! min x ,y ,z f 1i (P gi )+f 2i (Q gi )()i

"+12w T Hw +C w T w

subject to

!

g P (x )=P (",V )#P g +P d =0 (active power balance equations)

!

g Q (x )=Q (",V )#Q g +Q d =0 (reactive power balance equations) ! g S f (x )=S f (",V )#S max $0 (apparent power flow limit of lines, from end) ! g S t (x )=S t (",V )#S max $0 (apparent power flow limit of lines, to end) ! l "A x z # $ % & ' ( "u (general linear constraints)

! x min "x "x max (voltage and generation variable limits)

! z min "z "z max (limits on user defined variables) Here f 1i and f 2i are the costs of active and reactive power generation, respectively, for generator i at a given dispatch point. Both f 1i and f 2i are assumed to be polynomial or piecewise-linear functions.

The most significant additions to the traditional, simple OPF formulation appear in the generalized

cost terms containing w and in the general linear constraints involving the matrix A, described in the next two sections. These two frameworks allow tremendous flexibility in customizing the problem formulation, making MATPOWER even more useful as a research tool.

Note: In Optimization Toolbox versions 3.0 and earlier, fmincon seems to be providing inaccurate shadow prices on the constraints. This did not happen with constr and it may be a bug in these ver-sions of the Optimization Toolbox.

General Linear Constraints

In addition to the standard non-linear equality constraints for nodal power balance and non-linear ine-quality constraints for line flow limits, this formulation includes a framework for additional linear constraints involving the full set of optimization variables.

! l "A x z # $ % & '

( "u (general linear constraints) Some portions of these linear constraints are supplied directly by the user, while others are generated automatically based on the case data. Automatically generated portions include:

? rows for constraints that define generator P-Q capability curves

? rows for constant power factor constraints for dispatchable or price-sensitive loads

? rows for branch angle difference limits

? rows and columns for the helper variables from the CCV implementation of piecewise linear gen-erator costs and their associated constraints

In addition to these automatically generated constraints, the user can provide a matrix A u and vectors l u and u u to define further linear constraints. These user supplied constraints could be used, for example, to restrict voltage angle differences between specific buses. The matrix A u must have at least n x col-umns where n x is the number of x variables. If A u has more than n x columns, a corresponding z optimi-zation variable is created for each additional column. These z variables also enter into the generalized cost terms described below, so A u and N must have the same number of columns.

!

l u "A u x z # $ % & '

( "u u (user supplied linear constraints) Change from MATPOWER 3.0: The A u matrix supplied by the user no longer includes the (all zero) columns corresponding to the helper variables for piecewise linear generator costs. This should sim-plify significantly the creation of the desired A u matrix. Generalized Cost Function

The cost function consists of two parts. The first is the polynomial or piecewise linear cost of genera-tion. A polynomial or piecewise linear cost is specified for each generator’s active output and, option-ally, reactive output in the appropriate row(s) of the gencost matrix. Any piecewise linear costs are implemented using the CCV formulation described above which introduces corresponding helper variables. The general formulation allows generator costs of mixed type (polynomial and piecewise linear) in the same problem.

The second part of the cost function provides a general framework for imposing additional costs on the optimization variables, enabling things such as using penalty functions as soft limits on voltages, additional costs on variables involved in constraints handled by Langrangian relaxation, etc.

This general cost term is specified through a set of parameters H , C w , N and f parm , described below. It consists of a general quadratic function of an ! n w "1 vector w of transformed optimization variables.

! 12

w T Hw +C w T w H is the ! n w "n w symmetric, sparse matrix of quadratic coefficients and C w is the !

n w "1 vector of linear

coefficients. The sparse N matrix is ! n w "n xz , where the number of columns must match that of any user supplied A u matrix. And f parm is ! n w "4, where the 4 columns are labeled as

! f parm =d ? r h m []. The vector w is created from the x and z optimization variables by first applying a general linear trans-formation

! r =N x z " # $ % &

' , followed by a scaled function with a shifted “dead zone”, defined by the remaining elements of f parm . Each element of r is transformed into the corresponding element of w as follows:

! w i =m i "f i r i #? r i +h i (),r i #? r i <#h i 0,#h i $r i #? r i $h i m i "f i r i #? r i #h i (),r i #? r i >h i

% & ' ( ' where the function f i is a predetermined function selected by the index in d i . The current implementa-tion includes linear and quadratic options.

!

f i t ()=t ,d i =1t 2,

d i =2" # $ Th

e linear case, where d i = 1, is illustrated below, where w i is found by shifting r i by !

? r i , applying a

“dead zone” defined by h i and then scaling by m i .

Generator P-Q Capability Curves

The traditional AC OPF formulation models the generator P-Q capability curves as simple box con-straints defined by the PMIN, PMAX, QMIN and QMAX columns of the gen matrix. In MATPOWER 3.2, version 2 of the case file format is introduced, which includes 6 new columns in the gen matrix for specifying additional sloped upper and lower portions of the capability curves. The new columns are PC1, PC2, QC1MIN, QC1MAX, QC2MIN, and QC2MAX. The feasible region for generator operation with this

more general capability curve is illustrated by the shaded region in the figure below.

The particular values of

PC1 and PC2 are not important and may be set equal to PMIN and PMAX for convenience. The important point is to set the corresponding QC n MAX (QC n MIN ) limits such that the two resulting points define the desired line corresponding to the upper (lower) sloped portion of the capa-bility curve.

Dispatchable loads

In general, dispatchable or price-sensitive loads can be modeled as negative real power injections with associated costs. The current test is that if PMIN < PMAX = 0 for a generator, then it is really a dispatch-able load. If a load has a demand curve like the following

so that it will consume zero if the price is higher than price2, P1 if the price is less than price2 but higher than price1, and P2 if the price is equal or lower than price1. Considered as a negative injec-tion, the desired dispatch is zero if the price is greater than price2, -P1 if the price is higher than price1 but lower than price2, and -P2 if the price is equal to or lower than price1. This suggests the

following piecewise linear cost curve:

Note that this assumes that the demand blocks can be partially dispatched or “split”; if the price trigger is reached half-way through the block, the load must accept the partial block. Otherwise, accepting or rejecting whole blocks really poses a mixed-integer problem, which is outside the scope of the current MATPOWER implementation.

When there are dispatchable loads, the issue of reactive dispatch arises. If the QMIN /QMAX generation limits for the “negative generator” in question are not set to zero, then the algorithm will dispatch the reactive injection to the most convenient value. Since this is not normal load behavior, in the general-ized formulation it is assumed that dispatchable loads maintain a constant power factor. The mecha-nism for posing additional general linear constraints is employed to automatically include restrictions for these injections to keep the ratio of P g and Q g constant. This ratio is inferred from the values of PMIN and either QMIN (for inductive loads) or QMAX (for capacitive loads) in the gen table. It is impor-tant to set these appropriately, keeping in mind that PG is negative and that for normal inductive loads QG should also be negative (a positive reactive load is a negative reactive injection). The initial values of the PG and QG columns of the gen matrix must be consistent with the ratio defined by PMIN and the appropriate Q limit.

Branch Angle Difference Limits

The difference between the voltage angle ! "f at the from end of branch k and the angle !

"t at the to end can be limited by specifying values in the ANGMIN and ANGMAX columns of row k of the branch ma-trix.

branch(k, ANGMIN) ! "#f $#t " branch(k, ANGMAX) Values are specified in degrees and a value of zero or 360o (-360o) is considered to be unconstrained for ANGMAX (ANGMIN ). The Kuhn-Tucker multipliers on these constraints are returned in the MU_ANGMIN and MU_ANGMAX columns. These branch angle difference constraints can be ignored by setting the OPF_IGNORE_ANG_LIM option to a true value using mpoption .

Problem Data Transformation

Defining a user supplied A matrix to add additional linear constraints requires knowledge of the order of the optimization variables in the x vector. This requires an understanding of the standard transfor-mations performed on the input data (bus, gen, branch, areas and gencost tables) before the prob-lem is solved. All of these transformations are reversed after solving the problem so the output data is correctly placed in the tables.

The first step filters out inactive generators and branches; original tables are saved for data output.

comgen = find(gen(:,GEN_STATUS) > 0); % find online generators

onbranch = find(branch(:,BR_STATUS) ~= 0); % find online branches

gen = gen(comgen, :);

branch = branch(onbranch, :);

The second step is a renumbering of the bus numbers in the bus table so that the resulting table con-tains consecutively-numbered buses starting from 1:

[i2e, bus, gen, branch, areas] = ext2int(bus, gen, branch, areas);

where i2e is saved for inverse reordering at the end. Finally, generators are further reordered by bus number:

ng = size(gen,1); % number of generators or injections

[tmp, igen] = sort(gen(:, GEN_BUS));

[tmp, inv_gen_ord] = sort(igen); % save for inverse reordering at the end

gen = gen(igen, :);

if ng == size(gencost,1) % This is because gencost might have

gencost = gencost(igen, :); % twice as many rows as gen if there

else % are reactive injection costs.

gencost = gencost( [igen; igen+ng], :);

end

Having done this, the variables inside the x vector now have the same ordering as in the bus, gen ta-bles:

x = [ Theta ; % nb bus voltage angles

V ; % nb bus voltage magnitudes

Pg ; % ng active power injections (p.u.) (ascending bus order)

Qg ]; % ng reactive power injections (p.u.)(ascending bus order)

and the nonlinear constraints have the same order as in the bus, branch tables

g = [ gp; % nb real power flow mismatches (p.u.)

gq; % nb reactive power flow mismatches (p.u.)

gsf; % nl "from" end apparent power injection limits (p.u.)

gst ]; % nl "to" end apparent power injection limits (p.u.)

With this setup, box bounds on the variables are applied as follows: the reference angle is bounded above and below with the value specified for it in the original bus table. The V section of x is bounded above and below with the corresponding values for VMAX and VMIN in the bus table. The Pg and Qg sections of x are bounded above and below with the corresponding values for PMAX, PMIN, QMAX and QMIN in the gen table. The nonlinear constraints are similarly setup so that gp and gq are equality con-straints (zero RHS) and the limits for gsf, gst are taken from the RATE_A column in the branch table.

matlab电力系统潮流计算

华中科技大学 信息工程学院课程设计报告书题目: 电力系统潮流计算 专业:电气工程及其自动化 班级: 学号: 学生姓名: 指导教师: 2015年 11 月 10 日

2015年11月12日

信息工程学院课程设计成绩评定表

摘要 电力系统稳态分析包括潮流计算和静态安全分析。本文主要运用的事潮流计算,潮流计算是电力网络设计与运行中最基本的运算,对电力网络的各种设计方案及各种运行方式进行潮流计算,可以得到各种电网各节点的电压,并求得网络的潮流及网络中的各元件的电力损耗,进而求得电能损耗。本位就是运用潮流计算具体分析,并有MATLAB仿真。 关键词:电力系统潮流计算 MATLAB仿真

Abstract Electric power system steady flow calculation and analysis of the static safety analysis. This paper, by means of the calculation, flow calculation is the trend of the power network design and operation of the most basic operations of electric power network, various design scheme and the operation ways to tide computation, can get all kinds of each node of the power grid voltage and seek the trend of the network and the network of the components of the power loss, and getting electric power. The standard is to use the power flow calculation and analysis, the specific have MATLAB simulation. Key words: Power system; Flow calculation; MATLAB simulation

潮流计算(matlab)实例计算

潮流例题:根据给定的参数或工程具体要求(如图),收集和查阅资料;学习相关软件(软件自选:本设计选择Matlab进行设计)。 2.在给定的电力网络上画出等值电路图。 3.运用计算机进行潮流计算。 4.编写设计说明书。 一、设计原理 1.牛顿-拉夫逊原理 牛顿迭代法是取x0 之后,在这个基础上,找到比x0 更接近的方程的跟,一步一步迭代,从而找到更接近方程根的近似跟。牛顿迭代法是求方程根的重要方法之一,其最大优点是在方程f(x) = 0 的单根附近具有平方收敛,而且该法还可以用来求方程的重根、复根。电力系统潮流计算,一般来说,各个母线所供负荷的功率是已知的,各个节点电压是未知的(平衡节点外)可以根据网络结构形成节点导纳矩阵,然后由节点导纳矩阵列写功率方程,由于功率方程里功率是已知的,电压的幅值和相角是未知的,这样潮流计算的问题就转化为求解非线性方程组的问题了。为了便于用迭代法解方程组,需要将上述功率方程改写成功率平衡方程,并对功率平衡方程求偏导,得出对应的雅可比矩阵,给未知节点赋电压初值,一般为额定电压,将初值带入功率平衡方程,得到功率不平衡量,这样由功率不平衡量、雅可比矩阵、节点电压不平衡量(未知的)构成了误差方程,解误差方程,得到节点电压不平衡量,节点电压加上节点电压不平衡量构成新的节点电压初值,将新的初值带入原来的功率平衡方程,并重新形成雅可比矩阵,然后计算新

的电压不平衡量,这样不断迭代,不断修正,一般迭代三到五次就能收敛。 牛顿—拉夫逊迭代法的一般步骤: (1)形成各节点导纳矩阵Y。 (2)设个节点电压的初始值U和相角初始值e 还有迭代次数初值为0。 (3)计算各个节点的功率不平衡量。 (4)根据收敛条件判断是否满足,若不满足则向下进行。 (5)计算雅可比矩阵中的各元素。 (6)修正方程式个节点电压 (7)利用新值自第(3)步开始进入下一次迭代,直至达到精度退出循环。 (8)计算平衡节点输出功率和各线路功率 2.网络节点的优化 1)静态地按最少出线支路数编号 这种方法由称为静态优化法。在编号以前。首先统计电力网络个节点的出线支路数,然后,按出线支路数有少到多的节点顺序编号。当由n 个节点的出线支路相同时,则可以按任意次序对这n 个节点进行编号。这种编号方法的根据是导纳矩阵中,出线支路数最少的节点所对应的行中非零元素也2)动态地按增加出线支路数最少编号在上述的方法中,各节点的出线支路数是按原始网络统计出来的,在编号过程中认为固定不变的,事实上,在节点消去过程中,每消去一个节点以后,与该节点相连的各节点的出线支路数将发生变化(增加,减少或保持不变)。因此,如果每消去一个节点后,立即修正尚未编号节点的出线支路数,然后选其中支路数最少的一个节点进行编号,就可以预期得到更好的效果,动态按最少出线支路数编号方法的特点就是按出线最少原则编号时考虑了消去过程中各节点出线支路数目的变动情况。 3.MATLAB编程应用 Matlab 是“Matrix Laboratory”的缩写,主要包括:一般数值分析,矩阵运算、数字信号处理、建模、系统控制、优化和图形显示等应用程序。由于使用Matlab 编程运算与人进行科学计算的思路和表达方式完全一致,所以不像学习高级语言那样难于掌握,而且编程效率和计算效率极高,还可在计算机上直接输出结果和精美的图形拷贝,所以它的确为一高效的科研助手。 二、设计内容 1.设计流程图

matlab潮流计算

附录1 使用牛顿拉夫逊法进行潮流计算的Matlab程序代码 % 牛拉法计算潮流程序 %----------------------------------------------------------------------- % B1矩阵:1、支路首端号;2、末端号;3、支路阻抗;4、支路对地电纳 % 5、支路的变比;6、支路首端处于K侧为1,1侧为0 % B2矩阵:1、该节点发电机功率;2、该节点负荷功率;3、节点电压初始值 % 4、PV节点电压V的给定值;5、节点所接的无功补偿设备的容量 % 6、节点分类标号:1为平衡节点(应为1号节点);2为PQ节点;3为PV节点; %------------------------------------------------------------------------ clear all; format long; n=input('请输入节点数:nodes='); nl=input('请输入支路数:lines='); isb=input('请输入平衡母线节点号:balance='); pr=input('请输入误差精度:precision='); B1=input('请输入由各支路参数形成的矩阵:B1='); B2=input('请输入各节点参数形成的矩阵:B2='); Y=zeros(n);e=zeros(1,n);f=zeros(1,n);V=zeros(1,n);sida=zeros(1,n);S1=zeros(nl); %------------------------------------------------------------------ for i=1:nl %支路数 if B1(i,6)==0 %左节点处于1侧 p=B1(i,1);q=B1(i,2); else %左节点处于K侧 p=B1(i,2);q=B1(i,1); end Y(p,q)=Y(p,q)-1./(B1(i,3)*B1(i,5)); %非对角元 Y(q,p)=Y(p,q); %非对角元 Y(q,q)=Y(q,q)+1./(B1(i,3)*B1(i,5)^2)+B1(i,4); %对角元K侧 Y(p,p)=Y(p,p)+1./B1(i,3)+B1(i,4); %对角元1侧 end %求导纳矩阵 disp('导纳矩阵 Y='); disp(Y) %------------------------------------------------------------------- G=real(Y);B=imag(Y); %分解出导纳阵的实部和虚部 for i=1:n %给定各节点初始电压的实部和虚部

matlab电力系统潮流计算

m a t l a b电力系统潮流计 算 Final approval draft on November 22, 2020

华中科技大学 信息工程学院课程设计报告书题目: 电力系统潮流计算 专业:电气工程及其自动化 班级: 学号: 学生姓名: 指导教师: 2015年 11 月 10 日

信息工程学院课程设计成绩评定表

摘要 电力系统稳态分析包括潮流计算和静态安全分析。本文主要运用的事潮流计算,潮流计算是电力网络设计与运行中最基本的运算,对电力网络的各种设计方案及各种运行方式进行潮流计算,可以得到各种电网各节点的电压,并求得网络的潮流及网络中的各元件的电力损耗,进而求得电能损耗。本位就是运用潮流计算具体分析,并有MATLAB仿真。 关键词:电力系统潮流计算 MATLAB仿真

Abstract Electric power system steady flow calculation and analysis of the static safety analysis. This paper, by means of the calculation, flow calculation is the trend of the power network design and operation of the most basic operations of electric power network, various design scheme and the operation ways to tide computation, can get all kinds of each node of the power grid voltage and seek the trend of the network and the network of the components of the power loss, and getting electric power. The standard is to use the power flow calculation and analysis, the specific have MATLAB simulation. Key words: Power system; Flow calculation; MATLAB simulation

基于MATLAB的电力系统潮流计算

基于MATLAB的电力系统潮流计算 %简单潮流计算的小程序,相关的原始数据数据数据输入格式如下: %B1是支路参数矩阵,第一列和第二列是节点编号。节点编号由小到大编写%对于含有变压器的支路,第一列为低压侧节点编号,第二列为高压侧节点%编号,将变压器的串联阻抗置于低压侧处理。 %第三列为支路的串列阻抗参数。 %第四列为支路的对地导纳参数。 %第五烈为含变压器支路的变压器的变比 %第六列为变压器是否是否含有变压器的参数,其中“1”为含有变压器,%“0”为不含有变压器。 %B2为节点参数矩阵,其中第一列为节点注入发电功率参数;第二列为节点%负荷功率参数;第三列为节点电压参数;第六列为节点类型参数,其中 %“1”为平衡节点,“2”为PQ节点,“3”为PV节点参数。 %X为节点号和对地参数矩阵。其中第一列为节点编号,第二列为节点对地%参数。 n=input('请输入节点数:n='); n1=input('请输入支路数:n1='); isb=input('请输入平衡节点号:isb='); pr=input('请输入误差精度:pr='); B1=input('请输入支路参数:B1='); B2=input('请输入节点参数:B2='); X=input('节点号和对地参数:X='); Y=zeros(n); Times=1; %置迭代次数为初始值 %创建节点导纳矩阵 for i=1:n1 if B1(i,6)==0 %不含变压器的支路 p=B1(i,1); q=B1(i,2); Y(p,q)=Y(p,q)-1/B1(i,3); Y(q,p)=Y(p,q); Y(p,p)=Y(p,p)+1/B1(i,3)+0.5*B1(i,4); Y(q,q)=Y(q,q)+1/B1(i,3)+0.5*B1(i,4); else %含有变压器的支路 p=B1(i,1); q=B1(i,2); Y(p,q)=Y(p,q)-1/(B1(i,3)*B1(i,5)); Y(q,p)=Y(p,q); Y(p,p)=Y(p,p)+1/B1(i,3);

用matlab电力系统潮流计算

题目:潮流计算与matlab 教学单位电气信息学院姓名 学号 年级 专业电气工程及其自动化指导教师 职称副教授

摘要 电力系统稳态分析包括潮流计算和静态安全分析。本文主要运用的事潮流计算,潮流计算是电力网络设计与运行中最基本的运算,对电力网络的各种设计方案及各种运行方式进行潮流计算,可以得到各种电网各节点的电压,并求得网络的潮流及网络中的各元件的电力损耗,进而求得电能损耗。本位就是运用潮流计算具体分析,并有MATLAB仿真。 关键词:电力系统潮流计算 MATLAB Abstract Electric power system steady flow calculation and analysis of the static safety analysis. This paper, by means of the calculation, flow calculation is the trend of the power network design and operation of the most basic operations of electric power network, various design scheme and the operation ways to tide computation, can get all kinds of each node of the power grid voltage and seek the trend of the network and the network of the components of the power loss, and getting electric power. The standard is to use the power flow calculation and analysis, the specific have MATLAB simulation. Key words: Power system; Flow calculation; MATLAB simulation

基于MATLAB的潮流计算源程序代码(优.选)

%*************************电力系统直角坐标系下的牛顿拉夫逊法潮流计算********** clear clc load E:\data\IEEE014_Node.txt Node=IEEE014_Node; weishu=size(Node); nnum=weishu(1,1); %节点总数 load E:\data\IEEE014_Branch.txt branch=IEEE014_Branch; bwei=size(branch); bnum=bwei(1,1); %支路总数 Y=(zeros(nnum)); Sj=100; %********************************节点导纳矩阵******************************* for m=1:bnum; s=branch(m,1); %首节点 e=branch(m,2); %末节点 R=branch(m,3); %支路电阻 X=branch(m,4); %支路电抗 B=branch(m,5); %支路对地电纳 k=branch(m,6); if k==0 %无变压器支路情形 Y(s,e)=-1/(R+j*X); %互导纳 Y(e,s)=Y(s,e); end if k~=0 %有变压器支路情形 Y(s,e)=-(1/((R+j*X)*k)); Y(e,s)=Y(s,e); Y(s,s)=-(1-k)/((R+j*X)*k^2); Y(e,e)=-(k-1)/((R+j*X)*k); %对地导纳 end Y(s,s)=Y(s,s)-j*B/2; Y(e,e)=Y(e,e)-j*B/2; %自导纳的计算情形 end for t=1:nnum; Y(t,t)=-sum(Y(t,:))+Node(t,12)+j*Node(t,13); %求支路自导纳 end G=real(Y); %电导 B=imag(Y); %电纳 %******************节点分类************************************* * pq=0; pv=0; blancenode=0; pqnode=zeros(1,nnum); pvnode=zeros(1,nnum); for m=1:nnum; if Node(m,2)==3 blancenode=m; %平衡节点编号 else if Node(m,2)==0 pq=pq+1; pqnode(1,pq)=m; %PQ 节点编号 else if Node(m,2)==2 pv=pv+1; pvnode(1,pv)=m; %PV 节点编号 end end end end %*****************************设置电压初值********************************** Uoriginal=zeros(1,nnum); %对各节点电压矩阵初始化 for n=1:nnum Uoriginal(1,n)=Node(n,9); %对各点电压赋初值 if Node(n,9)==0;

基于matlab--psat软件的电力系统潮流计算课程设计

东北电力大学课程设计改革试用任务书: 电力系统潮流计算课程设计任务书 设计名称:电力系统潮流计算课程设计 设计性质:理论计算,计算机仿真与验证 计划学时:两周 一、设计目的 1.培养学生独立分析问题、解决问题的能力; 2.培养学生的工程意识,灵活运用所学知识分析工程问题的能力 3.编制程序或利用电力系统分析计算软件进行电力系统潮流分析。 二、原始资料 1、系统图:IEEE14节点。 2、原始资料:见IEEE14节点标准数据库 三、课程设计基本内容: 1.采用PSAT仿真工具中的潮流计算软件计算系统潮流; 1)熟悉PSAT仿真工具的功能; 2)掌握IEEE标准数据格式内容; 3)将IEEE标准数据转化为PSAT计算数据; 2.分别采用NR法和PQ分解法计算潮流,观察NR法计算潮流中雅可比矩阵的变化情况, 分析两种方法计算潮流的优缺点; 3.分析系统潮流情况,包括电压幅值、相角,线路过载情况以及全网有功损耗情况。

4.选择以下内容之一进行分析: 1)找出系统中有功损耗最大的一条线路,给出减小该线路损耗的措施,比较各种措施 的特点,并仿真验证; 2)找出系统中电压最低的节点,给出调压措施,比较各种措施的特点,并仿真验证; 3)找出系统中流过有功功率最大的一条线路,给出减小该线路有功功率的措施,比较 各种措施的特点,并仿真验证; 5.任选以下内容之一作为深入研究:(不做要求) 1)找出系统中有功功率损耗最大的一条线路,改变发电机有功出力,分析对该线路有 功功率损耗灵敏度最大的发电机有功功率,并进行有效调整,减小该线路的损耗; 2)找出系统中有功功率损耗最大的一条线路,进行无功功率补偿,分析对该线路有功 功率损耗灵敏度最大的负荷无功功率,并进行有效调整,减小该线路的损耗; 3)找出系统中电压最低的节点,分析对该节点电压幅值灵敏度最大的发电机端电压, 并有效调整发电机端电压,提高该节点电压水平; 四、课程设计成品基本要求: 1.绘制系统潮流图,潮流图应包括: 1)系统网络参数 2)节点电压幅值及相角 3)线路和变压器的首末端有功功率和无功功率 2.撰写设计报告,报告内容应包括以下几点: 1)本次设计的目的和设计的任务; 2)电力系统潮流计算的计算机方法原理,分析NR法和PQ分解法计算潮流的特点; 3)对潮流计算结果进行分析,评价该潮流断面的运行方式安全性和经济性; 4)找出系统中运行的薄弱环节,如电压较低点或负载较大线路,给出调整措施; 5)分析各种调整措施的特点并比较它们之间的差异; 6)结论部分以及设计心得; 五、考核形式 1.纪律考核:学生组织出勤情况和工作态度等; 2.书面考核:设计成品的完成质量、撰写水平等; 3.答辩考核:参照设计成品,对计算机方法进行电力系统潮流计算的相关问题等进行答辩; 4.采用五级评分制:优、良、中、及格、不及格五个等级。

MATLAB下的潮流计算实现-稀疏技术毕业设计

毕业设计(论文)MATLAB下的潮流计算实现-稀疏技术

毕业设计(论文)原创性声明和使用授权说明 原创性声明 本人郑重承诺:所呈交的毕业设计(论文),是我个人在指导教师的指导下进行的研究工作及取得的成果。尽我所知,除文中特别加以标注和致谢的地方外,不包含其他人或组织已经发表或公布过的研究成果,也不包含我为获得及其它教育机构的学位或学历而使用过的材料。对本研究提供过帮助和做出过贡献的个人或集体,均已在文中作了明确的说明并表示了谢意。 作者签名:日期: 指导教师签名:日期: 使用授权说明 本人完全了解大学关于收集、保存、使用毕业设计(论文)的规定,即:按照学校要求提交毕业设计(论文)的印刷本和电子版本;学校有权保存毕业设计(论文)的印刷本和电子版,并提供目录检索与阅览服务;学校可以采用影印、缩印、数字化或其它复制手段保存论文;在不以赢利为目的前提下,学校可以公布论文的部分或全部内容。 作者签名:日期:

摘要 电力系统潮流计算是研究电力系统稳态运行情况的一种计算,它根据给定的运行条件及系统接线情况确定整个电力系统各部分的运行状态:各母线的电压,各元件中流过的功率,系统的功率损耗等等。在电力系统规划的设计和现有电力系统运行方式的研究中,都需要利用潮流计算来定量地分析比较供电方案或运行方式的合理性、可靠性和经济性。因此潮流计算是研究电力系统的一种很重要和很基础的计算。由于电力系统结构及参数的一些特点,并且随着电力系统不断扩大,潮流问题的方程式阶数越来越高,对这样的方程式并不是任何数学方法都能保证给出正确答案的。这种情况成为促使电力系统计算人员不断寻求新的更可靠方法的重要因素。 本文旨在于研究潮流计算的牛顿—拉夫逊法的基本原理,在Matlab环境中实现牛顿—拉夫逊法潮流计算的数学模型,程序流程以及编制相应程序,并在程序中融合了节点优化编号和稀疏技术,以提高计算效率。最后用IEEE-3O节点标准测试系统验证所编程序。 关键词:潮流计算Newtom-Raphson法节点优化稀疏技术Matlab ABSTRACT Power flow calculation is fundanmental of analysis. Network reconfiguration,fault management,state estimator etc also need the data of electrial system power flow.There is important significance to develop power flow calculation in allusion to traits of distribution network. This paper introduces the principle of Newtom-Raphson algorithm, which is developed for calculation of power flow calculation ,where zero sequence network is open.With this algorithm,the three-phase load is resolved into positive/negative sequence power and coupling power,thus,decoupling three phase power flow into sequencet component power flow.The power flow can be obtained by just finding the positive sequence power flow and then finding the negative sequent component from the coupling https://www.sodocs.net/doc/473987926.html,pared with the existing methods,the jacobian matrix with the proposed algorithm is of much lower order,thus substantially reducing the computation burden.The proposed algorithm,together with a reference algorithm,has been simulated on an actual IEEE-30 system using statistic load date.And then it will

Matlab牛拉法潮流计算程序

%本程序的功能是用牛顿——拉夫逊法进行潮流计算 % B1矩阵:1、支路首端号;2、末端号;3、支路阻抗;4、支路对地电纳 % 5、支路的变比;6、支路首端处于K侧为1,1侧为0 % B2矩阵:1、该节点发电机功率;2、该节点负荷功率;3、节点电压初始值 % 4、PV节点电压V的给定值;5、节点所接的无功补偿设备的容量 % 6、节点分类标号:1为平衡节点(应为1号节点);2为PQ节点; % 3为PV节点; clear; n=input('请输入节点数:n='); nl=input('请输入支路数:nl='); isb=input('请输入平衡母线节点号:isb='); pr=input('请输入误差精度:pr='); B1=input('请输入由各支路参数形成的矩阵:B1='); B2=input('请输入各节点参数形成的矩阵:B2='); Y=zeros(n);e=zeros(1,n);f=zeros(1,n);V=zeros(1,n);sida=zeros(1,n);S1=zeros(nl); % % %--------------------------------------------------- for i=1:nl %支路数 if B1(i,6)==0 %左节点处于1侧 p=B1(i,1);q=B1(i,2); else %左节点处于K侧 p=B1(i,2);q=B1(i,1); end Y(p,q)=Y(p,q)-1./(B1(i,3)*B1(i,5)); %非对角元 Y(q,p)=Y(p,q); %非对角元 Y(q,q)=Y(q,q)+1./(B1(i,3)*B1(i,5)^2)+B1(i,4)./2; %对角元K侧 Y(p,p)=Y(p,p)+1./B1(i,3)+B1(i,4)./2; %对角元1侧 end %求导纳矩阵 disp('导纳矩阵Y='); disp(Y) %---------------------------------------------------------- G=real(Y);B=imag(Y); %分解出导纳阵的实部和虚部 for i=1:n %给定各节点初始电压的实部和虚部 e(i)=real(B2(i,3)); f(i)=imag(B2(i,3)); V(i)=B2(i,4); %PV节点电压给定模值 end for i=1:n %给定各节点注入功率 S(i)=B2(i,1)-B2(i,2); %i节点注入功率SG-SL B(i,i)=B(i,i)+B2(i,5); %i节点无功补偿量 end %=================================================================== P=real(S);Q=imag(S); %分解出各节点注入的有功和无功功率 ICT1=0;IT2=1;N0=2*n;N=N0+1;a=0; %迭代次数ICT1、a;不满足收敛要求的节点数IT2

MATLAB潮流计算仿真

附录A MATLAB程序 %本程序的功能是用牛顿——拉夫逊法进行潮流计算 % B1矩阵:1、支路首端号;2、末端号;3、支路阻抗;4、支路对地电纳 % 5、支路的变比;6、支路首端处于K侧为1,1侧为0 % B2矩阵:1、该节点发电机功率;2、该节点负荷功率;3、节点电压初始值 % 4、PV节点电压V的给定值;5、节点所接的无功补偿设备的容量 % 6、节点分类标号 clear; n=10;%input('请输入节点数:n='); nl=11;%input('请输入支路数:nl='); isb=1;%input('请输入平衡母线节点号:isb='); pr=0.00001;%input('请输入误差精度:pr='); B1=[1 2 1.755e-2+4.155e-2i 0.26i 1 0; 1 4 3.159e-2+7.479e-2i 0.1215i 1 0; 1 6 3.159e-2+7.479e-2i 0.1215i 1 0; 2 3 3.68e-3+0.11135i 0 0.909 1; 4 5 3.68e-3+0.11135i 0 0.909 1; 4 6 2.808e-2+6.648e-2i 0.108i 1 0; 6 7 3.0865e-3+0.0833i 0 0.909 1; 6 8 3.159e-2+7.479e-2i 0.1215i 1 0; 6 10 2.457e-2+5.817e-2i 0.0945i 1 0; 8 9 3.0865e-3+0.0833i 0 0.909 1; 8 10 2.808e-2+6.648e-2i 0.108i 1 0];%input('请输入由支路参数形成的矩阵: B1='); B2=[0 0 1.05 1.05 0 1; 0 0 1 0 0 2; 0 0.6+0.3718i 1 0 0 2; 0 0 1 0 0 2; 0 0.4+0.247i 1 0 0 2; 0 0 1 0 0 2; 0 0.35+0.2169i 1 0 0 2; 0 0 1 0 0 2; 0 0.5+0.3099i 1 0 0 2; 0.8 0 1.05 1.05 0 3];%input('请输入各节点参数形成的矩阵: B2='); Y=zeros(n);e=zeros(1,n);f=zeros(1,n);V=zeros(1,n);sida=zeros(1,n) ;S1=zeros(nl); %-------修改部分------------ ym=0; SB=100;UB=220; %ym=input('您输入的参数是标么值?(若不是则输入一个不为零的数值)'); if ym~=0

matlab潮流计算毕业设计

毕业设计(论文)matlab潮流计算

毕业设计(论文)原创性声明和使用授权说明 原创性声明 本人郑重承诺:所呈交的毕业设计(论文),是我个人在指导教师的指导下进行的研究工作及取得的成果。尽我所知,除文中特别加以标注和致谢的地方外,不包含其他人或组织已经发表或公布过的研究成果,也不包含我为获得及其它教育机构的学位或学历而使用过的材料。对本研究提供过帮助和做出过贡献的个人或集体,均已在文中作了明确的说明并表示了谢意。 作者签名:日期: 指导教师签名:日期: 使用授权说明 本人完全了解大学关于收集、保存、使用毕业设计(论文)的规定,即:按照学校要求提交毕业设计(论文)的印刷本和电子版本;学校有权保存毕业设计(论文)的印刷本和电子版,并提供目录检索与阅览服务;学校可以采用影印、缩印、数字化或其它复制手段保存论文;在不以赢利为目的前提下,学校可以公布论文的部分或全部内容。 作者签名:日期:

前言 电力系统潮流计算是研究电力系统稳态运行情况的一种计算,它根据给定的运行条件及系统接线情况确定整个电力系统各部分的运行状态:各母线的电压,各元件中流过的功率,系统的功率损耗等等。在电力系统规划的设计和现有电力系统运行方式的研究中,都需要利用潮流计算来定量地分析比较供电方案或运行方式的合理性。可靠性和经济性。此外,电力系统潮流计算也是计算系统动态稳定和静态稳定的基础。所以潮流计算是研究电力系统的一种很重要和很基础的计算。 随着科学技术的发展,电力系统变得越来越复杂,电气工程师掌握一种好的能对电力系统进行仿真的软件是学习和研究的需要。文章简要介绍了MATLAB发展历史、组成和强大的功能,并用简单例子分别就编程和仿真两方面分析了MATIAB软件在电力系统研究中的具体应用。采取等效电路法,能对特殊、复杂地电力系统进行高效仿真研究,因此,掌握编程和仿真是学好MATLAB的基础。与众多专门的电力系统仿真软件相比,MATLAB软件具有易学、功能强大和开放性好,是电力系统仿真研究的有力工具。 1电力系统的基本概念 电力系统:发电机把机械能转化为电能,电能经变压器和电力线路输送并分

用Matlab计算潮流计算-电力系统分析

《电力系统潮流上机》课程设计报告 院系:电气工程学院 班级:电088班 学号:0812002221 学生姓名:刘东昇 指导教师:张新松 设计周数:两周 日期:2010年12 月25 日

一、课程设计的目的与要求 目的:培养学生的电力系统潮流计算机编程能力,掌握计算机潮流计算的相关知识 要求:基本要求: 1.编写潮流计算程序; 2.在计算机上调试通过; 3.运行程序并计算出正确结果; 4.写出课程设计报告 二、设计步骤: 1.根据给定的参数或工程具体要求(如图),收集和查阅资料;学习相关软件(软件自选:本设计选择Matlab进行设计)。 2.在给定的电力网络上画出等值电路图。 3.运用计算机进行潮流计算。 4.编写设计说明书。 三、设计原理 1.牛顿-拉夫逊原理 牛顿迭代法是取x0 之后,在这个基础上,找到比x0 更接近的方程的跟,一步一步迭代,从而找到更接近方程根的近似跟。牛顿迭代法是求方程根的重要方法之一,其最大优点是在方程f(x) = 0 的单根附近具有平方收敛,而且该法还可以用来求方程的重根、复根。电力系统潮流计算,一般来说,各个母线所供负荷的功率是已知的,各个节点电压是未知的(平衡节点外)可以根据网络结构形成节点导纳矩阵,然后由节点导纳矩阵列写功率方程,由于功率方程里功率是已知的,电压的幅值和相角是未知的,这样潮流计算的问题就转化为求解非线性方程组的问题了。为了便于用迭代法解方程组,需要将上述功率方程改写

定电压,将初值带入功率平衡方程,得到功率不平衡量,这样由功率不平衡量、雅可比矩阵、节点电压不平衡量(未知的)构成了误差方程,解误差方程,得到节点电压不平衡量,节点电压加上节点电压不平衡量构成新的节点电压初值,将新的初值带入原来的功率平衡方程,并重新形成雅可比矩阵,然后计算新的电压不平衡量,这样不断迭代,不断修正,一般迭代三到五次就能收敛。 牛顿—拉夫逊迭代法的一般步骤: (1)形成各节点导纳矩阵Y。 (2)设个节点电压的初始值U和相角初始值e 还有迭代次数初值为0。 (3)计算各个节点的功率不平衡量。 (4)根据收敛条件判断是否满足,若不满足则向下进行。 (5)计算雅可比矩阵中的各元素。 (6)修正方程式个节点电压 (7)利用新值自第(3)步开始进入下一次迭代,直至达到精度退出循环。 (8)计算平衡节点输出功率和各线路功率 2.网络节点的优化 1)静态地按最少出线支路数编号 这种方法由称为静态优化法。在编号以前。首先统计电力网络个节点的出线支路数,然后,按出线支路数有少到多的节点顺序编号。当由n 个节点的出线支路相同时,则可以按任意次序对这n 个节点进行编号。这种编号方法的根据是导纳矩阵中,出线支路数最少的节点所对应的行中非零元素也2)动态地按增加出线支路数最少编号在上述的方法中,各节点的出线支路数是按原始网络统计出来的,在编号过程中认为固定不变的,事实上,在节点消去过程中,每消去一个节点以后,与该节点相连的各节点的出线支路数将发生变化(增加,减少或保持不变)。因此,如果每消去一个节点后,立即修正尚未编号节点的出线支路数,然后选其中支路数最少的一个节点进行编号,就可以预期得到更好的效果,动态按最少出线支路数编号方法的特点就是按出线最少原则编号时考虑了消去过程中各节点出线支路数目的变动情况。 3.MATLAB编程应用 Matlab 是“Matrix Laboratory”的缩写,主要包括:一般数值分析,矩阵运算、数字信号处理、建模、系统控制、优化和图形显示等应用程序。由于使用Matlab 编程运算与人进行科学计算的思路和表达方式完全一致,所以不像学习高级语言那样难于掌握,而且编程效率和计算效率极高,还可在计算机上直接输出结果和精美的图形拷贝,所以它的确为一高效的科研助手。 四、设计内容

matlab潮流计算工具箱使用手册

MATPOWER A M ATLAB? Power System Simulation Package Version 3.2 September 21, 2007 User’s Manual Ray D. Zimmerman Carlos E. Murillo-Sánchez rz10@https://www.sodocs.net/doc/473987926.html, carlos_murillo@https://www.sodocs.net/doc/473987926.html, ? 1997-2007 Power Systems Engineering Research Center (PS ERC) School of Electrical Engineering, Cornell University, Ithaca, NY 14853

Table of Contents Table of Contents (2) 1Introduction (3) 2Getting Started (4) 2.1System Requirements (4) 2.2Installation (4) 2.3Running a Power Flow (4) 2.4Running an Optimal Power Flow (4) 2.5Getting Help (4) 3Technical Reference (6) 3.1Data File Format (6) 3.2Modeling (8) 3.3Power Flow (11) 3.4Optimal Power Flow (12) 3.4.1AC OPF Formulation (13) 3.4.2DC OPF Formulation (21) 3.5Unit Decommitment Algorithm (22) 3.6MATPOWER Options (22) 3.7Summary of the Files (28) 4Acknowledgments (33) 5References (33) Appendix A: Notes on LP-Solvers for M ATLAB (34) Appendix B: Additional Notes (34) Appendix C: Auction Code (35)

Matlab牛拉法潮流计算程序(优选.)

最新文件---------------- 仅供参考--------------------已改成-----------word文本 --------------------- 方便更改 %本程序的功能是用牛顿——拉夫逊法进行潮流计算 % B1矩阵:1、支路首端号;2、末端号;3、支路阻抗;4、支路对地电纳 % 5、支路的变比;6、支路首端处于K侧为1,1侧为0 % B2矩阵:1、该节点发电机功率;2、该节点负荷功率;3、节点电压初始值 % 4、PV节点电压V的给定值;5、节点所接的无功补偿设备的容量 % 6、节点分类标号:1为平衡节点(应为1号节点);2为PQ节点; % 3为PV节点; clear; n=input('请输入节点数:n='); nl=input('请输入支路数:nl='); isb=input('请输入平衡母线节点号:isb='); pr=input('请输入误差精度:pr='); B1=input('请输入由各支路参数形成的矩阵:B1='); B2=input('请输入各节点参数形成的矩阵:B2='); Y=zeros(n);e=zeros(1,n);f=zeros(1,n);V=zeros(1,n);sida=zeros(1,n);S1=zeros(nl); % % %--------------------------------------------------- for i=1:nl %支路数 if B1(i,6)==0 %左节点处于1侧 p=B1(i,1);q=B1(i,2); else %左节点处于K侧 p=B1(i,2);q=B1(i,1);

电力系统分析潮流计算课程序设计及其MATLAB程序设计

电力系统分析潮流计算程序设计报告题目:13节点配电网潮流计算 学院电气工程学院 专业班级 学生姓名 学号 班内序号 指导教师房大中 提交日期 2015年05月04日

目录 一、程序设计目的 (1) 二、程序设计要求 (3) 三、13节点配网潮流计算 (3) 3.1主要流程................................................................................................... 错误!未定义书签。 3.1.1第一步的前推公式如下(1-1)-(1-5): ....................................... 错误!未定义书签。 3.1.2第二步的回代公式如下(1-6)—(1-9): ..................................... 错误!未定义书签。 3.2配网前推后代潮流计算的原理 (6) 3.3配网前推后代潮流计算迭代过程 (7) 3.3计算原理 (8) 四、计算框图流程 (9) 五、确定前推回代支路次序.......................................................................................... 错误!未定义书签。 六、前推回代计算输入文件 (10) 主程序: (10) 输入文件清单: (11) 计算结果: (12) 数据分析: (12) 七、配电网潮流计算的要点 (13) 八、自我总结 (13) 九、参考文献 (14) 附录一 MATLAB的简介 (14)

相关主题