📄 fm_pl.m
字号:
function fm_pl(flag)
% FM_PL define Polinomial Loads
%
% FM_PL(FLAG)
% FLAG -> 0 initialization
% FLAG -> 1 algebraic equations
% FLAG -> 2 algebraic Jacobians
%
%Author: Federico Milano
%Date: 11-Nov-2002
%Version: 1.0.0
%
%E-mail: fmilano@thunderbox.uwaterloo.ca
%Web-site: http://thunderbox.uwaterloo.ca/~fmilano
%
% Copyright (C) 2002-2006 Federico Milano
global Pl PQ DAE Bus Settings Varname
V = DAE.V(Pl.bus);
switch flag
case 0
i = find(Pl.con(:,11));
for j = 1:length(i)
k = i(j);
idx = findbus(PQ,Pl.bus(k));
if isempty(idx)
fm_disp(['No PQ load found for initializing ZIP load ', ...
'at bus ',Varname.bus{Pl.bus(k)}])
else
P = PQ.P0(idx)*sum(Pl.con(k,[5:7]))/100;
Q = PQ.Q0(idx)*sum(Pl.con(k,[8:10]))/100;
PQ = pqsub(PQ,idx,P,Q);
Pl.con(k,5) = Pl.con(k,5)*PQ.P0(idx)/V(k)/V(k)/100;
Pl.con(k,6) = Pl.con(k,6)*PQ.P0(idx)/V(k)/100;
Pl.con(k,7) = Pl.con(k,7)*PQ.P0(idx)/100;
Pl.con(k,8) = Pl.con(k,8)*PQ.Q0(idx)/V(k)/V(k)/100;
Pl.con(k,9) = Pl.con(k,9)*PQ.Q0(idx)/V(k)/100;
Pl.con(k,10) = Pl.con(k,10)*PQ.Q0(idx)/100;
PQ = remove(PQ,idx,'zero');
end
end
fm_disp('Initialization of ZIP loads completed.')
case 1
if Settings.init
DAE.gp = DAE.gp + sparse(Pl.bus,1,(Pl.con(:,5).*V + ...
Pl.con(:,6)).*V + Pl.con(:,7),Bus.n,1);
DAE.gq = DAE.gq + sparse(Pl.bus,1,(Pl.con(:,8).*V + ...
Pl.con(:,9)).*V + Pl.con(:,10),Bus.n,1);
elseif ~isempty(Pl.init)
i = Pl.init;
DAE.gp = DAE.gp + sparse(Pl.bus(i),1,(Pl.con(i,5).*V(i) + ...
Pl.con(i,6)).*V(i) + Pl.con(i,7),Bus.n,1);
DAE.gq = DAE.gq + sparse(Pl.bus(i),1,(Pl.con(i,8).*V(i) + ...
Pl.con(i,9)).*V(i) + Pl.con(i,10),Bus.n,1);
end
case 2
if Settings.init
DAE.J12 = DAE.J12 + sparse(Pl.bus,Pl.bus,2*Pl.con(:,5).*V + ...
Pl.con(:,6),Bus.n,Bus.n);
DAE.J22 = DAE.J22 + sparse(Pl.bus,Pl.bus,2*Pl.con(:,8).*V + ...
Pl.con(:,9),Bus.n,Bus.n);
elseif ~isempty(Pl.init)
i = Pl.init;
DAE.J12 = DAE.J12 + sparse(Pl.bus(i),Pl.bus(i),2*Pl.con(i,5).*V(i) + ...
Pl.con(i,6),Bus.n,Bus.n);
DAE.J22 = DAE.J22 + sparse(Pl.bus(i),Pl.bus(i),2*Pl.con(i,8).*V(i) + ...
Pl.con(i,9),Bus.n,Bus.n);
end
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -