1function gsync = refreshGlobalSync(self)
2% SYNC = REFRESHGLOBALSYNC()
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);
19 if sn.nodetype(ind) == NodeType.Transition
20 for m=1:sn.nodeparam{ind}.nmodes
22 enablingPlaces = find(sn.nodeparam{ind}.enabling{m});
23 gsync{end+1,1}.active{1} = ModeEvent(EventType.ENABLE, ind, m, 1.0);
24 gsync{end,1}.passive = cell(1,length(enablingPlaces));
25 for ep=1:length(enablingPlaces)
26 gsync{end,1}.passive{ep} = ModeEvent(EventType.LOCAL, enablingPlaces(ep), m, 1.0); % ID_LOCAL has no state effects
29 for m=1:sn.nodeparam{ind}.nmodes
31 firingPlaces = find(sn.nodeparam{ind}.firing{m});
32 enablingPlaces = find(sn.nodeparam{ind}.enabling{m});
33 gsync{end+1,1}.active{1} = ModeEvent(EventType.FIRE, ind, m);
35 gsync{end,1}.passive = {};
36 for ep=1:length(enablingPlaces)
37 % TODO:
this creates a departure
event for each
38 % job pulled from the enabling places, which
is
40 gsync{end,1}.passive{end+1} = ModeEvent(EventType.PRE, enablingPlaces(ep), m, sn.nodeparam{ind}.enabling{m}(enablingPlaces(ep)));
42 for fp=1:length(firingPlaces)
43 % TODO:
this creates an arrival
event for each
44 % fired job to the destination place, which
is
46 gsync{end,1}.passive{end+1} = ModeEvent(EventType.POST, firingPlaces(fp), m, sn.nodeparam{ind}.firing{m}(fp));
54if ~isempty(self.sn) %&& isprop(self.sn,
'nvars')
55 self.sn.gsync = gsync;