Interfacing function
eng


SYSTEMG_f

File content


//SYSTEMG_f Scicos Chua sub-system G block
//Classical interface function ver1.0 - scilab-2.7
//18 novembre 2003 - IRCOM GROUP - Author : A.Layec
function [x,y,typ]=SYSTEMG_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,init,A,m0,m1,exprs]=getvalue('Chua sub-system G',...
    ['Initial condition';'A';'m0';'m1'],list('vec',-1,'vec',-1,'vec',-1,'vec',-1),exprs);

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

     if ((size(init)==size(A)) & (size(A)==size(m0)) & (size(m0)==size(m1)) ) then
       if ok then
          graphics.exprs=exprs
          model.in=Nu
          model.out=Nu
          model.state=init(:)
          model.rpar=[A(:);m0(:);m1(:)]
          x.graphics=graphics; x.model=model
          break
       end
     else
        message('All parameters must have the same size');
     end
   end

case 'define' then

  Nu=1
  A=15.6
  m0=-8/7
  m1=-5/7
  init = 1.6

  model=scicos_model()
  model.sim=list('systemg',2)
  model.in=Nu
  model.out=Nu
  model.evtin=[]
  model.evtout=[]
  model.dstate=[]
  model.state=init
  model.rpar=[A;m0;m1]
  model.ipar=[]
  model.blocktype='c'
  model.firing=[]
  model.dep_ut=[%f %t]

  gr_i=['txt=[''Chua'';''sub-system G''];';
    'xstringb(orig(1),orig(2),txt,sz(1),sz(2),''fill'');']
  exprs=[string('1.6'),string('15.6'),string('-8/7'),string('-5/7')];
  x=standard_define([3 2],model,exprs,gr_i)
end
endfunction