function validateModel
% VALIDATEMODEL InitFcn Callback of XCP CAN FD configuration block
% Validate the block in the XCP Model context

% Copyright 2021-2023 The MathWorks, Inc.

blkh = gcbh;
% No seed/key support for Simulink Real-Time
if ~isempty(regexpi(get_param(bdroot, 'SystemTargetFile'),'^slrealtime', 'ONCE')) ...
        && strcmp(get_param(gcb,'EnableSecurity'),'on')
    TLTypeStr = xcp.blkmasks.utils.getTLTypeStr(blkh);
    error(message('xcp:xcpblks:noSeedKeySupportSLRT',TLTypeStr, gcb));
end

% @todo update the usage of edit-time filter filterOutInactiveVariantSubsystemChoices()
% instead use the post-compile filter activeVariants() - g2603543
canfdTLRx = find_system(bdroot, 'FollowLinks', 'on', ...
    'MatchFilter',@Simulink.match.internal.filterOutInactiveVariantSubsystemChoices,... % look only inside active choice of VSS
    'LookUnderMasks', 'on', ...
    'FunctionName', 'sxcpcantlrx');
canfdTLTx = find_system(bdroot, 'FollowLinks', 'on', ...
    'MatchFilter',@Simulink.match.internal.filterOutInactiveVariantSubsystemChoices,... % look only inside active choice of VSS
    'LookUnderMasks', 'on', ...
    'FunctionName', 'sxcpcantltx');

% No blocks found.
if ( (isempty(canfdTLTx) || isempty(canfdTLRx)))
    error(message('xcp:xcpblks:noCANTLBlocks'));
end

% More than one found.
if ( (length(canfdTLTx)>1) || (length(canfdTLRx)>1))
    error(message('xcp:xcpblks:multipleCANTLBlocks'));
end
end %validateModel