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

Update for new init call

parent d9655a1a
No related branches found
No related tags found
No related merge requests found
......@@ -26,14 +26,17 @@ classdef SCD
H.setup;
end
function H=init(expcode,shot)
assert(nargin==2,'must supply 2 inputs to init(expcode,shot)')
function H=init(expcode)
H=SCD.load(expcode);
H.init;
end
function H=actualize(expcode,shot)
H = SCD.load(expcode);
H.setup;
H.callinits;
H.actualize(shot);
end
function help()
help(mfilename);
end
......
......@@ -134,8 +134,11 @@ classdef SCDclass_algo
dd = obj.getdatadictionary;
ddpath = fullfile(obj.folder,dd);
% Close all open data dictionaries
Simulink.data.dictionary.closeAll;
% Close close this model's data dictionary
if contains(Simulink.data.dictionary.getOpenDictionaryPaths,dd)
Simulink.data.dictionary.closeAll(dd);
end
% Create if not existing already
if isempty(which(ddpath))
fprintf('generating data dictionary %s\n',fullfile(obj.folder,obj.getdatadictionary));
......@@ -330,7 +333,7 @@ classdef SCDclass_algo
fcnhandle = str2func(fcnhandle);
end
assert(isa(fcnhandle,'function_handle'),'stdinit function must be a function handle');
assert(nargout(fcnhandle)==0,'stdinit functions may not have output arguments')
assert(nargout(fcnhandle)<=0,'stdinit functions may not have output arguments')
obj.stdinits{end+1} = fcnhandle;
end
......
......@@ -327,11 +327,11 @@ classdef SCDclass_expcode
obj.taskcontainer.exectasksoninit(shot);
end
function callinits(obj)
function init(obj)
if(~isempty(obj.algoobjlist))
for ii=1:numel(obj.algoobjlist)
if nargin==1
obj.algoobjlist{ii}.callinits();
obj.algoobjlist{ii}.init();
elseif nargin==2
error('this use is deprecated, add tasks instead')
else
......@@ -362,8 +362,7 @@ classdef SCDclass_expcode
fprintf('Simulating %s.slx\n',myslx)
sim(myslx)
end
function build(obj,varargin)
if numel(varargin)==0
......@@ -413,41 +412,46 @@ classdef SCDclass_expcode
SCDclass_expcode.build_nodes(compileslx_list);
end
end
%% Printing methods
%% Property access methods
function nodes = getnodes(obj)
nodes = obj.nodes;
end
%% Printing methods
function printinfo(obj)
fprintf('*****************************************************\n');
fprintf('* SCD expcode: ''%s'', main code: %d\n',obj.name,obj.maincode);
fprintf('*****************************************************\n');
fprintf('* Configured wrappers:\n')
if(numel(obj.wrapperlist)>0)
for ii=1:numel(obj.wrapperlist)
fprintf(' Node: %d, CPU: %d, varalgo: %d, wrapper: ''%s'', datadict: ''%s''\n', ...
obj.wrapperlist{ii}{1}, ...
obj.wrapperlist{ii}{2}, ...
obj.wrapperlist{ii}{3}, ...
obj.wrapperlist{ii}{4}, ...
obj.wrapperlist{ii}{5} ...
);
end
end
fprintf('* Configured algorithms:\n');
if(numel(obj.algonamelist)>0)
for ii=1:numel(obj.algonamelist), fprintf(' ''%s''\n', char(obj.algonamelist{ii})); end
end
fprintf('* Configured algorithm data dictionaries:\n')
if(numel(obj.algoddlist)>0)
for ii=1:numel(obj.algoddlist), fprintf(' ''%s''\n', char(obj.algoddlist{ii})); end
end
fprintf('* Configured exported tunparams structures:\n')
if(numel(obj.exportedtps)>0)
for ii=1:numel(obj.exportedtps), fprintf(' ''%s''\n', char(obj.exportedtps{ii})); end
end
fprintf('* Configured MDS tunparams objects: %d (use printparameters method for details)\n', obj.mdscontainer.numparams);
fprintf('* Configured MDS wavegens objects: %d (use printwavegens method for details)\n', obj.mdscontainer.numwavegens);
fprintf('* Configured general purpose tasks: %d (use printtasks method for details)\n', obj.taskcontainer.numtasks);
fprintf('* Configured init scripts: %d (use printinits method for details)\n', numel(obj.stdinits));
fprintf('*****************************************************\n');
fprintf('* SCD expcode: ''%s'', main code: %d\n',obj.name,obj.maincode);
fprintf('*****************************************************\n');
fprintf('* Configured wrappers:\n')
if(numel(obj.wrapperlist)>0)
for ii=1:numel(obj.wrapperlist)
fprintf(' Node: %d, CPU: %d, varalgo: %d, wrapper: ''%s'', datadict: ''%s''\n', ...
obj.wrapperlist{ii}{1}, ...
obj.wrapperlist{ii}{2}, ...
obj.wrapperlist{ii}{3}, ...
obj.wrapperlist{ii}{4}, ...
obj.wrapperlist{ii}{5} ...
);
end
end
fprintf('* Configured algorithms:\n');
if(numel(obj.algonamelist)>0)
for ii=1:numel(obj.algonamelist), fprintf(' ''%s''\n', char(obj.algonamelist{ii})); end
end
fprintf('* Configured algorithm data dictionaries:\n')
if(numel(obj.algoddlist)>0)
for ii=1:numel(obj.algoddlist), fprintf(' ''%s''\n', char(obj.algoddlist{ii})); end
end
fprintf('* Configured exported tunparams structures:\n')
if(numel(obj.exportedtps)>0)
for ii=1:numel(obj.exportedtps), fprintf(' ''%s''\n', char(obj.exportedtps{ii})); end
end
fprintf('* Configured MDS tunparams objects: %d (use printparameters method for details)\n', obj.mdscontainer.numparams);
fprintf('* Configured MDS wavegens objects: %d (use printwavegens method for details)\n', obj.mdscontainer.numwavegens);
fprintf('* Configured general purpose tasks: %d (use printtasks method for details)\n', obj.taskcontainer.numtasks);
fprintf('* Configured init scripts: %d (use printinits method for details)\n', numel(obj.stdinits));
end
function printtasks(obj)
......@@ -521,8 +525,7 @@ classdef SCDclass_expcode
function printwavegens(obj)
obj.mdscontainer.printwavegens;
end
%% Configuration methods
function obj = addwrapper(obj, inode, icpu, varalgo, wrappername, varargin)
......@@ -771,8 +774,7 @@ classdef SCDclass_expcode
evalin('base','clear temp;');
end
function obj = setupwrapdd(obj)
% Sets up the data dictionaries of the wrappers to be loaded
% on the nodes inside the main tcv.sldd
......@@ -1099,8 +1101,6 @@ classdef SCDclass_expcode
obj.actualizewavegens(shot);
end
function actualizeparameters(obj,shot)
obj.mdscontainer.modeltoactualize=obj.modeltoactualize;
obj.mdscontainer.actualizeparameters(shot);
......@@ -1112,7 +1112,6 @@ classdef SCDclass_expcode
end
%% MDS update methods
function updatemds(obj, algo, shot)
if shot~=-1
error('SCDclass_expcode:updatemds','update permitted only on the model shot');
......
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