Skip to content

Commit 771c7f8

Browse files
committed
Improved compilation time of WBToolbox blocks by optimizing the Blockinitialization() 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.
1 parent 511abb5 commit 771c7f8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

matlab/+WBToolbox/BlockInitialization.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
blockNameSplit = strsplit(currentBlock,'/');
1717
topLevel = blockNameSplit{1};
1818

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

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

0 commit comments

Comments
 (0)