Interfacing function
eng


CPF_f

File content


//CPF_f Scicos Phase/Frequency Comparator block
//Classical interface function ver1.1 - scilab-3
//13 janvier 2005 - IRCOM GROUP - Author : A.Layec
function [x,y,typ]=CPF_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,d_puls,exprs]=getvalue('Scicos Phase/Frequency Comparator block',...
      ['Lenght of anti-backlash pulse (0:No pulse/Length of pulse [s])'],...
      list('vec',1),exprs);

      if ~ok then break,end;
        if ok then
           if d_puls<>0 then
            [model,graphics,ok]=check_io(model,graphics,[],[1;1],[1;1;1],[1])
            model.out=[1;1]
            model.evtin=[1;1;1]
            model.evtout=[1]       
            model.firing=[-1]
            model.rpar=[d_puls]
            model.sim=list('cpft',4)
           else
            [model,graphics,ok]=check_io(model,graphics,[],[1;1],[1;1],[])
            model.out=[1;1]
            model.evtin=[1;1]
            model.evtout=[]       
            model.firing=[]
            model.rpar=[]
            model.sim=list('cpf',4)
           end
           graphics.exprs=exprs
           x.graphics=graphics; x.model=model;
           break
        end
      end

case 'define' then
  d_puls=0
  
  model=scicos_model()
  model.sim=list('cpf',4)
  model.in=[]
  model.out=[1;1]
  model.evtin=[1;1]
  model.evtout=[]
  model.dstate=[0;0;0]
  model.rpar=[]
  model.ipar=[]
  model.blocktype='d'
  model.firing=[]
  model.dep_ut=[%f %f]

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