Interfacing function
eng


ZBUF_f

File content


//ZBUF_f Scicos discret memory bloc block
//Classical interface function ver1.0 - scilab-3
//8 juillet 2004 - IRCOM GROUP - Author : A.Layec
function [x,y,typ]=ZBUF_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,nu,nl,z,herit,exprs]=getvalue('Scicos Discrete memory block',...
      ['Size of inputs';'Size of memory word';...
      'Initial discret state';'Inherit (no:0, yes:1)'],...
      list('vec',1,'vec',1,'vec',-1,'vec',1),exprs);

      if ~ok then break,end;

      if(size(z,'*')<>nl+1) then
       message("Size of inital discrete state must be the Size of memory word+1");
       ok=%f
      end
      
      if ok then
        if herit==1 then
            model.dep_ut=[%t %f]
            [model,graphics,ok]=check_io(model,graphics,nu,[],[],[])
        else
            model.dep_ut=[%f %f]
            [model,graphics,ok]=check_io(model,graphics,nu,[],1,[])
        end
        model.in=nu
        model.dstate=z(:)
        model.ipar=nl
        graphics.exprs=exprs
        x.graphics=graphics; x.model=model;
        break
      end
   end


case 'define' then
  nu=16
  nl=128
  z=zeros(128+1,1)
  herit=0

  model=scicos_model()
  model.sim=list('z_buf',4)
  model.in=[nu]
  model.out=[]
  model.evtin=[1]
  model.evtout=[]
  model.dstate=zeros(128+1,1)
  model.rpar=[]
  model.ipar=nl
  model.blocktype='d'
  model.firing=[]
  model.dep_ut=[%f %f]

  gr_i=['txt=[''Z_buf''];';
    'xstringb(orig(1),orig(2),txt,sz(1),sz(2),''fill'');']
  exprs=[string(nu),string(nl),string('zeros(128+1,1)'),string(herit)]
  x=standard_define([2 2],model,exprs,gr_i)
end
endfunction