Skip to content
Snippets Groups Projects
Commit 545bbfee authored by Ravensbergen Timo's avatar Ravensbergen Timo
Browse files

bugfix in sldd creation in wrapper: should be in init and not setup to be...

bugfix in sldd creation in wrapper: should be in init and not setup to be consistent with other hierarchy classes
parent 324c4e14
No related branches found
No related tags found
No related merge requests found
......@@ -46,9 +46,21 @@ classdef (Abstract) SCDDSclass_wrapper < SCDDSclass_component
% if property holds true, automatically create fresh dd for wrapper
% when not yet there
if obj.createdd
% force close and delete linked sldd and create fresh
if contains(Simulink.data.dictionary.getOpenDictionaryPaths,obj.ddname)
Simulink.data.dictionary.closeAll(obj.ddname,'-discard');
% close if it exists and discard changes
end
delete(which(obj.ddname));
folder = fileparts(which(obj.mdlname));
SCDDSclass_algo.createdatadictionary(obj.ddname, folder);
load_system(obj.name);
% link wrapper slx model to new sldd
set_param(obj.name,'DataDictionary',obj.ddname);
end
for ii=1:numel(obj.algos)
obj.algos(ii).init;
......@@ -58,8 +70,7 @@ classdef (Abstract) SCDDSclass_wrapper < SCDDSclass_component
function setup(obj)
% only open dd if created during initialization
if obj.createdd
dd = Simulink.data.dictionary.open(obj.ddname);
load_system(obj.name);
dd = Simulink.data.dictionary.open(obj.ddname);
end
for ii=1:numel(obj.algos)
......@@ -68,9 +79,7 @@ classdef (Abstract) SCDDSclass_wrapper < SCDDSclass_component
if obj.createdd % only add algo dd params here if dd was freshly created
mydatasource = obj.algos(ii).datadictionary;
fprintf('adding data source %s to %s\n',mydatasource,obj.ddname)
dd.addDataSource(mydatasource);
% link wrapper slx model to new sldd
set_param(obj.name,'DataDictionary',obj.ddname);
dd.addDataSource(mydatasource);
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment