//COMP_f Scicos 1 bit Quantizer block //Classical interface function - scilab-3 //IRCOM GROUP - A.Layec //REV HISTORY //$Log$ function [x,y,typ]=COMP_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,nu,ampl,herit,exprs]=getvalue('Scicos one bit comparator block',... ['Size of input vector';'Amplitude of outputs';'Inherit (no:0, yes:1)'],... list('vec',1,'vec',-1,'vec',1),exprs); if ~ok then break,end; if (size(ampl,'*')<>1)&(nu<>size(ampl,'*')) then message("Parameter Amplitude of outputs must have a size equal to 1 or equal to size of input vector"); else if ok then //nu=size(ampl,'*') 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.rpar=ampl(:) x.graphics=graphics; x.model=model; break; end end end case 'define' then ampl=1 //nu=size(ampl,'*') nu=1 herit=1 model=scicos_model() model.sim=list('comp',4) model.in=nu model.out=nu model.evtin=[] model.evtout=[] model.dstate=[] model.rpar=ampl(:) model.ipar=[] model.blocktype='d' model.firing=[] model.dep_ut=[%t %f] gr_i=['thick=xget(''thickness'')' 'pat=xget(''pattern'')' 'fnt=xget(''font'')' 'xset(''thickness'',2)' 'xpoly(orig(1)+[0.704;0.410;0.410;0.107]*sz(1),orig(2)+[0.862;0.862;0.151;0.151]*sz(2),"'lines"')' 'xpoly(orig(1)+[0.264;0.589]*sz(1),orig(2)+[0.503;0.503]*sz(2),"'lines"')' 'txt=''1-bit quantizer'';' 'style=5;' 'rectstr=stringbox(txt,orig(1),orig(2),0,style,1);' 'w=(rectstr(1,3)-rectstr(1,2))*%zoom;' 'h=(rectstr(2,2)-rectstr(2,4))*%zoom;' 'xstringb(orig(1)+sz(1)/2-w/2,orig(2)-h-4,txt,w,h,''fill'');' 'e=gce();' 'e.font_style=style;' 'xset(''thickness'',thick)' 'xset(''pattern'',pat)' 'xset(''font'',fnt(1),fnt(2))' ] exprs=[string(nu),string(ampl),string(herit)]; x=standard_define([2 2],model,exprs,gr_i) end endfunction