//EYESCOPE_c Scicos eye diagram scope block //Classical interface function ver1.0 - scilab-4.1 //26 mars 2007 - INRIA - Author : A.Layec function [x,y,typ]=EYESCOPE_c(job,arg1,arg2) // Copyright INRIA 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=[]; case 'getorigin' then [x,y]=standard_origin(arg1) case 'set' then x=arg1; graphics=arg1.graphics;exprs=graphics.exprs; model=arg1.model; while %t do [ok,insz,wid,Tse,ne,ns,nt,y_dim,herit,exprs]=getvalue(.. 'Set Scope parameters',.. ['In size'; 'Output window number (automatic:-1)'; 'Sampling period'; 'Samples per symbol'; 'Number of symbols'; 'Number of traces'; 'Y axis bound [min,max] (autoscale:-1)'; 'Inherit (no:0, yes:1)'],.. list('vec',1, 'vec',1, 'vec',1, 'vec',1, 'vec',1, .. 'vec',1, 'vec',-1, 'vec',1),exprs) if ~ok then break,end //user cancel modification mess=[] //check values of user param if Tse<=0 then mess=[mess;'Sampling period must be greather than zero';' '] ok=%f end if ne<=0 then mess=[mess;'Sampling per symbol must be greather than zero';' '] ok=%f end if ns<=0 then mess=[mess;'Number of symbols must be greather than zero';' '] ok=%f end if nt<=0 then mess=[mess;'Number of trace must be greather than zero';' '] ok=%f end if size(y_dim,'*')==1|size(y_dim,'*')==0 then //autoscale ymin=-1; ymax=-1; scaltyp=1 else if y_dim(1)==-1 & y_dim(2)==-1 then //autoscale ymin=-1; ymax=-1; scaltyp=1 else if y_dim(1)>=y_dim(2) then mess=[mess;'Ymax must be greater than Ymin';' '] ok=%f else ymin=y_dim(1); ymax=y_dim(2); scaltyp=0 end end end if ~ok then message(['Some specified values are inconsistent:'; ' ';mess]) end //auto adjustement of some values if ok then if insz==0 then insz=-1, end if size(insz,'*')<>1 then insz=insz(1), end if herit==1 then [model,graphics,ok]=check_io(model,graphics,insz,[],[],[]) else [model,graphics,ok]=check_io(model,graphics,insz,[],1,[]) end end if ok then model.ipar = [wid;ne;ns;,nt;scaltyp] model.rpar = [Tse;ymin;ymax] model.dstate = [0;0;0;0] //[Samples;Symbols;Traces;ind_gr] graphics.exprs=exprs; x.graphics=graphics;x.model=model break end end case 'define' then insz = -1 wid = -1 //ipar(1) Tse = 1 //rpar(1) ne = 8 //ipar(2) ns = 2 //ipar(3) nt = 20 //ipar(4) // y_dim = [-1;-1] ymin = -1 //rpar(2) ymax = -1 //rpar(3) scaltyp = 1 //ipar(5) herit = 0 model=scicos_model() model.sim = list('eye_scope',4) model.in = insz model.out = [] model.evtin = [1] model.evtout = [] model.dstate = [0;0;0;0] //[Samples;Symbols;Traces;ind_gr] model.ipar = [wid;ne;ns;,nt;scaltyp] model.rpar = [Tse;ymin;ymax] model.blocktype = 'd' model.firing = [] model.dep_ut = [%t %f] exprs=[string(insz) string(wid) string(Tse) string(ne) string(ns) string(nt) sci2exp([-1 -1]) string(herit)]; gr_i=['thick=xget(''thickness'');'; 'pat=xget(''pattern'');'; 'fnt=xget(''font'');'; 'a=orig(1)+sz(1)/10;'; 'b=a+sz(1)*8/10;'; 'd=orig(2)+(1-1/10)*sz(2);'; 'c=d-sz(2)*8/10;'; ''; 'xset(''thickness'',2);'; 'xrect(a,d,sz(1)*8/10,sz(2)*8/10);'; ''; 'cc=0.2*(d-c)/2;'; 'ccc=0.15*(d-c)/2;'; 'c1=c+cc;d1=d-cc;'; 'cc1=c+ccc;dd1=d-ccc;'; ''; 'xx=(a:(b-a)/16:b);'; 'xx=xx'';'; ''; 'yy=[1 ; 0.873;'; ' 0.626 ; 0.311;'; ' -0.041 ; -0.390;'; ' -0.692 ; -0.906;'; ' -1 ; -0.956;'; ' -0.793 ; -0.520;'; ' -0.177 ; 0.189;'; ' 0.528 ; 0.795;'; ' 1];'; ''; 'xset(''thickness'',1);'; 'xpoly(xx,((yy+1)/2)*(d1-c1)+c1);'; 'xpoly(xx,((-yy+1)/2)*(d1-c1)+c1);'; 'xpoly([a;b],[cc1;cc1]);'; 'xpoly([a;b],[dd1;dd1]);'; 'xset(''thickness'',thick);'; 'xset(''pattern'',pat);'; 'xset(''font'',fnt(1),fnt(2));'; ] x=standard_define([2 2],model,exprs,gr_i) end endfunction