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

24 lines
944 B
Matlab

% Copyright 2024 Volvo Car Corporation
% Licensed under Apache 2.0.
function out = parsePreProcBlks(model)
% parsePreProcBlks Find all preprocessor blocks in the model
%
% See also parseModelInfo
preProcessorBlks = find_system(model, 'FindAll', 'on', 'RegExp', 'on', ...
'LookUnderMasks', 'all', 'MaskType', 'TL_PreProcessorIf');
blks = {};
for sbh=preProcessorBlks'
ports = get_param(sbh, 'PortHandles');
l=get_param(ports.Inport, 'Line');
blk = get_param(l, 'SrcBlockHandle');
if strcmp(get_param(blk, 'blocktype'), 'Inport')
tmp=get_param(get_param(blk,'parent'), 'linehandles');
blk=get_param(tmp.Inport(str2num(get_param(blk, 'port'))), 'srcblockhandle');
end
if_exp = tl_get(sbh, 'ifexpression');
blks = [strrep(if_exp,'u1',get_param(blk, 'const_name')); blks];
end
out = unique(blks);
end