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

 找回密码
 立即加入
搜索
查看: 2930|回复: 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 $ u1 X1 B4 S3 i5 n/ Y

    8 K' i; y# N; P5 H7 e$ F
    $ f) H( ^: V- C7 u( D2 `    大哥,是可以在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] = ..." e" \1 f6 L& O: g1 M' a
        opf(varargin)
    4 B' ]% J2 R$ h( s/ U& A1 U%OPF  Solves an optimal power flow.* k+ l" _% P9 t' D* J
    %   [RESULTS, SUCCESS] = OPF(MPC, MPOPT)) j5 L$ d8 u% [- h9 k, X9 C3 y& B! C
    %
    ( w, t) u3 f. ^1 y%   Returns either a RESULTS struct and an optional SUCCESS flag, or individual& v0 p& l$ {! c/ M5 R6 B$ l
    %   data matrices, the objective function value and a SUCCESS flag. In the
    ) D7 [6 f" G; J" J) m+ w5 f%   latter case, there are additional optional return values. See Examples* E9 f, p( ~& w1 |" n
    %   below for the possible calling syntax options.
    $ o2 {' |; g5 u0 a6 }%
    ) c7 l& G( S# b; u( g, e) c' P%   Examples:
    5 k2 R8 {( d# [1 s* ]%       Output argument options:) n( B1 `& R* Y: x1 J6 p9 {
    %
    + x! j  o& Y! p3 i4 C' N%       results = opf(...)
    4 }( d/ {& t( q* p! _%       [results, success] = opf(...)
    2 [9 w' v* S8 C) K- P# U%       [bus, gen, branch, f, success] = opf(...)
    . q1 A; j2 d, w# P7 h( N%       [bus, gen, branch, f, success, info, et, g, jac, xr, pimul] = opf(...)
    6 c* u6 y# a7 H' Z$ V; s8 Y%
    $ ~, S3 A0 `: i$ a8 K# _0 B' v%       Input arguments options:
    . a+ `; }3 o$ v5 C& j0 K%
    0 u: v; l1 p, q- C%       opf(mpc)
    # c& L( _" `+ M' E5 E% o%       opf(mpc, mpopt)7 }$ e0 w, c$ A3 b7 A
    %       opf(mpc, userfcn, mpopt)3 y5 k% B9 M; y) L/ T
    %       opf(mpc, A, l, u)5 v. v4 F# x2 G( {  g
    %       opf(mpc, A, l, u, mpopt)! f! k/ p# W) m+ Y4 b4 p% E) \
    %       opf(mpc, A, l, u, mpopt, N, fparm, H, Cw)
    , `- T$ O" a" T/ p* L. k6 V%       opf(mpc, A, l, u, mpopt, N, fparm, H, Cw, z0, zl, zu)
    5 o) t& X1 I  P%
    # Y% s6 o8 w5 i%       opf(baseMVA, bus, gen, branch, areas, gencost)0 u: y& I7 h$ t* {' L( H
    %       opf(baseMVA, bus, gen, branch, areas, gencost, mpopt)5 z9 P  W. V/ X3 C' c1 F* v9 |; y1 I
    %       opf(baseMVA, bus, gen, branch, areas, gencost, userfcn, mpopt)
    # S/ K: S6 P. n1 W%       opf(baseMVA, bus, gen, branch, areas, gencost, A, l, u)
    % m; N% n2 B2 L! L7 f& L%       opf(baseMVA, bus, gen, branch, areas, gencost, A, l, u, mpopt)) N, V- }4 c) J9 U5 ?+ D! I
    %       opf(baseMVA, bus, gen, branch, areas, gencost, A, l, u, ...0 ^+ g. Q! @* Q  P5 i' T
    %                                   mpopt, N, fparm, H, Cw). U- C) f5 H! Z: M6 [% o" Q5 W
    %       opf(baseMVA, bus, gen, branch, areas, gencost, A, l, u, ...  d6 Y, t5 r- r4 j& d7 A+ T/ C
    %                                   mpopt, N, fparm, H, Cw, z0, zl, zu)$ `6 V) b: z+ F' M1 w
    %2 j: N6 X; z* F8 r% w/ K' S& t
    %   The data for the problem can be specified in one of three ways:
    6 C; T, s/ |" \0 o9 X1 w$ O- l%   (1) a string (mpc) containing the file name of a MATPOWER case
    4 z( i7 m: P2 h) u. T! j1 w%     which defines the data matrices baseMVA, bus, gen, branch, and
    ! j% X1 j7 P6 _, y8 b%     gencost (areas is not used at all, it is only included for  H, {/ S% s. x7 T: ]9 ?$ p$ e1 Q
    %     backward compatibility of the API).
    - L. X4 u" o. ]7 B%   (2) a struct (mpc) containing the data matrices as fields.
    7 s7 K$ b! W1 W" i* M%   (3) the individual data matrices themselves." a/ L1 H) S! j" h/ N
    %   : ]% Y: g* \/ j2 R! G% o# U
    %   The optional user parameters for user constraints (A, l, u), user costs( w: ~$ E2 ]# Q
    %   (N, fparm, H, Cw), user variable initializer (z0), and user variable8 Q6 f) \6 U+ V3 l, F) H
    %   limits (zl, zu) can also be specified as fields in a case struct,
    ; ]* n9 d$ K$ k1 I+ z9 m9 k%   either passed in directly or defined in a case file referenced by name./ z6 B! S' j: @# L& [
    %   
    % Y+ T. b. m: r7 Y3 s%   When specified, A, l, u represent additional linear constraints on the1 `; s2 t7 e0 g5 P
    %   optimization variables, l <= A*[x; z] <= u. If the user specifies an A: U* b/ {# [( ?4 X9 d4 }  f+ _& R
    %   matrix that has more columns than the number of "x" (OPF) variables,
    4 b) K% X9 m2 U%   then there are extra linearly constrained "z" variables. For an
    1 Q4 o; k9 z' _+ p, q%   explanation of the formulation used and instructions for forming the  y5 l$ n3 Y1 Y- s6 I  e
    %   A matrix, see the manual.
    % I6 a9 X8 \, H6 p! p6 c. {%$ ?: N9 v- |% I6 R" v) L
    %   A generalized cost on all variables can be applied if input arguments  n% t8 }! C9 i+ U/ |" c
    %   N, fparm, H and Cw are specified.  First, a linear transformation4 T! k' r% N7 t
    %   of the optimization variables is defined by means of r = N * [x; z].
    1 c, J5 r. S- Q3 n8 K%   Then, to each element of r a function is applied as encoded in the- H, \/ i, y3 ~
    %   fparm matrix (see manual). If the resulting vector is named w,
    # b) e3 J9 n7 @7 u( K% |* A6 J& J3 Z%   then H and Cw define a quadratic cost on w: (1/2)*w'*H*w + Cw * w .& A4 P) j8 {/ Z. L8 Z0 o2 S0 u
    %   H and N should be sparse matrices and H should also be symmetric.2 J+ k" w. c; K  E/ t
    %( @: Q, ~8 L( b, k* X% b
    %   The optional mpopt vector specifies MATPOWER options. If the OPF) n5 K* i( r! {: `' X
    %   algorithm is not explicitly set in the options MATPOWER will use
    6 P% G- q: O& F+ q2 P) Z' K%   the default solver, based on a primal-dual interior point method.
    2 U+ K- O  y# w; ?8 h0 c%   For the AC OPF this is OPF_ALG = 560, unless the TSPOPF optional
    ! w0 i* X3 z+ t) K" q6 G6 l%   package is installed, in which case the default is 540. For the
    7 ^8 W9 w/ ~2 h. g, c%   DC OPF, the default is OPF_ALG_DC = 200. See MPOPTION for  _- \6 [- }: T4 O8 @3 t2 |/ m
    %   more details on the available OPF solvers and other OPF options5 N7 L) f! z( O! f
    %   and their default values.% j0 _: x! v; `4 n6 T8 O* K0 U
    %
    , c2 \* ^& S; V5 r+ a" J  a%   The solved case is returned either in a single results struct (described
    " a* P- V$ {& o%   below) or in the individual data matrices, bus, gen and branch. Also
    9 J7 G' _- |) }( B%   returned are the final objective function value (f) and a flag which is# O% m1 I! U6 d- F0 T
    %   true if the algorithm was successful in finding a solution (success).
    , [$ g4 ]8 i4 `8 _%   Additional optional return values are an algorithm specific return status8 `' g, R3 g1 W3 H( v
    %   (info), elapsed time in seconds (et), the constraint vector (g), the
    : T' \  u& q% b" B%   Jacobian matrix (jac), and the vector of variables (xr) as well
    + K8 Z6 @0 V; D; u%   as the constraint multipliers (pimul)." M7 W) b1 i$ e( Y$ |( y3 u
    %
    " w  x: [* g0 ^%   The single results struct is a MATPOWER case struct (mpc) with the- E+ |( y$ G6 d
    %   usual baseMVA, bus, branch, gen, gencost fields, along with the' I3 |' A: y+ i' N9 \  A, K) E
    %   following additional fields:
    9 w2 c$ Z' z1 l8 H% S& o%
    : |* U; R8 N/ Y$ D3 r1 u%       .order      see 'help ext2int' for details of this field9 {2 l  h. e/ L6 i# t+ O% g8 P
    %       .et         elapsed time in seconds for solving OPF
    0 a, F* H* U( M%       .success    1 if solver converged successfully, 0 otherwise' q. V' l' Z0 B2 ?& Q' J+ b
    %       .om         OPF model object, see 'help opf_model'
    $ F4 H9 r0 I' {) ]4 C%       .x          final value of optimization variables (internal order)  h) p9 j% a1 s% ]8 r3 v7 L+ _+ U" r8 {
    %       .f          final objective function value
    , [, a: h' a3 w, B0 t%       .mu         shadow prices on ...
    3 c8 V; x! b- o%           .var* K  T: W- u* M0 H4 M
    %               .l  lower bounds on variables
    & T: k7 q7 }4 q* [: \%               .u  upper bounds on variables
    + |# j( g9 r' G6 K- q$ v8 d%           .nln
    9 R: _) K7 A# K( {' {, U%               .l  lower bounds on nonlinear constraints
    " W- z8 `" ~# @  i' }6 B7 @0 f%               .u  upper bounds on nonlinear constraints
    , q/ P, ~8 N8 v/ a/ T& {%           .lin
    4 v& h5 w, _2 e, w/ A; N%               .l  lower bounds on linear constraints" y+ M; F, t, g) \9 N& I" l
    %               .u  upper bounds on linear constraints
    4 B7 |6 j& q$ H- j; E; w0 R$ `  x%       .raw        raw solver output in form returned by MINOS, and more, \4 a/ H; O% n4 n3 S; f, P5 Z, [% W0 q
    %           .xr     final value of optimization variables
      F: m3 u, S4 V3 v$ O%           .pimul  constraint multipliers
    4 _' ^: I7 S5 f2 {, K3 U%           .info   solver specific termination code+ G6 p! ^" C* p1 R/ U; u+ D
    %           .output solver specific output information" O" F! x3 E2 C4 i$ P' U7 u! n
    %              .alg algorithm code of solver used
      \3 B# M, A  G: S! Q) t8 `3 m%           .g      (optional) constraint values8 U+ B2 E1 P( D/ h& A( z4 q1 {* g* ~
    %           .dg     (optional) constraint 1st derivatives& z$ B0 k. c; k8 w$ C- Y
    %           .df     (optional) obj fun 1st derivatives (not yet implemented)% {! y$ ~/ Y" c+ e" M# {: [- m
    %           .d2f    (optional) obj fun 2nd derivatives (not yet implemented)" `5 N( ~! n% Z- |0 t3 D3 g
    %       .var
    ; _# P& J8 x- k  s8 k2 C* n& Q%           .val    optimization variable values, by named block
    0 s" Q# Y/ R" V' g/ R%               .Va     voltage angles- j& [0 V$ A) }
    %               .Vm     voltage magnitudes (AC only)
    ) r  S% R$ e+ J. d" l+ f4 d& a%               .Pg     real power injections
    " F. ~1 X, E8 |$ w* ?%               .Qg     reactive power injections (AC only)1 q9 r. A4 t; W
    %               .y      constrained cost variable (only if have pwl costs)* H# q! m+ D" z
    %               (other) any user defined variable blocks
    ) |# j& A7 T! Z, W; Q%           .mu     variable bound shadow prices, by named block
    , n* L% c3 e- L, T1 b" Z%               .l  lower bound shadow prices
    6 P6 ^1 C- ?) ~9 d%                   .Va, Vm, Pg, Qg, y, (other)9 X' `' y, _. ^% E9 o& Y0 t4 y
    %               .u  upper bound shadow prices8 p6 E# ?0 m9 U! L/ t
    %                   .Va, Vm, Pg, Qg, y, (other). b1 F; s5 J2 x% ]9 A
    %       .nln    (AC only)' S) t6 {5 E1 P/ r' J/ W3 Z' Q
    %           .mu     shadow prices on nonlinear constraints, by named block
    . L$ \# T4 t- t  D! v; F# Y%               .l  lower bounds
    + F5 ~5 k5 V2 @8 \. a%                   .Pmis   real power mismatch equations& E. W3 `# @& X$ u! _: ~
    %                   .Qmis   reactive power mismatch equations; t3 G/ w4 {0 Z7 _+ A
    %                   .Sf     flow limits at "from" end of branches
    / ~; T7 D' |, W5 R7 I- c' o3 L' p%                   .St     flow limits at "to" end of branches
    % N5 N! e7 `$ b4 f/ o- {+ }; H; E6 R%               .u  upper bounds
    # t) k8 \' ]5 H0 _%                   .Pmis, Qmis, Sf, St
    2 b- L% K) ^( y; k5 H, K%       .lin) I5 ?4 Y, b# H% g& c
    %           .mu     shadow prices on linear constraints, by named block
    , p5 h. f/ d  S  X- `8 i4 F%               .l  lower bounds
    ; v) x9 ^, y% S7 [. G& c%                   .Pmis   real power mistmatch equations (DC only)
    ) F. V6 R& x  T( E%                   .Pf     flow limits at "from" end of branches (DC only)
    ! q" b6 z3 J+ A' h2 ?6 B%                   .Pt     flow limits at "to" end of branches (DC only)+ U! Y: Z' A# N' Y% X% r8 i
    %                   .PQh    upper portion of gen PQ-capability curve (AC only), a$ K% `* P( m( e
    %                   .PQl    lower portion of gen PQ-capability curve (AC only)) t. M# s+ l" ?! d! @+ }) A
    %                   .vl     constant power factor constraint for loads (AC only)" `' R' N4 f3 B+ d6 d
    %                   .ycon   basin constraints for CCV for pwl costs
    : p6 N6 ^& U2 P8 S2 W$ U/ `%                   (other) any user defined constraint blocks# l2 d- m: s) v% ?5 }7 s8 W
    %               .u  upper bounds9 @) ^; Y' \3 {0 u( T1 ]
    %                   .Pmis, Pf, Pf, PQh, PQl, vl, ycon, (other)
      z4 m6 F1 x2 @; Q# R& ?! \* T%       .cost       user defined cost values, by named block
    0 G- k- Y" ?8 J8 u6 h; [( k%
    . n5 s# h0 m3 S) e: b8 P2 s%   See also RUNOPF, DCOPF, UOPF, CASEFORMAT.
    & G, t* w0 r- Q+ V' ~* ~, G- k; d0 @) W% C1 m$ ?3 ]. K0 w% ^
    %   MATPOWER
    1 {- k  u7 c0 \2 w" e%   $Id: opf.m,v 1.73 2010/06/09 14:56:58 ray Exp $: O; J2 V8 N7 |2 {. N
    %   by Ray Zimmerman, PSERC Cornell
    ' c' u' a2 j( p+ u%   and Carlos E. Murillo-Sanchez, PSERC Cornell & Universidad Autonoma de Manizales
    . ]' D$ F& \- X1 Q. ]& Y%   Copyright (c) 1996-2010 by Power System Engineering Research Center (PSERC)3 E2 {2 s# B  l
    %
    3 z' \$ P; e; v% t1 x- k- k7 D4 R" b%   This file is part of MATPOWER.9 \) @  @* B; s" x1 B
    %   See http://www.pserc.cornell.edu/matpower/ for more info.) K3 U% M6 V$ H( z( \
    %3 l0 g  L2 `. [" t3 p
    %   MATPOWER is free software: you can redistribute it and/or modify
    + V" i1 t: a9 k2 S4 m- F3 C%   it under the terms of the GNU General Public License as published* x- ~% z# n& a. L$ T$ S0 Y
    %   by the Free Software Foundation, either version 3 of the License,
    ) ?" p# k8 ]# k. c' {- }1 g  R  i+ M%   or (at your option) any later version.% r" M* U: G/ Y7 X5 _* }5 u" g
    %; ^2 Q5 F  O: L2 j, |
    %   MATPOWER is distributed in the hope that it will be useful,
    ; t" B5 q; [% S% U' l) v%   but WITHOUT ANY WARRANTY; without even the implied warranty of; J$ b6 \% @3 W1 R* l2 R
    %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    5 i" ?6 J" i8 n& A$ K9 w%   GNU General Public License for more details.
      k# ^3 o  J+ _* c0 K3 p5 {%# A4 j. m8 B4 J' P# H0 P
    %   You should have received a copy of the GNU General Public License, ]4 J* K$ ~: q/ q$ G- u
    %   along with MATPOWER. If not, see <http://www.gnu.org/licenses/>.& w. V+ j4 q& A
    %5 o, c6 ?$ e- e5 L% ?  T4 g
    %   Additional permission under GNU GPL version 3 section 71 m5 g' H7 c$ T8 g
    %
    " l, p* r0 T. [8 x%   If you modify MATPOWER, or any covered work, to interface with
      j3 B5 ^' R  c: E) L( [- k& m%   other modules (such as MATLAB code and MEX-files) available in a9 H% n- \# K' F6 y$ `- F: m
    %   MATLAB(R) or comparable environment containing parts covered% m( c2 b8 d, ~4 C2 Z% C/ S/ p
    %   under other licensing terms, the licensors of MATPOWER grant
    & ]3 ^+ ~- {& Z4 Y+ z%   you additional permission to convey the resulting work.2 s: c, b1 x: b" V3 X3 t  F7 l

    6 ^) f! Y3 P6 k' h( B5 |8 m" X%%----- initialization -----  V) O7 f) ^" Q/ b
    t0 = clock;         %% start timer( q/ j, Y* w% s* y
    # C! }' q4 L) O1 u( Z
    %% define named indices into data matrices. K" B; B; r" [* ?; W7 O) R' S
    [PQ, PV, REF, NONE, BUS_I, BUS_TYPE, PD, QD, GS, BS, BUS_AREA, VM, ...
    1 V% g/ i# W' A: I8 b9 K    VA, BASE_KV, ZONE, VMAX, VMIN, LAM_P, LAM_Q, MU_VMAX, MU_VMIN] = idx_bus;4 k& p; P5 e" [- q5 _8 C9 t
    [GEN_BUS, PG, QG, QMAX, QMIN, VG, MBASE, GEN_STATUS, PMAX, PMIN, .../ q" Y1 U9 V  P7 M' T5 W
        MU_PMAX, MU_PMIN, MU_QMAX, MU_QMIN, PC1, PC2, QC1MIN, QC1MAX, ...' Y' o0 l* u1 o* {
        QC2MIN, QC2MAX, RAMP_AGC, RAMP_10, RAMP_30, RAMP_Q, APF] = idx_gen;
    0 @$ }  \. q. Q+ W9 k[F_BUS, T_BUS, BR_R, BR_X, BR_B, RATE_A, RATE_B, RATE_C, ..., Z! U2 w  U1 S' e0 E* |5 Y+ n
        TAP, SHIFT, BR_STATUS, PF, QF, PT, QT, MU_SF, MU_ST, ...
    * H! D) z. d7 [1 ], [    ANGMIN, ANGMAX, MU_ANGMIN, MU_ANGMAX] = idx_brch;6 w# a1 E# f0 j/ J
    [PW_LINEAR, POLYNOMIAL, MODEL, STARTUP, SHUTDOWN, NCOST, COST] = idx_cost;
    0 f( i- [* f0 t. t
    ' G# c/ F: L  f2 l& g: ~%% process input arguments
    ( p/ r5 Z- L: C' A$ N2 Z1 l[mpc, mpopt] = opf_args(varargin{:});) v" f( X# o. e

    # k! c2 P# F. O; p! y. H9 B%% add zero columns to bus, gen, branch for multipliers, etc if needed* H2 Q+ ~9 ^( o2 E& S# l
    nb   = size(mpc.bus, 1);    %% number of buses
    $ K7 z; d2 B6 Y# r) K2 knl   = size(mpc.branch, 1); %% number of branches
    , B* D- R+ i3 e9 f" x2 Eng   = size(mpc.gen, 1);    %% number of dispatchable injections
    2 L3 j, J9 ~* z+ M6 b0 N) }6 ~if size(mpc.bus,2) < MU_VMIN
    + A0 R' ^* i0 ~  v' X# T( ?; w  mpc.bus = [mpc.bus zeros(nb, MU_VMIN-size(mpc.bus,2)) ];( {/ ~% n* i. s7 z0 M
    end
    7 _" N  R/ f* R3 i& jif size(mpc.gen,2) < MU_QMIN; {2 }& C# r3 G& O& m1 u
      mpc.gen = [ mpc.gen zeros(ng, MU_QMIN-size(mpc.gen,2)) ];' y4 n3 b; ?9 e8 \
    end$ J! _7 b, ]! d+ a: w  G' x
    if size(mpc.branch,2) < MU_ANGMAX) @4 g0 ?" g4 f$ A# z( Z( m
      mpc.branch = [ mpc.branch zeros(nl, MU_ANGMAX-size(mpc.branch,2)) ];
    3 d" q! o$ S$ M3 T" R2 qend. G7 w1 H+ @- u7 ]1 `# |; b7 t

    # e/ `3 [0 E1 l; r! Z%%-----  convert to internal numbering, remove out-of-service stuff  ------ X) M+ d8 P0 u  G% j! L6 |
    mpc = ext2int(mpc);9 L% ]  v6 r5 O/ s

    3 W% B- H7 t& d2 n%%-----  construct OPF model object  -----
    ; Q$ }) Y* b2 J2 e+ k) Q! S7 kom = opf_setup(mpc, mpopt);+ Y" i& z: @8 R0 ?1 |+ V/ @
    ( b2 t" v3 M3 J' u$ ~
    %%-----  execute the OPF  -----
    . |. O5 I1 n2 j, D9 rif nargout > 7
    + r8 _# j0 E" o, d: `    mpopt(52) = 1;      %% RETURN_RAW_DER, d; l7 r8 X- J3 j
    end
    6 l9 A6 r* R6 W4 F3 K2 ?[results, success, raw] = opf_execute(om, mpopt);
    % h% O/ S  C. e. `* x. c. d6 _
    8 G" \* x- ~  }# ?4 e; Q%%-----  revert to original ordering, including out-of-service stuff  -----
    2 q% r1 N3 C7 `3 L* uresults = int2ext(results);
    * r( T) n- b; ?$ Q/ E2 Y
    + T5 T2 O& J# \' H' I, q%% zero out result fields of out-of-service gens & branches
    # d2 i0 r% G; T2 a8 jif ~isempty(results.order.gen.status.off)
    ) l7 t8 n9 V5 J: i  results.gen(results.order.gen.status.off, [PG QG MU_PMAX MU_PMIN]) = 0;/ |0 [- {/ g8 z2 t- x  Z. d/ d6 ]
    end
    7 l) e6 @# |! r# Q; c+ s% g5 zif ~isempty(results.order.branch.status.off)" m& }( ]" R% D  U
      results.branch(results.order.branch.status.off, [PF QF PT QT MU_SF MU_ST MU_ANGMIN MU_ANGMAX]) = 0;
    + v% A! _# {5 t7 R( ?end
    ) g6 n# j5 K/ C- z) }$ r3 Q3 M+ j8 j2 N: u7 V; {
    %%-----  finish preparing output  -----
    9 p3 B1 F: L3 I# Cet = etime(clock, t0);      %% compute elapsed time- _' m2 I. ]6 D# B
    if nargout > 0
      y+ Z, ~. F6 p9 Z  if nargout <= 2: \' U9 j5 S) A4 \  R
        results.et = et;- g9 i: C- I- F1 G$ C- e: k9 _
        results.success = success;/ ]0 C6 Y1 i7 W' q! n# q
        results.raw = raw;
    * R) q; h3 ~0 ^& g    busout = results;
    ' T$ D% `5 K3 A' l    genout = success;' y/ o( N; d( B" N% a/ ]7 ^
      else; Q% j: N  y5 s+ Q! \
        [busout, genout, branchout, f, info, xr, pimul] = deal(results.bus, ...; Y) S) A) z0 u7 s: I$ p* [3 V/ C
            results.gen, results.branch, results.f, raw.info, raw.xr, raw.pimul);8 A. ~5 T9 p, T/ B8 \. G
        if isfield(results, 'g')
    9 t& }/ B+ v5 _/ v8 o      g = results.g;
    # ~$ m3 [$ T. D( [' ?6 d  m( L    end( S* O3 Y& D- E$ J
        if isfield(results, 'dg')
    7 |; }  P; C/ a6 ^6 J7 `      jac = results.dg;) q* @5 S9 ^# W' z
        end8 [4 l1 t- i! c- i& L& i
      end
      @3 i; }1 b1 L" y- M! |! L+ `9 h) H: delseif success, P/ S% k  @  U
      results.et = et;$ s& y. {- A' I& s9 `
      results.success = success;: I7 X$ A, C. b- u+ V
      printpf(results, 1, mpopt);
    * ~8 O3 R/ e4 e8 bend
    "真诚赞赏,手留余香"
    还没有人打赏,支持一下
    帖文化:【文明发帖 和谐互动】 社区精神:【创新、交流、互助、共享】

    该用户从未签到

    尚未签到

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

    该用户从未签到

    尚未签到

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

    该用户从未签到

    尚未签到

    发表于 2013-5-22 15:19:13 | 显示全部楼层
    回复 6# 白萝卜 : p$ x) }) L, u( A9 j% o

    5 Z" u( K" ?$ F$ T. }
    . g. h3 g3 K4 f# O0 O* \  在psat中可以直接画模型,基本上opf潮流计算(稳态)是没问题。进一步讨论得具体分析
    "真诚赞赏,手留余香"
    还没有人打赏,支持一下
    帖文化:【文明发帖 和谐互动】 社区精神:【创新、交流、互助、共享】
    您需要登录后才可以回帖 登录 | 立即加入

    本版积分规则

    招聘斑竹

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

    GMT+8, 2026-3-17 01:20

    Powered by Discuz! X3.5 Licensed

    © 2001-2025 Discuz! Team.

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