-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenbr.m
More file actions
40 lines (38 loc) · 1.41 KB
/
Copy pathgenbr.m
File metadata and controls
40 lines (38 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
function mat = genbr(ID,btype,F,T,Sb,Pg,Pd,u0,phi,varargin)
[g,b,~,tau,tshift,gsh,~] = branchparts_unpack(Sb,btype);
% Gwtype = varargin_parse(varargin,'Gw','default');
% Gw = genweights(g,Gwtype);
Gw = varargin_parse(varargin,'Gw',branchweights(Sb));
switch ID
case 0
mat = ...
exp(-u0).*(Pg-Pd) - exp(u0).*gsh ...
-F'*diags(tau.^(-1))*(diags(tau.^(-1))*(exp(Gw.g*F*u0).*g)...
-exp(Gw.g*T*u0).*(g.*cos(tshift) - b.*sin(tshift)).*(1 - phi))...
-T'*(exp(Gw.g*T*u0).*g ...
-diags(tau.^(-1))*exp(Gw.g*F*u0).*(g.*cos(tshift) + b.*sin(tshift)).*(1-phi));
case 1
mat = ...
exp(-u0).*(Pg-Pd) - exp(u0).*gsh ...
-F'*(exp(Gw.g*F*u0).*g...
-exp(Gw.g*T*u0).*(g.*cos(tshift) - b.*sin(tshift)).*(1-phi))...
-T'*(exp(Gw.g*T*u0).*g ...
-exp(Gw.g*F*u0).*(g.*cos(tshift) + b.*sin(tshift)).*(1-phi));
case 2
mat = ...
Pg - Pd - gsh ...
-F'*(g-(g.*cos(tshift) - b.*sin(tshift)).*(1-phi))...
-T'*(g-(g.*cos(tshift) + b.*sin(tshift)).*(1-phi));
case 3
mat = ...
exp(-u0).*(Pg-Pd) - exp(u0).*gsh ...
-F'*(exp(T*u0).*b.*sin(tshift).*(1-phi))...
+T'*(exp(F*u0).*b.*sin(tshift).*(1-phi));
case 4
mat = ...
Pg - Pd - gsh ...
-F'*(b.*sin(tshift).*(1-phi))...
+T'*(b.*sin(tshift).*(1-phi));
otherwise
error('Incorrect ID')
end