1. What the Program Does
This example delays switching lighting off. While Light_Command is active, Light_Output is on. When the command clears, a TOF timer holds the output TRUE for a preset number of scans.
The same pattern can delay stopping a lamp, fan, siren, or auxiliary mechanism after its command ends.
Light_Command → TOF_Light_Delay → Light_Output2. Example Signals
| Signal | Type | Purpose |
|---|---|---|
| Light_Command | Input | Lighting on command |
| TOF_Light_Delay | Block | Off-delay timer |
| Light_Output | Output | Final lighting output |
3. Main Logic
TOF is an off-delay timer. Light_Command TRUE makes Q TRUE immediately. When the command becomes FALSE, Q stays TRUE until the preset delay has elapsed.
This example uses PT_SCANS = 100.
4. Testing in the Simulator
- Activate Light_Command: Light_Output immediately becomes TRUE.
- Clear Light_Command: Light_Output remains TRUE during the delay.
- Observe successive scans while the output is held.
- Reactivate Light_Command before the delay expires: the timer returns to its active state.
- Let the complete off-delay expire: the output becomes FALSE.
5. What to Watch For
TON delays turning on; TOF delays turning off. This program needs TOF because lighting should turn on immediately and turn off after a delay.
Real systems usually specify delays in milliseconds or seconds. This JSON stores a number of logical scans for deterministic simulator behaviour.
Check in editor
Open the ready-made FBD diagram, toggle inputs, and compare the simulation behavior with the program notes. The JSON is also available as a direct download.