classdef model_singleserver < coupled 
  %% Description
  %  model of generator, queue, server and terminator
  %% Ports
  %  no input, no output (root model)
  %% Parameters
  % tG: generation time interval
  % tS: service time
  % debug: flag to output debugging infos
  %
  methods
    function obj = model_singleserver(name, varargin)
      obj=obj@coupled(name);
      
      tG = varargin{1};
      tS = varargin{2};
      debug = varargin{3};

      % Instantiate a generator
      n0 = 0;
      gen = am_generator('gen', tG, n0, debug);

      % Instantiate a queue
      queue = am_queue('queue', debug);

      % Instantiate a server
      server = am_server('server', tS, debug);

      % Instantiate a terminator
      term = am_terminator('term');

      addcomponents(obj, {gen, queue, server, term});

      set_x_ports(obj, {});
      set_y_ports(obj, {});

      Zid = {'gen', 'out', 'queue', 'in'; ...
             'queue', 'out', 'server','in';...
             'server','out','term','in';...
             'server', 'working', 'queue', 'bl'};
      set_Zid(obj, Zid);
    end             
  end
end
