Skip to content

Commit

Permalink
Improved compilation time of WBToolbox blocks by optimizing the `Bloc…
Browse files Browse the repository at this point in the history
…kinitialization()` code.

- Refer to #189 for full details.
- In `Blockinitialization()` current implementation, we first retrieve the list of all the WBT
  blocks in the model. Then we look for the closest Config block, starting from the block's
  scope, and going up in the tree.
- The optimization consisted in retrieving only the Config blocks (name under mask is `ImConfig`)
  instead of the full list. the reduced list is enough for the second regexp, when looking for
  the closest Config, since only the lines containing `ImConfig` are supposed to match the regexp.
- This change is compatible with the support of multi-config models.
  • Loading branch information
nunoguedelha committed Jun 16, 2020
1 parent 511abb5 commit 771c7f8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions matlab/+WBToolbox/BlockInitialization.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
blockNameSplit = strsplit(currentBlock,'/');
topLevel = blockNameSplit{1};

% Get all the blocks from the top level of the system
blocks_system = find_system(topLevel,'LookUnderMasks','on','FollowLinks','on');
% Get all the "Config" blocks from the top level of the system (name of block under mask matching 'ImConfig')
blocks_system = find_system(topLevel,'LookUnderMasks','on','FollowLinks','on','Regexp','on','Name','ImConfig');

% Get the name of the block's subsystem
%[blockScopeName,~] = fileparts(blockAbsoluteName);
Expand Down

0 comments on commit 771c7f8

Please sign in to comment.