setx0.m

来自「这是一个很适合研究和学习用的电力系统仿真软件」· M 代码 · 共 40 行

M
40
字号
function a = setx0(a)

global Syn Pod Bus DAE PV

if ~a.n, return, end

V = DAE.V(a.bus);
Kr = a.con(:,5);
Tr = a.con(:,6);
ist_max = a.con(:,7);
ist_min = a.con(:,8);

% eliminate PV components used for initializing STATCOM's
global Syn
for i = 1:a.n
  idxg = find(Syn.bus == a.bus(i));
  if ~isempty(idxg)
    statcomwarn(a,i,[' STATCOM cannot be connected at the same bus as ' ...
                   'synchronous machines.'])
    continue
  end
  idx = findbus(PV,a.bus(i));
  PV = remove(PV,idx);
  if isempty(idx)
    statcomwarn(a,i,' no PV generator found at the bus.')
  end
end
DAE.x(a.ist) = Bus.Qg(a.bus)./V;
idx = find(DAE.x(a.ist) > ist_max);
if idx, statcomwarn(a,idx,' Ish is over its max limit.'), end
idx = find(DAE.x(a.ist) < ist_min);
if idx, statcomwarn(a,idx,' Ish is under its min limit.'), end
DAE.x(a.ist) = max(DAE.x(a.ist),ist_min);
DAE.x(a.ist) = min(DAE.x(a.ist),ist_max);

% reference voltages
a.Vref = DAE.x(a.ist)./Kr + V;

fm_disp('Initialization of STATCOMs completed.')

⌨️ 快捷键说明

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