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

More class method comments and remove useless ones

parent 5586c83e
No related branches found
No related tags found
No related merge requests found
...@@ -315,7 +315,7 @@ classdef SCDclass_expcode ...@@ -315,7 +315,7 @@ classdef SCDclass_expcode
'set node number and node property do not match while setting node %s',nodenr) 'set node number and node property do not match while setting node %s',nodenr)
obj.nodes{node.nodenr} = node; obj.nodes{node.nodenr} = node;
% process data dicationaries, mds objects, init functions etc % Make lists of data dictionaries, mds objects, init functions etc
% that come with this node. % that come with this node.
% wrapper algorithms % wrapper algorithms
...@@ -344,6 +344,7 @@ classdef SCDclass_expcode ...@@ -344,6 +344,7 @@ classdef SCDclass_expcode
obj.nodes{nodenr}.wrapper{cpunr}.wrapperObj.printinfo; obj.nodes{nodenr}.wrapper{cpunr}.wrapperObj.printinfo;
return return
elseif nargin==2 elseif nargin==2
if isempty(obj.nodes{nodenr}); fprintf('no node %d defined\n',nodenr); end
obj.nodes{nodenr}.printinfo; obj.nodes{nodenr}.printinfo;
return return
end end
......
...@@ -26,17 +26,24 @@ classdef SCDclass_node < SCDclass_component ...@@ -26,17 +26,24 @@ classdef SCDclass_node < SCDclass_component
methods methods
function obj = SCDclass_node(nodenr) function obj = SCDclass_node(nodenr)
% constructor
name = sprintf('SCD_rtc_%02d',nodenr); name = sprintf('SCD_rtc_%02d',nodenr);
obj.nodenr = nodenr; obj.nodenr = nodenr;
obj.name = name; obj.name = name;
obj.algos = []; obj.algos = [];
obj.ddname = [name,'.sldd']; obj.ddname = [name,'.sldd'];
obj.mdlname = [name,'.slx']; obj.mdlname = [name,'.slx'];
% get node-specific configurations
obj = defaultnodeconfig(obj,nodenr); obj = defaultnodeconfig(obj,nodenr);
end end
function obj = addwrapper(obj,wrapperObj,cpunr,varalgo,isactive) function obj = addwrapper(obj,wrapperObj,cpunr,varalgo,isactive)
% add wrapper to a node at a given cpunumber
% varalgo is the variant subsystem number used to select this wrapper
% isactive (true by default) sets whether the addition of the wrapper
% also sets the cpu to be active;
% by default, activate CPU when adding a wrapper % by default, activate CPU when adding a wrapper
if nargin==4, isactive=true; end if nargin==4, isactive=true; end
...@@ -56,7 +63,7 @@ classdef SCDclass_node < SCDclass_component ...@@ -56,7 +63,7 @@ classdef SCDclass_node < SCDclass_component
end end
function node = defaultnodeconfig(node,nodenr) function node = defaultnodeconfig(node,nodenr)
% [general part] % Default configuration for nodes
switch nodenr switch nodenr
case 1 case 1
node.ncpu = 1; node.ncpu = 1;
...@@ -189,45 +196,11 @@ classdef SCDclass_node < SCDclass_component ...@@ -189,45 +196,11 @@ classdef SCDclass_node < SCDclass_component
end end
function obj = setactive(obj,value) function obj = setactive(obj,value)
% set the node to be active
assert(islogical(value),'value must be boolean') assert(islogical(value),'value must be boolean')
obj.active = value; obj.active = value;
end end
function linknodedd(obj,node)
% link node data dictionary to main expcode object data dicationary
assert(isa(node,'SCDclass_node'),'node must be an SCDclass_node object')
ddObj = Simulink.data.dictionary.open(obj.ddname);
prefix = 'SCD_rtc';
% already linked sources
prevsources = ddObj.DataSources;
prevsources_nodes = prevsources(startsWith(prevsources,prefix));
% make algo data dictionary list list
reqsources = node.ddname;
% removing unnecessary ones
for ii=1:numel(prevsources_nodes)
mysource = prevsources_nodes{ii};
if ~contains(reqsources,mysource)
obj.printlog('Removing algorithm data source %s from %s',mysource,obj.ddname);
ddObj.removeDataSource(prevsources_nodes{ii})
end
end
% add new ones not yet present
mysource = reqsources;
assert(startsWith(mysource,prefix),...
'attempting to add algo dd: %s that does not start with ''%s''-aborting',prefix,mysource);
if contains(prevsources,mysource)
obj.printlog('Not adding node data source %s - already exists',mysource);
else
obj.printlog('Adding node data source %s to %s',mysource,obj.ddname);
ddObj.addDataSource(mysource);
end
end
function updatetemplatetp(obj) function updatetemplatetp(obj)
% update wrapper algos % update wrapper algos
for ii=1:numel(obj.wrappers) for ii=1:numel(obj.wrappers)
......
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