LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
sn_set_arrival.m
1%{ @file sn_set_arrival.m
2 % @brief Sets arrival rate for a class at the Source station
3 %
4 % @author LINE Development Team
5%}
6
7%{
8 % @brief Sets arrival rate for a class at the Source station
9 %
10 % @details
11 % Directly modifies the arrival rate in NetworkStruct. Finds the Source
12 % station and updates its rate for the specified class.
13 %
14 % @par Syntax:
15 % @code
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)
19 % @endcode
20 %
21 % @par Parameters:
22 % <table>
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)
29 % </table>
30 %
31 % @par Returns:
32 % <table>
33 % <tr><th>Name<th>Description
34 % <tr><td>sn<td>Modified network structure
35 % </table>
36%}
37function sn = sn_set_arrival(sn, classIdx, rate, scv, autoRefresh)
38
39if nargin < 4 || isempty(scv)
40 scv = 1.0;
41end
42
43if nargin < 5 || isempty(autoRefresh)
44 autoRefresh = false;
45end
46
47% Find Source station index
48sourceIdx = find(sn.nodetype == NodeType.Source);
49if isempty(sourceIdx)
50 error('sn_set_arrival: No Source station found in network');
51end
52
53% Convert node index to station index
54stationIdx = sn.nodeToStation(sourceIdx);
55
56% Delegate to sn_set_service
57sn = sn_set_service(sn, stationIdx, classIdx, rate, scv, autoRefresh);
58
59end