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

Add timing to wrapper and check correct algo dt when adding

parent ac893d2f
No related branches found
No related tags found
No related merge requests found
......@@ -12,6 +12,7 @@ classdef SCDclass_component
mdlname % simulink model name
ddname % data dictionary name
algos % algorithms contained in this wrapper
timing % sample time
end
methods
......@@ -19,6 +20,11 @@ classdef SCDclass_component
function obj = addalgo(obj,algo)
% add an algorithm object
assert(isa(algo,'SCDclass_algo'));
assert(algo.gettiming.dt == obj.timing.dt,...
'Algorithm %s sample time: %f does not match %s sample time: %f',...
algo.getname,algo.gettiming.dt,obj.name,obj.timing.dt)
obj.algos = [obj.algos;algo];
end
......
......@@ -11,7 +11,6 @@ classdef SCDclass_node < SCDclass_component
hasethercat
ncpu % number of CPUs
cputype
timing
buildcfg
initscdbeforecomp
cpuactive
......
classdef SCDclass_wrapper < SCDclass_component
% Wrapper class containing algos
methods
function obj = SCDclass_wrapper(name)
function obj = SCDclass_wrapper(name,dt)
if nargin<2, dt=1e-3; end % default wrapper period
obj.name = name;
obj.algos = [];
obj.ddname = [name,'.sldd'];
obj.mdlname = [name,'.slx'];
obj.timing = struct('dt',dt);
assert(~isempty(which(obj.mdlname)),...
'could not find %s for SCD component %s',obj.mdlname,obj.name);
end
......
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