Interfacing function
eng


INTSYMB_f

File content


//INTSYMB_f Scicos Symbol Integrator block
//Classical interface function ver1.0 - scilab-3
//22 décembre 2004  Author : - IRCOM GROUP - A.Layec
function [x,y,typ]=INTSYMB_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

      text=['Set Scicos Symbol Integrator']
      [ok,nu,nech,init,gain,herit,exprs]=getvalue(text,...
      ['Size of inputs';'Number of sample';'Initial sample';...
      'Gain';'Inherit (no:0, yes:1)'],...
      list('vec',1,'vec',1,'vec',1,'vec',1,'vec',1),exprs)

      if ~ok then break,end;

      if init<1 then
        message('The initial sample must be positive.')
        ok=%f
      end

      if ok then
          if herit==1 then
            model.dep_ut=[%t %f]
            [model,graphics,ok]=check_io(model,graphics,nu,nu,[],[])
          else
            model.dep_ut=[%t %f]
            [model,graphics,ok]=check_io(model,graphics,nu,nu,1,[])
          end
          graphics.exprs=exprs
          model.in=nu
          model.out=nu
          model.dstate=[0 0]
          model.ipar=[nech;init]
          model.rpar=1/gain
          x.graphics=graphics;x.model=model
          break;
      end
   end

case 'define' then
  nu=64
  herit=1
  nech=8
  init=1
  gain=1

  model=scicos_model()
  model.sim=list('int_symb',4)
  model.in=nu
  model.out=nu
  model.evtin=[]
  model.evtout=[]
  model.dstate=[0 0]
  model.rpar=1/gain
  model.ipar=[nech;init]
  model.blocktype='d'
  model.firing=[]
  model.dep_ut=[%t %f]

  gr_i=['thick=xget(''thickness'')'
        'pat=xget(''pattern'')'
        'fnt=xget(''font'')'
        'txt=''0'';'
        'style=2;'
        'rectstr=stringbox(txt,orig(1)+0.05*sz(1),orig(2)+0.1*sz(2),0,style,0);'
        'w=(rectstr(1,3)-rectstr(1,2))*%zoom;'
        'h=(rectstr(2,2)-rectstr(2,4))*%zoom;'
        'xstringb(orig(1)+0.05*sz(1),orig(2)+0.1*sz(2),txt,w,h,''fill'');'

//        'xstring(orig(1)+0.05*sz(1),orig(2)+0.1*sz(2),""0 "",0,0)'
        'txt=''Ts'';'
        'style=2;'
        'rectstr=stringbox(txt,orig(1)+0.63*sz(1),orig(2)+0.7*sz(2),0,style,0);'
        'w=(rectstr(1,3)-rectstr(1,2))*%zoom;'
        'h=(rectstr(2,2)-rectstr(2,4))*%zoom;'
        'xstringb(orig(1)+0.63*sz(1),orig(2)+0.7*sz(2),txt,w,h,''fill'');'

//        'xstring(orig(1)+0.63*sz(1),orig(2)+0.7*sz(2),""Ts "",0,0)'
        'xpoly(orig(1)+[0.601;0.5;0.453;0.406;0.357;0.3]*sz(1),orig(2)+[0.888;0.833;0.711;0.252;0.153;0.153]*sz(2),''lines'')'
        'xset(''thickness'',thick)'
        'xset(''pattern'',pat)'
        'xset(''font'',fnt(1),fnt(2))'
       ]
  exprs=[string(nu),string(nech),string(init),string(gain),string(herit)]
  x=standard_define([2 2],model,exprs,gr_i)
end
endfunction