gcall.m

来自「电力系统分析计算程序」· M 代码 · 共 62 行

M
62
字号
function p = gcall(p)global DAE Settings Bus PVif ~p.n, return, endidx = find(p.u);DAE.g(p.bus(idx)) = 0;if ~Settings.pv2pq   DAE.g(p.vbus(idx)) = 0;     returnend% ================================================% check reactive power limits% ================================================% find max mismatch errorif isempty(DAE.g)  prev_err = inf;else  prev_err = 2*max(abs(DAE.g));end% Q min% ================================================% Limit check improved by Lars L. 2006-01.[tmp,idx] = max(p.u.*(p.con(:,7) - DAE.g(p.vbus) - prev_err));  if tmp > 0 & ~PV.newpq  if ~p.dq(idx)    fm_disp(['Switch SW bus <', ...             Bus.names{p.bus(idx)}, ...             '> to theta-Q bus: Min Qg reached'])  end  p.qg(idx) = p.con(idx,7);      p.dq(idx) = 1;end% Q max% ================================================% Limit check improved by Lars L. 2006-01.[tmp,idx] = min(p.u.*(p.con(:,6) - DAE.g(p.vbus) + prev_err));if tmp < 0 & ~PV.newpq   if ~p.dq(idx)    fm_disp(['Switch SW bus <', ...             Bus.names{p.bus(idx)}, ...             '> to theta-Q bus: Max Qg reached'])  end  p.qg(idx) = p.con(idx,6);      p.dq(idx) = 1;end% Generator reactive powers% ================================================DAE.g(p.vbus) = DAE.g(p.vbus) - p.u.*p.qg;DAE.g(p.vbus(find(~p.dq & p.u))) = 0;

⌨️ 快捷键说明

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