1%{ @file sn_set_service.m
2 % @brief Sets service rate at a specific station and
class
4 % @author LINE Development Team
8 % @brief Sets service rate at a specific station and
class
11 % Directly modifies the service rate in NetworkStruct without rebuilding
12 % the full Network
object. Useful
for fast parameter updates in optimization.
16 % sn = sn_set_service(sn, stationIdx, classIdx, rate)
17 % sn = sn_set_service(sn, stationIdx, classIdx, rate, scv)
18 % sn = sn_set_service(sn, stationIdx, classIdx, rate, scv, autoRefresh)
23 % <tr><th>Name<th>Description
24 % <tr><td>sn<td>Network structure
25 % <tr><td>stationIdx<td>Station index (1-based)
26 % <tr><td>classIdx<td>Class index (1-based)
27 % <tr><td>rate<td>New service rate (must be positive)
28 % <tr><td>scv<td>Squared coefficient of variation (
default 1.0)
29 % <tr><td>autoRefresh<td>If
true, refresh process fields (
default false)
34 % <tr><th>Name<th>Description
35 % <tr><td>sn<td>Modified network structure
38function sn = sn_set_service(sn, stationIdx, classIdx, rate, scv, autoRefresh)
40if nargin < 5 || isempty(scv)
44if nargin < 6 || isempty(autoRefresh)
49sn.rates(stationIdx, classIdx) = rate;
52sn.scv(stationIdx, classIdx) = scv;
54% Auto-refresh process fields if requested
56 sn = sn_refresh_process_fields(sn, stationIdx, classIdx);