diff --git a/code/classes/SCDclass_algo.m b/code/classes/SCDclass_algo.m index 94ed43b6cb977966c3f53f722383a4f6588121ff..c0f720bd4def55d30d4a44ada344eb160a3c0bc5 100644 --- a/code/classes/SCDclass_algo.m +++ b/code/classes/SCDclass_algo.m @@ -15,9 +15,9 @@ classdef SCDclass_algo end methods - %% Constructor - + function obj=SCDclass_algo(name) + %% Constructor % Empty algorithm constructor obj.modelname=name; @@ -63,6 +63,11 @@ classdef SCDclass_algo fprintf('*****************************************************\n'); end + %% Setup + + function setup(obj) + obj.buildworkspacetpstruct; + end %% General purpose getters function out = getname(obj) diff --git a/code/classes/SCDclass_expcode.m b/code/classes/SCDclass_expcode.m index 98a12c6713cc3294e4fc96989d99fcecfcb55501..10eac0c227b80c33ab967a085a7ed28415a1a8ac 100644 --- a/code/classes/SCDclass_expcode.m +++ b/code/classes/SCDclass_expcode.m @@ -546,12 +546,12 @@ classdef SCDclass_expcode function obj = buildworkspacetpstruct(obj) % this funtion builds a workspace structures containing - % replicas of all tunable parameters structurea in the data + % replicas of all tunable parameters structures in the data % dictionaries, this structure is the one actually used % for loading simulation wavegen data % It is better not to use directly data dictionaries structures % to avoid flooding dds with big sim data sets (and - % conseguently the SCD SVN itself + % conseguently the rtccode GIT repo itself dd=SCDconf_getdatadict('tcv.sldd'); diff --git a/code/classes/SCDclass_expcodecontainer.m b/code/classes/SCDclass_expcodecontainer.m index 90b686a10ccf00c7d88ad6ebcf332ce91655b7cc..b4456c2b4e0ddc5c0626abac3546006f0b7e81f7 100644 --- a/code/classes/SCDclass_expcodecontainer.m +++ b/code/classes/SCDclass_expcodecontainer.m @@ -12,6 +12,14 @@ classdef SCDclass_expcodecontainer obj.expcodes={}; end + function list = getexpcodelist(obj) + % get numerical list of available codes; + list = zeros(1,obj.numexpcodes); + for ii=1:obj.numexpcodes + list(ii) = obj.expcodes{ii}{1}; + end + end + function obj=insertexpcode(obj, maincode, definefunction) if(obj.numexpcodes==0) diff --git a/code/functions/SCDconf_createexpcodes.m b/code/functions/SCDconf_createexpcodes.m index b8b0685a9e7828fe35c6e036ecd879e7c34399c5..a7bf2d38e56cc32d9b3fc91681d669511feef482 100644 --- a/code/functions/SCDconf_createexpcodes.m +++ b/code/functions/SCDconf_createexpcodes.m @@ -1,4 +1,4 @@ -function [] = SCDconf_createexpcodes() +function SCDexps = SCDconf_createexpcodes() %% The expcode container, % it contains a list of expcode numbers and function pointers @@ -13,9 +13,12 @@ SCDexps=SCDclass_expcodecontainer; SCDexps=SCDexps.insertexpcode(1, @(x) SCDexpcodeconf_template); SCDexps=SCDexps.insertexpcode(1005, @(x) SCDexpcodeconf_tcvstandard02); SCDexps=SCDexps.insertexpcode(10 , @(x) SCDexpcodeconf_f4eexample); +SCDexps=SCDexps.insertexpcode(1006, @(x) SCDexpcodeconf_DMmagcontrol); - -assignin('base','SCDexps',SCDexps); +if nargout == 0 + % assign output argument in base + assignin('base','SCDexps',SCDexps); +end end diff --git a/test/simulink_codegen_tests/ert_unix.tmf b/test/simulink_codegen_tests/ert_unix.tmf index 35959367a89defea160dd7951b69038ce14965f3..2848cbd4b36aa4400987734e11d14da60e5541d0 100644 --- a/test/simulink_codegen_tests/ert_unix.tmf +++ b/test/simulink_codegen_tests/ert_unix.tmf @@ -303,6 +303,13 @@ ifeq ($(SFCN),0) SYSLIBS += -lm endif +# Additional .so for compiling DM controllers, RTWINCLUDEAOT has +# to be set before building, e.g. setenv('RTWINCLUDEAOT','1') from +# the compiling matlab session +ifeq ($(RTWINCLUDEAOT),1) +SYSLIBS += -lexport_aot_model_linux +endif + LIBS = |>START_PRECOMP_LIBRARIES<| ifeq ($(OPT_OPTS),$(DEFAULT_OPT_OPTS)) diff --git a/tests/test_expcodes.m b/tests/test_expcodes.m new file mode 100644 index 0000000000000000000000000000000000000000..c1460ff7e47e1bbd58ab0d788f92240f597149d9 --- /dev/null +++ b/tests/test_expcodes.m @@ -0,0 +1,47 @@ +classdef test_expcodes < matlab.unittest.TestCase + + properties + expcode_obj; + SCDexps; + end + + properties(MethodSetupParameter) + expcode_number = {1,1005,1006}; % list of expcodes to test + end + + methods(TestClassSetup) + function setup_environment(testCase) + testCase.addTeardown(@cd,pwd); + testCase.addTeardown(@path,path); + + basePath = fullfile(fileparts(mfilename('fullpath')),'..'); + run(fullfile(basePath,'rtccode_paths')); + + % get SCD experimental code object container + testCase.SCDexps = SCDconf_createexpcodes; + end + end + + methods(TestMethodSetup) + function setup_expcode(testCase,expcode_number) + % get this expcode object from expcode object container + testCase.expcode_obj = getbymaincode(testCase.SCDexps,expcode_number); + testCase.expcode_obj.setup; % run setup this exp code + end + end + + methods(Test) + function test_expcode(testCase) + % attempt compiling tcv.slx for this expcode + try + tcv([],[],[],'compile'); + tcv([],[],[],'term'); + catch ME + tcv([],[],[],'term'); + rethrow(ME) + end + testCase.assertTrue(true); % dummy + end + + end +end