📄 fm_lf.m
字号:
function fm_lf(flag)% FM_LF compute power flow equations and Jacobian for% transmission lines.%% FM_LF(FLAG)% FLAG = 1: power flow equations% FLAG = 2: power flow Jacobian matrix%%see also FM_Y and DAE, Bus and Line structures%%Author: Federico Milano%Date: 11-Nov-2002%Version: 1.0.0%%E-mail: fmilano@thunderbox.uwaterloo.ca%Web-site: http://thunderbox.uwaterloo.ca/~fmilano%% Copyright (C) 2002-2005 Federico Milano%% This toolbox is free software; you can redistribute it and/or modify% it under the terms of the GNU General Public License as published by% the Free Software Foundation; either version 2.0 of the License, or% (at your option) any later version.%% This toolbox is distributed in the hope that it will be useful, but% WITHOUT ANY WARRANTY; without even the implied warranty of% MERCHANDABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU% General Public License for more details.%% You should have received a copy of the GNU General Public License% along with this toolbox; if not, write to the Free Software% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307,% USA.global Bus Line DAE jay Settingsswitch flag case 1 DAE.V = max(DAE.V,1e-6); Vc = DAE.V.*exp(jay*DAE.a); S = Vc.*conj(Line.Y*Vc); DAE.gp = real(S); DAE.gq = imag(S); DAE.glfp = DAE.gp; DAE.glfq = DAE.gq; case 2 n = 1:Bus.n; U = exp(jay*DAE.a); V = DAE.V.*U; I = Line.Y*V; if Settings.octave diagVc = diag(V); diagVn = diag(U); diagIc = diag(I); dS = diagVc*conj(Line.Y*diagVn)+conj(diagIc)*diagVn; DAE.J12 = real(dS); DAE.J22 = imag(dS)+1e-6*eye(Bus.n); dS = jay*diagVc*conj(diagIc-Line.Y*diagVc); DAE.J11 = real(dS)+1e-6*eye(Bus.n); DAE.J21 = imag(dS); else diagVc = sparse(n,n,V,Bus.n,Bus.n); diagVn = sparse(n,n,U,Bus.n,Bus.n); diagIc = sparse(n,n,I,Bus.n,Bus.n); dS = diagVc * conj(Line.Y * diagVn) + conj(diagIc) * diagVn; DAE.J12 = real(dS); DAE.J22 = imag(dS) + 1e-6*speye(Bus.n); dS = jay * diagVc * conj(diagIc - Line.Y * diagVc); DAE.J11 = real(dS) + 1e-6*speye(Bus.n); DAE.J21 = imag(dS); end end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -