This video blog looks at fault detection and error handling. The included images of State Machines show templates for how I generally model fault detection algorithms.
In this first example there are two things to note:
- Debounce protection: Returning from “move to fault” and “no fault.” The signal needs to fall below the trigger signal – a delta to the signal. This prevents “jitter” in the signal. (Green circle.)
- Temporal logic: The move to “in fault” only takes place after you have held the fault condition as true for a set period of time. (Orange circle and black circle.)
The next example is more complex; in this example, a single variable “engine temp” can result in two different error modes. “High Temp” or “Critical High Temp.” In reality, the pattern is a slight variation on the previous version however it shows how it can be expanded to more complex fault conditions.