name | Name des Objekts |
tG | Zeitintervall zwischen neuen Entitäten |
n0 | id der ersten Entität |
debug | für optionale Debugging-Ausgaben |
if nargin == 4
x = {}; % no inputs
y = {'out'}; % output to emit entities
s = {'counter'}; %
sysparams = struct('tG', tG, 'n0', n0, 'debug', debug);
else
error('mistake at constructor method for class am_generator');
end
obj = obj@atomic(name, x, y, s, 0, sysparams); % call parent
obj.s.counter = obj.sysparams.n0; % initialize the state
function deltaintfun(obj)
obj.s.counter = obj.s.counter + 1;
end
function lambdafun(obj)
% generate an entity with given id
obj.y.out = {obj.s.counter + 1};
if obj.sysparams.debug
fprintf('%4.1f %8s OUT, out=%2d\n', ...
obj.tnext, obj.name, cell2mat(obj.y.out))
end
end
function ta = tafun(obj)
ta = obj.sysparams.tG;
end
Z49 | (vor t=4) wie erwartet |
Z50 | gen gibt E4 aus |
Z51 | server gibt E2 und working=0 aus, Zustandsänderung danach in Z56 |
Z52-55 | queue sammelt E4 ein und geht in unblocked |
Z56 | server geht nach idle (vgl. Z51) |
Z57 | queue gibt E3 aus (vgl. Z59) |
Z58 | server empfängt E3, geht in goProcessing |
Z59-62 | Zustandsänderung zur Ausgabe (vgl. Z57) |
Z63 | queue gibt schon E4 raus! |
Z64 | jetzt kommt erst das Blocking vom Server! |
Z65 | bl-Input und Wechsel 2→2 sind confluent! |
Z66-73 | queue macht erst int (also E raus), dann ext (also bl) |
muss anders herum! |
function deltaconffun(obj,gt)
[bl, ~] = readInputBag(obj);
if bl == true % go to phase 3, no entity output!
deltaextfun(obj,gt);
else
deltaintfun(obj);
deltaextfun(obj,gt);
end
end
function deltaconffun(obj,gt)
if obj.s.phase == 1 % blocking came to late -> ignore input
deltaintfun(obj);
else % first current entity leaves, then new one enters
deltaintfun(obj);
deltaextfun(obj,gt);
end
end