1function tranSysState = sampleSys(self, numEvents)
2% TRANSYSSTATE = SAMPLESYS(NUMEVENTS)
3% System-wide sample path over all stateful
nodes via a fully JSON-mediated
4% transient LDES simulation. Mirrors
the Python-native sampleSys().
6% Returns a
struct with fields:
7% .handle -
column of stateful-node handles
8% .t - (nTimePoints x 1) time vector
9% .state - 1 x nstateful cell; {isf}
is (nTimePoints x nclasses)
11% .numEvents - horizon used
13if nargin < 2 || isempty(numEvents)
17if GlobalConstants.DummyMode
22res = self.runTransientJson(numEvents);
24tranSysState =
struct();
25tranSysState.handle = self.model.getStatefulNodes
';
26tranSysState.isaggregate = false;
27tranSysState.numEvents = numEvents;
29if isempty(res.t) || isempty(res.QNt)
31 tranSysState.state = {};
35sn = self.model.getStruct;
38nstateful = sn.nstateful;
39states = cell(1, nstateful);
41 nodeState = zeros(nt, R);
42 if isf <= numel(res.QNt)
43 classCells = res.QNt{isf};
44 for k = 1:min(R, numel(classCells))
47 n = min(nt, size(cd, 1));
48 nodeState(1:n, k) = cd(1:n, 1);
52 states{isf} = nodeState;
55tranSysState.t = res.t;
56tranSysState.state = states;