1%{ @file sn_set_arrival.m
2 % @brief Sets arrival rate
for a
class at the Source station
4 % @author LINE Development Team
8 % @brief Sets arrival rate
for a
class at the Source station
11 % Directly modifies the arrival rate in NetworkStruct. Finds the Source
12 % station and updates its rate
for the specified
class.
16 % sn = sn_set_arrival(sn, classIdx, rate)
17 % sn = sn_set_arrival(sn, classIdx, rate, scv)
18 % sn = sn_set_arrival(sn, classIdx, rate, scv, autoRefresh)
23 % <tr><th>Name<th>Description
24 % <tr><td>sn<td>Network structure
25 % <tr><td>classIdx<td>Class index (1-based)
26 % <tr><td>rate<td>New arrival rate (lambda)
27 % <tr><td>scv<td>Squared coefficient of variation (
default 1.0)
28 % <tr><td>autoRefresh<td>If
true, refresh process fields (
default false)
33 % <tr><th>Name<th>Description
34 % <tr><td>sn<td>Modified network structure
37function sn = sn_set_arrival(sn, classIdx, rate, scv, autoRefresh)
39if nargin < 4 || isempty(scv)
43if nargin < 5 || isempty(autoRefresh)
47% Find Source station index
48sourceIdx = find(sn.nodetype == NodeType.Source);
50 error(
'sn_set_arrival: No Source station found in network');
53% Convert node index to station index
54stationIdx = sn.nodeToStation(sourceIdx);
56% Delegate to sn_set_service
57sn = sn_set_service(sn, stationIdx, classIdx, rate, scv, autoRefresh);