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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
classdef SCDclass_node < SCDclass_component
% Wrapper class containing algos
properties (SetAccess = private)
nodenr
active = false; % default
hasrfm = true; % all nodes have rfm
haswavegen
hasadc
hasethercat
ncpu % number of CPUs
cputype
timing = struct('t_start',-4.5,'t_stop',3,'dt',1e-4);
thperiod
buildcfg
initscdbeforecomp
cpuactive
wrappers % info about thread wrappers contained in this node
end
properties
type = 'node';
end
methods
function obj = SCDclass_node(nodenr)
name = sprintf('SCD_rtc_%02d',nodenr);
obj.nodenr = nodenr;
obj.name = name;
obj.algos = [];
obj.ddname = [name,'.sldd'];
obj.mdlname = [name,'.slx'];
obj = getnodeconfig(obj,nodenr);
end
function obj = addwrapper(obj,wrapperObj,threadnr,varalgo)
assert(isa(wrapperObj,'SCDclass_wrapper'));
for ii=1:numel(obj.wrappers)
assert(~isequal(wrapperObj,obj.wrappers{ii}.wrapperobj),...
'wrapper %s is already present in node %d thread %d',obj.name,obj.nodenr,threadnr)
end
mywrapper.wrapperobj = wrapperObj;
mywrapper.thread = threadnr;
mywrapper.varalgo = varalgo;
obj.wrappers{threadnr} = mywrapper;
end
function node = getnodeconfig(node,nodenr)
% [general part]
switch nodenr
case 1
node.ncpu = 1;
node.type = 'std1cpu2015a';
node.timing.t_start = -4.5;
node.timing.t_stop = 3;
node.timing.dt = 1e-4;
node.thperiod = 1.0000e-03;
node.buildcfg.conffile{1} = 'standard';
node.buildcfg.initscdbeforecomp = false;
node.haswavegen = true;
node.hasethercat = false;
node.hasadc = true;
case 2
node.ncpu = 6;
node.type = 'std1cpu2015a';
node.timing.t_start = -4.5;
node.timing.t_stop = 3;
node.timing.dt = 1e-4;
node.thperiod = [1.0000e-03 1.0000e-03 1.0000e-03 1.0000e-03 1.0e-3 1.0e-3];
node.buildcfg.conffile = cell(node.ncpu,1);
node.buildcfg.conffile{1} = 'standard';
node.buildcfg.conffile{2} = 'standard';
node.buildcfg.conffile{3} = 'standard';
node.buildcfg.conffile{4} = 'standard';
node.buildcfg.conffile{5} = 'standard';
node.buildcfg.conffile{6} = 'standard';
node.buildcfg.initscdbeforecomp = false;
node.haswavegen = true;
node.hasadc = true;
node.hasethercat = true;
case 3
node.ncpu = 4;
node.type = '4cpus2015a';
node.timing.t_start = -2.0;
node.timing.t_stop = 2.75;
node.timing.dt = 1e-3;
node.thperiod = [1.0000e-03 1.0000e-03 1.0000e-03 1.0000e-03];
node.buildcfg.conffile = cell(node.ncpu,1);
node.buildcfg.conffile{1} = 'standard';
node.buildcfg.conffile{2} = 'standard';
node.buildcfg.conffile{3} = 'standard';
node.buildcfg.conffile{4} = 'standard';
node.buildcfg.initscdbeforecomp = [0 0 0 0];
node.haswavegen = true;
node.hasadc = false;
node.hasethercat = false;
case 4
node.ncpu = 4;
node.type = 'std1cpu2015a';
node.timing.t_start = -4.5;
node.timing.t_stop = 3;
node.timing.dt = 1e-4;
node.thperiod = 1.0000e-04;
node.buildcfg.conffile{1} = 'standard';
node.buildcfg.initscdbeforecomp = false;
node.haswavegen = true;
node.hasadc = false;
node.hasethercat = false;
case 5
node.ncpu = 1;
node.type = 'std1cpu2015a';
node.timing.t_start = -4.5;
node.timing.t_stop = 3;
node.timing.dt = 1e-4;
node.thperiod = 1.0000e-04;
node.buildcfg.conffile{1} = 'standard';
node.buildcfg.initscdbeforecomp = false;
node.haswavegen = true;
node.hasadc = false;
node.hasethercat = false;
case 6
node.ncpu = 4;
node.type = '4cpus2015a';
node.timing.t_start = 0.0;
node.timing.t_stop = 2.75;
node.timing.dt = 1e-3;
node.thperiod = [1.0000e-03 1.0000e-03 1.0000e-03 1.0000e-03];
node.buildcfg.conffile = cell(node.ncpu,1);
node.buildcfg.conffile{1} = 'standard';
node.buildcfg.conffile{2} = 'standard';
node.buildcfg.conffile{3} = 'standard';
node.buildcfg.conffile{4} = 'standard';
node.buildcfg.initscdbeforecomp = [0 0 0 0];
node.haswavegen = true;
node.hasadc = false;
node.hasethercat = false;
case 7
node.ncpu = 4;
node.type = '4cpus2015a';
node.timing.t_start = -0.5;
node.timing.t_stop = 2.5;
node.timing.dt = 1e-3;
node.thperiod = [1.0000e-03 1.0000e-03 1.0000e-03 1.0000e-03];
node.buildcfg.conffile = cell(node.ncpu,1);
node.buildcfg.conffile{1} = 'standard';
node.buildcfg.conffile{2} = 'standard';
node.buildcfg.conffile{3} = 'standard';
node.buildcfg.conffile{4} = 'standard';
node.buildcfg.initscdbeforecomp = [0 0 0 0];
node.haswavegen = true;
node.hasadc = true;
node.hasethercat = false;
case 8
node.ncpu = 1;
node.type = '4cpus2015a';
node.timing.t_start = -0.5;
node.timing.t_stop = 2.5;
node.timing.dt = 1e-3;
node.thperiod = [1.0000e-03 1.0000e-03 1.0000e-03 1.0000e-03];
node.buildcfg.conffile = cell(node.ncpu,1);
node.buildcfg.conffile{1} = 'standard';
node.buildcfg.conffile{2} = 'standard';
node.buildcfg.conffile{3} = 'standard';
node.buildcfg.conffile{4} = 'standard';
node.buildcfg.initscdbeforecomp = [0 0 0 0];
node.haswavegen = true;
node.hasadc = true;
node.hasethercat = false;
end
node.cpuactive = zeros(node.ncpu,1);
% add template node wrappers
for icpu=1:node.ncpu
wrappername = sprintf('SCDwrap_template%02d%02d',nodenr,icpu);
mywrapper = SCDclass_wrapper(wrappername);
varalgo = 1; % template value
node = node.addwrapper(mywrapper,icpu,varalgo);
end
end
function updatetemplatetp(obj)
% update wrapper algos
for ii=1:numel(obj.wrappers)
obj.wrappers{ii}.wrapperobj.updatetemplatetp;
end
% update node algos
for ii=1:numel(obj.algos)
if ~isempty(obj.algos(ii))
obj.algos(ii).updatetemplatetp;
end
end
end
end
end