olindgre 2ece01e1d7 Make powertrain-build not overlap with pybuild in site-packages
Change-Id: I7b59f3f04f0f787d35db0b9389f295bf1ad24f56
2024-09-17 10:25:04 +02:00

21 lines
754 B
Matlab

% Copyright 2024 Volvo Car Corporation
% Licensed under Apache 2.0.
function topLevelSystem = topLevelSystem(model)
%Function which returns a string to the top level target link subsystem
%Takes one argument, which is the model names
tlFncs = find_system(model, 'FindAll', 'on', 'LookUnderMasks', 'all', ...
'Regexp' ,'on', 'MaskType', 'TL_Function');
funcParents = get_param(tlFncs, 'Parent');
if ~iscell(funcParents)
funcParents = {funcParents};
end
lenFncs = cellfun(@(p)length(p), funcParents);
if ~isempty(lenFncs)
topLevelIdx = lenFncs == min(lenFncs(:));
topLevelSystem = funcParents{topLevelIdx};
else
error('did not find any TL_Function blocks')
end
end