← All exercises

Tank Fill

medium

Open a fill valve until the tank level reaches the setpoint and close within deadband.

What it teaches

Latched bang-bang control: valve opens when level < setpoint - deadband, closes when level >= setpoint. The output is a latch driven by two thresholds. Teaches the canonical fill-controller pattern that every tank, hopper, and bin uses.

Inputs and outputs

TagTypeDefaultDescription
In_LevelREAL50Current tank level
Cfg_SetpointREAL100Target fill level
Cfg_DeadbandREAL10Deadband below setpoint to start filling
Out_ValveBOOLFill valve command signal

Required behavior

  • Out_Valve turns on when In_Level drops below Cfg_Setpoint minus Cfg_Deadband.
  • Out_Valve turns off when In_Level rises to or above Cfg_Setpoint.
  • Out_Valve maintains its current state when In_Level is between the start-fill threshold and the setpoint.