1function budget = pollingBudget(pinfo, nbufq)
2% BUDGET = POLLINGBUDGET(PINFO, NBUFQ)
4% Initial value of the ctr
column of a visit that starts at a buffer holding
5% NBUFQ waiting jobs. NBUFQ
is the
class-q population at the polling instant:
6% the service facility
is empty when a visit starts, so it
is the whole
7%
class-q population at the station.
9% See State.pollingInfo
for the meaning of ctr under each discipline.
11% Copyright (c) 2012-2026, Imperial College London
15 case PollingType.EXHAUSTIVE
16 budget = 0; % unused: the visit ends when the buffer drains
17 case PollingType.GATED
18 budget = nbufq; % serve exactly the jobs found at the polling instant
19 case PollingType.KLIMITED
20 budget = pinfo.pk; % serve at most K, fewer
if the buffer drains first
21 case PollingType.DECREMENTING
22 budget = nbufq - 1; % serve until the population drops one below the level found
24 line_error(mfilename, sprintf(
'Unsupported polling type: %d.', pinfo.ptype));