Interfacing function
eng


GENMLLSRS_f

File content


//GENMLLSRS_f Scicos Maximal Length Linear feddback Shift Regiter Sequences Generator block
//Classical interface function ver1.0 - scilab-2.7&3.0
//15 dec 2004 - IRCOM GROUP - Author : A.Layec
function [x,y,typ]=GENMLLSRS_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,ny,long,ci,coef,exprs]=getvalue('PN Sequence generator',...
   ['Vector of Size of outputs';...
   'Vector of Length of register';...
   'Vector of Initial condition register';...
   'Vector of coefficients register'],...
   list('vec',-1,'vec',-1,'vec',-1,'vec',-1),exprs);

   if ~ok then break,end;
   Nu=size(long,'*')

   if ((size(long)==size(ny))&(size(long)==size(ci))&(size(long)==size(coef))) then
       if ok then
          graphics.exprs=exprs;
          model.out=sum(ny)
          model.dstate=ci(:)
          ipar = [Nu;ny(:);long(:);coef(:)]
          model.ipar=ipar(:)
          x.graphics=graphics; x.model=model
          break
        end
     else
       message('All parameters must have the same size');
     end
 end

case 'define' then
  ny=(2^5)-1
  Nu=1
  long=5
  ci=21
  coef=9

  model=scicos_model()
  model.sim=list('genmllsrs',4)
  model.in=[]
  model.out=ny
  model.evtin=1
  model.evtout=[]
  model.dstate=ci
  model.rpar=[]
  model.ipar=[Nu;ny;long;coef]
  model.blocktype='d'
  model.firing=[]
  model.dep_ut=[%f %f]

  gr_i=['txt=[''PN Sequence'';''Generator''];';
   'xstringb(orig(1),orig(2),txt,sz(1),sz(2),''fill'');']
  exprs=[sci2exp(ny);sci2exp(long);sci2exp(ci);sci2exp(coef)];
  x=standard_define([3 2],model,exprs,gr_i)
end
endfunction