1function svc = mam_svc_mixture(
D_arr, pie_cell, D0_cell)
2% SVC = MAM_SVC_MIXTURE(D_ARR, PIE_CELL, D0_CELL)
4% Builds
the arrival-weighted phase-type mixture of
the per-
class service
5% laws at a station, as
the service descriptor accepted by QSYS_MAPG1K and
8% D_ARR - {D0, D_class1, ..., D_classR} arrival
MMAP
9% PIE_CELL - per-
class PH initial distributions
10% D0_CELL - per-
class PH subgenerators
12% The mixture
is PH(alpha_mix, T_mix) with alpha_mix = [w_1*pie_1, ...],
13% T_mix = blkdiag(D0_1, ...), and w_k = lambda_k/sum_j lambda_j
the fraction
14% of arrivals belonging to
class k. It
is therefore
the service law of an
15% arbitrary packet, and it reduces to
the common law exactly (as a
16% distribution) when every
class shares one.
18% This
is the same construction MAM_TRUNCATE_RENORM already applies when a
19% station carries more than one
class, and it
is factored out here so that
20%
the exact finite-buffer branch and
the truncate-and-renormalize fallback
21% rest on identical service assumptions and remain comparable.
23% See also QSYS_MMAPG1K, MAM_TRUNCATE_RENORM, MAM_DETECT_MMCK.
25nClasses = numel(pie_cell);
27e_arr = ones(size(D0, 1), 1);
28Dsum = zeros(size(D0));
30 Dsum = Dsum +
D_arr{k+1};
32theta = ctmc_solve(D0 + Dsum);
33lambda_k = zeros(1, nClasses);
35 lambda_k(k) = theta *
D_arr{k+1} * e_arr;
41 w = ones(1, nClasses) / nClasses;
44n_k = cellfun(@(p) numel(p), pie_cell);
46alpha_mix = zeros(1, n_total);
47T_mix = zeros(n_total, n_total);
50 alpha_mix(offset+1 : offset+n_k(k)) = w(k) * pie_cell{k}(:)
';
51 T_mix(offset+1:offset+n_k(k), offset+1:offset+n_k(k)) = D0_cell{k};
52 offset = offset + n_k(k);
55svc = struct('type
', 'ph
', 'alpha
', alpha_mix, 'T
', T_mix);