1
function [x,y,typ]=DELAY_f(job,arg1,arg2)
8
[x,y,typ]=standard_inputs(arg1)
10
[x,y,typ]=standard_outputs(arg1)
12
[x,y]=standard_origin(arg1)
14
// paths to updatable parameters or states
18
register_label=x(3)(8)(4)(2)(4)
19
evtdly_label=x(3)(8)(5)(2)(4)
20
label=[evtdly_label(1);register_label]
22
[ok,dt,z0,label]=getvalue(['This block implements as a discretised delay';
23
'it is consist of a shift register and a clock';
24
'value of the delay is given by;'
25
'the discretisation time step multiplied by the';
26
'number-1 of state of the register'],..
27
['Discretisation time step';
28
'Register initial state'],list('vec',1,'vec',-1),label)
31
if prod(size(z0))<2 then
32
mess=[mess;'Register length must be at least 2';' ']
36
mess=[mess;'Discretisation time step must be positive';' ']
39
if ~ok then message(mess);end
42
x(3)(8)(5)(2)(4)(1)=label(1);
43
x(3)(8)(5)(3)(11)=0; //initial delay firing date
44
if x(3)(8)(5)(3)(8)<>dt then //Discretisation time step
46
newpar($+1)=5 // notify clock changes
49
x(3)(8)(4)(2)(4)=label(2)
50
if or(x(3)(8)(4)(3)(7)<>z0(:)) then //Register initial state
51
x(3)(8)(4)(3)(7)=z0(:)
52
newpar($+1)=4 // notify register changes
62
model = list('csuper',1,1,[],[],[],[],..
63
list(list([600,400],'DELAY_f',[],[]),..
64
list('Block',list([92,210],[20,20],%t,['1';'1'],[],7,[],[],[]),..
65
list('input',[],1,[],[],[],[],[],1,'c',[],[%f,%f],' ',list()),' ','IN_f'),..
66
list('Block',list([440,210],[20,20],%t,['1';'1'],6,[],[],[],[]),..
67
list('output',1,[],[],[],[],[],[],1,'c',[],[%f,%f],' ',list()),' ','OUT_f'),..
68
list('Block',list([238,195],[50,50],%t,'0;0;0;0;0;0;0;0;0;0',7,6,10,[],..
69
['dly=model(8);';'txt=[''Shift'';''Register'';string(dly)];';
70
'xstringb(orig(1),orig(2),txt,sz(1),sz(2),''fill'')']),..
71
list('delay',1,1,1,[],[],zeros(10,1),[],[],'d',[],[%f,%f],' ',list()),' ','REGISTER_f'),..
72
list('Block',list([243,296],[40,40],%t,['0.1';'1'],[],[],11,8,..
73
['dt=model(8);';'txt=[''Delay'';string(dt)];';
74
'xstringb(orig(1),orig(2),txt,sz(1),sz(2),''fill'');']),..
75
list('evtdly',[],[],1,1,[],[],0.1,[],'d',1,[%f,%f],' ',list()),' ','EVTDLY_f'),..
76
list('Link',[296.6;440],[220;220],'drawlink',' ',[0,0],[1,1],[4,1],[3,1]),..
77
list('Link',[112;229.4],[220;220],'drawlink',' ',[0,0],[1,1],[2,1],[4,1]),..
78
list('Link',[263;263],[290.3;271.2],'drawlink',' ',[0,0],[5,-1],[5,1],[9,1]),..
79
list('Block',list([263;271.2],[1,1],%t,' ',[],[],8,[10;11]),..
80
list('lsplit',[],[],1,[1;1],[],[],[],[],'d',[-1,-1],[%t,%f],' ',list()),' ','CLKSPLIT_f'),..
81
list('Link',[263;263],[271.2;250.7],'drawlink',' ',[0,0],[5,-1],[9,1],[4,1]),..
82
list('Link',[263;308.6;308.6;263;263],[271.2;271.2;367;367;341.7],'drawlink',..
83
' ',[0,0],[5,-1],[9,2],[5,1])),[],'h',%f,[%f,%f])
84
gr_i='xstringb(orig(1),orig(2),''Delay'',sz(1),sz(2),''fill'')'
85
x=standard_define([2 2],model,'DELAY_f',gr_i)