Debugging Cyber-Physical Systems (CPS)—such as autonomous vehicles, medical devices, or aircraft—is a significant challenge for engineers. These systems are inherently "hybrid," integrating continuous physical processes (like fluid pressure or velocity) with discrete computational logic (like state machines). When a failure occurs, the root cause is often temporally and spatially distant from the observed violation. For example, a sensor might drift at $t=2$, but the system-level requirement isn't violated until $t=10$, after the error has propagated through dozens of internal components.
Traditional debugging tools typically report that a requirement was violated but offer little assistance in tracing the failure back to a specific faulty component or a corrupted look-up table. CPSDebug is a novel framework designed to automate the "why" behind these failures by combining automated testing with specification mining.
The CPSDebug Workflow
The CPSDebug framework operates in three distinct phases to provide a forensic storyboard of system failures:
- Testing & Instrumentation: The system instruments a Simulink/Stateflow model to log internal signals. Using Signal Temporal Logic (STL), it automatically partitions test runs into "passing" and "failing" traces.
- Mining (Learning Normalcy): This core phase analyzes passing traces to infer intended behavior. It utilizes two complementary tools:
- Daikon: A template-based tool that discovers algebraic invariants (e.g., "Variable A is always greater than Variable B").
- Timed k-Tail (TkT): An automata-learning technique that captures the timing of state transitions.
- Explaining (Failure Analysis): When a test fails, CPSDebug checks the failing trace against the mined properties. It identifies internal variables that violate the "normal" rules, clusters these violations, and produces a sequence of time-ordered "snapshots" showing how the fault originated and propagated.
Hybrid Mining for Hybrid Systems
A key insight of the research is that algebraic invariants alone are insufficient for CPS. To catch "guard faults"—errors where the system performs the correct action but at the wrong time—the framework integrates Timed k-Tail (TkT) to learn the expected timing of state transitions.
As shown in the figure above, the inferred automaton captures specific timing constraints (e.g., $102 < T < 357$) and relative clock resets ($C_i = 0$) that define the boundaries of normal operation. Any deviation from these learned bounds in a failing run is flagged as a potential anomaly.
Key Results and Evaluation
The framework was evaluated using two industry-standard benchmarks: the Aircraft Elevator Control System (AECS) and the Automatic Transmission Control System (ATCS).
- Search Space Reduction: In the AECS case study, which features 426 variables, CPSDebug reduced the number of variables an engineer needs to inspect to just 17—a 96% reduction—while still pinpointing the root cause.
- Detecting Timing Anomalies: In the ATCS study, purely invariant-based methods failed to detect a specific "guard fault" because the signal values remained within normal ranges. However, the TkT integration successfully flagged the error because the timing of the state transition was anomalous.
- Efficiency: While the initial mining of properties is computationally intensive, the failure explanation phase is highly efficient, typically generating results in under 2 seconds.
Limitations and Future Directions
While powerful, CPSDebug has limitations. It cannot currently detect "masked" faults—internal errors that are compensated for by system redundancy and thus do not trigger a top-level failure. Additionally, the quality of the explanation is dependent on the coverage of the initial test suite used for mining. Future work aims to combine this debugging tool with automated test generation to proactively discover and explain edge-case failures.
Summary updated