1function sync = refreshSync(self)
5local = self.getNumberOfNodes+1;
8emptystate = cellzeros(sn.nnodes,1,0,0);
9if any(sn.isstatedep(:))
10 rtmask = self.sn.rtfun(emptystate, emptystate);
12 rtmask = ceil(self.sn.rt);
17 if sn.isstation(ind) && sn.phases(sn.nodeToStation(ind),r)> 1
19 sync{end+1,1} =
struct(
'active',cell(1),
'passive',cell(1));
20 sync{end,1}.active{1} = Event(EventType.PHASE, ind, r);
21 sync{end,1}.passive{1} = Event(EventType.LOCAL, local, r, 1.0);
23 if sn.isstation(ind) && isfield(sn,
'impatienceClass') && ~isempty(sn.impatienceClass) ...
24 && sn.impatienceClass(sn.nodeToStation(ind),r) == ImpatienceType.RENEGING ...
25 && sn.impatienceType(sn.nodeToStation(ind),r) == ProcessType.EXP
26 % Reneging action (exponential patience): a waiting class-r job
27 % abandons
the queue at a memoryless per-job rate;
the job leaves
28 %
the system (passive LOCAL, mirroring
the phase-change action).
29 sync{end+1,1} =
struct(
'active',cell(1),
'passive',cell(1));
30 sync{end,1}.active{1} = Event(EventType.RENEGE, ind, r);
31 sync{end,1}.passive{1} = Event(EventType.LOCAL, local, r, 1.0);
33 if sn.isstation(ind) && isfield(sn,
'retrialProc') && ~isempty(sn.retrialProc) ...
34 && ~isempty(sn.retrialProc{sn.nodeToStation(ind),r}) ...
35 && sn.retrialType(sn.nodeToStation(ind),r) == ProcessType.EXP
36 % Retrial action (exponential retrial delay): an orbiting class-r
37 % job retries entry into
the station. Each orbiting job retries at a
38 % memoryless rate retrialMu, so
the aggregate rate
is (orbit size) *
39 % retrialMu;
the retry succeeds (job enters service) only when a
40 % server
is free, otherwise
the job stays in orbit (no-op).
41 sync{end+1,1} =
struct(
'active',cell(1),
'passive',cell(1));
42 sync{end,1}.active{1} = Event(EventType.RETRY, ind, r);
43 sync{end,1}.passive{1} = Event(EventType.LOCAL, local, r, 1.0);
45 if sn.isstation(ind) && sn.sched(sn.nodeToStation(ind)) == SchedStrategy.POLLING
46 % Switchover action:
the server of a polling station walks towards
47 % buffer r. Unlike PHASE, which carries only
the internal
48 % transitions of a phase-type and leaves
the absorption to DEP,
49 %
this event carries both, because
the completion of a switchover
50 % moves no job and so has nothing to synchronize with (passive
51 % LOCAL, mirroring
the phase-change action). It
is therefore
52 % emitted also
for a single-phase switchover, where it consists of
53 %
the absorption alone. Immediate switchovers take zero time and
54 % are folded into
the enclosing transition, so they emit nothing.
55 pinfoSync = State.pollingInfo(sn, ind);
56 if ~isempty(pinfoSync) && pinfoSync.hasSw(r)
57 sync{end+1,1} =
struct(
'active',cell(1),
'passive',cell(1));
58 sync{end,1}.active{1} = Event(EventType.SWITCH, ind, r);
59 sync{end,1}.passive{1} = Event(EventType.LOCAL, local, r, 1.0);
63 if sn.nodetype(ind) == NodeType.Cache
64 if ~isnan(sn.nodeparam{ind}.pread{r}) %
class can read
65 sync{end+1,1}.active{1} = Event(EventType.READ, ind, r);
66 sync{end,1}.passive{1} = Event(EventType.READ, local, r, 1.0);
68 elseif sn.nodetype(ind) == NodeType.Transition
69 for m=1:sn.nodeparam{ind}.nmodes
71 sync{end+1,1}.active{1} = Event(EventType.PHASE, ind, m);
72 sync{end,1}.passive{1} = Event(EventType.LOCAL, local, m, 1.0);
75 if sn.nodetype(ind) == NodeType.Fork
76 % Stateful Fork
nodes (FJ-augmented copies)
do not emit
77 % departure syncs:
the atomic multi-branch emission
is
78 % handled by
the fork firing synchronizations (sn.fjsync)
81 isf = sn.nodeToStateful(ind);
84 jsf = sn.nodeToStateful(jnd);
86 p = rtmask((isf-1)*nclasses+r,(jsf-1)*nclasses+s);
88 new_sync = struct('active',cell(1),'passive',cell(1));
89 new_sync.active{1} = Event(EventType.DEP, ind, r);
90 switch sn.routing(ind,s)
91 case {RoutingStrategy.RROBIN, RoutingStrategy.WRROBIN, RoutingStrategy.JSQ, RoutingStrategy.RL, RoutingStrategy.KCHOICES}
92 new_sync.passive{1} = Event(EventType.ARV, jnd, s, @(state_before, state_after) at(self.sn.rtfun(state_before, state_after), (isf-1)*nclasses+r, (jsf-1)*nclasses+s));
94 new_sync.passive{1} = Event(EventType.ARV, jnd, s, sn.rt((isf-1)*nclasses+r, (jsf-1)*nclasses+s));
96 sync{end+1,1} = new_sync;
104if ~isempty(self.sn) %&& isprop(self.sn,
'nvars')