diff --git a/algos/template/algo_template.slx b/algos/template/algo_template.slx index 8b57e10ac0e3a3753ed76dd65c6b579e4e6d2ca7..409a1893eec671f7753322058250c5371130f741 100644 Binary files a/algos/template/algo_template.slx and b/algos/template/algo_template.slx differ diff --git a/algos/template/algo_template_harness.slx b/algos/template/algo_template_harness.slx index 6beba1d4535228191471cd1460a5ca438f669736..370430490403cf847b658e2d524b16041e361004 100644 Binary files a/algos/template/algo_template_harness.slx and b/algos/template/algo_template_harness.slx differ diff --git a/algos/template/algo_template_loadtp.m b/algos/template/algo_template_loadtp.m index 1c08d9286f2f173a425caf3672d100c7adcde017..71333b6142ef87a52b041c52af095a26cc61da2b 100644 --- a/algos/template/algo_template_loadtp.m +++ b/algos/template/algo_template_loadtp.m @@ -1,11 +1,11 @@ function TP = algo_template_loadtp() -% Setup tunable control params +% Setup tunable control params default values TP.enable = true; TP.gain = single(2); TP.refmodel.gain = single(4); % another gain used in referenced model TP.rowvect = int32([1 2 3]); -TP.colvect = int16([1 2 3]'); +TP.colvect = single([1 2 3]'); TP.matrix = int8([1 2; 3 4]); end diff --git a/algos/template/algo_template_outBus_def.m b/algos/template/algo_template_outBus_def.m index 3acb8cd5d98cbcc0aa9c2deebd1c1f91dc8df786..8a4523c9386334633253248902f6646db97d5637 100644 --- a/algos/template/algo_template_outBus_def.m +++ b/algos/template/algo_template_outBus_def.m @@ -26,6 +26,18 @@ elems(2).Max = []; elems(2).DocUnits = ''; elems(2).Description = ''; +elems(3) = Simulink.BusElement; +elems(3).Name = 'signal3'; +elems(3).Dimensions = 1; +elems(3).DimensionsMode = 'Fixed'; +elems(3).DataType = 'single'; +elems(3).SampleTime = -1; +elems(3).Complexity = 'real'; +elems(3).Min = []; +elems(3).Max = []; +elems(3).DocUnits = ''; +elems(3).Description = ''; + algo_template_outBus = Simulink.Bus; algo_template_outBus.HeaderFile = ''; algo_template_outBus.Description = ''; diff --git a/algos/template/algo_template_signal_buses.m b/algos/template/algo_template_signal_buses.m index 7687d18ae772f4ebcd37cc6771ff4247a5876cd6..03b87030fcfcab1f5255ab0532f59536c659bffa 100644 --- a/algos/template/algo_template_signal_buses.m +++ b/algos/template/algo_template_signal_buses.m @@ -46,11 +46,17 @@ Buses{end+1} = outBus; % init bus elems(1)=Simulink.BusElement; -elems(1).Name='init1'; +elems(1).Name='clipgain1'; elems(1).DataType='single'; elems(2)=Simulink.BusElement; -elems(2).Name='init2'; -elems(2).DataType='int32'; +elems(2).Name='tstart1'; +elems(2).DataType='single'; +elems(3)=Simulink.BusElement; +elems(3).Name='tstop1'; +elems(3).DataType='single'; +elems(4)=Simulink.BusElement; +elems(4).Name='enable1'; +elems(4).DataType='boolean'; initBus = Simulink.Bus; initBus.HeaderFile = ''; diff --git a/algos/template/duplicate_template.m b/algos/template/duplicate_template.m index 1b835cabe2596febb94d90c1a52c8869505b4563..49ea09ced33e07af3b54460c1f66ef188e30ff20 100644 --- a/algos/template/duplicate_template.m +++ b/algos/template/duplicate_template.m @@ -20,6 +20,7 @@ filelist={... 'algo_template_outBus_def.m',... 'algo_template_inBus_def.m',... 'algoobj_template.m',... + 'algo_template_create_tree.tcl',... }; for i=1:numel(filelist) cpcmd=sprintf('cp -vf %s/%s %s/%s',fcnpath,filelist{i},algopath,strrep(filelist{i},'template',name)); @@ -53,17 +54,26 @@ end % keeping a list like this % updated (manually ...) with the template content: fprintf('Changing block diagrams properties ...\n'); -list={{'algo_template/realtime' ,'SampleTime',}, ... - {'algo_template/signal_in' ,'OutDataTypeStr',}, ... - {'algo_template/signal_out' ,'OutDataTypeStr',}, ... - {'algo_template/Gain' ,'Gain'}, ... - {'algo_template/Constant' ,'OutDataTypeStr'}, ... - {'algo_template/Model' ,'ModelNameDialog'}, ... - {'algo_template/InitFcn/Constant1','Value'},... - {'algo_template/InitFcn/Constant2','Value'},... - {'algo_template/InitFcn/InitOut','OutDataTypeStr',}, ... +list={{'algo_template/realtime' ,'SampleTime',},... + {'algo_template/signal_in' ,'OutDataTypeStr',},... + {'algo_template/signal_out' ,'OutDataTypeStr',},... + {'algo_template/Gain' ,'Gain'},... + {'algo_template/Constant' ,'OutDataTypeStr'},... + {'algo_template/Model' ,'ModelNameDialog'},... + {'algo_template/InitFcn/Constant1' ,'Value'},... + {'algo_template/InitFcn/Constant2' ,'Value'},... + {'algo_template/InitFcn/Constant3' ,'Value'},... + {'algo_template/InitFcn/Constant4' ,'Value'},... + {'algo_template/InitFcn/InitOut' ,'OutDataTypeStr',},... + {'algo_template_harness/Model' ,'ModelNameDialog'},... + {'algo_template_harness/clock' ,'SampleTime'},... + {'algo_template_harness/test_inputs' ,'VariableName'},... + {'algo_template_harness/test_inputs' ,'SampleTime'},... + {'algo_template_harness/test_inputs' ,'OutDataTypeStr'},... }; load_system(['algo_' name]); +load_system(['algo_' name '_harness']); + for i=1:numel(list) parobj=strrep(list{i}{1},'template',name); oldvalue = get_param(parobj,list{i}{2}); @@ -72,7 +82,7 @@ for i=1:numel(list) set_param(parobj,list{i}{2},newvalue); end -fprintf('Changing referenced subsystem instance parameter ...\n'); +fprintf('Changing referenced subsystems instance parameter ...\n'); list={{'algo_template/Model', 'InstanceParameters'}}; for i=1:numel(list) parobj=strrep(list{i}{1},'template',name); @@ -84,10 +94,13 @@ for i=1:numel(list) end save_system(['algo_' name]); +load_system(['algo_' name '_harness']); -fprintf('Renaming ''template'' to ''%s'' inside .m files ...\n',name); +fprintf('Renaming ''template'' to ''%s'' inside script files ...\n',name); rncmd=sprintf('cd %s; sed -i ''s/template/%s/g'' *.m', algopath, name); system(rncmd); +rncmd=sprintf('cd %s; sed -i ''s/template/%s/g'' *.tcl', algopath, name); +system(rncmd); eval(sprintf('cd %s',startpath));