LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
getCdfRespT.m
1function RD = getCdfRespT(self, R)
2% RD = GETCDFRESPT(R) Returns cumulative distribution function of response times
3%
4% @brief Computes steady-state response time distribution for each station and class
5%
6% This method returns the cumulative distribution function (CDF) of response times
7% at each station for each job class. The response time represents the time from
8% when a job arrives at a station until it completes service and departs.
9%
10% The Fluid solver uses ODE-based mean-field approximations to estimate response
11% time distributions. The distributions are fitted based on the computed steady-state
12% moments and assume phase-type characteristics.
13%
14% @param self SolverFluid instance
15% @param R (optional) Response time computation handle. If provided, uses cached results.
16% Otherwise computes new CDFs by solving the passage time ODEs.
17%
18% @return RD Nested cell array of CDF data
19% - RD is a {nstations x nclasses} cell array
20% - RD{i,k} contains CDF data for station i, job class k
21% - Each non-empty element is [n x 2] matrix:
22% - Column 1: CDF values (cumulative probability from 0 to 1)
23% - Column 2: Response time values (increasing sequence)
24% - Empty cells indicate metric is disabled or not applicable
25%
26% @note Response time CDF depends on the queue length distribution and service
27% times at each station. Requires getAvg() to have been called first to
28% establish steady-state baseline metrics.
29%
30% @warning The Fluid approximation is mean-field based. For exact distributions,
31% use CTMC solver on small models or SSA for general models.
32% Results may not be accurate for systems with high variability or
33% strong state dependencies.
34%
35% @see getAvg - Computes steady-state average metrics (prerequisite)
36% @see getCdfPassT - Returns first passage time distributions
37%
38% Example:
39% @code
40% model = Network('example');
41% % ... model construction ...
42% solver = SolverFluid(model);
43% solver.getAvg(); % Compute steady-state first
44%
45% % Get response time CDFs
46% cdf_respt = solver.getCdfRespT();
47%
48% % Access CDF for station 0, class 1
49% if ~isempty(cdf_respt{1,2})
50% cdf_matrix = cdf_respt{1,2};
51% probs = cdf_matrix(:,1);
52% times = cdf_matrix(:,2);
53%
54% % Plot response time CDF
55% plot(times, probs, 'LineWidth', 2);
56% xlabel('Response Time');
57% ylabel('Cumulative Probability');
58% grid on;
59% end
60% @endcode
61
62sn = self.getStruct;
63if GlobalConstants.DummyMode
64 RD = cell(sn.nstations,sn.nclasses);
65 return
66end
67
68T0 = tic;
69if nargin<2 %~exist('R','var')
70 R = self.getAvgRespTHandles;
71 % to do: check if some R are disabled
72end
73self.getAvg; % get steady-state solution
74options = self.getOptions;
75options.init_sol = self.result.solverSpecific.odeStateVec;
76% we need to pass the modified sn as the number of phases may have changed
77% during the fluid iterations, affecting the size of odeStateVec
78RD = solver_fluid_passage_time(self.result.solverSpecific.sn, options);
79runtime = toc(T0);
80self.setDistribResults(RD, runtime);
81end