classdef CSDLinearizationID < modelpack.CSDPortID
    %modelpack.CSDLinearizationID class
    %   modelpack.CSDLinearizationID extends modelpack.CSDPortID.
    %

    %    modelpack.CSDLinearizationID properties:
    %       Description - Property is of type 'ustring'
    %       isOpenLoop - Property is of type 'bool'  (read only)
    %
    %    modelpack.CSDLinearizationID methods:
    %       setOpenLoop -  method to set linearization port open-loop setting.
    %       setType -  method to set linearization port type.

    % Copyright 2000-2023 The MathWorks, Inc.

    properties (SetAccess=private, SetObservable)
        %ISOPENLOOP Property is of type 'bool'  (read only)
        isOpenLoop = false;
    end

    methods  % constructor block
        function this = CSDLinearizationID(Name,Dimension,Path,Type)
            % CSDLinearizationID  constructor for SISOTOOL linearization port object
            %
            % h = modelpack.CSDLinearizationID(Name,Dimension,[Path],[Type])
            %
            % Inputs:
            %   Name      - string with port name
            %   Dimension - double vector with port dimensions
            %   Path      - string with path to port
            %   Type      - string with port type, valid types {'Input'|'Output'}
            %

            %Instantiate object

            % No argument constructor call
            if nargin == 0, return, end

            %Check number of arguments
            if nargin < 2 || nargin > 4
                error(message('SLControllib:modelpack:errNumArguments','2 to 4'))
            end

            %Set default input arguments
            if nargin < 3 || isempty(Path), Path = ''; end
            if nargin < 4 || isempty(Type), Type = 'Output'; end

            %Check input argument types
            if ~any(strcmpi({'Input','Output'},Type))
                error(message('SLControllib:modelpack:errValueEnumerated','Type','{''Input''|''Output''}'));
            end

            %Set properties
            this.Version    = 1.0;
            this.Name       = Name;
            this.Path       = Path;
            this.PortNumber = 1;
            this.Dimension  = Dimension;
            this.Type       = Type;


        end  % CSDLinearizationID

    end  % constructor block

    methods
        function set.isOpenLoop(obj,value)
            % DataType = 'bool'
            validateattributes(value,{'numeric','logical'}, {'scalar','nonnan'},'','isOpenLoop')
            value = logical(value); %  convert to logical
            obj.isOpenLoop = value;
        end

    end   % set and get functions

    methods  % public methods
        function setOpenLoop(~,~)
            % SETOPENLOOP  method to set linearization port open-loop setting.
            %
            % As SISOTOOL port types cannot be set this method is a no-op, but is
            % required for consistency with the model API.
            %


            warning(message('SLControllib:modelpack:stWarnReadOnly','open-loop'))
        end  % setOpenLoop

        function setType(~,~)
            % SETTYPE  method to set linearization port type.
            %
            % As SISOTOOL port types cannot be set this method is a no-op, but is
            % required for consistency with the model API.
            %


            warning(message('SLControllib:modelpack:stWarnReadOnly','Type'))
        end  % setType

    end  % public methods

end  % classdef

% LocalWords:  ISOPENLOOP SETOPENLOOP
