function [state, message] = plctoolstrip_statefunction(obj, ~)%
%

%   Copyright 2018 The MathWorks, Inc.

    [state, message] = check_allowed_atomic_subsys(obj);
end

function [state, message] = check_allowed_atomic_subsys(obj)
    state = 'nonsupported';
    message = 'Select Subsystem block to generate PLC code';
    if ~isa(obj, 'Simulink.SubSystem')
        return;
    end
    
    message = '';
    ports = obj.Ports;
    if ~strcmpi(obj.TreatAsAtomicUnit,'on') || ports(3) ~= 0 || ports(4) ~= 0
        state = 'convertible';
        return;
    end    
    
    state = 'supported';
end

% LocalWords:  nonsupported
