1function [capacity, classcap, droprule] = refreshCapacity(self)
2% [CAPACITY, CLASSCAP, DROPRULE] = REFRESHCAPACITY()
4% Copyright (c) 2012-2026, Imperial College London
6%I = getNumberOfStatefulNodes(self);
7M = getNumberOfStations(self);
8K = getNumberOfClasses(self);
10% set zero buffers
for classes that are disabled
11classcap = Inf*ones(M,K);
12chaincap = Inf*ones(M,K);
14droprule = DropStrategy.WAITQ*ones(M,K);
19 inchain = sn.inchain{c};
21 chainCap = sum(njobs(inchain));
23 station = self.getStationByIndex(ist);
25 if sn.nodetype(sn.stationToNode(ist)) ~= NodeType.Source
26 % Guard against dropRule array not having entry
for class r
27 if length(station.dropRule) >= r && ~isempty(station.dropRule(r))
28 stationDropRule = station.dropRule(r);
32 % Default to Drop
for finite capacity queues
if no
explicit drop rule set
33 if isempty(stationDropRule)
34 if ~isinf(station.cap) && station.cap < intmax
35 stationDropRule = DropStrategy.DROP;
37 stationDropRule = DropStrategy.WAITQ;
40 droprule(ist,r) = stationDropRule;
42 if isnan(rates(ist,r)) && sn.nodetype(sn.stationToNode(ist)) ~= NodeType.Place
46 chaincap(ist,c) = chainCap;
47 classcap(ist,r) = chainCap;
48 % Guard against classCap array not having entry
for class r
49 if length(station.classCap) >= r && station.classCap(r) >= 0
50 classcap(ist,r) = min(classcap(ist,r), station.classCap(r));
53 classcap(ist,r) = min(classcap(ist,r), station.cap);
60 capacity(ist,1) = min([sum(chaincap(ist,:)),sum(classcap(ist,:))]);
62self.sn.cap = capacity;
63self.sn.classcap = classcap;
64self.sn.droprule = droprule;