Interfacing function
eng


NDELAY_f

File content


//NDELAY_f Scicos vector shift register
//Classical interface function ver1.0 - scilab-2.7
//18 novembre 2003 - IRCOM GROUP - Author : A.Layec
function [x,y,typ]=NDELAY_f(job,arg1,arg2)
x=[];y=[];typ=[]
select job
case 'plot' then
  standard_draw(arg1)
case 'getinputs' then
  [x,y,typ]=standard_inputs(arg1)
case 'getoutputs' then
  [x,y,typ]=standard_outputs(arg1)
case 'getorigin' then
  [x,y]=standard_origin(arg1)
case 'set' then
   x=arg1;
   graphics=arg1.graphics;model=arg1.model;
   exprs=graphics.exprs;

   while %t do

      [ok,ndelay,exprs]=getvalue(['Vector Shift Register';...
      'Set number of delay'],...
      ['Size of Delay'],...
      list('vec',-1),exprs);

      if ~ok then break,end;

      Nu = prod(size(ndelay));
      [model,graphics,ok]=check_io(model,graphics,Nu,Nu,1,[])
      ndelay=ndelay(:)
      sizez=0
      for i=1:Nu
        sizez=sizez+ndelay(i);
      end
      init=zeros(sizez,1)
      if ok then
          graphics.exprs=exprs
          model.dstate=init(:)
          model.ipar=ndelay(:)
          x.graphics=graphics; x.model=model;
          break;
       end
   end

case 'define' then
  Nu=1
  ndelay=4
  init=zeros(ndelay,1)

  model=scicos_model()
  model.sim=list('ndelay',2)
  model.in=Nu
  model.out=Nu
  model.evtin=1
  model.evtout=[]
  model.dstate=init
  model.rpar=[]
  model.ipar=ndelay
  model.blocktype='d'
  model.firing=[]
  model.dep_ut=[%f %f]

  gr_i=['txt=[''Delay''];';
    'xstringb(orig(1),orig(2),txt,sz(1),sz(2),''fill'');']
  exprs=[sci2exp(ndelay)];
  x=standard_define([2 2],model,exprs,gr_i)
end
endfunction