function [x,y,typ]=PCLOCK_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 //paths to updatable parameters or states ppath = list(1,2) newpar=list(); y=0; for path=ppath do np=size(path,'*') spath=list() for k=1:np spath($+1)='model' spath($+1)='rpar' spath($+1)='objs' spath($+1)=path(k) end xx=arg1(spath)// get the block execstr('xxn='+xx.gui+'(''set'',xx)') if ~isequalbitwise(xxn,xx) then model=xx.model model_n=xxn.model if ~is_modelica_block(xx) then modified=or(model.sim<>model_n.sim)|.. ~isequal(model.state,model_n.state)|.. ~isequal(model.dstate,model_n.dstate)|.. ~isequal(model.odstate,model_n.odstate)|.. ~isequal(model.rpar,model_n.rpar)|.. ~isequal(model.ipar,model_n.ipar)|.. ~isequal(model.opar,model_n.opar)|.. ~isequal(model.label,model_n.label) if or(model.in<>model_n.in)|or(model.out<>model_n.out)|.. or(model.in2<>model_n.in2)|or(model.out2<>model_n.out2)|.. or(model.outtyp<>model_n.outtyp)|or(model.intyp<>model_n.intyp) then needcompile=1 end if or(model.firing<>model_n.firing) then needcompile=2 end if (size(model.in,'*')<>size(model_n.in,'*'))|.. (size(model.out,'*')<>size(model_n.out,'*')) then needcompile=4 end if model.sim=='input'|model.sim=='output' then if model.ipar<>model_n.ipar then needcompile=4 end end if or(model.blocktype<>model_n.blocktype)|.. or(model.dep_ut<>model_n.dep_ut) then needcompile=4 end if (model.nzcross<>model_n.nzcross)|(model.nmode<>model_n.nmode) then needcompile=4 end if prod(size(model_n.sim))>1 then if model_n.sim(2)>1000 then if model.sim(1)<>model_n.sim(1) then needcompile=4 end end end else modified=or(model_n<>model) eq=model.equations;eqn=model_n.equations; if or(eq.model<>eqn.model)|or(eq.inputs<>eqn.inputs)|.. or(eq.outputs<>eqn.outputs) then needcompile=4 end end //parameter or states changed arg1(spath)=xxn// Update newpar(size(newpar)+1)=path// Notify modification y=max(y,needcompile) end end x=arg1 typ=newpar case 'define' then scs_m_1=scicos_diagram(.. version="scicos4.2",.. props=scicos_params(.. wpar=[600,450,0,0,600,450],.. Title="PCLOCK_f",.. tol=[0.0001;0.000001;1.000E-10;100001;0;0;0],.. tf=270,.. context=" ",.. void1=[],.. options=tlist(["scsopt","3D","Background","Link","ID","Cmap"],list(%t,33),[8,1],[1,5],.. list([5,1],[4,1]),[0.8,0.8,0.8]),.. void2=[],.. void3=[],.. doc=list())) scs_m_1.objs(1)=scicos_block(.. gui="PEVTDLY_f",.. graphics=scicos_graphics(.. orig=[273.70536,308.45238],.. sz=[60,40],.. flip=%t,.. theta=0,.. exprs=["0.1";"0"],.. pin=7,.. pout=[],.. pein=5,.. peout=[5;3;4],.. gr_i=list(.. ["txt=[''Phase'';''Modulator''];"; "xstringb(orig(1),orig(2),txt,sz(1),sz(2),''fill'');"],8),.. id="",.. in_implicit="E",.. out_implicit=[]),.. model=scicos_model(.. sim=list("pevtdly",4),.. in=1,.. in2=[],.. intyp=1,.. out=[],.. out2=[],.. outtyp=1,.. evtin=1,.. evtout=[1;1;1],.. state=[],.. dstate=0,.. odstate=list(),.. rpar=1,.. ipar=[],.. opar=list(),.. blocktype="d",.. firing=[0;-1;-1],.. dep_ut=[%f,%f],.. label="",.. nzcross=0,.. nmode=0,.. equations=list()),.. doc=list()) scs_m_1.objs(2)=scicos_block(.. gui="CLKSOMV_f",.. graphics=scicos_graphics(.. orig=[295.37202,264.55357],.. sz=[16.666667,16.666667],.. flip=%t,.. theta=0,.. exprs=[],.. pin=[],.. pout=[],.. pein=[0;3;4],.. peout=9,.. gr_i=list(.. ["rx=sz(1)*p/2;ry=sz(2)/2"; "xsegs(orig(1)+rx*[1/2.3 1;2-1/2.3 1],orig(2)+ry*[1 2-1/2.3;1,1/2.3],0)"],8),.. id="",.. in_implicit=[],.. out_implicit=[]),.. model=scicos_model(.. sim="sum",.. in=[],.. in2=[],.. intyp=1,.. out=[],.. out2=[],.. outtyp=1,.. evtin=[1;1;1],.. evtout=1,.. state=[],.. dstate=[],.. odstate=list(),.. rpar=[],.. ipar=[],.. opar=list(),.. blocktype="d",.. firing=-1,.. dep_ut=[%f,%f],.. label="",.. nzcross=0,.. nmode=0,.. equations=list()),.. doc=list()) scs_m_1.objs(3)=scicos_link(.. xx=[303.70536;303.70536],.. yy=[302.7381;281.22024],.. id="drawlink",.. thick=[0,0],.. ct=[5,-1],.. from=[1,2,0],.. to=[2,2,1]) scs_m_1.objs(4)=scicos_link(.. xx=[318.70536;318.70536;312.03869],.. yy=[302.7381;272.8869;272.8869],.. id="drawlink",.. thick=[0,0],.. ct=[5,-1],.. from=[1,3,0],.. to=[2,3,1]) scs_m_1.objs(5)=scicos_link(.. xx=[288.70536;288.70536;252.87202;252.87202;303.70536;303.70536],.. yy=[302.7381;292.08333;292.08333;367.23214;367.23214;354.16667],.. id="drawlink",.. thick=[0,0],.. ct=[5,-1],.. from=[1,1,0],.. to=[1,1,1]) scs_m_1.objs(6)=scicos_block(.. gui="IN_f",.. graphics=scicos_graphics(.. orig=[225.13393,318.45238],.. sz=[20,20],.. flip=%t,.. theta=0,.. exprs="1",.. pin=[],.. pout=7,.. pein=[],.. peout=[],.. gr_i=list(" ",8),.. id="",.. in_implicit=[],.. out_implicit="E"),.. model=scicos_model(.. sim="input",.. in=[],.. in2=[],.. intyp=1,.. out=-1,.. out2=-2,.. outtyp=-1,.. evtin=[],.. evtout=[],.. state=[],.. dstate=[],.. odstate=list(),.. rpar=[],.. ipar=1,.. opar=list(),.. blocktype="c",.. firing=[],.. dep_ut=[%f,%f],.. label="",.. nzcross=0,.. nmode=0,.. equations=list()),.. doc=list()) scs_m_1.objs(7)=scicos_link(.. xx=[245.13393;265.13393],.. yy=[328.45238;328.45238],.. id="drawlink",.. thick=[0,0],.. ct=[1,1],.. from=[6,1,0],.. to=[1,1,1]) scs_m_1.objs(8)=scicos_block(.. gui="CLKOUTV_f",.. graphics=scicos_graphics(.. orig=[293.70536,206.93452],.. sz=[20,30],.. flip=%t,.. theta=0,.. exprs="1",.. pin=[],.. pout=[],.. pein=9,.. peout=[],.. gr_i=list(" ",8),.. id="",.. in_implicit=[],.. out_implicit=[]),.. model=scicos_model(.. sim="output",.. in=[],.. in2=[],.. intyp=1,.. out=[],.. out2=[],.. outtyp=1,.. evtin=1,.. evtout=[],.. state=[],.. dstate=[],.. odstate=list(),.. rpar=[],.. ipar=1,.. opar=list(),.. blocktype="d",.. firing=[],.. dep_ut=[%f,%f],.. label="",.. nzcross=0,.. nmode=0,.. equations=list()),.. doc=list()) scs_m_1.objs(9)=scicos_link(.. xx=[303.70536;303.70536],.. yy=[266.93452;236.93452],.. id="drawlink",.. thick=[0,0],.. ct=[5,-1],.. from=[2,1,0],.. to=[8,1,1]) model=scicos_model(.. sim="csuper",.. in=-1,.. in2=[],.. intyp=1,.. out=[],.. out2=[],.. outtyp=1,.. evtin=[],.. evtout=1,.. state=[],.. dstate=[],.. odstate=list(),.. rpar=scs_m_1,.. ipar=[],.. opar=list(),.. blocktype="h",.. firing=[],.. dep_ut=[%f,%f],.. label="",.. nzcross=0,.. nmode=0,.. equations=list()) gr_i=list(.. ["wd=xget(''wdim'').*[1.016,1.12];"; "thick=xget(''thickness'');xset(''thickness'',2);"; "p=wd(2)/wd(1);p=1;"; "rx=sz(1)*p/2;ry=sz(2)/2;"; "xarcs([orig(1)+0.05*sz(1);"; "orig(2)+0.95*sz(2);"; " 0.9*sz(1)*p;"; " 0.9*sz(2);"; " 0;"; " 360*64],scs_color(5));"; "xset(''thickness'',1);"; "xx=[orig(1)+rx orig(1)+rx;"; " orig(1)+rx orig(1)+rx+0.6*rx*cos(%pi/6)];"; "yy=[orig(2)+ry orig(2)+ry ;"; " orig(2)+1.8*ry orig(2)+ry+0.6*ry*sin(%pi/6)];"; "xsegs(xx,yy,scs_color(10));"; "xset(''thickness'',thick);"],8) x=standard_define([2 2],model,[],gr_i) end endfunction