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

📄 genform.m

📁 以上所传的内容为电力系统比较全面的分析程序,才用的是matlab编写m的文件
💻 M
📖 第 1 页 / 共 2 页
字号:
% In the generalized OPF formulation, the capability to accept% general linear constraints is used to introduce new variables "y"% (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.m .% Because a linear cost on the y variables is also required, the% last row of the matrix that is actually passed on 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.m (or mopf.m when using MINOS) and% the users need not worry about this.  If the user wants to add% linear constraints of his or her own, 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].  In that case it is necessary to% know how many piece wise linear cost curves (both active and reactive)% there are for the generators that are online.  That is equal to the% number of "y" variables.%% *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*% 4.0 CURTAILABLE AND PRICE-SENSITIVE LOADS% *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*%% In general, 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 price-sensitive 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. Then, when the load is% is considered as a negative injection what is wanted is that it is % dispatched at zero if the price is greater than price2,% at -P1 if the price is higher than price1 but lower than price2,% and at -P2 if the price is equal to or lower than price1.% This suggests the following piece wise-linear cost curve:%%                                       cost%                                        ^%          -P2              -P1         0|% ---------------------------------------*-->  power%                                      * |0%                       slope=price2 *   |%                                  *     |%                                *       |%                              *         |%                            *           |%                       *                |%                  *                     |%             * slope=price1             |%        *                               |%%% Note that this assumes that the demand blocks can be "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 not% inside the scope of MATPOWER at this time.%% When there are price-sensitive loads, the issue of reactive% dispatch arises.  If the QMIN/QMAX generation limits for the% generator (really a load) in question are not set to zero,% then the algorithm will actually dispatch the reactive injection% to the most convenient value.  This is not normal load behavior% and therefore in the generalized formulation it is assumed that% variable 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 initial values of PG and QG in the gen() table;% thus, 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).%% *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*% 5. ADDITIONAL STRUCTURE INFORMATION% *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*%% The advanced user may need to add linear constraints to the% problem and/or linear costs.  Sometimes new state variables% may need to be defined (in addition to x and y discussed% before).  And, sometimes the user may also need 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.m and mopf.m when the following factors% interact:%% a) existence of y variables because of piece wise-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% piece wise-linear costs, then some additional constraints will% be constructed to model the cost segments.  If there are% price-sensitive loads (with either polynomial or piece wise-linear costs)% then some more constraints will be added 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], the software takes charge of constructing%      any linear cost vector needed for modeling of the piece wise-linear%      costs and it does not expect any user-provided cost row%      in A.%%   b) If the number of columns in A is greater than the number of%      elements in [x;y], then it becomes the user's responsibility 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 piece wise-linear costs as described in section 2;%          this includes both the coefficient matrix and the left%          and right hand sides of the restrictions.%          The function makeAy.m 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 means that if the user wants to add linear costs% on just the [x,y] variables, he or she will have to create at least% one dummy z variable 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) | M = 2nb%      |   dSf      dSf                     |                         |    +2nl%  nl  |   ---      ---       0        0    |                         |    +AM%      |   dth      dV                      |                         |%      |                                    |                         |%      |   dSt      dSt                     |                         |%  nl  |   ---      ---       0        0    |                         |%      |   dth      dV                      |                         |%      ----------------------------------------------------------------%      |                                                              |%  AM  |                                A                             |%      |                                                              |%      ----------------------------------------------------------------%%   MATPOWER%   $Id: genform.m,v 1.4 2004/09/15 16:23:02 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 + -