03 · Timers that reset correctly

Practice module 3 of 5 · Ladder + Siemens SCL

Measure continuous time, not wishful time.

Trace a TON through a chattering sensor. Call it consistently and explain elapsed time.

20–25 minutesWritten predictions + self-checkNo account required

03 / Timing with evidence

What you will be able to prove

  • Separate elapsed-time qualification from a motion timeout.
  • Call timers consistently and make reset conditions explicit.
  • Test boundaries using timestamps rather than guessed scan counts.

Before this module: Modules 01–02: Boolean conditions and retained memory.
Core: 20–25 min · Applied lab: 25–35 min. These are planning estimates; work at your pace.

Your deliverable: Two independent timer specifications, a timing trace and a fault-isolation checklist.

Predict → trace → challenge → explain. The written labs are self-assessed. Use paper or your own compatible simulation. The browser workshop supports a limited training subset; these SCL excerpts are not import-ready or TIA-compiled blocks.

Your next step

Start small. Build from there.

New to this topic? Find the timer input and preset. Trace what happens when the input becomes FALSE before the delay finishes.

Optional hint: the idea in plain words

TON is an on-delay timer. IN is its input, PT is the requested delay, ET is elapsed time, and Q is the timer result. Keep the call running every scan.

Work in one language first, then compare the other. After the prediction, open step 3 for guidance or step 4 for an independent challenge.

Before you reveal: write your answer and one sentence explaining it. Use a notebook or your own editor. These pages do not execute code, auto-grade answers, or save progress.

01 · WORKED EXAMPLE

Wait for a stable part signal.

A part-present sensor must remain TRUE for 500 ms before Stable becomes TRUE. Inputs PartPresent, Run: BOOL. Outputs Stable, AcceptCmd: BOOL; Elapsed: TIME. In a Siemens FB, insert a TON with Static multi-instance PartDelay : TON_TIME. Keep the preset fixed.

Ladder

Call TON PartDelay every scan:
  IN  <- PartPresent
  PT  <- T#500ms
  Q   -> Stable
  ET  -> Elapsed

--[ Run ]--[ Stable ]--( AcceptCmd )
LAD network notation; contacts test Boolean values.

SCL

#PartDelay(IN := #PartPresent,
           PT := T#500ms,
           Q => #Stable,
           ET => #Elapsed);
#AcceptCmd := #Run AND #Stable;
SCL function-block body excerpt.

The block call comes before the output uses Stable. TON needs one dedicated persistent instance. When called with IN=FALSE, Q and ET reset. A TRUE input shorter than the preset does not accumulate credit across a later FALSE interval. This example qualifies the sensor even while Run=FALSE; Run only gates AcceptCmd.

02 · PREDICT

Trace a chattering sensor.

For this paper trace, assume calls at exactly the listed times and the timer starts at t=0. Write Stable and Elapsed after each call. Real observation occurs at program execution points, not continuously.

TON with PT = 500 ms
TimePartPresentStable?Elapsed?
0 ms1??
300 ms1??
400 ms0??
600 ms1??
1000 ms1??
1100 ms1??
1200 ms0??
Reveal the answer and why

Stable: 0, 0, 0, 0, 0, 1, 0. Elapsed: 0, 300, 0, 0, 400, 500, 0 ms. The FALSE call at 400 ms resets the first attempt. The new rising edge at 600 ms begins a new interval, so 1000 ms is only 400 ms later. At or after reaching PT while IN is still TRUE, Q is TRUE.

03 · FINISH THE SOLUTIONRequire Run during the delay.

Change the requirement: the signal must be present continuously while Run is TRUE. A stop must reset qualification. Leave the TON call unconditional and change only its IN expression.

#PartDelay(IN := ______,
           PT := T#500ms,
           Q => #Stable,
           ET => #Elapsed);
#AcceptCmd := #Run AND #Stable;
Guided exercise: pass FALSE when either condition fails.
Reveal the answer and why

Use #Run AND #PartPresent. In LAD, connect series Run and PartPresent contacts to the TON IN pin while ensuring the timer instruction is executed each scan. When Run becomes FALSE, the call receives FALSE and resets. Skipping the call with an IF is not a reset.

04 · INDEPENDENT VARIANTDelay a ventilation request.

BOOL inputs Enable and Demand must both stay TRUE for 2 seconds before FanCmd turns on. Either going FALSE must reset timing and turn FanCmd off. Declare a dedicated Static TON_TIME instance FanDelay, BOOL output FanCmd, and TIME output Elapsed. Draw the block connections and write SCL. Test a 1.9 s request, a full 2 s request, a brief interruption, and Enable dropping after the delay completes.

Compare your independent solution

Ladder

Call TON FanDelay every scan:
  IN  <- Enable AND Demand
  PT  <- T#2s
  Q   -> FanCmd
  ET  -> Elapsed
LAD network notation; contacts test Boolean values.

SCL

#FanDelay(IN := #Enable AND #Demand,
          PT := T#2s,
          Q => #FanCmd,
          ET => #Elapsed);
SCL function-block body excerpt.

A 1.9 s pulse never makes Q TRUE. A continuously TRUE input reaches Q=TRUE at an observation at or after 2 s. Any FALSE call resets Q and ET, so the next TRUE interval starts again from zero. A run that lasts longer than PT keeps Q TRUE while IN stays TRUE.

05 · TROUBLESHOOTThe timer was never told FALSE.
IF #Run THEN
  #PartDelay(IN := #PartPresent,
             PT := T#500ms,
             Q => #Stable,
             ET => #Elapsed);
END_IF;
Faulty design when normal stop must reset qualification.

Why is this different from the guided solution? Write the corrected unconditional call.

Reveal the answer and why

With Run=FALSE the instruction is skipped, so no FALSE input is delivered to the timer. You cannot treat that as reset or pause. Call every scan with IN := #Run AND #PartPresent. On Siemens CPUs, reading instance Q/ET can also refresh timer values; use the connected Stable/Elapsed outputs as the observation point and do not write timer internals.

APPLIED LAB / BUILD • INJECT • PROVE

Applied lab: qualification is not a timeout

A virtual transfer needs two different time rules. First, PartPresent must stay TRUE for 300 ms while Run is TRUE before PartStable becomes TRUE. Second, a commanded transfer that has not reached AtEnd within 2 s must raise TimeoutNow. Use separate persistent TON instances; do not reuse one instance for both jobs.

Declare Qualify and TravelWatch as Static TON_TIME instances. Inputs Run, PartPresent, TransferCmd and AtEnd are BOOL; outputs PartStable and TimeoutNow are BOOL; QualifyET and TravelET are TIME observation tags.

Compare the timer inputs after writing your requirements
#Qualify(IN := #Run AND #PartPresent,
         PT := T#300ms,
         Q => #PartStable, ET => #QualifyET);
#TravelWatch(IN := #TransferCmd AND NOT #AtEnd,
             PT := T#2s,
             Q => #TimeoutNow, ET => #TravelET);

Call both every scan. TimeoutNow is a live timeout condition, not a latched fault. If TransferCmd clears, this TON receives FALSE and its output clears. Preserve a separate fault record if the requirement says the operator must acknowledge the fault; that is the capstone task.

Boundary tests to record
Input sequenceExpected result
PartPresent TRUE for 299 ms, then a FALSE callNo qualification; elapsed time resets.
Continuous Run and PartPresent through 300 msPartStable TRUE at the first observation at or after the preset.
Run drops after qualificationPartStable and QualifyET reset at the FALSE-input call.
TransferCmd TRUE; AtEnd never arrivesTimeoutNow TRUE at an observation at or after 2 s.
AtEnd TRUE before 2 sTravelWatch resets; TimeoutNow remains FALSE.
Command clears after timeoutTimeoutNow clears. Explain why this alone is not fault memory.

Fault ticket: “the timer is random”

Capture its IN expression, connected Q/ET outputs, call execution and timestamp. Check whether IN chatters, the call is skipped, another call shares the instance, or the preset/units are wrong. Do not “fix” it by increasing PT before proving the cause. Do not infer exact real-machine timing from this simplified trace.

Reference: Siemens V20 TON behavior. These excerpts are teaching examples, not compiled TIA blocks.

Move on when: you can solve the independent variant in both representations, explain the edge cases, and fix any error without copying. A correct guess is a review item.