Quantitative monitoring of STL with edit distance

Stefan Jaksic, Ezio Bartocci, Radu Grosu, Thang Nguyen, Dejan Nickovic

Abstract

This paper introduces a novel framework for monitoring Cyber-Physical Systems (CPS) by extending Signal Temporal Logic (STL) with a weighted edit distance (WED) semantics. Unlike traditional spatial robustness metrics, which are often sensitive to minor timing jitter, WED accounts for both value deviations and timing shifts in digitized signals. We detail a translation process from STL formulas to weighted symbolic automata, supported by an efficient online dynamic programming algorithm for real-time robustness computation. The methodology is validated through an FPGA implementation and tested against automotive benchmarks and the SENT protocol, demonstrating a robust, time-aware approach to hardware-level system monitoring.

Introduction

Cyber-Physical Systems (CPS), such as autonomous vehicles, drones, and medical devices, operate at the intersection of digital control and physical processes. Ensuring the safety and correctness of these systems requires rigorous monitoring against formal specifications. Signal Temporal Logic (STL) is a widely used formalism for this purpose, allowing engineers to define complex temporal and value-based constraints.

However, traditional monitoring approaches often rely on "spatial robustness," which measures the minimum distance a signal must move to violate a property. A significant drawback of this metric is its extreme sensitivity to timing variations. A signal that is functionally correct but slightly delayed can result in a large robustness penalty, leading to false positives in safety monitoring. Furthermore, most existing STL monitoring tools are designed for continuous-time simulations and struggle with the discrete, quantized nature of signals in embedded hardware. This paper addresses these gaps by proposing a metric that is cumulative, time-aware, and suitable for high-speed hardware implementation.

Methodology

Weighted Edit Distance (WED)

The core contribution of this work is the adaptation of the classical Levenshtein (edit) distance to the domain of digitized signals. The WED metric allows for three primary operations to align a signal with a specification:

  1. Substitution: Changing a signal's value to meet a predicate.
  2. Insertion: Adding a sample to account for timing delays.
  3. Deletion: Removing a sample to account for timing advances.

By assigning costs to these operations, the monitor calculates the "cheapest" way to satisfy the STL formula. This approach allows the system to "forgive" small timing inaccuracies (jitter) while still penalizing significant deviations in behavior.

Automata-Based Translation and Online Monitoring

To enable real-time monitoring, the authors developed a procedure to translate STL formulas into Weighted Symbolic Automata. These automata represent the logic and timing constraints of the specification as a state machine.

An online dynamic programming algorithm processes incoming signal samples step-by-step, finding the optimal path through the automaton. The resulting cost represents the robustness degree. This method ensures semantic equivalence, meaning that different but logically identical ways of writing a rule will yield the same robustness score.

Hardware Acceleration

To prove the practical utility of the WED framework, the monitor was implemented in Verilog HDL for deployment on Field Programmable Gate Arrays (FPGAs). This allows for high-frequency, low-latency monitoring directly on the hardware interface, bridging the gap between high-level design-time simulation and low-level deployment-time execution.

Experimental Evaluation

The proposed framework was evaluated using three distinct data sources:

  • Automatic Transmission Benchmark: A standard research model featuring eight complex STL requirements (e.g., constraints on engine speed and gear shifts).
  • Fault-Tolerant Fuel Control System: A stochastic model used to assess the monitor's performance under varying air-to-fuel ratio disturbances.
  • SENT Protocol Data: Real-world data from a magnetic sensor following the Single Edge Nibble Transmission (SENT) automotive standard.

Key Results

  • Phase-Shift Resilience: The WED metric demonstrated superior stability compared to traditional Hamming distance. While Hamming distance increases linearly with time shifts, WED remains stable, providing a more intuitive measure of system health.
  • Cumulative Robustness: Unlike point-wise metrics that only capture the single worst violation, WED is cumulative. It can distinguish between a single minor glitch and persistent instability near the failure threshold.
  • Resource Efficiency: FPGA implementation results showed that while simple properties are highly efficient (~260 LUTs), complex properties with large timing bounds can lead to "state explosion," requiring significant hardware resources (up to 120k+ LUTs).

Discussion and Future Work

While the WED framework provides a robust solution for CPS monitoring, the challenge of state explosion for complex properties remains. The current implementation's reliance on explicit clock enumeration contributes to this scaling issue. Future research will explore the use of "symbolic time" to reduce memory and logic requirements. Additionally, the authors aim to extend the framework's predictive capabilities, using the robustness degree to forecast potential system failures before they occur, thereby enhancing proactive safety measures in autonomous systems.

Summary updated

BibTeX
@article{jaksic2018quantitative,
  author = {Stefan Jaksic and Ezio Bartocci and Radu Grosu and Thang Nguyen and Dejan Nickovic},
  title = {{Quantitative monitoring of STL with edit distance}},
  journal = {Formal Methods Syst. Des.},
  year = {2018},
  doi = {10.1007/s10703-018-0319-x},
}
Figure