📄 genform.m
字号:
%additive part of the cost contributed by this generator is y.%%In the generalized OPF formulation, the capability to accept general%linear constraints is used to introduce new y variables (one for each%piecewise linear cost in the problem) and constraints (one for each cost%segment in the problem). The function that builds the coefficient matrix%for the restrictions is makeAy. Because a linear cost on the y variables%is also required, the last row of the matrix that is passed to the%solver is expected to contain not some linear restriction coefficients%but a linear cost vector on [x; y]. In normal use this is done%automatically inside fmincopf (or mopf when using MINOPF) and the user%need not worry about this. To incorporate additional linear constraints,%however, it is necessary to know in advance how many y variables there%are so that the coefficient matrix for the user's constraints have a%matching number of columns to multiply [x; y]. The number of y variables%is equal to the number of piecewise linear cost curves (both active and%reactive) there are for the generators that are online.%%%*-*-*-*-*-*-*-*-*-*-*-*%4.0 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 dispatchable%load. If a load has a demand curve like the following%% quantity% ^% |% |%P2 |-------------+% | |% | |%P1 |_____________|_____________+% | |% | |% |---------------------------+----> price% price1 price2%%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 injection,%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:%% cost% ^% -P2 -P1 0|%---------------------------------------*--> power% * |0% slope=price2 * |% * |% * |% * |% * |% * |% * |% * slope=price1 |% * |%%%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 generalized formulation it is assumed that%dispatchable loads maintain a constant power factor. The mechanism for%posing additional general linear constraints is employed to%automatically include restrictions for these injections to keep the%ratio of Pg and Qg 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 important 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.%%%*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*%5. ADDITIONAL INFORMATION ON THE GENERALIZED FORMULATION STRUCTURE %*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*%%The advanced user may want to incorporate additional linear constraints%and/or linear costs to the problem. Sometimes new state variables may%need to be defined (in addition to x and y discussed above). And,%sometimes the user may also want to include additional linear costs on%some or all of the variables, but in most cases fmincopf (or mopf) hide%these steps from the user and create certain costs and restrictions%automatically. This creates a conflict between ease of use and%generality of the software. In this section we explain the behavior%adopted by fmincopf and mopf when the following factors interact:%%a) existence of y variables because of piecewise linear costs%b) user-provided linear restrictions% b1) on whatever the existing variables [x; y] are;% b2) with A having more columns than there are elements in [x; y],% thus creating extra variables z and an overall optimization vector% [x; y; z].%%If the user does not provide any additional linear restrictions via the%A, l, u parameters, then internally there are only x and y-type%variables; if there are y-type variables for modeling piecewise linear%costs, then some additional constraints will be constructed to model the%cost segments. If there are dispatchable loads (with either%polynomial or piecewise linear costs) then additional constraints will%be included to maintain a constant power factor.%%If a user does provide A, l, u parameters to add general linear%constraints, then%%a) if the number of columns in A is the same as the number of variables% in [x; y], then any linear cost vector needed for modeling of the% piecewise linear costs is constructed automatically and the user is% not expected to provide a cost row in A.%%b) if the number of columns in A is greater than the number of elements% in [x; y], then the user is responsible to provide%% b1) the appropriate linear restrictions on y and the Pg, Qg sections% of the x vector to model each of the segments of the piecewise% linear costs as described in previously; this includes both the% coefficient matrix and the left and right hand sides of the% restrictions. The function makeAy can be used for this, but keep% in mind that it will return a coefficient matrix that has only as% many columns as elements in [x; y]. It must be padded with enough% sparse zero columns on the right to make it conformable with% [x; y; z] if there are any z variables.%% b2) the appropriate linear cost in the last row of A and this% includes ANY NECESSARY COST COEFFICIENTS ON THE y SECTION OF THE% COST VECTOR. Note that l and u must still have the same number of% elements as A has rows but the last elements in l and u are% meaningless; set them to (-large, +large).%%Note that this implies that in order to add linear costs on just the%[x; y] variables, at least one dummy z variable must be created for the%interface to provide the user with the opportunity to specify the linear%cost vector.%%Finally, to complete this section we include the structure of%the Jacobian used internally by MINOS; note that the sparse matrix%returned by the solvers only includes the rows up to the last of the%nonlinear constraints (those related to the injection limit on the%"to" side of the branches).%% nb nb ng ng ny + nz% +------------------------------------+-------------------------+% | dgP dgP dgP | |%nb | --- --- --- 0 | |% | dth dV dP | |% | | |% | dgQ dgQ dgQ | |%nb | --- --- 0 --- | |% | dth dV dQ | |% | | sparse(2*nb+2*nl,ny+nz) |% | dSf dSf | |%nl | --- --- 0 0 | | M = 2*nb% | dth dV | | + 2*nl% | | | + mA% | dSt dSt | |%nl | --- --- 0 0 | |% | dth dV | |% +------------------------------------+-------------------------+% | |%mA | A |% | |% +--------------------------------------------------------------+% N = 2*nb + 2*ng + ny + nz% MATPOWER% $Id: genform.m,v 1.7 2005/01/25 14:39:47 ray Exp $% by Carlos E. Murillo-Sanchez, PSERC Cornell & Universidad Autonoma de Manizales% Copyright (c) 2004 by Power System Engineering Research Center (PSERC)% See http://www.pserc.cornell.edu/matpower/ for more info.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -