Newer
Older
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
function info = extract_info_connection_matrix(IDS)
% Extract the following information from pf_active and connection
% matrix and add them to the IDS structure
% -------------------------------------------
% Which coils belong to a specific circuit added to
% pf_active.circuit{i}.coils_belonging_to_circuit
% Which power supply belongs to a spefic circuit added to
% pf_active.circuit{i}.supplies_belonging_to_circuit
% Which circuit does a given coil belong to added to
% pf_active.coil{i}.belonged_circuit
% Which circuit does a given power supply belong to
% pf_active.supply{i}.belonged_circuit
info = IDS;
info.ntotcoils = numel(IDS.pf_active.coil);
info.ntotcircuits = numel(IDS.pf_active.circuit);
info.ntotsupplies = numel(IDS.pf_active.supply);
info.ntotelements = info.ntotcoils + info.ntotsupplies;
for ii = 1:info.ntotcircuits
% Supplies belonging to the circuit
supplies_of_circuit = {};
supplies_of_circuit_ind = [];
counter = 0;
for jj=1:info.ntotsupplies
index = (2*(jj-1) + 1);
if sum(IDS.pf_active.circuit{ii}.connections(:,index)) == 1
counter = counter +1;
supplies_of_circuit{counter} = IDS.pf_active.supply{jj}.name;
supplies_of_circuit_ind(counter) = jj;
end
end
info.pf_active.circuit{ii}.supplies_belonging_to_circuit = supplies_of_circuit;
info.pf_active.circuit{ii}.supplies_ind_belonging_to_circuit = supplies_of_circuit_ind;
% Find to which circuit each supply belongs to
for jj=supplies_of_circuit_ind
info.pf_active.supply{jj}.belonged_circuit = IDS.pf_active.circuit{ii}.name;
info.pf_active.supply{jj}.belonged_circuit_ind = ii;
end
% Coils belonging to the circuit
coils_of_circuit = {};
coils_of_circuit_ind = [];
counter = 0;
for jj=1:info.ntotcoils
index = (2*(jj-1) + 1 + 2*info.ntotsupplies);
if sum(IDS.pf_active.circuit{ii}.connections(:,index)) == 1
counter = counter +1;
coils_of_circuit{counter} = IDS.pf_active.coil{jj}.name;
coils_of_circuit_ind(counter) = jj;
end
end
info.pf_active.circuit{ii}.coils_belonging_to_circuit = coils_of_circuit;
info.pf_active.circuit{ii}.coils_ind_belonging_to_circuit = coils_of_circuit_ind;
% Find to which circuit each coil belongs to
for jj=coils_of_circuit_ind
info.pf_active.coil{jj}.belonged_circuit = IDS.pf_active.circuit{ii}.name;
info.pf_active.coil{jj}.belonged_circuit_ind = ii;
end
end