//ZBUFT_f Scicos discret memory bloc block //Classical interface function ver1.0 - scilab-3 //4 Mai 2005 - IRCOM GROUP - Author : A.Layec function [x,y,typ]=ZBUFT_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,nl,opt,z,herit,exprs]=getvalue('Scicos Discrete memory block',... ['Size of memory word';'Computation of period jitter (0:No/1:Yes)?' 'Initial discret state';'Inherit (no:0, yes:1)'],... list('vec',1,'vec',1,'vec',-1,'vec',1),exprs); if ~ok then break,end; if(size(z,'*')<>nl+2) then message("Size of inital discrete state must be the Size of memory word+2"); ok=%f end if ok then if herit==1 then model.dep_ut=[%t %f] [model,graphics,ok]=check_io(model,graphics,-1,[],[],[]) model.in=-1; else model.dep_ut=[%f %f] [model,graphics,ok]=check_io(model,graphics,[],[],1,[]) model.in=[]; end model.dstate=z(:) model.ipar=[nl;opt] graphics.exprs=exprs x.graphics=graphics; x.model=model; break end end case 'define' then nl=128 z=zeros(128+2,1) herit=0 opt=1 model=scicos_model() model.sim=list('z_buft',4) model.in=[] model.out=[] model.evtin=[1] model.evtout=[] model.dstate=zeros(128+2,1) model.rpar=[] model.ipar=[nl;opt] model.blocktype='d' model.firing=[] model.dep_ut=[%f %f] gr_i=['txt=[''Z_buft''];'; 'xstringb(orig(1),orig(2),txt,sz(1),sz(2),''fill'');'] exprs=[string(nl),string(opt),string('zeros(128+2,1)'),string(herit)] x=standard_define([2 2],model,exprs,gr_i) end endfunction