Hysteresis Control

The Adapnex SDK provides blocks for switching boolean outputs based on analog input thresholds. These blocks implement hysteresis, a technique crucial for preventing rapid, unwanted switching ("chattering") when a signal fluctuates near a threshold.

These blocks are generic templates that operate with any comparable type (such as float, double, or int). Because they maintain internal state across cycles, they are designed to be instantiated as member variables of a Task and invoked cyclically within Update().

Overview of Available Blocks

The table below summarizes the hysteresis blocks available in the SDK. Detailed logic diagrams, parameter tables, and runnable examples for each block are documented on their respective reference pages linked in the table.

Block Type Behavior Summary Common Use Case

Hysteresis

Standard hysteresis

Switches output based on two thresholds (SET and RESET)

Thermostats, cooling fans, heating systems

HysteresisWithDelay

Delayed hysteresis

Adds an on-delay filter (PT) to both threshold transitions

Liquid level control, turbulent signals

Threshold Logic

These blocks automatically adapt their logic based on the relationship between SET and RESET:

  • Direct (e.g. Cooling/High-Alarm): If SET > RESET:

    • OUT becomes true when IN rises above SET.

    • OUT becomes false when IN falls below RESET.

  • Inverse (e.g. Heating/Low-Alarm): If SET ⇐ RESET:

    • OUT becomes true when IN falls below SET.

    • OUT becomes false when IN rises above RESET.

Best Practices

  1. Task Member Instantiation: Always declare hysteresis blocks as member variables of your Task class. Function blocks maintain internal state across cycles and will reset every cycle if declared locally inside Update().