Skip to content

HanSur94/FastSense

Repository files navigation

FastSense

Tests Benchmark codecov License: MIT MATLAB Octave Platform

Sensor data, at the scale you actually have it — in MATLAB.

FastSense is a pure-MATLAB platform for working with massive sensor time-series. Plot 100M+ points without crashing, model sensors as Tags with state-aware behaviour, detect events as they happen, and compose interactive dashboards — all without a single toolbox license.

Built for engineers who deal with real industrial data: long recordings, condition-dependent alarm limits, dashboards that need to stay live for hours, and the moment when MATLAB's own plot() falls over at 10M points.


30 seconds in

install;   % run once: adds paths + builds MEX accelerators

x = linspace(0, 100, 1e7);              % 10 million points
y = sin(x) + 0.1 * randn(size(x));

fp = FastSense('Theme', 'dark');
fp.addLine(x, y, 'DisplayName', 'Sensor');
fp.addThreshold(0.8, 'Direction', 'upper', 'ShowViolations', true);
fp.render();

That renders in a few milliseconds and stays at 200+ FPS while you zoom and pan. MATLAB's built-in plot() takes ~3 seconds on the same data and crawls at ~2 FPS. (benchmarks ↓)


The core idea: Tags

Everything in FastSense — sensors, machine states, alarms, derived signals — is a Tag. One unified type, four flavours:

Tag What it is
SensorTag A measured time-series (pressure, temperature, …)
StateTag A discrete system state (idle / running / fault, recipe)
MonitorTag A derived 0/1 alarm signal — "is this sensor out of spec?"
CompositeTag An aggregation of other tags

Tags carry their own metadata (units, criticality, labels) and live in a shared TagRegistry so every part of the system — plots, dashboards, event detection, the web bridge — speaks the same language.

press = SensorTag('press_a', 'Name', 'Chamber Pressure', 'Units', 'bar');
press.updateData(t, pressure_data);

% Alarm whenever pressure > 55 bar
alarm = MonitorTag('press_high', press, @(x, y) y > 55);

TagRegistry.register(press);
TagRegistry.register(alarm);

fp = FastSense();
fp.addTag(press);
fp.addTag(alarm);     % overlaid as a 0/1 step trace
fp.render();

The same alarm tag drives event detection, lights up status widgets in the dashboard, fires notifications, and shows up in the browser bridge — without you re-declaring the rule four times. For monitors that depend on multiple parents (e.g., a state-conditional alarm), compose them via CompositeTag.


Build a dashboard

Compose monitoring dashboards from widgets on a 24-column grid. The same Tags drive the data — no re-wiring.

d = DashboardEngine('Process Monitor');
d.Theme = 'dark';
d.addWidget('fastsense', 'Position', [1 1 16 8],  'Tag', press);
d.addWidget('number',    'Position', [17 1 8 4],  'Tag', press, 'Label', 'Pressure');
d.addWidget('gauge',     'Position', [17 5 8 4],  'Tag', press, 'Label', 'Live');
d.addWidget('status',    'Position', [1 9 24 2],  'Tag', alarm, 'Label', 'Alarm');
d.render();

d.save('process.json');           % JSON-persist
% later:  d = DashboardEngine.load('process.json');
  • 21 widget types — plots, numbers, gauges, status lights, gantt timelines, heatmaps, tables, markdown, …
  • Multi-page tabs · collapsible groups · pop-out detached widgets
  • Live mode — synchronised refresh on a configurable timer
  • Browser bridgeWebBridge(d).serve() exposes the dashboard over TCP to a FastAPI + uPlot frontend

Performance

FastSense vs. MATLAB's built-in plot() on 10M data points:

plot() FastSense
Render time ~3.2 s 4.7 ms
Memory 153 MB 0.06 MB
Zoom/pan FPS ~2 FPS 212 FPS
Points displayed 10 000 000 ~400 (visually identical)

MacBook Pro M1 Pro · GNU Octave 11 · MEX + NEON. Tracked on every commit; regressions trigger alerts. Live benchmark charts

The trick: per-pixel MinMax and LTTB downsampling (SIMD C kernels with pure-MATLAB fallbacks), an SQLite-backed disk store for datasets that don't fit in RAM, and a render pipeline that only touches the points you can actually see.


What's in the box

  • Plotting engine — 100M+ point time-series, 6 themes, linked axes, datetime support, optional MEX SIMD kernels
  • Tag domain modelSensorTag, StateTag, MonitorTag, CompositeTag, shared TagRegistry
  • Event detection — group violations into events, statistics, live pipeline, interactive Gantt viewer, notifications
  • Dashboards — 21 widget types, JSON persistence, multi-page, collapsible, detachable, live refresh
  • Browser bridge — TCP → FastAPI → uPlot, bidirectional callbacks
  • Disk-backed storage — SQLite chunks with WAL for live reads, pyramid-cached downsamples
  • Pure MATLAB / Octave — no toolboxes, no internet, no licenses

Install

git clone https://github.com/HanSur94/FastSense.git
cd FastSense

Then in MATLAB or Octave:

install;   % adds paths + compiles MEX accelerators

MEX is optional — pure-MATLAB fallbacks kick in if no C compiler is available. Requires MATLAB R2020b+ or GNU Octave 7+ on Linux, macOS, or Windows.


Examples & docs

40+ runnable scripts in examples/, grouped by topic (01-basics07-advanced). Run them all with run_all_examples.

Full reference lives in the Wiki: Getting Started · API Reference · Architecture · MEX details · Performance.


Citation · License

@software{fastsense,
  title  = {FastSense: Sensor Monitoring and Dashboarding for MATLAB and GNU Octave},
  url    = {https://github.com/HanSur94/FastSense},
  license= {MIT}
}

See CITATION.cff for the full citation metadata.

Released under the MIT License.

About

Sensor monitoring and dashboarding platform for MATLAB and GNU Octave. Plot 100M+ points at 200+ FPS, define state-dependent thresholds, detect events in real time, and build interactive dashboards.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors