LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
sampleSys.m
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().
5%
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)
10% .isaggregate - false
11% .numEvents - horizon used
12
13if nargin < 2 || isempty(numEvents)
14 numEvents = 0;
15end
16
17if GlobalConstants.DummyMode
18 tranSysState = [];
19 return
20end
21
22res = self.runTransientJson(numEvents);
23
24tranSysState = struct();
25tranSysState.handle = self.model.getStatefulNodes';
26tranSysState.isaggregate = false;
27tranSysState.numEvents = numEvents;
28
29if isempty(res.t) || isempty(res.QNt)
30 tranSysState.t = [];
31 tranSysState.state = {};
32 return
33end
34
35sn = self.model.getStruct;
36nt = numel(res.t);
37R = sn.nclasses;
38nstateful = sn.nstateful;
39states = cell(1, nstateful);
40for isf = 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))
45 cd = classCells{k};
46 if ~isempty(cd)
47 n = min(nt, size(cd, 1));
48 nodeState(1:n, k) = cd(1:n, 1);
49 end
50 end
51 end
52 states{isf} = nodeState;
53end
54
55tranSysState.t = res.t;
56tranSysState.state = states;
57end
Definition fjtag.m:157
Definition Station.m:245