fm_breaker.m

来自「电力系统的psat」· M 代码 · 共 120 行

M
120
字号
function fm_breaker(flag,t)% FM_BREAKER define circuit breakers%% FM_BREAKER(FLAG,T)%       FLAG = 0 initialization%       FLAG = 1 breaker operations%       T current simulation time%%Author:    Federico Milano%Date:      11-Nov-2002%Update:    11-Sep-2003%Version:   1.1.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 Breaker Line DAE Bus Fault Settings Syn SWswitch flagcase 0  if Breaker.n > 0,    Fault.V = DAE.V;    Fault.ang = DAE.a;    if Syn.n      Fault.delta = mean(DAE.x(Syn.delta));    else      Fault.delta = 0;    end  endcase 1  % Opening Breakers  index_open = find(Breaker.con(:,7) == t);  if ~isempty(index_open)    fm_disp(['Opening breaker(s) at t = ',num2str(t),' s'])    for i = 1:length(index_open)      h = index_open(i);      % update line reactance and admittance matrix      Line.con(Breaker.line(h),[8 9 10 11 12]) = ...	  [0 1e6 0 1 0]; % + Breaker.con(h,[9 10 11 12 13]);      fm_y      % checking for islanded buses      island_bus = find(abs(sum(Line.Y).'-diag(Line.Y)) < 1e-4);      if ~isempty(island_bus)        Bus.island = island_bus;      end      % setting up voltage phase initial guess      if Syn.n & ~SW.n        DAE.a = mean(DAE.x(Syn.delta))-Fault.delta+Fault.ang;      else        DAE.a = Fault.ang;      end      % update algebraic variables      conv = fm_nrlf(40, 1e-4);    end  end  % Closing Breakers  index_close = find(Breaker.con(:,8) == t);  if ~isempty(index_close)    fm_disp(['Closing breaker(s) at t = ',num2str(t),' s'])    for i = 1:length(index_close)      h = index_close(i);      % update Line data and admittance matrix      Line.con(Breaker.line(h),[8 9 10 11 12]) = ...	  Breaker.con(h,[9 10 11 12 13]);      fm_y      % setting up voltage phase initial guess      if Syn.n & ~SW.n        DAE.a = mean(DAE.x(Syn.delta))-Fault.delta+Fault.ang;      else        DAE.a = Fault.ang;      end      % update algebraic variables      conv = fm_nrlf(40, 1e-4);      % checking for islanded buses      traceY = abs(sum(Line.Y).'-diag(Line.Y));      island_bus = find(diag(traceY(Bus.island)) > 1e-4);      if ~isempty(island_bus)        Bus.island(island_bus) = [];      end    end  endend

⌨️ 快捷键说明

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