setx0.m

来自「用于电力系统的一个很好的分析软件」· M 代码 · 共 54 行

M
54
字号
function a = setx0(a)global DAE PQif ~a.n, return, endV = DAE.y(a.vbus);T1 = a.con(:,6);Ta = a.con(:,7);Tref = a.con(:,8);K1 = a.con(:,10);KL = a.con(:,11);Pl = zeros(a.n,1);% get powers and update PQ loadsfor i = 1:a.n  idx = findbus(PQ,a.bus(i));  if isempty(idx)    warn(a,idx,' No PQ load found.')  else    Pl(i) = a.con(i,2)*PQ.P0(idx)/100;    PQ = pqsub(PQ,idx,a.u(i)*Pl(i),0);    PQ = remove(PQ,idx,'zero');  endendG = Pl./V./V;DAE.y(a.G) = a.u.*G;DAE.x(a.x) = a.u.*G;DAE.x(a.T) = a.u.*Tref;a.con(:,10) = (Tref-Ta)./Pl;idx = find(T1 == 0);if idx  a.con(idx,8) = 1200;  warn(a,idx,' Found T1 = 0. Default value T1 = 1200 s will be used.')endidx = find(KL < 1 & KL ~= 0);if idx  a.con(idx,11) = 2;  warn(a,idx,' Found KL < 1. Default value KL = 2 will be used.')endidx = find(KL == 0);if ~isempty(idx), Gmax = a.con(idx,9); end% fix G_maxa.con(:,9) = a.con(:,11).*G;if ~isempty(idx), a.con(idx,9) = Gmax; endfm_disp('Initialization of Thermostatically Controlled Loads completed.')

⌨️ 快捷键说明

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