setx0.m
来自「这是一个很适合研究和学习用的电力系统仿真软件」· M 代码 · 共 48 行
M
48 行
function a = setx0(a)
global Bus DAE PQ
if ~a.n, return, end
V1 = DAE.V(a.bus);
t1 = DAE.a(a.bus);
for k = 1:a.n
idx = findbus(PQ,a.bus(k));
if isempty(idx)
mixedwarn(a,idx,'No PQ load found for initialization.')
a.con(k,6) = 0;
a.con(k,10) = 0;
else
P = PQ.P0(idx)*sum(a.con(k,[6:8]))/100;
Q = PQ.Q0(idx)*sum(a.con(k,[9:11]))/100;
PQ = pqsub(PQ,idx,P,Q);
a.con(k,6) = a.con(k,6)*PQ.P0(idx)/100;
a.con(k,10) = a.con(k,10)*PQ.Q0(idx)/100;
PQ = remove(PQ,idx,'zero');
end
end
%check time constants
idx = find(a.con(:,13) == 0);
if idx
mixedwarn(a,idx, 'Time constant Tfv cannot be zero. Tfv = 0.001 s will be used.'),
end
a.con(idx,13) = 0.001;
idx = find(a.con(:,14) == 0);
if idx
mixedwarn(a,idx, 'Time constant Tft cannot be zero. Tft = 0.001 s will be used.'),
end
a.con(idx,14) = 0.001;
%variable initialization
DAE.x(a.x) = -V1./a.con(:,13);
x = DAE.x(a.x);
DAE.x(a.y) = 0;
y = DAE.x(a.y);
a.dat(:,1) = V1;
a.dat(:,2) = t1;
%check limits
fm_disp('Initialization of mixed loads completed.')
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?