function [designSid, replacementSid, sid, sfObjType, sfObjNum, isSfun, statePortIdx] = getModelObjectInfoInDesignModel(testcomp, modelObj)
%

% Copyright 2019-2022 The MathWorks, Inc.

    statePortIdx = 0;

    if modelObj.isStateflow
        if modelObj.slBlkH~=0
            designObjectSL = Sldv.DataUtils.getDesignObject(testcomp, modelObj.slBlkH);
        else
            designObjectSL = 0;
        end
        [designObjectSF, replacementSid] = Sldv.DataUtils.getDesignObject(testcomp, modelObj.sfObjID);
    else
        if modelObj.slBlkH~=0
            [designObjectSL, replacementSid] = Sldv.DataUtils.getDesignObject(testcomp, modelObj.slBlkH);

            try
                lineInfo = get_param(modelObj.slBlkH,'LineHandles');
                if ~isempty(lineInfo.State)
                    statePortIdx = numel(lineInfo.Outport)+1;
                end
            catch Mex %#ok<NASGU>
            end
        else
            % External MATLAB files from MLSysBlk
            designObjectSL = 0;
            replacementSid = '';
        end
        designObjectSF = 0;
    end

    [sfObjType, sfObjNum, designSid] = Sldv.DataUtils.getPathAndNumber(modelObj, designObjectSL, designObjectSF);

    [~, ~, sid, isSfun] = Sldv.DataUtils.getPathAndNumber(modelObj);
end
