1function result = qsys_mapph1(D0, D1, sigma, S, varargin)
2% QSYS_MAPPH1 Analyzes a MAP/PH/1 queue
using BUTools MMAPPH1FCFS.
4% RESULT = QSYS_MAPPH1(D0, D1, SIGMA, S) analyzes a MAP/PH/1 queue with:
5% D0 - MAP hidden transition matrix (n x n)
6% D1 - MAP arrival transition matrix (n x n)
7% SIGMA - PH service initial probability vector (1 x m)
8% S - PH service generator matrix (m x m)
10% RESULT = QSYS_MAPPH1(...,
'numQLMoms', K) computes K queue length moments
11% RESULT = QSYS_MAPPH1(...,
'numQLProbs', N) computes N queue length probs
12% RESULT = QSYS_MAPPH1(...,
'numSTMoms', K) computes K sojourn time moments
14% Returns a
struct with fields:
15% meanQueueLength - Mean number of customers in system
16% meanWaitingTime - Mean waiting time in queue
17% meanSojournTime - Mean sojourn time (waiting + service)
18% utilization - Server utilization
19% queueLengthDist - Queue length distribution
P(Q=n)
20% queueLengthMoments- Raw moments of queue length
21% sojournTimeMoments- Raw moments of sojourn time
22% analyzer - Name of analyzer used
24% See also MMAPPH1FCFS, qsys_mapmap1, qsys_phph1
26% Parse optional arguments
28addParameter(p, 'numQLMoms', 3);
29addParameter(p, 'numQLProbs', 100);
30addParameter(p, 'numSTMoms', 3);
33numQLMoms = p.Results.numQLMoms;
34numQLProbs = p.Results.numQLProbs;
35numSTMoms = p.Results.numSTMoms;
37% Build
MMAP structure for BUTools (single class)
40% Service parameters as cell arrays
45[ncMoms, ncDistr, stMoms] = MMAPPH1FCFS(D, sigmaCell, SCell, ...
46 'ncMoms', numQLMoms,
'ncDistr', numQLProbs,
'stMoms', numSTMoms);
48% Compute utilization from arrival and service rates
49theta = ctmc_solve(D0 + D1);
50lambda = sum(theta * D1);
53meanService = sigma * negSinv * ones(size(S,1), 1);
54mu = 1.0 / meanService;
70% Waiting time = sojourn time - service time
71meanWT = max(0, meanST - meanService);
75result.meanQueueLength = meanQL;
76result.meanWaitingTime = meanWT;
77result.meanSojournTime = meanST;
78result.utilization = rho;
79result.queueLengthDist = ncDistr;
80result.queueLengthMoments = ncMoms;
81result.sojournTimeMoments = stMoms;
82result.analyzer =
'BUTools:MMAPPH1FCFS';