1%{ @file sn_get_node_arvr_from_tput.m
2 % @brief Computes average arrival rates at
nodes from station throughputs
4 % @author LINE Development Team
8 % @brief Computes average arrival rates at
nodes from station throughputs
11 % This function calculates the average arrival rate at each node in steady-state
12 % from the station throughputs, accounting
for node-level routing and
visits.
16 % ANn = sn_get_node_arvr_from_tput(sn, TN, TH)
17 % ANn = sn_get_node_arvr_from_tput(sn, TN, TH, AN)
22 % <tr><th>Name<th>Description
23 % <tr><td>sn<td>Network structure
24 % <tr><td>TN<td>Average throughputs at stations
25 % <tr><td>TH<td>Throughput handles
26 % <tr><td>AN<td>(Optional) Average arrival rates at stations; computed
if missing
31 % <tr><th>Name<th>Description
32 % <tr><td>ANn<td>Average arrival rates at
nodes
35function ANn=sn_get_node_arvr_from_tput(sn, TN, TH, AN)
43 AN = sn_get_arvr_from_tput(sn, TN, TH);
47if ~isempty(TH) && ~isempty(TN)
49 ind = sn.stationToNode(ist);
50 ANn(ind,:) = AN(ist,:);
54 inchain = sn.inchain{c};
55 refstat = sn.refstat(c);
57 if sn.nodetype(ind) ~= NodeType.Source
58 switch sn.nodetype(ind)
60 % For cache
nodes, only the requesting
class arrives
61 % Hit/miss
classes don
't arrive - they leave
62 hitclass = sn.nodeparam{ind}.hitclass;
63 missclass = sn.nodeparam{ind}.missclass;
64 if ~(any(find(r==hitclass)) || any(find(r==missclass)))
65 % This is a requesting class (e.g., ClientClass)
66 % Arrival rate = total throughput for this class
67 ANn(ind, r) = (sn.nodevisits{c}(ind,r) / sum(sn.visits{c}(sn.stationToStateful(refstat),inchain))) * sum(TN(refstat,inchain));
69 % Hit/miss classes have 0 arrival rate at cache (they only depart)
71 % For station nodes, the arrival rate is already set from AN
72 % Only use nodevisits for non-station nodes (like ClassSwitch, Sink)
73 % Note: nodeToStation is NaN for non-stations like Sink, so use ~(>0) check
74 if ~(sn.nodeToStation(ind) > 0)
75 ANn(ind, r) = (sn.nodevisits{c}(ind,r) / sum(sn.visits{c}(sn.stationToStateful(refstat),inchain))) * sum(TN(refstat,inchain));