📄 fm_breaker.m
字号:
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-2006 Federico Milanoglobal Breaker Line DAE Bus Fault Settings Syn SW Varnamepersistent old_timeswitch flag case 0 old_time = -999; %if Breaker.n, Fault.ang = DAE.a; end fm_connectivity(0,'init'); % initialize function fm_connectivity(0,'areas'); % get initial network connectivity case 1 % do not repeat computations if the simulation is stucking if old_time ~= t old_time = t; else return end % Opening Breakers index_open = find(Breaker.con(:,7) == t); if ~isempty(index_open) for i = 1:length(index_open) fm_disp(['Opening breaker at bus <', ... Varname.bus{Breaker.bus(index_open(i))}, ... '> on line from <', ... Varname.bus{Line.from(Breaker.line(index_open(i)))}, ... '> to <', ... Varname.bus{Line.to(Breaker.line(index_open(i)))}, ... '> for t = ',num2str(t),' s']) 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 fm_connectivity(0,'islands'); % setting up voltage phase initial guess if Syn.n & ~SW.n DAE.a = mean(DAE.x(Syn.delta))*ones(Bus.n,1); DAE.a(Syn.bus) = DAE.x(Syn.delta); else DAE.a = DAE.a(Settings.refbus)*ones(Bus.n,1); %Fault.ang; end % update algebraic variables conv = fm_nrlf(40,1e-4,1); end end % Closing Breakers index_close = find(Breaker.con(:,8) == t); if ~isempty(index_close) for i = 1:length(index_close) fm_disp(['Closing breaker at bus <', ... Varname.bus{Breaker.bus(index_close(i))}, ... '> on line from <', ... Varname.bus{Line.from(Breaker.line(index_close(i)))}, ... '> to <', ... Varname.bus{Line.to(Breaker.line(index_close(i)))}, ... '> for t = ',num2str(t),' s']) 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 % checking for islanded buses fm_connectivity(0,'islands'); % setting up voltage phase initial guess if Syn.n & ~SW.n DAE.a = mean(DAE.x(Syn.delta))*ones(Bus.n,1); DAE.a(Syn.bus) = DAE.x(Syn.delta); else DAE.a = DAE.a(Settings.refbus)*ones(Bus.n,1); %Fault.ang; end % update algebraic variables conv = fm_nrlf(40,1e-4,1); end end % looking for system areas if ~isempty(index_close) | ~isempty(index_open) fm_connectivity(t,'areas'); endend
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -