⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 genform.m

📁 MATPOWER 一款基于MATLAB的电力系统潮流计算及优化的程序
💻 M
字号:
%GENFORM: Help file describing the generalized OPF formulation used by%         the fmincopf and MINOPF solvers.%%==========% CONTENTS%==========%%1. General OPF Problem Formulation%2. General Linear Constraints%3. Generalized Cost Function%4. Piecewise Linear Convex Cost Formulation Using Constrained Cost Variables%5. Generator P-Q Capability Curves%6. Dispatchable Loads%7. Problem Data Transformation%8. Example of Additional Linear Constraint%9. Miscellaneous%%%====================================% 1. GENERAL OPF PROBLEM FORMULATION%====================================%%The problem is formulated in terms of 3 groups of optimization variables,%labeled x, y and z. The vector x = [ Theta; V; Pg; Qg ] contains the OPF%variables, consisting of the voltage angles Theta and magnitudes V at each of%the nb buses, and real and reactive generator injections Pg and Qg for each of%the ng generators. The y variables are the helper variables used by the%constrained cost variable (CCV) formulation of the piecewise linear generator%cost functions. Additional user defined variables are grouped in z.%%The optimization problem can be expressed as follows:%%   min  sum( f1i(Pgi) + f2i(Qgi) ) + sum(y) + 0.5 * w' * H * w + Cw' * w%  x,y,z%%subject to%  g(x) <=> 0          (nonlinear constraints: bus power balance equations%                                              & branch flow limits)%  l <= A*[x;y;z] <= u (general linear constraints)%  xmin <= x <= xmax   (variable bounds: voltage limits, generation limits)%%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.%%%===============================% 2. GENERAL LINEAR CONSTRAINTS%===============================%%In addition to the standard non-linear equality constraints for nodal power%balance and non-linear inequality constraints for line flow limits, this%formulation includes a framework for additional linear constraints involving%the full set of optimization variables.%%  l <= A*[x;y;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 loads%* rows and columns for the y variables from the CCV implementation of%  piecewise linear generator costs and their associated constraints%%In addition to these automatically generated constraints, the user can provide%a matrix Au and vectors lu and uu to define further linear constraints. These%user supplied constraints could be used, for example, to restrict voltage%angle differences between specific buses. The matrix Au must have at least nx%columns where nx is the number of x variables. If Au has more than nx columns,%a corresponding z optimization variable is created for each additional column.%These z variables also enter into the generalized cost terms described below,%so Au and N must have the same number of columns.%%  lu <= Au*[x;z] <= uu (user supplied linear constraints)%%*Change from MATPOWER 3.0*: The Au matrix supplied by the user no longer%includes the (all zero) col-umns corresponding to the y variables for%piecewise linear generator costs. This should simplify signifi-cantly the%creation of the desired Au matrix.%%%==============================% 3. GENERALIZED COST FUNCTION%==============================%%The cost function consists of 3 parts. The first two are the polynomial and%piecewise linear costs, respectively, of generation. A polynomial or piecewise%linear cost is specified for each generator's active output and, optionally,%reactive output in the appropriate row(s) of the gencost matrix. Any piecewise%linear costs are implemented using the CCV formulation described below which%introduces corresponding helper y variables. The general formulation allows%generator costs of mixed type (polynomial and piece-wise linear) in the same%problem.%%The third 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, Cw,  N and fparm,%described below. It consists of a general quadratic function of an  nw x 1%vector w of transformed optimization variables.%%  1/2 * w' * H * w + Cw' * w%%H is the nw x nw symmetric, sparse matrix of quadratic coefficients and Cw%is the nw x 1 vector of linear coefficients. The sparse N matrix is nw x nxz,%where the number of columns must match that of any user supplied Au matrix.%And fparm is nw x 4, where the 4 columns are labeled as%%  fparm = [ d rhat h m ].%%The vector w is created from the x and z optimization variables by first%applying a general linear transformation%%  r = N * [x; z],%%followed by a scaled function with a shifted "dead zone", defined by the%remaining elements of fparm. Each element of r is transformed into the%corresponding element of w as follows:%%        /  mi * fi(ri - rhati + hi),  for ri - rhati < -hi%  wi = <   0,                         for -hi <= ri - rhati <= hi%        \  mi * fi(ri - rhati - hi),  for ri - rhati > hi%%where the function fi is a predetermined function selected by the index in di.%The current implementation includes linear and quadratic options.%%           /  t,    for di = 1%  fi(t) = <%           \  t^2,  for di = 2%%See the User's Manual for an illustration of the linear case. %%%==============================================================================% 4. PIECEWISE LINEAR CONVEX COST FORMULATION USING CONSTRAINED COST VARIABLES%==============================================================================%%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.%% cost axis%     ^%c2   |                           *%     |                        *%     |                     *%c1   |                  *%     |          *%c0   |   *%     |------------------------------->   Pg axis%         x0            x1         x2%        Pmin                     Pmax%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 variable 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 >= m1*(Pg - x0) + c0   (y must lie above the first segment)%  2)  y >= m2*(Pg - x1) + c1   (y must lie above the second segment)%%where  m1 and m2 are the slopes of the two segments. Also needed, of course,%are the box restrictions on Pg:  Pmin 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -