Key Behaviors of Debouncer Chart
The key behaviors of the Debouncer chart are:
Intermediate Debounce State Isolates Transients
In addition to the states On and Off, the Debouncer chart contains
an intermediate state called Debounce. The Debounce state isolates
transient inputs by checking whether the signals retain their positive
or negative values, or fluctuate between zero crossings over a prescribed
period of time. The logic works as follows.
If the input signal...Then this state...Transitions
to...And the...Retains positive value for 0.1 secondDebounce.OnOnSwitch turns on
Retains negative value for 0.1 secondDebounce.OffOffSwitch turns off
Fluctuates between zero crossings for 0.3 secondDebounceOff.FaultNote:
The Debounce to Off.Fault transition comes from a higher level
in the chart hierarchy and overrides the transitions from the Debounce.Off
and Debounce.On substates.Chart isolates the input as a transient signal and gives
it time to recover
Temporal Logic Determines True State
The
debouncer design pattern uses temporal logic to:Determine whether the input signal is normal or transient
Give transient signals time to recover and return
to normal state
Use Absolute-Time Temporal Logic.The debouncer design uses the after(n,
sec) operator to implement absolute-time temporal logic
(see Operators for Absolute-Time Temporal Logic). The keyword sec defines
simulation time that has elapsed since activation of a state.
Use Event-Based Temporal Logic.As an alternative to absolute-time temporal logic, you can apply
event-based temporal logic to determine true state in the Debouncer
chart by using the after(n, tick) operator
(see Operators for Event-Based Temporal Logic). The keyword tick specifies
and implicitly generates a local event when the chart awakens (see Control Chart Execution Using Implicit Events).
The Error Generator block in the sf_debouncer model
generates a pulse signal every 0.001 second. Therefore, to convert
the absolute-time temporal logic specified in the Debouncer chart
to event-based logic, multiply the n argument
by 1000, as follows.
Absolute Time-Based LogicEvent-Based Logicafter ( 0.1, sec )after ( 100, tick )
after ( 0.3, sec )after ( 300, tick )
after ( 1, sec )after ( 1000, tick )