1function tranSysState = sampleSysAggr(self, numSamples)
2% TRANSYSSTATE = SAMPLESYSAGGR(NUMSAMPLES) Returns aggregated system-wide sample path
4% @brief Generates a discrete-
event sample path
for all stateful
nodes with aggregation
6% This method runs a DES transient simulation and records the sequence
7% of states visited at all stateful
nodes, with states aggregated to
8% show only the number of jobs per
class (not per-phase details).
10% @param self SolverDES instance
11% @param numSamples Number of time points to sample
13% @
return tranSysState Structure containing the aggregated system-wide sample path with fields:
14% - tranSysState.handle: Cell array of stateful node handles
15% - tranSysState.t: Vector of time points
16% - tranSysState.state: Cell array of aggregated state matrices (jobs per class)
17% - tranSysState.event: Cell array of events
18% - tranSysState.isaggregate: Boolean true (aggregated sample)
20% @see sampleSys - Returns detailed system-wide sample path
21% @see sampleAggr - Returns aggregated sample path for a single node
25% model = Network(
'MM1');
26% % ... model setup ...
27% solver = SolverDES(model,
'seed', 42);
28% result = solver.sampleSysAggr(1000);
32 numSamples = self.options.samples;
35% Convert model to Java
36jmodel = LINE2JLINE(self.model);
38% Create Java DES options
39joptions = jline.solvers.des.DESOptions();
40joptions.samples = self.options.samples;
41joptions.seed = self.options.seed;
44jsolver = jline.solvers.des.SolverDES(jmodel, joptions);
46% Call Java sampleSysAggr method
47jresult = jsolver.sampleSysAggr(numSamples);
49% Convert Java result to MATLAB structure
50tranSysState =
struct();
51tranSysState.handle = self.model.getStatefulNodes
';
55 tranSysState.t = JLINE.from_jline_matrix(jresult.t);
60% Convert state - it's a List<Matrix> in Java, convert to cell array
61sn = self.model.getStruct;
62if ~isempty(jresult.state) && isa(jresult.state,
'java.util.List')
63 nstateful = jresult.state.size();
64 tranSysState.state = cell(1, nstateful);
66 jmatrix = jresult.state.get(isf - 1); % Java
is 0-indexed
67 if ~isempty(jmatrix) && isa(jmatrix, 'jline.util.matrix.Matrix')
68 tranSysState.state{isf} = JLINE.from_jline_matrix(jmatrix);
70 tranSysState.state{isf} = [];
74 tranSysState.state = {};
78if ~isempty(jresult.event) && isa(jresult.event,
'jline.util.matrix.Matrix')
79 tranSysState.event = JLINE.from_jline_matrix(jresult.event);
81 tranSysState.event = {};
84tranSysState.isaggregate = jresult.isAggregate;
85tranSysState.numSamples = jresult.numSamples;