 function checkCompatibility(sliceSubSystemH ,~, deadHandles)
    %

    %   Copyright 2014-2020 The MathWorks, Inc.
    
    
    ssType = Simulink.SubsystemType(sliceSubSystemH);
    if ~Simulink.SubsystemType.isModelBlock(sliceSubSystemH) && ~ssType.isSubsystem()
        error('ModelSlicer:SubsystemSlicing:UnsportedSubsystemType', ...
            getString(message('Sldv:ModelSlicer:Transform:NonSSorModelObject')));
    end
    % Check that the subsystem is inactive
    if any(sliceSubSystemH == deadHandles) || strcmpi(get_param(sliceSubSystemH,'CompiledIsActive'),'off')
        error('ModelSlicer:SubsystemSlicing:NothingToSlice',...
            getString(message('Sldv:ModelSlicer:Transform:InactiveSStoSlice',...
            getfullname(sliceSubSystemH))));
    end
    if Simulink.SubsystemType.isModelBlock(sliceSubSystemH)
        if ~strcmpi(get_param(sliceSubSystemH,'SimulationMode'),'normal')
           error('ModelSlicer:ComponentSlicing:NonNormalModeComponent',...
            getString(message('Sldv:ModelSlicer:Transform:NonNormalModeComponent',...
            getfullname(sliceSubSystemH))));
        else
            return;
        end
    end 
    % Check subsystem type    
    if ~( ssType.isAtomicSubsystem ...
            || ssType.isEnabledSubsystem  ...
            || ssType.isEnabledAndTriggeredSubsystem  ...
            || ssType.isTriggeredSubsystem ...
            || ssType.isFunctionCallSubsystem)
        error('ModelSlicer:SubsystemSlicing:UnsportedSubsystemType',...
            getString(message('Sldv:ModelSlicer:Transform:UnsupportedSSType'...
            ,getfullname(sliceSubSystemH),ssType.getType)));
    end
    
    % Stateflow based blocks are not supported.
    if slprivate('is_stateflow_based_block',sliceSubSystemH)
        chartId = sfprivate('block2chart', sliceSubSystemH);
        if sf('Private', 'is_eml_chart', chartId)
            str = 'MATLAB Function';
        elseif sf('Private', 'is_truth_table_chart', chartId)
            str = 'Truth Table';
        elseif Stateflow.STT.StateEventTableMan.isStateEventTableChart(chartId)
            str = 'State Transition Table';
        else
            str = 'Stateflow';
        end
        error('ModelSlicer:SubsystemSlicing:UnsportedSubsystemType',...
            getString(message('Sldv:ModelSlicer:Transform:UnsupportedSSType'...
            ,getfullname(sliceSubSystemH),str)));
    end
    
    if ~strcmp(get_param(bdroot(sliceSubSystemH),'SimulationStatus'),'stopped')
        % Check use of bus signal
        if sldvprivate('blk_has_bus',sliceSubSystemH)
            error('ModelSlicer:SubsystemSlicing:BusUnsupported',...
                getString(message('Sldv:ModelSlicer:Transform:BusUnsupported',...
                getfullname(sliceSubSystemH))));
        end
        
        % Inf sample time is not supported.
        SampleTime = get_param(sliceSubSystemH,'CompiledSampleTime');
        if isnumeric(SampleTime) && ~isempty(SampleTime) && isinf(SampleTime(1))
            error('ModelSlicer:InfSampleTimeNotSupported',...
                getString(message('Sldv:ModelSlicer:Transform:SubsystemHasInf',...
                getfullname(sliceSubSystemH))));
        end
    end
    
end
