设为首页收藏本站|繁體中文 快速切换版块

 找回密码
 立即加入
搜索
查看: 2933|回复: 11

[讨论] 最优潮流

  [复制链接]

该用户从未签到

尚未签到

发表于 2011-9-8 17:17:59 | 显示全部楼层 |阅读模式

马上加入,结交更多好友,共享更多资料,让你轻松玩转电力研学社区!

您需要 登录 才可以下载或查看,没有账号?立即加入

×
刚刚上研一,想写最优潮流,有sb有最优潮流的MATLAB程序吗?谢谢哦~
"真诚赞赏,手留余香"
还没有人打赏,支持一下
楼主热帖
帖文化:【文明发帖 和谐互动】 社区精神:【创新、交流、互助、共享】

该用户从未签到

尚未签到

发表于 2011-9-13 12:00:34 | 显示全部楼层
你可以看看matpower。基于matlab的潮流计算。里面有OPF。希望能帮到你
"真诚赞赏,手留余香"
还没有人打赏,支持一下
帖文化:【文明发帖 和谐互动】 社区精神:【创新、交流、互助、共享】

该用户从未签到

尚未签到

发表于 2011-10-14 21:56:36 | 显示全部楼层
Matpower
"真诚赞赏,手留余香"
还没有人打赏,支持一下
帖文化:【文明发帖 和谐互动】 社区精神:【创新、交流、互助、共享】
  • TA的每日心情
    无聊
    2020-11-23 21:46
  • 签到天数: 3 天

    连续签到: 1 天

    [LV.2]偶尔看看I

    累计签到:3 天
    连续签到:1 天
    发表于 2011-11-25 11:10:24 | 显示全部楼层
    回复 2# helton8221 ! s4 N! _1 m. n$ ^
    0 @, v+ B( m. I5 D' d6 O

    ( Q3 G  e; Q9 e; `) Z# p9 }    大哥,是可以在matpower里面直接看到最优潮流的matlab程序吗?
    "真诚赞赏,手留余香"
    还没有人打赏,支持一下
    帖文化:【文明发帖 和谐互动】 社区精神:【创新、交流、互助、共享】
  • TA的每日心情
    无聊
    2017-9-26 15:28
  • 签到天数: 21 天

    连续签到: 1 天

    [LV.4]偶尔看看III

    累计签到:21 天
    连续签到:1 天
    发表于 2011-11-30 11:27:31 | 显示全部楼层
    楼主,你的帖子里“sb”是啥意思呀,小心删贴处罚你
    "真诚赞赏,手留余香"
    还没有人打赏,支持一下
    帖文化:【文明发帖 和谐互动】 社区精神:【创新、交流、互助、共享】

    该用户从未签到

    尚未签到

    发表于 2011-12-3 10:57:38 | 显示全部楼层
    我咋记得PSAT里面有呢, 还是MATPOWER来着, 反正其中有一个有OPF的按钮.
    "真诚赞赏,手留余香"
    还没有人打赏,支持一下
    帖文化:【文明发帖 和谐互动】 社区精神:【创新、交流、互助、共享】
  • TA的每日心情
    开心
    2021-3-9 07:58
  • 签到天数: 6 天

    连续签到: 1 天

    [LV.2]偶尔看看I

    累计签到:6 天
    连续签到:1 天
    发表于 2012-4-20 20:00:12 | 显示全部楼层
    function [busout, genout, branchout, f, success, info, et, g, jac, xr, pimul] = .... s8 [; r6 z1 X7 ^6 ~' b
        opf(varargin)* d% k3 ]! O: _- X
    %OPF  Solves an optimal power flow.
    1 L+ \% e/ ?; J* t%   [RESULTS, SUCCESS] = OPF(MPC, MPOPT)' B( Z+ n0 n  ]) k4 v
    %/ t5 t! I5 [4 E* c* O: q
    %   Returns either a RESULTS struct and an optional SUCCESS flag, or individual- ~6 `# \& I1 r9 ^
    %   data matrices, the objective function value and a SUCCESS flag. In the/ z; T$ r1 t* L
    %   latter case, there are additional optional return values. See Examples5 B2 h+ z0 J8 e8 ~6 u4 f1 t' H$ h) E
    %   below for the possible calling syntax options.: a, U+ l' G0 Y6 Z0 L: ^
    %
    2 i1 V7 h" X3 J/ @, a4 a1 M- G%   Examples:3 U0 {- S6 X7 O" X8 l
    %       Output argument options:
    6 ^2 t+ s9 E0 e- H& m4 a0 F%
    ' c; P/ D/ o8 \# N%       results = opf(...)
    2 B* n/ d% Z$ |; Y3 Q+ R- g: b%       [results, success] = opf(...)
    " A* F& O' {+ m) x%       [bus, gen, branch, f, success] = opf(...)% ^; s* T- N* \- p8 p# W7 k3 f* @
    %       [bus, gen, branch, f, success, info, et, g, jac, xr, pimul] = opf(...)8 P, S" X7 ]: X) U2 H% n  }$ k8 R
    %% H9 X7 x" s# Z+ T7 E
    %       Input arguments options:
    2 {! ~4 U+ f9 e# s2 x%
    / i  d6 O: i1 {% c( T4 l%       opf(mpc)
    & ]$ O4 E% U7 i& X( }6 W; D%       opf(mpc, mpopt)3 W9 @+ g* Q: B( g! h
    %       opf(mpc, userfcn, mpopt)+ u  l9 B+ l9 w
    %       opf(mpc, A, l, u)
    1 S. B3 {: J1 {+ J. V9 F- y%       opf(mpc, A, l, u, mpopt); K4 K9 `7 ^) B. w$ N7 t
    %       opf(mpc, A, l, u, mpopt, N, fparm, H, Cw)3 r* D+ f1 O* G6 l8 Z
    %       opf(mpc, A, l, u, mpopt, N, fparm, H, Cw, z0, zl, zu)8 O; K& o5 L# h, l
    %3 ]$ A# \( B5 R5 ^# d" U
    %       opf(baseMVA, bus, gen, branch, areas, gencost)( E3 |% M' z0 l; P$ K- @. z
    %       opf(baseMVA, bus, gen, branch, areas, gencost, mpopt), \4 o0 x9 c, v( h4 c8 W
    %       opf(baseMVA, bus, gen, branch, areas, gencost, userfcn, mpopt); Q5 y+ d/ i8 t* r2 Q& ?# Z
    %       opf(baseMVA, bus, gen, branch, areas, gencost, A, l, u)
    # Z$ I& n) Y4 C# A6 K* [, m% H( _%       opf(baseMVA, bus, gen, branch, areas, gencost, A, l, u, mpopt)- b% w3 @; p% t. L, Y
    %       opf(baseMVA, bus, gen, branch, areas, gencost, A, l, u, ...
    2 _- b$ Y4 G$ a2 w) G9 d- R# U" P% ^%                                   mpopt, N, fparm, H, Cw)
    8 U( N8 W7 u# A! {$ `' r7 M%       opf(baseMVA, bus, gen, branch, areas, gencost, A, l, u, ...
    ! y7 ?- _) E) d3 H7 N1 O2 o%                                   mpopt, N, fparm, H, Cw, z0, zl, zu)$ [" C: s) j/ n* l7 g
    %
    0 }' \" D9 ]1 c" l; k$ @%   The data for the problem can be specified in one of three ways:
    % s0 x- x2 a7 [1 |( `& N9 X. f' E%   (1) a string (mpc) containing the file name of a MATPOWER case
    ( F# p7 z& }0 Y# R%     which defines the data matrices baseMVA, bus, gen, branch, and5 z& `- L+ I/ p  {( M7 ?
    %     gencost (areas is not used at all, it is only included for- r" w1 ?/ \( M0 v; N( `0 Q# S
    %     backward compatibility of the API).2 O( t) h: i  k! j! }4 y; T8 y
    %   (2) a struct (mpc) containing the data matrices as fields.
    1 _8 M8 G, D* I* M& X3 ]%   (3) the individual data matrices themselves.
    ) v/ C+ `' l  R8 C* t%   0 v: H0 o9 }8 Z  K( X
    %   The optional user parameters for user constraints (A, l, u), user costs7 y! Z+ D. X8 h- e
    %   (N, fparm, H, Cw), user variable initializer (z0), and user variable
    0 O+ c- ]" T! d1 h) y$ {%   limits (zl, zu) can also be specified as fields in a case struct,
    2 u, h! o/ A2 \4 p' d8 V, X# f%   either passed in directly or defined in a case file referenced by name.% D2 ^2 Z) u7 X+ i
    %   
    ! H8 ^$ m$ Q+ \! o9 [%   When specified, A, l, u represent additional linear constraints on the
    , g' Z& ]* ^% j& J: z$ z6 f%   optimization variables, l <= A*[x; z] <= u. If the user specifies an A8 i( S$ A& [9 q+ W+ s
    %   matrix that has more columns than the number of "x" (OPF) variables,1 u- f; b/ l# d1 j: l; M
    %   then there are extra linearly constrained "z" variables. For an
    + c9 x0 p8 U: D# K2 X$ I%   explanation of the formulation used and instructions for forming the! [4 v/ n* u* j- Y! K7 F( x" {0 Q* ?5 H
    %   A matrix, see the manual.) t' R6 Q+ k: B% L( M8 I$ x
    %
      i+ R4 z. j2 z%   A generalized cost on all variables can be applied if input arguments
    , u" j& U0 h# t6 n4 t" z8 _%   N, fparm, H and Cw are specified.  First, a linear transformation
    % s, z: i" L' O& O! G3 L%   of the optimization variables is defined by means of r = N * [x; z].+ V) i; V& M  e1 T2 v+ E  ?
    %   Then, to each element of r a function is applied as encoded in the% n' Z) [3 u4 D2 _0 D
    %   fparm matrix (see manual). If the resulting vector is named w,( |6 q* u0 w" E! n$ g9 k
    %   then H and Cw define a quadratic cost on w: (1/2)*w'*H*w + Cw * w .( @6 S: b+ T4 v6 Y
    %   H and N should be sparse matrices and H should also be symmetric.3 x) F8 q# }. n1 T6 M2 Z
    %
    . a0 g$ ^: u3 {+ u%   The optional mpopt vector specifies MATPOWER options. If the OPF& Z; Y0 a  @( e! }
    %   algorithm is not explicitly set in the options MATPOWER will use0 M1 q: w- [( f) }- q& X6 }
    %   the default solver, based on a primal-dual interior point method.( ~4 Y7 z6 o* K' v
    %   For the AC OPF this is OPF_ALG = 560, unless the TSPOPF optional9 D9 s4 \# n( P' a( t1 o
    %   package is installed, in which case the default is 540. For the( P! b) u( p# o. W$ K' a
    %   DC OPF, the default is OPF_ALG_DC = 200. See MPOPTION for, Q3 n5 U! P* ~0 l2 w) s
    %   more details on the available OPF solvers and other OPF options
    $ d  B3 t! V' h& p. U%   and their default values.1 M% f7 [. y! q) B9 t! s8 P
    %
    * i' M, ~1 K8 |- C& E- T+ L%   The solved case is returned either in a single results struct (described+ O! I; W" ?) {3 b( [
    %   below) or in the individual data matrices, bus, gen and branch. Also
    - V; z3 }7 S8 `' s' |4 n%   returned are the final objective function value (f) and a flag which is
      _- M# W: ^- U5 P! i, m2 I%   true if the algorithm was successful in finding a solution (success).
    5 Z- `0 Q, e5 E7 x1 F9 q%   Additional optional return values are an algorithm specific return status
    ; Z" P" D( w8 |" ^%   (info), elapsed time in seconds (et), the constraint vector (g), the( `+ R: ?' N  x
    %   Jacobian matrix (jac), and the vector of variables (xr) as well
    ; n$ l, C0 ~$ y9 f! Y! w4 L+ U%   as the constraint multipliers (pimul).& g$ K' ~/ z. p3 n
    %% K% c% Y. ]; d/ N  `3 R  ?
    %   The single results struct is a MATPOWER case struct (mpc) with the
    2 ?9 F( }0 W0 R%   usual baseMVA, bus, branch, gen, gencost fields, along with the; L: y! _* b% O& \* P( u# x
    %   following additional fields:
    0 U* B8 T: F' m# m* H) v  U& `%& I) k& P9 |( M' @. ^  R
    %       .order      see 'help ext2int' for details of this field; \3 @5 y4 d& v( c5 P6 P
    %       .et         elapsed time in seconds for solving OPF
    0 V$ I% c  @' u% E4 p& s1 b7 Q%       .success    1 if solver converged successfully, 0 otherwise: F- l! H' d" T$ ?5 N$ x
    %       .om         OPF model object, see 'help opf_model'
    ! W8 a$ v0 O, |%       .x          final value of optimization variables (internal order)
    - h" W: g' b" ~' q- o%       .f          final objective function value( f! O: H. x! ~
    %       .mu         shadow prices on ...; G0 Y7 _+ z. K% D+ L1 h: t3 H
    %           .var# ]9 x2 D0 q2 c/ V8 {# Q3 g3 M
    %               .l  lower bounds on variables# v1 [( K) _1 C  B% z' ]
    %               .u  upper bounds on variables
    & z4 T; L% [% {: \( F%           .nln
    : A: ]0 ~  a, @+ E# X8 M/ h; q3 y$ M%               .l  lower bounds on nonlinear constraints/ a  ^  X' g3 y! }8 |8 w1 z
    %               .u  upper bounds on nonlinear constraints8 D) o) s2 t* E5 p9 ~
    %           .lin
    # S2 H9 H1 j, f6 M7 @%               .l  lower bounds on linear constraints. q! {2 U1 b, V. J6 g! y6 {% z
    %               .u  upper bounds on linear constraints
    4 p- b2 v( i. f%       .raw        raw solver output in form returned by MINOS, and more! U% F$ ~+ |5 \: i* Z7 c' @) g
    %           .xr     final value of optimization variables! J2 n. f  f6 w! u0 |1 K
    %           .pimul  constraint multipliers
    ' C' _* O# O6 Y' x2 m%           .info   solver specific termination code1 ]6 l2 g$ \8 b* A5 H) T% `
    %           .output solver specific output information
    ( b" k4 \7 V0 W1 l. a$ \%              .alg algorithm code of solver used$ H; _, W% I5 `3 d6 X
    %           .g      (optional) constraint values2 u" V2 d( e& ^( v/ P0 `0 ~
    %           .dg     (optional) constraint 1st derivatives$ Y2 X7 n) O# H* R8 U+ ~
    %           .df     (optional) obj fun 1st derivatives (not yet implemented)" J+ m3 Z2 n* Z1 J
    %           .d2f    (optional) obj fun 2nd derivatives (not yet implemented)
    ( E" U( a) |( L7 H7 z. S%       .var
    + f, Q- Q& t5 F9 R%           .val    optimization variable values, by named block* l6 \- ^9 n! y! o  e% j; X" W9 i
    %               .Va     voltage angles5 H/ K1 Y" h, j& y; h3 E6 G
    %               .Vm     voltage magnitudes (AC only)5 f9 ]& C" Z4 y$ t5 c: }
    %               .Pg     real power injections* I8 r! t9 F2 [& [
    %               .Qg     reactive power injections (AC only)3 o2 n- L) O* e- u1 U: \6 J% a
    %               .y      constrained cost variable (only if have pwl costs)# {" O8 S* j5 G' `
    %               (other) any user defined variable blocks; e9 h( j7 f, M& I
    %           .mu     variable bound shadow prices, by named block# f/ B1 J$ q! g% l7 M7 v
    %               .l  lower bound shadow prices3 r+ b. c/ ?& M( D
    %                   .Va, Vm, Pg, Qg, y, (other)/ U) F: R1 R7 n, E
    %               .u  upper bound shadow prices9 Z) r( _5 M) O5 G" s* T' D  ]
    %                   .Va, Vm, Pg, Qg, y, (other)8 c, x3 R0 h/ n; i/ j
    %       .nln    (AC only)
    : N- p* Y2 B# s+ p( ~+ x9 P%           .mu     shadow prices on nonlinear constraints, by named block- B6 \8 G9 w  c6 s- K! i. Y
    %               .l  lower bounds
    1 g9 L' C; _) q% k& j% S  b%                   .Pmis   real power mismatch equations' k8 p) I  O0 t+ E# w) `/ R9 v
    %                   .Qmis   reactive power mismatch equations! \, n6 Z! O$ b8 ]+ d+ Z/ T
    %                   .Sf     flow limits at "from" end of branches2 U* o9 g; L3 z( P5 |8 p
    %                   .St     flow limits at "to" end of branches
    5 v2 E5 G7 s. {1 k2 o0 Q9 S3 \- P%               .u  upper bounds
    , o: h0 }1 j6 z" Q%                   .Pmis, Qmis, Sf, St
    ) X; E9 @) O' }%       .lin+ H3 z  K. b; O% B' `, I3 B3 k
    %           .mu     shadow prices on linear constraints, by named block
    # Z3 s2 q1 p" ?1 @, X9 ?%               .l  lower bounds
    5 o( I# |. h/ w- {0 m%                   .Pmis   real power mistmatch equations (DC only)
    ( u6 h4 q+ J; v" [+ F6 V%                   .Pf     flow limits at "from" end of branches (DC only)3 O2 B1 T/ A; k  e5 X
    %                   .Pt     flow limits at "to" end of branches (DC only)
    8 t5 P3 {0 v: \" q% h( ~%                   .PQh    upper portion of gen PQ-capability curve (AC only)
    # X, I2 \0 S# X; f: h%                   .PQl    lower portion of gen PQ-capability curve (AC only)
    $ P2 q: n2 e9 B6 D7 n' B. m" u* D%                   .vl     constant power factor constraint for loads (AC only): \" X7 Q9 K, M6 x, G7 Q4 `! y
    %                   .ycon   basin constraints for CCV for pwl costs
    & z' j  [7 P1 Y7 M%                   (other) any user defined constraint blocks
    & k6 X2 P# ?* {%               .u  upper bounds
    ! T$ ~+ e4 x  q/ Y%                   .Pmis, Pf, Pf, PQh, PQl, vl, ycon, (other); [: P% s! W2 f* E& m
    %       .cost       user defined cost values, by named block
    , s1 v, B0 U6 Q8 ?# O%
    1 m9 Y) ?: u. T8 K. g- t%   See also RUNOPF, DCOPF, UOPF, CASEFORMAT.8 O* A& A4 `4 Q0 H9 {
    ! n  l' ]. k0 E6 x
    %   MATPOWER  a7 O$ v' b# y# B9 }1 ^4 ~. {
    %   $Id: opf.m,v 1.73 2010/06/09 14:56:58 ray Exp $+ P  N- Z4 z2 P2 ?5 r# V! G
    %   by Ray Zimmerman, PSERC Cornell
    8 F% y- U: s" r%   and Carlos E. Murillo-Sanchez, PSERC Cornell & Universidad Autonoma de Manizales
    1 O( ?; ~$ G" e8 l$ z%   Copyright (c) 1996-2010 by Power System Engineering Research Center (PSERC): a* m/ f4 j6 R, x' i: Q5 N
    %
    9 C4 f) m* T) z( y2 Y%   This file is part of MATPOWER.
    # ^; c7 ^# J5 f- ]$ [7 q%   See http://www.pserc.cornell.edu/matpower/ for more info.1 f" j' Y# p( H- R" q6 W. f0 U
    %/ \- P5 y+ a( Z! H# |' I# H
    %   MATPOWER is free software: you can redistribute it and/or modify
    3 b3 c7 W; j: u9 S! w3 u%   it under the terms of the GNU General Public License as published, C6 P. A* r: L" O! C% y
    %   by the Free Software Foundation, either version 3 of the License,' Z/ n' ^" J+ o5 ~1 q7 Z, G/ b
    %   or (at your option) any later version.6 [) {; q- C3 `( g; U; F
    %
    5 k+ C+ ^" F& o& {/ x%   MATPOWER is distributed in the hope that it will be useful,5 X: x* ~) k( a6 ?# s! q8 ~& Z
    %   but WITHOUT ANY WARRANTY; without even the implied warranty of/ o" B/ ~/ R2 w" p1 y
    %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    ; x- u, y# @8 S) |%   GNU General Public License for more details.+ M, p6 f9 N1 A3 Y! ^6 T9 {
    %6 T9 Z6 g# y& J- f0 F% E0 \8 ?
    %   You should have received a copy of the GNU General Public License
    8 j8 }8 M# A3 n/ V%   along with MATPOWER. If not, see <http://www.gnu.org/licenses/>.+ u- w5 {1 v) W( E, D' b0 H0 P
    %+ t* R# M* h& b* K
    %   Additional permission under GNU GPL version 3 section 7
      R# F* X" M" z" _%: k2 Y. b. E8 C. V
    %   If you modify MATPOWER, or any covered work, to interface with
    8 U2 r; r5 W  W- L! f. e%   other modules (such as MATLAB code and MEX-files) available in a7 k+ A5 H+ k  ]) R
    %   MATLAB(R) or comparable environment containing parts covered
    ) M; d" a' e" V( ]; D4 r%   under other licensing terms, the licensors of MATPOWER grant; G4 K0 ?* W1 v1 H2 ?2 u/ r
    %   you additional permission to convey the resulting work.
    % f6 F( T0 B7 w$ Z' Q
    9 K$ z0 l/ r: v: p%%----- initialization -----# a. A& m4 t7 l
    t0 = clock;         %% start timer# C! a% \8 [0 Y+ F$ V- n. \2 @
    - L2 k5 Z9 a' I" @
    %% define named indices into data matrices
    ) w. ~. `" E; o$ s[PQ, PV, REF, NONE, BUS_I, BUS_TYPE, PD, QD, GS, BS, BUS_AREA, VM, ...
    & r; f* k, D, z& M) [    VA, BASE_KV, ZONE, VMAX, VMIN, LAM_P, LAM_Q, MU_VMAX, MU_VMIN] = idx_bus;; e. u$ O& q2 t3 B2 J9 c
    [GEN_BUS, PG, QG, QMAX, QMIN, VG, MBASE, GEN_STATUS, PMAX, PMIN, ...+ D$ ?/ D: Z7 E1 e, i: l* ?; G  G
        MU_PMAX, MU_PMIN, MU_QMAX, MU_QMIN, PC1, PC2, QC1MIN, QC1MAX, ...
    0 k+ ?7 u+ v: _* H3 H    QC2MIN, QC2MAX, RAMP_AGC, RAMP_10, RAMP_30, RAMP_Q, APF] = idx_gen;! U- ~2 @* q( |6 Z- S4 a
    [F_BUS, T_BUS, BR_R, BR_X, BR_B, RATE_A, RATE_B, RATE_C, ...- q; X8 J- }2 P* X
        TAP, SHIFT, BR_STATUS, PF, QF, PT, QT, MU_SF, MU_ST, ...( F: ~+ B) `4 N( c3 Z
        ANGMIN, ANGMAX, MU_ANGMIN, MU_ANGMAX] = idx_brch;
    / l2 A" f7 Y( B! v[PW_LINEAR, POLYNOMIAL, MODEL, STARTUP, SHUTDOWN, NCOST, COST] = idx_cost;
    " m* r; g! o( I# }) V; P0 m! m. M$ Z; X
    %% process input arguments3 v, G% @8 [( x0 Q( ~
    [mpc, mpopt] = opf_args(varargin{:});. N  d+ _  E9 A9 O$ {* A
    , P# v$ Q) z/ ?
    %% add zero columns to bus, gen, branch for multipliers, etc if needed5 u% ^1 m( ~$ Q+ k; y& Z
    nb   = size(mpc.bus, 1);    %% number of buses
    " z* J6 m, }. C: lnl   = size(mpc.branch, 1); %% number of branches
    4 |8 Y# j0 |( T% z' \( B. Nng   = size(mpc.gen, 1);    %% number of dispatchable injections( @6 \6 y6 }" t7 t2 v2 A
    if size(mpc.bus,2) < MU_VMIN3 G1 Q4 }% q0 x# h
      mpc.bus = [mpc.bus zeros(nb, MU_VMIN-size(mpc.bus,2)) ];2 H9 j: u5 }. [; y: x: n' R5 Q
    end
    7 B+ G# Z5 Q  i1 B) L5 jif size(mpc.gen,2) < MU_QMIN; {/ U* V6 h- m& h( o) I( `9 Q
      mpc.gen = [ mpc.gen zeros(ng, MU_QMIN-size(mpc.gen,2)) ];
    # n2 \$ @+ [. [) J" Jend
    ! y, X% G! M+ k3 y8 {+ c4 dif size(mpc.branch,2) < MU_ANGMAX  O7 H# U% d% N5 _6 t7 O
      mpc.branch = [ mpc.branch zeros(nl, MU_ANGMAX-size(mpc.branch,2)) ];
    ' F- D4 n0 Q- j: V; }3 Xend
    : ^0 K( C" Y2 C* n. p6 I& Y; i3 C5 O! x! B; \
    %%-----  convert to internal numbering, remove out-of-service stuff  -----: p1 f3 e5 T5 N( a
    mpc = ext2int(mpc);  I6 T7 l- F  T" |$ V

    2 Q. H0 d' X) I%%-----  construct OPF model object  -----
    1 m* |1 p8 ?: @1 k* ~* j8 m1 O; Xom = opf_setup(mpc, mpopt);8 \# P3 ?. N4 L

    / ?# a- _2 e6 _% D7 u%%-----  execute the OPF  -----
    4 R+ _4 C' J7 xif nargout > 7: P5 s# L7 _; V8 j0 X
        mpopt(52) = 1;      %% RETURN_RAW_DER: Q2 o$ y0 F' P7 P' v4 b4 t
    end& ^3 a# J# H; p; B7 D5 f
    [results, success, raw] = opf_execute(om, mpopt);* v2 R* ~, J7 r+ w/ d) d

    ( k+ l" T6 Q/ p, Z) w3 {%%-----  revert to original ordering, including out-of-service stuff  -----7 q) c1 N* _1 f3 o
    results = int2ext(results);9 O. o& I- n$ ?0 }% V) O- e
    . j5 y7 Q3 q8 C
    %% zero out result fields of out-of-service gens & branches
    ' L+ X4 l+ C& T' L" fif ~isempty(results.order.gen.status.off). ^+ b+ j( N( k/ s- W' D% Z
      results.gen(results.order.gen.status.off, [PG QG MU_PMAX MU_PMIN]) = 0;0 i7 t( N0 m0 \8 O& _/ v, }/ \" E
    end* v& c2 m5 _2 [5 R, w6 i9 i
    if ~isempty(results.order.branch.status.off)
    9 O; @6 `0 |& g  results.branch(results.order.branch.status.off, [PF QF PT QT MU_SF MU_ST MU_ANGMIN MU_ANGMAX]) = 0;+ X! ]$ z3 i4 V4 y0 l# t$ I- O. i
    end
    5 {3 z9 @5 V9 r! N( x' k+ J2 @' A# r2 k+ u
    %%-----  finish preparing output  -----
    1 a' J7 o8 G9 a1 j# D/ d6 pet = etime(clock, t0);      %% compute elapsed time
    2 f  V  X# a" [. X+ `6 Eif nargout > 0
    . ^9 F, [5 h6 ^- d  if nargout <= 27 e. o6 x5 u% C- B* i
        results.et = et;
    7 B# n5 j0 v- b& M    results.success = success;
      z- K( s4 m) {. H. t    results.raw = raw;
    - d" @/ K. n* x6 o7 z    busout = results;5 V- L( ]! [5 X- P" l/ a. _
        genout = success;1 i' j. R2 f" f. f
      else$ W. A; d" ?# u. }. \6 \0 {# d3 t
        [busout, genout, branchout, f, info, xr, pimul] = deal(results.bus, ...$ O: J9 T- v1 H1 x5 S$ [( X) a
            results.gen, results.branch, results.f, raw.info, raw.xr, raw.pimul);
    % D7 M: i2 k- T5 J5 h    if isfield(results, 'g'). A3 }8 }2 ~5 p1 @" ~! M/ C
          g = results.g;
    3 o" v0 m! B  Z+ L    end! W& q$ _; F- N& ~6 v: `
        if isfield(results, 'dg')
    * N% F- o5 B' {, _$ T      jac = results.dg;3 J: A1 j% |- ?! c6 N7 `1 s
        end
    3 n" F9 i4 F4 [  end
    # ?4 c' k0 @3 Q" v( a2 e( L, i7 oelseif success
    ) w5 h3 l. [8 J. D, k# C) i. N  results.et = et;7 E. n2 l0 a* a. ~
      results.success = success;
    / D5 N/ W% X6 \6 \& v9 }' R/ |4 h  printpf(results, 1, mpopt);
    9 s9 B; c5 v4 }end
    "真诚赞赏,手留余香"
    还没有人打赏,支持一下
    帖文化:【文明发帖 和谐互动】 社区精神:【创新、交流、互助、共享】

    该用户从未签到

    尚未签到

    发表于 2012-6-1 10:22:44 | 显示全部楼层
    PSAT里有直接算最优潮流的按钮,不用编程,很方便的
    "真诚赞赏,手留余香"
    还没有人打赏,支持一下
    帖文化:【文明发帖 和谐互动】 社区精神:【创新、交流、互助、共享】

    该用户从未签到

    尚未签到

    发表于 2013-5-20 15:29:14 | 显示全部楼层
    。。。坛子里有
    "真诚赞赏,手留余香"
    还没有人打赏,支持一下
    帖文化:【文明发帖 和谐互动】 社区精神:【创新、交流、互助、共享】

    该用户从未签到

    尚未签到

    发表于 2013-5-22 15:19:13 | 显示全部楼层
    回复 6# 白萝卜
    9 Q  I9 }7 E5 I2 {9 _& Y1 x! g3 c/ V( O
    * B' p' d4 k) {' T. s
      在psat中可以直接画模型,基本上opf潮流计算(稳态)是没问题。进一步讨论得具体分析
    "真诚赞赏,手留余香"
    还没有人打赏,支持一下
    帖文化:【文明发帖 和谐互动】 社区精神:【创新、交流、互助、共享】
    您需要登录后才可以回帖 登录 | 立即加入

    本版积分规则

    招聘斑竹

    小黑屋|手机版|APP下载(beta)|Archiver|电力研学网 ( 赣ICP备12000811号-1|赣公网安备36040302000210号 )|网站地图

    GMT+8, 2026-3-17 05:43

    Powered by Discuz! X3.5 Licensed

    © 2001-2025 Discuz! Team.

    快速回复 返回顶部 返回列表