1function ARV = solver_mam_traffic(sn, DEP, config)
2% ARV = SOLVER_MAM_ESTFLOWS(QN, DEP, CONFIG)
3% DEP{i,r}
is the departure process of
class r from i in (D0,D1) format
9% In
this function we use indexing over all non-ClassSwitch
nodes
12nodeToNCS = zeros(1,I);
14 if sn.nodetype(ind) ~= NodeType.ClassSwitch
15 non_cs_classes(end+1:end+R)= ((ind-1)*R+1):(ind*R);
17 nodeToNCS(ind) = sum(isNCS);
23% Hide the
nodes that are not
class switches
24rtncs = dtmc_stochcomp(sn.rtnodes,non_cs_classes);
25Inc = I - sum(sn.nodetype == NodeType.ClassSwitch);
27MMAP = DEP; % PH renewal process initially in (D0,D1) format
29% We now bring into
MMAP format with a single
class
32 if isempty(
MMAP{ist,r}) || any(any(isnan(
MMAP{ist,r}{1})))
33 MMAP{ist,r} = {[0],[0],[0]}; % no arrivals from
this class
43% first we determine all outgoing flows from all stations
47 switch sn.nodetype(ind)
48 case {NodeType.Source, NodeType.Delay, NodeType.Queue}
49 ist = sn.nodeToStation(ind);
51 % obtain departure maps
53 DEP{inc} = mmap_super({
MMAP{ist,1:R}});
55 DEP{inc} =
MMAP{ist,1};
57 Psplit = zeros(R,Inc*R);
58 for r=1:R % superpose all
classes
63 Psplit(r,(jnc-1)*R+s) = rtncs((inc-1)*R+r, (jnc-1)*R+s);
69 [Fsplit{1:Inc}] = npfqn_traffic_split_cs(DEP{inc}, Psplit, config);
71 LINKS{inc,jnc} = Fsplit{jnc};
72 LINKS{inc,jnc} = mmap_normalize(LINKS{inc,jnc});
77% then we determine all incoming flows from all stations
80 if isNCS(ind) && sn.nodetype(ind) ~= NodeType.Source
83 if ~isempty(LINKS{jnd,inc}) && sum(mmap_lambda(LINKS{jnd,inc}))> GlobalConstants.FineTol
84 FLOWS{end+1} = LINKS{jnd,inc};
88 ARV{ind} = npfqn_traffic_merge(FLOWS, config);
89 elseif length(FLOWS)==1
91 else %length(FLOWS)==0
92 ARV{ind} = LINKS{jnd,1}; % all links are zeros, take one