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

📄 fm_dynlf.m

📁 电力系统的psat
💻 M
字号:
function fm_dynlf% FM_DYNLF define state variable indices for components which are%          included in power flow analysis%% FM_DYNLF%%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 DAEDAE.n = 0;global Motif Mot.n  Mot.slip = zeros(Mot.n,1);  Mot.e1r = zeros(Mot.n,1);  Mot.e1m = zeros(Mot.n,1);  Mot.e2r = zeros(Mot.n,1);  Mot.e2m = zeros(Mot.n,1);endfor i = 1:Mot.n  mot_ord = Mot.con(i,5);  switch mot_ord   case 1    Mot.slip(i) = DAE.n + 1;    DAE.n = DAE.n+1;   case 3    Mot.slip(i) = DAE.n + 1;    Mot.e1r(i) = DAE.n + 2;    Mot.e1m(i) = DAE.n + 3;    DAE.n = DAE.n+3;   case 5    Mot.slip(i) = DAE.n + 1;    Mot.e1r(i) = DAE.n + 2;    Mot.e1m(i) = DAE.n + 3;    Mot.e2r(i) = DAE.n + 4;    Mot.e2m(i) = DAE.n + 5;    DAE.n = DAE.n+5;  endendglobal Ltcif Ltc.n  for  i = 1:Ltc.n    Ltc.m(i) = DAE.n + i;  end  DAE.n = DAE.n + Ltc.n;endglobal Tapif Tap.n  for i = 1:Tap.n    Tap.m(i) = DAE.n + i;  end  DAE.n = DAE.n + Tap.n;endglobal SAE1if SAE1.n  for i = 1:SAE1.n    SAE1.m(i) = DAE.n + i;  end  DAE.n = DAE.n + SAE1.n;endglobal SAE2if SAE2.n  for i = 1:SAE2.n    SAE2.m1(i) = DAE.n + 1;    SAE2.m2(i) = DAE.n + 2;    DAE.n = DAE.n + 2;  endendglobal SAE3if SAE3.n  for i = 1:SAE3.n    SAE3.m1(i) = DAE.n + 1;    SAE3.m2(i) = DAE.n + 2;    SAE3.m3(i) = DAE.n + 3;    DAE.n = DAE.n + 3*SAE3.n;  endendglobal Hvdcif Hvdc.n  Hvdc.Id = zeros(Hvdc.n,1);  Hvdc.xr = zeros(Hvdc.n,1);  Hvdc.xi = zeros(Hvdc.n,1);  for i = 1:Hvdc.n    Hvdc.Id(i) = DAE.n + 1;    Hvdc.xr(i) = DAE.n + 2;    Hvdc.xi(i) = DAE.n + 3;    DAE.n = DAE.n + 3;  endendglobal Statcomif Statcom.n  for i = 1:Statcom.n    Statcom.Vdc(i) = DAE.n + 1;    Statcom.alpha(i) = DAE.n + 2;    Statcom.m(i) = DAE.n + 3;    Statcom.Vmdc(i) = DAE.n + 4;    Statcom.Vmac(i) = DAE.n + 5;    DAE.n = DAE.n + 5;  endendglobal Ssscif Sssc.n  for i = 1:Sssc.n    Sssc.Vdc(i) = DAE.n + 1;    Sssc.beta(i) = DAE.n + 2;    Sssc.m(i) = DAE.n + 3;    Sssc.Pmac(i) = DAE.n + 4;    Sssc.Vmdc(i) = DAE.n + 5;    DAE.n = DAE.n + 5;  endendglobal Upfcif Upfc.n  for i = 1:Upfc.n    Upfc.Vmdc(i) = DAE.n + 1;    Upfc.Vmac(i) = DAE.n + 2;    Upfc.Vdc(i) = DAE.n + 3;    Upfc.alpha(i) = DAE.n + 4;    Upfc.m(i) = DAE.n + 5;    Upfc.x1(i) = DAE.n + 6;    Upfc.x2(i) = DAE.n + 7;    Upfc.Imd(i) = DAE.n + 8;    Upfc.Imq(i) = DAE.n + 9;    DAE.n = DAE.n + 9;  endendglobal RLCif RLC.n  RLC.vd = zeros(DAE.n,1);  RLC.vq = zeros(DAE.n,1);  RLC.id = zeros(DAE.n,1);  RLC.iq = zeros(DAE.n,1);  for i = 1:RLC.n    if RLC.con(i,7) == 0; RLC.con(i,7) = 1e-6; end    if RLC.con(i,8) == 0; RLC.con(i,8) = 1e-6; end    if RLC.con(i,9) == 0; RLC.con(i,9) = 1e-6; end    ord = RLC.con(i,5);    if ord == 1      RLC.vd(i) = DAE.n + 1;      RLC.vq(i) = DAE.n + 2;      DAE.n = DAE.n + 2;    elseif ord == 2      RLC.id(i) = DAE.n + 1;      RLC.iq(i) = DAE.n + 2;      DAE.n = DAE.n + 2;    else      RLC.vd(i) = DAE.n + 1;      RLC.vq(i) = DAE.n + 2;      RLC.id(i) = DAE.n + 3;      RLC.iq(i) = DAE.n + 4;      DAE.n = DAE.n + 4;    end  endendglobal Phsif Phs.n  for i = 1:Phs.n    Phs.alpha(i) = DAE.n + 1;    Phs.Pm(i) = DAE.n + 2;    DAE.n = DAE.n + 2;  endend

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -