Expand description
§mstlo - Online Signal Temporal Logic
mstlo provides runtime and macro-based tooling to parse, build, and execute
Signal Temporal Logic (STL) monitors over streaming data.
It includes:
- a high-level monitor builder API,
- incremental evaluation backend,
- multiple semantics (qualitative, quantitative, RoSI), and
- optional multi-signal synchronization/interpolation.
§Simple usage
use mstlo::monitor::*;
use mstlo::{step, stl};
// Build a monitor from the macro DSL.
let formula = stl!(G[0, 1](x > 5.0));
let mut monitor = StlMonitor::builder()
.formula(formula)
.algorithm(Algorithm::Incremental)
.semantics(DelayedQuantitative)
.build()
.unwrap();
// Stream updates
let out1 = monitor.update(&step!("x", 7.0, 0s));
let out2 = monitor.update(&step!("x", 6.0, 1s));
let out3 = monitor.update(&step!("x", 4.0, 2s));
let out4 = monitor.update(&step!("x", 7.0, 3s));
assert_eq!(out1.verdicts(), vec![]);
assert_eq!(out2.verdicts(), vec![step!("x", 1.0, 0s)]);
assert_eq!(out3.verdicts(), vec![step!("x", -1.0, 1s)]);
assert_eq!(out4.verdicts(), vec![step!("x", -1.0, 2s)]);Re-exports§
pub use monitor::semantic_markers::DelayedQualitative;pub use monitor::semantic_markers::DelayedQuantitative;pub use monitor::semantic_markers::EagerQualitative;pub use monitor::semantic_markers::Rosi;pub use monitor::semantic_markers::SemanticType;pub use monitor::Algorithm;pub use monitor::MonitorOutput;pub use monitor::Semantics;pub use monitor::StlMonitor;pub use monitor::StlMonitorBuilder;pub use monitor::SyncStepResult;
Modules§
- monitor
- High-level STL monitor API.
Macros§
- step
- Convenience macro to construct a
::mstlo::Step. - stl
- The main entry point for the
stl!procedural macro.
Structs§
- Parse
Error - Error type for STL formula parsing.
- Ring
Buffer VecDeque-backed ring buffer for timestamped signal steps.- Robustness
Interval - Interval-valued robustness, represented as
(lower, upper)bounds. - Step
- A single sampled value of a named signal at a given timestamp.
- Synchronizer
- Synchronizer struct that handles interpolation of missing steps across multiple signals. It maintains a timeline of all timestamps and the last known step for each active signal. A signal is considered active if it has received at least one step.
- Time
Interval - Closed temporal interval $[start, end]$ used by STL temporal operators.
- Variables
- A container for runtime variable bindings.
Enums§
- Formula
Definition - An enum representing the definition of an STL formula.
- Synchronization
Strategy - Strategy used to synthesize missing samples at known timeline timestamps.
Traits§
- Interpolatable
- Value requirements for synchronization interpolation.
- Ring
Buffer Trait - Common interface for timestamped ring buffers.
- Robustness
Semantics - Semantic operations required by STL operators for a robustness domain.
- Signal
Identifier - Trait for extracting referenced signal names from operator/formula trees.
Functions§
- get_
formulas - Returns the vector of Signal Temporal Logic formulas.
If
idsis not empty, returns only the formulas with the specified IDs. - parse_
stl - Parse an STL formula from a string.