fm_lf.m
来自「这是一个很适合研究和学习用的电力系统仿真软件」· M 代码 · 共 53 行
M
53 行
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-2006 Federico Milano
global Bus Line DAE jay Settings
switch 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;
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 = diagVc * conj(diagIc - Line.Y * diagVc);
DAE.J11 = -imag(dS) + 1e-6*speye(Bus.n);
DAE.J21 = real(dS);
end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?