Skip to content
Snippets Groups Projects
Commit 5f80b86f authored by Federico Felici's avatar Federico Felici
Browse files

some refactoring of wrapper list creation

parent 5e64eaa3
No related branches found
No related tags found
No related merge requests found
......@@ -307,6 +307,9 @@ classdef SCDclass_expcode
fprintf('Setting up expcode %d, ''%s'', configuring wrappers ...\n',obj.maincode,obj.name);
obj=obj.setupwrappers;
fprintf('Setting up main expcode data dictionary')
obj = obj.setupmaindd;
fprintf('Setting up expcode %d, ''%s'', configuring data dictionaries ...\n',obj.maincode,obj.name);
obj.setupwrapdd;
obj.setupalgodd;
......@@ -314,8 +317,7 @@ classdef SCDclass_expcode
fprintf('Setting up variant model configuration')
obj.setupvaralgo;
fprintf('Setting up main expcode data dictionary')
obj = obj.setupmaindd;
fprintf('Setting up expcode %d, ''%s'', configuring default tunable parameters ...\n',obj.maincode,obj.name);
obj.updatedefaulttp;
fprintf('Setting up expcode %d, ''%s'', configuring global data ...\n',obj.maincode,obj.name);
......@@ -865,10 +867,15 @@ classdef SCDclass_expcode
for idx_nodedds=1:numel(obj.activenodes)
inode = obj.activenodes(idx_nodedds);
% Getting data dictionary and required data sources
% Getting node data dictionary and required data sources
datadictname = obj.nodes(inode).datadict;
fprintf('opening %s\n',datadictname)
nodedd=Simulink.data.dictionary.open(datadictname);
if isempty(which(datadictname))
nodedd=Simulink.data.dictionary.create(datadictname);
else
nodedd = Simulink.data.dictionary.open(datadictname);
end
nodeddsources=nodedd.DataSources;
reqsources=obj.nodes(inode).wrapdatadicts';
......@@ -1044,30 +1051,29 @@ classdef SCDclass_expcode
function obj = setupwrappers(obj)
for ii=1:numel(obj.wrapperlist)
inode = obj.wrapperlist{ii}{1};
switch inode
%%% THIS SHOULD BE REFACTORED
case {1,8}
if(obj.wrapperlist{ii}{2}==1)
obj.nodes(inode).varalgo=obj.wrapperlist{ii}{3};
obj.nodes(inode).wrapdatadicts{1}=obj.wrapperlist{ii}{5};
else
warning('SCDclass_expcode:setupwrappers','not supported node%02d cpu',inode);
end
case {2,3,4,6,7}
if(obj.wrapperlist{ii}{2}>=1 && obj.wrapperlist{ii}{2}<=max(obj.activecpus{inode}))
obj.nodes(inode).varalgo(obj.wrapperlist{ii}{2})=obj.wrapperlist{ii}{3};
obj.nodes(inode).wrapdatadicts{obj.wrapperlist{ii}{2}}=obj.wrapperlist{ii}{5};
else
warning('SCDclass_expcode:setupwrappers','not supported node%02d cpu',inode);
end
otherwise
warning('SCDclass_expcode:setupwrappers','not supported node');
end
for ii=1:numel(obj.wrapperlist)
inode = obj.wrapperlist{ii}{1};
icpu = obj.wrapperlist{ii}{2};
varalgo = obj.wrapperlist{ii}{3};
modelname = obj.wrapperlist{ii}{4}; %#ok<NASGU>
wrapper_dd = obj.wrapperlist{ii}{5};
switch inode
case {1,8}
assert(icpu==1,'SCDclass_expcode:setupwrappers',...
'not supported node%02d cpu',inode)
obj.nodes(inode).varalgo(icpu) = varalgo;
obj.nodes(inode).wrapdatadicts{icpu} = wrapper_dd;
case {2,3,4,6,7}
assert((icpu>=1 && icpu <=max(obj.activecpus{inode})),...
'SCDclass_expcode:setupwrappers','not supported node%02d cpu',inode);
otherwise
warning('SCDclass_expcode:setupwrappers','not supported node');
end
obj.nodes(inode).varalgo(icpu) = varalgo;
obj.nodes(inode).wrapdatadicts{icpu} = wrapper_dd;
end
end
function addRFMbus(obj,dd)
ddSection = dd.getSection('Design Data');
zeroElem = Simulink.BusElement;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment