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

📄 fm_base.m

📁 一个较好的MATLAB潮流程序
💻 M
字号:
function fm_base%FM_BASE report component parameters to system bases%%FM_BASE%%see also FM_SPF%%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.fm_varif Line.n  % look for transformers (kt ~= 0)  idx = find(Line.con(:,7));  kt = Line.con(idx,7);  VL1 = Line.con(:,4);  % set zero length for transformers  Line.con(idx,6) = zeros(length(idx),1);  V1 = Bus.con(Line.from,2);  V2 = Bus.con(Line.to,2);  KT = V1(idx)./V2(idx);  % check consistency of voltage bases  if ~isempty(kt)    corr = abs(kt-KT)./KT;    idx1 = find(corr > 0.1);    for i = 1:length(idx1)      fm_disp(['Tap ratio of transformer #',num2str(idx(idx1(i))), ...	       ' from bus ', num2str(Line.con(idx(idx1(i)),1)), ...               ' to bus ', num2str(Line.con(idx(idx1(i)),2)), ...	       ' differs more than 10% from the bases defined at', ...	       ' connected buses.'])    end  end  idx2 = find(abs(VL1-V1)./V1 > 0.1);  for i = 1:length(idx2)    fm_disp(['Voltage of Line #',num2str(idx2(i)), ...	       ' from bus ', num2str(Line.con(idx2(i),1)), ...               ' to bus ', num2str(Line.con(idx2(i),2)), ...	     ' differs more than 10% from the base defined at', ...	     ' the connected bus #', ...	     num2str(Line.from(idx2(i)))])  end  % report line parameters to system base [Sb]  Line.con(:,8)  = Line.con(:,8)./Line.con(:,3)*Settings.mva;  Line.con(:,9)  = Line.con(:,9)./Line.con(:,3)*Settings.mva;  Line.con(:,10) = Line.con(:,10).*Line.con(:,3)/Settings.mva;  % report line limits to system bases  Line.con(:,13) = Line.con(:,13).*Line.con(:,3).*V1./VL1/Settings.mva;  Line.con(:,14) = Line.con(:,14).*Line.con(:,3)/Settings.mva;  Line.con(:,15) = Line.con(:,15).*Line.con(:,3)/Settings.mva;endif SW.n  SW.con(:,6)  = SW.con(:,6).*SW.con(:,2)/Settings.mva;  SW.con(:,7)  = SW.con(:,7).*SW.con(:,2)/Settings.mva;  SW.con(:,10) = SW.con(:,10).*SW.con(:,2)/Settings.mva;endif PQ.n  PQ.con(:,4) = PQ.con(:,4).*PQ.con(:,2)/Settings.mva;  PQ.con(:,5) = PQ.con(:,5).*PQ.con(:,2)/Settings.mva;  PQ.P0 = PQ.con(:,4);  PQ.Q0 = PQ.con(:,5);endif PV.n  PV.con(:,4) = PV.con(:,4).*PV.con(:,2)/Settings.mva;  PV.con(:,6) = PV.con(:,6).*PV.con(:,2)/Settings.mva;  PV.con(:,7) = PV.con(:,7).*PV.con(:,2)/Settings.mva;endif Pl.n  Pl.con(:,5) = Pl.con(:,5).*Pl.con(:,2)/Settings.mva;  Pl.con(:,6) = Pl.con(:,6).*Pl.con(:,2)/Settings.mva;  Pl.con(:,7) = Pl.con(:,7).*Pl.con(:,2)/Settings.mva;  Pl.con(:,8) = Pl.con(:,8).*Pl.con(:,2)/Settings.mva;  Pl.con(:,9) = Pl.con(:,9).*Pl.con(:,2)/Settings.mva;  Pl.con(:,10) = Pl.con(:,10).*Pl.con(:,2)/Settings.mva;endif Mn.n  Mn.con(:,4) = Mn.con(:,4).*Mn.con(:,2)/Settings.mva;  Mn.con(:,5) = Mn.con(:,5).*Mn.con(:,2)/Settings.mva;endif Mot.n  Mot.con(:,[7 8 9 10 11 12 13]) = Mot.con(:,[7 8 9 10 11 12 13])*Settings.mva;  Mot.con(:,7)  = Mot.con(:,7)./Mot.con(:,2);  Mot.con(:,8)  = Mot.con(:,8)./Mot.con(:,2);  Mot.con(:,9)  = Mot.con(:,9)./Mot.con(:,2);  Mot.con(:,10) = Mot.con(:,10)./Mot.con(:,2);  Mot.con(:,11) = Mot.con(:,11)./Mot.con(:,2);  Mot.con(:,12) = Mot.con(:,12)./Mot.con(:,2);  Mot.con(:,13) = Mot.con(:,13)./Mot.con(:,2);  Mot.con(:,14) = Mot.con(:,14).*Mot.con(:,2)/Settings.mva;endif Tap.n  Tap.con(:,9) = Tap.con(:,9)./Tap.con(:,2)*Settings.mva;  Tap.con(:,10) = Tap.con(:,10)./Tap.con(:,2)*Settings.mva;endif Syn.n  i = [6:10, 13:15];  for h = 1:length(i)    Syn.con(:,i(h))= (Syn.con(:,i(h))./Syn.con(:,2))*Settings.mva;  end  Syn.con(:,18) = Syn.con(:,18).*Syn.con(:,2)/Settings.mva;endif Tg.n  Tg.con(:,5) = Tg.con(:,5).*Syn.con(Tg.syn,2)/Settings.mva;  Tg.con(:,6) = Tg.con(:,6).*Syn.con(Tg.syn,2)/Settings.mva;endif Svc.n  ty1 = find(Svc.con(:,5) == 1);  if ~isempty(ty1)    Svc.con(ty1,9) = Svc.con(ty1,9).*Svc.con(ty1,2)/Settings.mva;    Svc.con(ty1,10) = Svc.con(ty1,10).*Svc.con(ty1,2)/Settings.mva;  endendif Cswt.n  Cswt.con(:,6) = Cswt.con(:,6)./Cswt.con(:,3)*Settings.mva;  Cswt.con(:,7) = Cswt.con(:,7)./Cswt.con(:,3)*Settings.mva;  Cswt.con(:,8) = Cswt.con(:,8)./Cswt.con(:,3)*Settings.mva;  Cswt.con(:,9) = Cswt.con(:,9)./Cswt.con(:,3)*Settings.mva;  Cswt.con(:,10) = Cswt.con(:,10)./Cswt.con(:,3)*Settings.mva;  Cswt.con(:,11) = Cswt.con(:,11).*Cswt.con(:,3)/Settings.mva;  Cswt.con(:,12) = Cswt.con(:,12).*Cswt.con(:,3)/Settings.mva;  Cswt.con(:,13) = Cswt.con(:,13).*Cswt.con(:,3)/Settings.mva;endif Dfig.n  Dfig.con(:,6) = Dfig.con(:,6)./Dfig.con(:,3)*Settings.mva;  Dfig.con(:,7) = Dfig.con(:,7)./Dfig.con(:,3)*Settings.mva;  Dfig.con(:,8) = Dfig.con(:,8)./Dfig.con(:,3)*Settings.mva;  Dfig.con(:,9) = Dfig.con(:,9)./Dfig.con(:,3)*Settings.mva;  Dfig.con(:,10) = Dfig.con(:,10)./Dfig.con(:,3)*Settings.mva;  Dfig.con(:,11) = Dfig.con(:,11).*Dfig.con(:,3)/Settings.mva;  Dfig.con(:,20) = Dfig.con(:,20).*Dfig.con(:,3)/Settings.mva;  Dfig.con(:,21) = Dfig.con(:,21).*Dfig.con(:,3)/Settings.mva;  Dfig.con(:,22) = Dfig.con(:,22).*Dfig.con(:,3)/Settings.mva;  Dfig.con(:,23) = Dfig.con(:,23).*Dfig.con(:,3)/Settings.mva;endif Fault.n  Fault.con(:,7) = Fault.con(:,7)./Fault.con(:,2)*Settings.mva;  Fault.con(:,8) = Fault.con(:,8)./Fault.con(:,2)*Settings.mva;endif Demand.n  Demand.con(:,3) = Demand.con(:,3).*Demand.con(:,2)/Settings.mva;  Demand.con(:,4) = Demand.con(:,4).*Demand.con(:,2)/Settings.mva;  Demand.con(:,5) = Demand.con(:,5).*Demand.con(:,2)/Settings.mva;  Demand.con(:,6) = Demand.con(:,6).*Demand.con(:,2)/Settings.mva;endif Supply.n  Supply.con(:,3) = Supply.con(:,3).*Supply.con(:,2)/Settings.mva;  Supply.con(:,4) = Supply.con(:,4).*Supply.con(:,2)/Settings.mva;  Supply.con(:,5) = Supply.con(:,5).*Supply.con(:,2)/Settings.mva;endif Rmpg.n  Rmpg.con(:,3) = Rmpg.con(:,3).*Rmpg.con(:,2)/Settings.mva;  Rmpg.con(:,4) = Rmpg.con(:,4).*Rmpg.con(:,2)/Settings.mva;end

⌨️ 快捷键说明

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