function adasblocks_utilUseExternal(blk,para,chkpara)
% Callback function of the external source checkbox in the Adaptive Cruise
% Control (ACC) System and Lane Keeping Assit (LKA) System block dialog.
% 
% Three optional inports for ACC block:
%   - maximum acceleration amax
%   - maximum deceleration amin
%
% Four optional inports for LKA block:
%   - maximum steering angle
%   - minimum steering angle
%
%   Author: Meng Xia, Rong Chen

%   Copyright 2017-2018 The MathWorks, Inc.

% this parameter is not tunable.
if any(strcmpi(get_param(bdroot(blk),'SimulationStatus'),{'external','running'}))
    return
end
% enable/disable of external ports is not tunable
maskObj = Simulink.Mask.get(blk);
object = maskObj.Parameters.findobj('Name',para);
if strcmp(get_param(blk,chkpara),'on')
    object.Enabled = 'off';
else
    object.Enabled = 'on';
end
