1function block = pollingInit(sn, ind, nbuf, srvclass)
2% BLOCK = POLLINGINIT(SN, IND, NBUF, SRVCLASS)
4% Canonical initial value of
the polling controller columns
for a station whose
5% buffers hold NBUF and whose service facility holds a
class-SRVCLASS job (0
6% when empty). Returns a 1-by-pinfo.width row, empty when
the node
is not a
7% polling station or carries no materialized controller
column.
9% The row
is always one that State.pollingBlocks also enumerates, so that
the
10% initial state
is a member of
the generated state space.
12% Copyright (c) 2012-2026, Imperial College London
16pinfo = State.pollingInfo(sn, ind);
23 % A visit to srvclass
is under way. Take it to have started with
the whole
24 %
class present, which
is the state reached by a server that has just
25 % arrived at a buffer holding nbuf(srvclass)+1 jobs and pulled one of them
29 ctr = State.pollingBudget(pinfo, nbuf(srvclass)+1);
31 % The facility
is empty: let
the server walk from a canonical position and
32 % settle wherever
the discipline puts it. With work waiting
this cannot
33 %
return a visit, because initialization always fills
the single server of
34 % a non-empty station (see initDefault), so only a switchover or a park
is
36 [q, mode] = State.pollingNext(pinfo, 1, nbuf, R,
true);
41 swk = find(pinfo.swpie{q} > 0, 1,
'first');
47block = State.pollingProject(pinfo, [pos, swk, ctr]);