function boolVal = isFPTLaunchedOnSameModel(fpt, modelObject)
    %% helper function to determine FPT is open on the selected block in model.
    % return true if FPT is already open on the selected block, mdlref,
    % subsystem. Else returns false.
    
    %   Copyright 2016-2018 The MathWorks, Inc.
    
    model = fpt.getModel;
    boolVal = isequal(get_param(model,'Object'), modelObject);
    if ~boolVal
        % check for mdl ref
        [refMdls,~] = SimulinkFixedPoint.AutoscalerUtils.getMdlRefs(model);
        boolVal = any(strcmp(refMdls,modelObject.getFullName));
    end
    
end
