Interfacing function
eng


DESTOCKBIT_f

File content


//DESTOCKBIT_f Scicos Binary shift register function block
//Classical interface function ver1.0 - scilab-2.7
//12 novembre 2003 - IRCOM GROUP - Author : A.Layec
function [x,y,typ]=DESTOCKBIT_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,nbit,nbpaquet,exprs]=getvalue('Scicos Binary shift register function block',...
      ['Number of bit';'Number of packet'],list('vec',-1,'vec',-1),exprs);

      if ~ok then break,end;

      if size(nbit)==size(nbpaquet) then
       Nu=size(nbit,'*');
       if ok then
          graphics.exprs=exprs
          nbit=int(nbit);nbpaquet=int(nbpaquet)
          ipar=[nbit(:);nbpaquet(:)]
          model.ipar=ipar(:)
          model.dstate=zeros(Nu,1)
          model.in=Nu;model.out=Nu
          x.graphics=graphics; x.model=model;
          break;
       end
      else
       message('Vector Number of bit and Vector Number of packet must have the same size');
      end
   end

case 'define' then
  Nu=1
  nbit=3
  nbpaquet=4

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

  gr_i=['txt=[''Destockbit''];';
    'xstringb(orig(1),orig(2),txt,sz(1),sz(2),''fill'');']
  exprs=[string(nbit);string(nbpaquet)]
  x=standard_define([2 2],model,exprs,gr_i)
end
endfunction