|
2 | 2 |
|
3 | 3 | # API Reference: Event Detection |
4 | 4 |
|
5 | | -## `EventDetector` --- Detects events from threshold violations. |
6 | | - |
7 | | -> Inherits from: `handle` |
8 | | -
|
9 | | -det = EventDetector() |
10 | | - det = EventDetector('MinDuration', 2, 'OnEventStart', @myCallback) |
11 | | - |
12 | | - Call shape: |
13 | | - events = det.detect(tag, threshold) % 2-arg Tag overload |
14 | | - |
15 | | - Reads (X, Y) from tag.getXY() and derives threshold metadata |
16 | | - from the Threshold handle; forwards to the private detect_ body. |
17 | | - Dispatch is entry-level on isa(arg, 'Tag') — the ABSTRACT BASE — |
18 | | - matching the FastSense.addTag precedent (Pitfall 1: NO subclass |
19 | | - isa anywhere in this file). |
20 | | - |
21 | | -### Constructor |
22 | | - |
23 | | -```matlab |
24 | | -obj = EventDetector(varargin) |
25 | | -``` |
26 | | - |
27 | | -### Properties |
28 | | - |
29 | | -| Property | Default | Description | |
30 | | -|----------|---------|-------------| |
31 | | -| MinDuration | | numeric: minimum event duration (default 0) | |
32 | | -| OnEventStart | | function handle: callback f(event) on new event | |
33 | | -| MaxCallsPerEvent | | numeric: max callback invocations per event (default 1) | |
34 | | - |
35 | | -### Methods |
36 | | - |
37 | | -#### `events = detect(obj, tag, threshold)` |
38 | | - |
39 | | -DETECT Find events from threshold violations. |
40 | | - events = det.detect(tag, threshold) |
41 | | - |
42 | | ---- |
43 | | - |
44 | | -## `IncrementalEventDetector` --- Wraps EventDetector with incremental state. |
45 | | - |
46 | | -> Inherits from: `handle` |
47 | | -
|
48 | | -Tracks last-processed index per sensor and carries over open events. |
49 | | - |
50 | | -### Constructor |
51 | | - |
52 | | -```matlab |
53 | | -obj = IncrementalEventDetector(varargin) |
54 | | -``` |
55 | | - |
56 | | -### Properties |
57 | | - |
58 | | -| Property | Default | Description | |
59 | | -|----------|---------|-------------| |
60 | | -| MinDuration | `0` | | |
61 | | -| MaxCallsPerEvent | `1` | | |
62 | | -| OnEventStart | `[]` | | |
63 | | -| EscalateSeverity | `true` | | |
64 | | - |
65 | | -### Methods |
66 | | - |
67 | | -#### `newEvents = process(~, ~, ~, ~, ~, ~, ~)` |
68 | | - |
69 | | -PROCESS Legacy entry point -- no longer functional. |
70 | | - The Sensor/Threshold/StateChannel pipeline this method relied |
71 | | - on was deleted in Phase 1011. LiveEventPipeline now uses |
72 | | - MonitorTag.appendData() for incremental detection (Phase 1007 |
73 | | - MONITOR-08). This stub remains so that callers get a clear |
74 | | - error rather than a missing-method crash. |
75 | | - |
76 | | -#### `tf = hasOpenEvent(obj, sensorKey)` |
77 | | - |
78 | | -#### `st = getSensorState(obj, sensorKey)` |
79 | | - |
80 | | ---- |
81 | | - |
82 | 5 | ## `Event` --- Represents a single detected threshold violation event. |
83 | 6 |
|
84 | 7 | > Inherits from: `handle` |
@@ -125,58 +48,6 @@ ESCALATETOP Escalate event to a higher severity threshold. |
125 | 48 |
|
126 | 49 | --- |
127 | 50 |
|
128 | | -## `EventConfig` --- Configuration for the event detection system. |
129 | | - |
130 | | -> Inherits from: `handle` |
131 | | -
|
132 | | -cfg = EventConfig() |
133 | | - cfg.MinDuration = 2; |
134 | | - cfg.addSensor(sensor); |
135 | | - events = cfg.runDetection(); |
136 | | - |
137 | | -### Constructor |
138 | | - |
139 | | -```matlab |
140 | | -obj = EventConfig() |
141 | | -``` |
142 | | - |
143 | | -### Properties |
144 | | - |
145 | | -| Property | Default | Description | |
146 | | -|----------|---------|-------------| |
147 | | -| Sensors | | cell array of Sensor objects | |
148 | | -| SensorData | | struct array: name, t, y (for viewer click-to-plot) | |
149 | | -| MinDuration | | numeric: debounce (default 0) | |
150 | | -| MaxCallsPerEvent | | numeric: callback limit (default 1) | |
151 | | -| OnEventStart | | function handle: callback | |
152 | | -| ThresholdColors | | containers.Map: label -> [R G B] | |
153 | | -| AutoOpenViewer | | logical: auto-open EventViewer after detection | |
154 | | -| EscalateSeverity | | logical: escalate events to higher thresholds (default true) | |
155 | | -| EventFile | | char: path to .mat file for auto-saving events (empty = disabled) | |
156 | | -| MaxBackups | | numeric: number of backup files to keep (default 5, 0 = no backups) | |
157 | | - |
158 | | -### Methods |
159 | | - |
160 | | -#### `addSensor(~, ~)` |
161 | | - |
162 | | -ADDSENSOR Legacy entry point -- no longer functional. |
163 | | - The Sensor.resolve() pipeline was deleted in Phase 1011. |
164 | | - Use MonitorTag + EventStore for event detection. |
165 | | - |
166 | | -#### `setColor(obj, label, rgb)` |
167 | | - |
168 | | -SETCOLOR Set color for a threshold label. |
169 | | - |
170 | | -#### `det = buildDetector(obj)` |
171 | | - |
172 | | -BUILDDETECTOR Create a configured EventDetector. |
173 | | - |
174 | | -#### `events = runDetection(obj)` |
175 | | - |
176 | | -RUNDETECTION Detect events across all configured sensors. |
177 | | - |
178 | | ---- |
179 | | - |
180 | 51 | ## `EventStore` --- Atomic read/write of events to a shared .mat file. |
181 | 52 |
|
182 | 53 | > Inherits from: `handle` |
|
0 commit comments