diff --git a/test/simulink_codegen_tests/confsettingsmodformmi.txt b/build/simulink_codegen/confsettingsmodformmi.txt
similarity index 100%
rename from test/simulink_codegen_tests/confsettingsmodformmi.txt
rename to build/simulink_codegen/confsettingsmodformmi.txt
diff --git a/test/simulink_codegen_tests/ert_shrlib_scd.tlc b/build/simulink_codegen/ert_shrlib_scd.tlc
similarity index 100%
rename from test/simulink_codegen_tests/ert_shrlib_scd.tlc
rename to build/simulink_codegen/ert_shrlib_scd.tlc
diff --git a/test/simulink_codegen_tests/ert_unix.tmf b/build/simulink_codegen/ert_unix.tmf
similarity index 100%
rename from test/simulink_codegen_tests/ert_unix.tmf
rename to build/simulink_codegen/ert_unix.tmf
diff --git a/test/simulink_codegen_tests/export_shrlib_def_scd.tlc b/build/simulink_codegen/export_shrlib_def_scd.tlc
similarity index 100%
rename from test/simulink_codegen_tests/export_shrlib_def_scd.tlc
rename to build/simulink_codegen/export_shrlib_def_scd.tlc
diff --git a/code/classes/SCD.m b/code/classes/SCD.m
index af7ff65e0b8b7f4a02fd53b05ad50ccb2e18c7f6..a3f919f7bac031b6f18940646423b4345d538f89 100644
--- a/code/classes/SCD.m
+++ b/code/classes/SCD.m
@@ -20,6 +20,12 @@ classdef SCD
    SCDconf_setSIMconf; % set conf for simulation
   end
   
+  function H=setup(expcode)
+    % load and setup
+    H=SCD.load(expcode);
+    H.setup;
+  end
+  
   function H=init(expcode,shot)
     assert(nargin==2,'must supply 2 inputs to init(expcode,shot)')
     H=SCD.load(expcode);
diff --git a/code/classes/SCDclass_algo.m b/code/classes/SCDclass_algo.m
index d31df20d1abe6c3bcf4d39edd353daa7d8dd7123..fab4af62b916058d285aae8c87524160d145768c 100644
--- a/code/classes/SCDclass_algo.m
+++ b/code/classes/SCDclass_algo.m
@@ -221,13 +221,13 @@ classdef SCDclass_algo
             targetworkspace = 'global'; % default: global workspace (assigninGlobal)
           end
           
-          if ~iscell(targetstruct)
+          if ~iscell(targetstruct) && ~isempty(targetstruct)
             targetstruct = {targetstruct};
           end
          
            if(~isempty(obj.stdinits))
                for ii=1:numel(obj.stdinits)
-                   if contains(obj.stdinits{ii}{2},targetstruct)
+                   if ~isempty(targetstruct) && contains(obj.stdinits{ii}{2},targetstruct)
                        warning('SCDclass_algo:addfpinitfcn','A function defining the structure %s has already been added, ignoring.\d',targetstruct)
                        return
                    end
@@ -251,7 +251,7 @@ classdef SCDclass_algo
        end
        
        
-       function callinits(obj,shot)
+       function callinits(obj)
          % call initialization functions that set fixed parameters
           if ~isempty(obj.stdinits)
               for ii=1:numel(obj.stdinits)
@@ -269,9 +269,7 @@ classdef SCDclass_algo
                     initcmd=sprintf('%s(obj);', initfunction);
                     [value{1:nout}] = eval(initcmd);
                   elseif isa(initfunction,'function_handle')
-                    if nargin(initfunction)==2
-                      argins = {obj,shot};
-                    elseif nargin(initfunction)==1
+                    if nargin(initfunction)==1
                       argins={obj};
                     elseif nargin(initfunction)==0
                       argins = {};
@@ -313,6 +311,9 @@ classdef SCDclass_algo
          sim(obj.modelname);
        end
        
+       function open(obj)
+         open(obj.modelname)
+       end
     end
 end
 
diff --git a/code/classes/SCDclass_expcode.m b/code/classes/SCDclass_expcode.m
index 7b275e308fd9139b7c0b1953ba341b7261fb2a02..3bf3c93fd90f9321e6d2f3f5485f8bdbc6e4c9c0 100644
--- a/code/classes/SCDclass_expcode.m
+++ b/code/classes/SCDclass_expcode.m
@@ -1,8 +1,18 @@
 classdef SCDclass_expcode
-    %A SCD expcode object
-    %   This object is a virgin SCD expode
-    %   its constructor builds an expode 
-    %   with all templates algorithms
+    %An SCD expcode object
+    %   
+    % Methods:
+    %  .open: Open baseline .slx model
+    %     open(N): Open node N
+    %     open(N,M): Open thread M of node N
+    % .build, build(N), build(N,M): Generate C code for node N, thread M
+    % .compile, compile(N), compile(N,M): Compile Simulink model for node N, thread M)
+    % .close_all: Close all Simulink block diagrams
+    % 
+    % .printinfo: Print information about components of this expcode
+    % .printtasks: Print configured tasks
+    % .printwavegens: Print configured wavegen signals
+    %. 
     
     properties (Access = private)     
         activenodes         % numerical list of configured active nodes
@@ -30,6 +40,9 @@ classdef SCDclass_expcode
     end
     
     methods(Static)
+      function help
+        help(mfilename)
+      end
       function node = defaultnode(nodenr)
             
             node01.active = 0;
@@ -339,7 +352,8 @@ classdef SCDclass_expcode
             nodestr=sprintf('node%02d',inode);
             obj.nodes(inode).varalgo(icpu) = varalgo;
             obj.nodes(inode).wrapper{icpu} = wrappername;
-            obj.nodes(inode).cpuactive(icpu) = 1;
+            obj.nodes(inode).cpuactive(icpu) = true;
+            obj.nodes(inode).active = true;
             %% save in wrapper list
                 
             tempwrapper=cell(10,1);
@@ -463,7 +477,7 @@ classdef SCDclass_expcode
            % parameters import
            obj.mdscontainer=obj.mdscontainer.importmdsobjects(expcode.mdscontainer);
         end
-            
+
         function setup(obj)
            % This function sets up the TCV Simulink  model
            % to simulate this experimental code.
@@ -521,7 +535,7 @@ classdef SCDclass_expcode
            fprintf('Actualizing expcode %d, ''%s'', configuring wavegens ...\n',obj.maincode,obj.name);
            obj.actualizewavegens(shot);
         end
-      
+
         function printparameters(obj)
             obj.mdscontainer.printparameters;
         end
@@ -542,7 +556,7 @@ classdef SCDclass_expcode
         function actualizewavegens(obj,shot)
             obj.mdscontainer.modeltoactualize=obj.modeltoactualize;
             obj.mdscontainer.actualizewavegens(shot);
-        end   
+        end
         
         function printinits(obj)
            if(~isempty(obj.stdinits))
@@ -551,8 +565,8 @@ classdef SCDclass_expcode
                end
            end
         end
-            
-        function callinits(obj,~)
+       
+        function callinits(obj)
           if(~isempty(obj.algoobjlist))
               for ii=1:numel(obj.algoobjlist)
                  if nargin==1
@@ -597,7 +611,7 @@ classdef SCDclass_expcode
             end
             obj.mdscontainer.printMARTe2parconfig(shot);
         end
-         
+
         function printMARTe2wgbusconfig(obj, shot, ddname, busname, frequency)
             fprintf("+MDSWavegen_%s = {\n", busname);
             fprintf(" Class = MDSWavegen\n");
@@ -645,12 +659,8 @@ classdef SCDclass_expcode
               nodeinfo=obj.nodes(inode);
               for icpu = 1:nodeinfo.ncpu
                 if nodeinfo.cpuactive(icpu)
-                  if inode~=1
                   compileslx_list = [compileslx_list,...
                     SCDclass_expcode.getslxname(inode,icpu)]; %#ok<AGROW>
-                  else
-                    warning('Do not compile node %d thread %d since this is just a dummy',inode,icpu);
-                  end
                 end
               end
             end
@@ -663,6 +673,7 @@ classdef SCDclass_expcode
             % user passed nodes,threads to compile
             myslx = SCDclass_expcode.getslxname(varargin{:});
             fprintf('building %s.slx\n',myslx)
+            compileslx_list{1} = myslx;
           end
          
            % set CodeGen folder for this expcode (allows fast rebuilding)
@@ -691,9 +702,11 @@ classdef SCDclass_expcode
    
     methods (Access = private)
         
-        function obj=printlog(obj,str)
+        function obj=printlog(obj,str,varargin)
+          % printlog, allows sprintf()-like expressions
             if obj.loadverbose==1
-               fprintf('Expcode %d, %s\n', obj.maincode, str); 
+               fprintf('Expcode %d, ', obj.maincode, str); 
+               fprintf(str,varargin{:}); fprintf('\n');
             end
         end
                  
@@ -749,7 +762,7 @@ classdef SCDclass_expcode
                nodeddsourcesok={};
                nodeddsourcesokitems=0;
                for ii=1:numel(nodeddsources)
-                  if(strcmp(nodeddsources{ii}(1:7),'SCDwrap'))
+                  if startsWith(nodeddsources{ii},'SCDwrap')
                       temp={nodeddsources{ii}, 0};
                       nodeddsourcesok=[nodeddsourcesok; temp];
                       nodeddsourcesokitems=nodeddsourcesokitems+1;
@@ -759,20 +772,17 @@ classdef SCDclass_expcode
                reqsourcesok={};
                reqsourcesokitems=0;
                for ii=1:numel(reqsources)
-                  if(strcmp(reqsources{ii}(1:7),'SCDwrap'))           
+                  if startsWith(reqsources{ii},'SCDwrap')          
                       temp={reqsources{ii}, 1};
                       reqsourcesok=[reqsourcesok; temp];
                       reqsourcesokitems=reqsourcesokitems+1;
                   else
-                      str=sprintf('Proposed wrapper data dictionary %s does not begin with SCDwrap, ignoring it.', reqsources{ii});
-                      warning(str);
-                      %obj.printlog(str);
+                      warning('Proposed wrapper data dictionary %s does not begin with SCDwrap, ignoring it.', reqsources{ii});
                   end
-                  
                end
                
                % Finding which data sources to eliminate and which to add
-               if(nodeddsourcesokitems>0 && reqsourcesokitems>0)
+               if (nodeddsourcesokitems>0 && reqsourcesokitems>0)
                   for ii=1:nodeddsourcesokitems
                      todel=1;
                      for jj=1:reqsourcesokitems
@@ -800,8 +810,7 @@ classdef SCDclass_expcode
                if(nodeddsourcesokitems>0)
                   for ii=1:nodeddsourcesokitems
                     if(nodeddsourcesok{ii,2}==1)
-                       str=sprintf('Removing wrapper data source %s from %s', char(nodeddsourcesok{ii,1}), datadictname);
-                       obj.printlog(str);
+                       obj.printlog('Removing wrapper data source %s from %s', char(nodeddsourcesok{ii,1}), datadictname);
                        removeDataSource(nodedd, char(nodeddsourcesok{ii,1}));
                     end
                   end
@@ -811,8 +820,7 @@ classdef SCDclass_expcode
                if(reqsourcesokitems>0)
                   for ii=1:reqsourcesokitems
                       if(reqsourcesok{ii,2}==1)
-                         str=sprintf('Adding wrapper data source %s to %s', char(reqsourcesok{ii,1}), datadictname); 
-                         obj.printlog(str);
+                         obj.printlog('Adding wrapper data source %s to %s', char(reqsourcesok{ii,1}), datadictname);
                          addDataSource(nodedd, char(reqsourcesok{ii,1}));
                       end
                   end
@@ -880,8 +888,7 @@ classdef SCDclass_expcode
                if(tcvddsourcesokitems>0)
                   for ii=1:tcvddsourcesokitems
                     if(tcvddsourcesok{ii,2}==1)
-                       str=sprintf('Removing algorithm data source %s', char(tcvddsourcesok{ii,1}));
-                       obj.printlog(str);
+                       obj.printlog('Removing algorithm data source %s', char(tcvddsourcesok{ii,1}));
                        removeDataSource(tcvdd, char(tcvddsourcesok{ii,1}));
                     end
                   end
@@ -891,8 +898,7 @@ classdef SCDclass_expcode
                if(reqsourcesokitems>0)
                   for ii=1:reqsourcesokitems
                       if(reqsourcesok{ii,2}==1)
-                         str=sprintf('Adding algorithm data source %s', char(reqsourcesok{ii,1})); 
-                         obj.printlog(str);
+                         obj.printlog('Adding algorithm data source %s', char(reqsourcesok{ii,1}));
                          addDataSource(tcvdd, char(reqsourcesok{ii,1}));
                       end
                   end
@@ -929,7 +935,6 @@ classdef SCDclass_expcode
                         else
                             warning('SCDclass_expcode:setupwrappers','not supported node%02d cpu',inode);
                         end
-                        
                     case {2,3,4,6,7}
                         if(obj.wrapperlist{ii}{2}>=1 &&  obj.wrapperlist{ii}{2}<=4)
                             obj.nodes(inode).varalgo(obj.wrapperlist{ii}{2})=obj.wrapperlist{ii}{3};
@@ -937,10 +942,8 @@ classdef SCDclass_expcode
                         else
                             warning('SCDclass_expcode:setupwrappers','not supported node%02d cpu',inode);
                         end
-
                     otherwise
                         warning('SCDclass_expcode:setupwrappers','not supported node');
-                  
                 end
                 
             end
@@ -975,27 +978,43 @@ classdef SCDclass_expcode
         function obj = buildworkspacesimstructnode(obj,inode,dd)
           node = obj.nodes(inode);
 
-          try % get existing SCDsimdata
+          if evalin('base','exist(''SCDsimdata'',''var'')');
             SCDsimdata = evalin('base','SCDsimdata');
-          catch ME
-            if strcmp(ME.identifier,'MATLAB:UndefinedFunction')
-              SCDsimdata = struct(); % assign here if empty
-            else
-              rethrow(ME);
-            end
+          else
+            SCDsimdata = struct(); % assign here if empty
           end
           
           if node.haswavegen
             for ithread = 1:node.ncpu
               % get whatever is in data dictionary template in wrappers
               simstructname = sprintf('SCDnode%02d%02d_simdata',inode,ithread);
-              fprintf('   setting up %s\n',simstructname);
-              try
-               simstruct = dd.getEntry(simstructname).getValue;
-              catch
-                warning('%s not found in data dictionary, auto-generate from bus definition',simstructname)
-                wgbusname = sprintf('WG%02d%02dbus',inode,ithread);
-                simstruct = SCDconf_createsimdatastruct(dd,wgbusname);
+              wgbusname = sprintf('WG%02d%02dbus',inode,ithread);
+
+              fprintf('   setting up %s',simstructname);
+              if dd.exist(simstructname)
+                simstruct = dd.getEntry(simstructname).getValue;
+                mybus=dd.getEntry(wgbusname).getValue; % get from data dictionary
+                if ~isstruct(simstruct) || ~isfield(simstruct,'wavegen')
+                  fprintf('.. loaded simstruct wavegen is not compatible');
+                  regenerate = true;
+                elseif SCDconf_structbuscmp(simstruct.wavegen,mybus)
+                  fprintf('... loaded WG from data dictionary\n');
+                  regenerate=false;
+                else
+                  fprintf('... loaded WG structure from dd does not match bus definition...');
+                  regenerate=true;
+                end
+              else
+                regenerate=true;
+                fprintf('... could not find %s in data dictionary',simstructname);
+              end
+              
+              if regenerate
+                simstruct.wavegen = SCDconf_createstructfrombus(dd,wgbusname); % structure to match
+                %ddsource = dd.find('Name',wgbusname).DataSource; % dd containing bus
+                %wrapdd=Simulink.data.dictionary.open(ddsource).getSection('Design Data');
+                %wrapdd.addEntry(simstructname,simstruct)
+                fprintf('... re-generated from bus %s\n',wgbusname')
               end
               SCDsimdata.(simstructname) = simstruct;
             end
@@ -1006,7 +1025,7 @@ classdef SCDclass_expcode
           if node.hasadc
             adcbusname = sprintf('ADC%02dbus',inode);
             fprintf('   setting up %s.adc\n',simstructname);
-            SCDsimdata.(simstructname).adc = SCDconf_createsimdatastruct(dd,adcbusname);
+            SCDsimdata.(simstructname).adc = SCDconf_createstructfrombus(dd,adcbusname);
           end
           
           if node.hasethercat
@@ -1014,18 +1033,16 @@ classdef SCDclass_expcode
             ethercatbusname = 'ETHCAT1IN';
             fprintf('   setting up %s.ethercat\n',simstructname);
             SCDsimdata.(simstructname).ethercat = ...
-              SCDconf_createsimdatastruct(dd,ethercatbusname);
+              SCDconf_createstructfrombus(dd,ethercatbusname);
           end
           
           % add also RFM
           RFMbusname = 'RFMINbus';
-          SCDsimdata.rfm = SCDconf_createsimdatastruct(dd,RFMbusname);
+          SCDsimdata.rfm = SCDconf_createstructfrombus(dd,RFMbusname);
 
           % assign result in base workspace         
           assignin('base','SCDsimdata',SCDsimdata);
         end
-
-        
     end 
 
 end
diff --git a/code/classes/SCDclass_mdswgsigsingle.m b/code/classes/SCDclass_mdswgsigsingle.m
index e4cbbe75c4a0c87d3c75ba01a9458653a8f96099..83d400d347510fa30d613745286a897ae1803a8d 100644
--- a/code/classes/SCDclass_mdswgsigsingle.m
+++ b/code/classes/SCDclass_mdswgsigsingle.m
@@ -46,36 +46,32 @@ classdef SCDclass_mdswgsigsingle < SCDclass_mdswg
             end
             
             value=obj.getdata();
-                                   
-            baseparam=obj.wavegenbasestruct;
-            structparam=obj.wavegentarget;
 
-            wgentryval=evalin('base',baseparam);
+            baseparam=obj.wavegenbasestruct; % name of base workspace structure
+            structparam=obj.wavegentarget; % name of target field
+            wgentryval = evalin('base',baseparam); % structure of wavegen in base workspace
             
-            getcurrenttssize =sprintf('ddtssamples=numel(wgentryval.%s.Time);',structparam);
-            eval(getcurrenttssize);
-            if(ddtssamples~=numel(value.Time))
-                % the dd timeseries has different dims w.r.t. the signals
-                % to be loaded, we have to load the timeseries as it is
-                
-                assigncmd   =sprintf('wgentryval.%s=value;',structparam);
-                eval(assigncmd);
-            else
-                % the dd timeseries has the same size than the signals
-                % to be loaded, we can do a partial loading
-             
-                assigncmdtime    =sprintf('wgentryval.%s.Time=value.Time;',structparam);
-                assigncmddata    =sprintf('wgentryval.%s.Data(:,%d)=value.Data;',structparam,obj.destidx);
+            assert(isfield(wgentryval,structparam),...
+              'Wavegen field %s does not exist in target structure %s. ',structparam,baseparam)
             
-                eval(assigncmdtime);
-                eval(assigncmddata);
+            % assign field from wavegen entry value
+            ddtssamples=numel(wgentryval.(structparam).Time);
+            if ddtssamples~=numel(value.Time)
+              % the dd timeseries has different dims w.r.t. the signals
+              % to be loaded, we have to load the timeseries as it is
+              wgentryval.(structparam)=value;
+            else
+              % the dd timeseries has the same size than the signals
+              % to be loaded, we can do a partial loading
+              wgentryval.(structparam).Time=value.Time;
+              wgentryval.(structparam).Data(:,obj.destidx)=value.Data;
             end
             
             assignin('base','temp',wgentryval);
-            assigncmd=sprintf('%s=temp;',baseparam);            
+            assigncmd=sprintf('%s=temp;',baseparam);
             evalin('base',assigncmd);
             evalin('base','clear temp');
-                                  
+
         end
         
         function value=getdata(obj)
diff --git a/code/functions/SCDconf_createsimdatastruct.m b/code/functions/SCDconf_createstructfrombus.m
similarity index 69%
rename from code/functions/SCDconf_createsimdatastruct.m
rename to code/functions/SCDconf_createstructfrombus.m
index 591c3fc892e92ab06ea6a63487d918faf16bb623..63d4f29c41c5847c6d0745af8395edfc45771c41 100644
--- a/code/functions/SCDconf_createsimdatastruct.m
+++ b/code/functions/SCDconf_createstructfrombus.m
@@ -5,9 +5,19 @@
 % and with zero data of the correct kind
 % This is enough for passing a ctrl-D with from Workspace bus kind blocks
 
-function [out] = SCDconf_createsimdatastruct(dd,busname)
+function [out] = SCDconf_createstructfrombus(varargin)
+% Create data structure matching a bus signature
+% From either a datadictionary+busname or from a bus directly
+% [out] = SCDconf_createstructfrombus(dd,busname)
+% [out] = SCDconf_createstructfrombus(bus)
 
-bus=dd.getEntry(busname).getValue; % get from data dictionary
+if nargin==1
+  bus = varargin{1};
+else
+  dd = varargin{1};
+  busname = varargin{2};
+  bus=dd.getEntry(busname).getValue; % get from data dictionary
+end
 bussize=size(bus.Elements);
 signalssize=bussize(1);
 
@@ -16,7 +26,7 @@ for ii=1:signalssize
   if contains(element.DataType,'Bus: ')
     busname = erase(element.DataType,'Bus: ');
     % recursive call
-    out.(element.Name) = SCDconf_createsimdatastruct(dd,busname);
+    out.(element.Name) = SCDconf_createstructfrombus(dd,busname);
   else
     try cast(1,element.DataType); catch ME; error('non-numeric type'); end
     elementdims=element.Dimensions;
diff --git a/code/functions/SCDconf_structbuscmp.m b/code/functions/SCDconf_structbuscmp.m
new file mode 100644
index 0000000000000000000000000000000000000000..adfdd3acdf11d1e73f212c4a3d07a6ca58d3252e
--- /dev/null
+++ b/code/functions/SCDconf_structbuscmp.m
@@ -0,0 +1,31 @@
+% Compare the structure of a bus to that of a structure, return 1 if they
+% are the same.
+
+function [areequal] = SCDconf_structbuscmp(mystruct,mybus)
+
+nelem=numel(mybus.Elements);
+
+for ielem = 1:nelem
+  myelem = mybus.Elements(ielem);
+  myelementname = myelem.Name;
+  if ~isfield(mystruct,myelementname)
+    areequal = false; return;
+  end
+  
+  myfield = mystruct.(myelementname);
+  if startsWith(myelem.DataType,'Bus')
+    % recursive call
+    areequal = SCDconf_structbuscmp(mystruct,mybus);
+    if ~areequal; return; end
+  elseif ~isa(myfield,'timeseries') % check timeseries
+    areequal=false; return;
+  elseif ~isa(myfield.Data,myelem.DataType) % check data type
+    areequal=false; return;
+  elseif ~all(size(myfield.Data,2:ndims(myfield.Data))==myelem.Dimensions) % check dimension
+    areequal=false; return;    
+  end
+end
+
+% if we made it this far..
+areequal = true;
+end
diff --git a/tests/test_SCDclass.m b/tests/test_SCDclass.m
index 9cb7cbaf84cddfc39d8b59ab8b295bb54e4ada41..60c189f11030e9fd67cd9a4251d58f543dc724b5 100644
--- a/tests/test_SCDclass.m
+++ b/tests/test_SCDclass.m
@@ -6,7 +6,7 @@ classdef test_SCDclass < matlab.unittest.TestCase
     shot = 65668;
   end
   
-  methods(Test,TestTags={'expcodes'})
+  methods(Test)
     function test_load(testCase)
       SCD.load(testCase.expcode);
     end
diff --git a/tests/test_expcodes.m b/tests/test_expcodes.m
index d67acbce92950f3717038f89cf1c444f96e43d17..c9d161a771662926ef8bd386cf778a08e0e9ec0f 100644
--- a/tests/test_expcodes.m
+++ b/tests/test_expcodes.m
@@ -7,10 +7,9 @@ classdef test_expcodes < matlab.unittest.TestCase
   end
   
   properties(ClassSetupParameter)
-    %expcode_number = {'1','1005','1010'}; % list of expcodes to test
-    expcode_number = {'1','1005'}; % list of expcodes to test  
+    expcode = {'1','1005','1006'}; % list of expcodes to test  
   end
-  
+   
   methods(TestClassSetup)
     function setup_environment(testCase)
       testCase.addTeardown(@cd,pwd);
@@ -27,10 +26,10 @@ classdef test_expcodes < matlab.unittest.TestCase
       SCDconf_setSIMconf; % set ConfigurationSettings for Simulation
     end
   
-    function setup_expcode(testCase,expcode_number)
+    function setup_expcode(testCase,expcode)
       % get this expcode object from expcode object container
-      fprintf('\n=== Testing expcode %s ===\n',expcode_number);
-      testCase.expcode_obj = getbymaincode(testCase.SCDexps,str2double(expcode_number));
+      fprintf('\n=== Testing expcode %s ===\n',expcode);
+      testCase.expcode_obj = getbymaincode(testCase.SCDexps,str2double(expcode));
     end
     
   end
@@ -57,20 +56,18 @@ classdef test_expcodes < matlab.unittest.TestCase
       testCase.expcode_obj.printinits
     end
     
-    function test_expcode_setup(testCase)
-      fprintf('\n=== Testing callinits for expcode %d: %s === \n',...
-        testCase.expcode_obj.maincode,...
-        testCase.expcode_obj.name);
-      
+    function test_expcode_setup(testCase)    
       fprintf('\n=== Testing setup for expcode %d: %s === \n',...
-        testCase.expcode_obj.maincode,...
-        testCase.expcode_obj.name);
-      
+      testCase.expcode_obj.maincode,...
+      testCase.expcode_obj.name);
       testCase.expcode_obj.setup; % run setup this exp code
     end
 
     function test_callinits(testCase)
-          testCase.expcode_obj.callinits;
+        fprintf('\n=== Testing callinits for expcode %d: %s === \n',...
+        testCase.expcode_obj.maincode,...
+        testCase.expcode_obj.name);
+        testCase.expcode_obj.callinits;
     end
     
     function test_actualize(testCase)
@@ -79,7 +76,8 @@ classdef test_expcodes < matlab.unittest.TestCase
     
     function test_expcode_compile_nodes(testCase)
       % compile each node separately first
-    
+      testCase.assumeFalse(testCase.expcode_obj.maincode==1006,'Skipping compile tests for 1006 which requires library')
+
       for inode = 1:numel(testCase.expcode_obj.nodes)
         node = testCase.expcode_obj.nodes(inode);
         if node.active
@@ -92,11 +90,16 @@ classdef test_expcodes < matlab.unittest.TestCase
       end
     end
     
-    function test_expcode_compile_all(testCase)
-      testCase.expcode_obj.compile; % compile whole tcv.slx with this expcode
+    function test_expcode_sim(testCase)
+      testCase.assumeFalse(testCase.expcode_obj.maincode==1006,'Skipping compile tests for 1006 which requires library')
+
+      fprintf('\n === Testing Simulink simulation of tcv.slx for expcode %d: === \n',testCase.expcode_obj.maincode)
+      testCase.expcode_obj.sim; % simulate whole tcv.slx with this expcode
     end
     
+    
     function test_build(testCase)
+      testCase.assumeFalse(testCase.expcode_obj.maincode==1006,'Skipping build tests for 1006 which requires library')
       testCase.expcode_obj.build;
     end
   end
diff --git a/tests/test_structbus.m b/tests/test_structbus.m
new file mode 100644
index 0000000000000000000000000000000000000000..b054474ec7e5582b16d1fd69e6478ea45be28693
--- /dev/null
+++ b/tests/test_structbus.m
@@ -0,0 +1,71 @@
+classdef test_structbus < matlab.unittest.TestCase
+  
+  properties
+    testBus = test_structbus.getTestBus();
+  end
+  
+  methods(Test,TestTags={'Unit'})
+    function testDifferentStruct(testCase)
+      mystruct = struct('a',1);
+      testCase.assertFalse(SCDconf_structbuscmp(mystruct,testCase.testBus));
+    end
+    
+    function testSameStruct(testCase)
+      mystruct = SCDconf_createstructfrombus(testCase.testBus);  % generate to match bus
+      areequal = SCDconf_structbuscmp(mystruct,testCase.testBus);
+      testCase.assertTrue(areequal);
+    end
+  end
+  
+    methods(Static)
+    function testBus = getTestBus()
+      testBus = Simulink.Bus;
+      testBus.Description = '';
+      testBus.DataScope = 'Auto';
+      testBus.HeaderFile = '';
+      testBus.Alignment = -1;
+      saveVarsTmp{1} = Simulink.BusElement;
+      saveVarsTmp{1}.Name = 'a';
+      saveVarsTmp{1}.Complexity = 'real';
+      saveVarsTmp{1}.Dimensions = 24;
+      saveVarsTmp{1}.DataType = 'single';
+      saveVarsTmp{1}.Min = [];
+      saveVarsTmp{1}.Max = [];
+      saveVarsTmp{1}.DimensionsMode = 'Fixed';
+      saveVarsTmp{1}.SamplingMode = 'Sample based';
+      saveVarsTmp{1}.SampleTime = -1;
+      saveVarsTmp{1}.DocUnits = 'varies';
+      saveVarsTmp{1}.Description = ['References for observable errors coming ' ...
+        'from the A matrix'];
+      saveVarsTmp{1}(2, 1) = Simulink.BusElement;
+      saveVarsTmp{1}(2, 1).Name = 'b';
+      saveVarsTmp{1}(2, 1).Complexity = 'real';
+      saveVarsTmp{1}(2, 1).Dimensions = 8;
+      saveVarsTmp{1}(2, 1).DataType = 'single';
+      saveVarsTmp{1}(2, 1).Min = [];
+      saveVarsTmp{1}(2, 1).Max = [];
+      saveVarsTmp{1}(2, 1).DimensionsMode = 'Fixed';
+      saveVarsTmp{1}(2, 1).SamplingMode = 'Sample based';
+      saveVarsTmp{1}(2, 1).SampleTime = -1;
+      saveVarsTmp{1}(2, 1).DocUnits = 'V';
+      saveVarsTmp{1}(2, 1).Description = ['Feed-forwards for SCR E converters' ...
+        ' voltage commands'];
+      saveVarsTmp{1}(3, 1) = Simulink.BusElement;
+      saveVarsTmp{1}(3, 1).Name = 'hyb_FF_f_u';
+      saveVarsTmp{1}(3, 1).Complexity = 'real';
+      saveVarsTmp{1}(3, 1).Dimensions = 8;
+      saveVarsTmp{1}(3, 1).DataType = 'single';
+      saveVarsTmp{1}(3, 1).Min = [];
+      saveVarsTmp{1}(3, 1).Max = [];
+      saveVarsTmp{1}(3, 1).DimensionsMode = 'Fixed';
+      saveVarsTmp{1}(3, 1).SamplingMode = 'Sample based';
+      saveVarsTmp{1}(3, 1).SampleTime = -1;
+      saveVarsTmp{1}(3, 1).DocUnits = 'V';
+      saveVarsTmp{1}(3, 1).Description = ['Feed-forwards for SCR F converters' ...
+        ' voltage commands'];
+      
+      testBus.Elements = saveVarsTmp{1};
+    end
+    end
+end
+