LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
pollingInit.m
1function block = pollingInit(sn, ind, nbuf, srvclass)
2% BLOCK = POLLINGINIT(SN, IND, NBUF, SRVCLASS)
3%
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.
8%
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.
11
12% Copyright (c) 2012-2026, Imperial College London
13% All rights reserved.
14
15block = [];
16pinfo = State.pollingInfo(sn, ind);
17if isempty(pinfo)
18 return
19end
20R = sn.nclasses;
21
22if srvclass > 0
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
26 % into service.
27 pos = srvclass;
28 swk = 0;
29 ctr = State.pollingBudget(pinfo, nbuf(srvclass)+1);
30else
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
35 % reachable here.
36 [q, mode] = State.pollingNext(pinfo, 1, nbuf, R, true);
37 pos = q;
38 ctr = 0;
39 switch mode
40 case 2
41 swk = find(pinfo.swpie{q} > 0, 1, 'first');
42 otherwise
43 swk = 0;
44 end
45end
46
47block = State.pollingProject(pinfo, [pos, swk, ctr]);
48end
Definition Station.m:245