Implementing Timer Functions in SIMATIC PCS 7 CFC and SFC - Using the APL TimerP Block vs Built-In Step Timers
To implement timing logic in SIMATIC PCS 7 Continuous Function Charts (CFC), use the standard Advanced Process Library (APL) block TimerP (FB1810) or classical TIMER_P (FB5). To configure a delay-on timer where an input change starts timing and sets an output bit upon reaching a setpoint, set TimerP.Mode = 1 (On-Delay / TON), configure the target duration at parameter Ti (format T#10s), and wire the trigger signal to In; upon reaching Ti, output Q transitions to 1. If triggering timers from Sequential Function Charts (SFC), note that SFC steps contain native execution timers (StepName.TI for elapsed time and StepName.TMAX for maximum time) that can directly drive step transitions without requiring external timer blocks.
Table of Contents
- Timer Architecture in SIMATIC PCS 7: Library Function Blocks vs SFC Native Timers
- Operating Modes of the APL TimerP Block (Pulse, On-Delay, Off-Delay)
- Step-by-Step Parameterization: Triggering Timers from CFC Logic and SFC Steps
- Native SFC Step Timers: Eliminating External Timer Blocks in Sequential Sequences
- Comparative Timing Matrix: TimerP vs IEC Timers vs Native SFC Step Timers
- Step-by-Step Procedure to Integrate TimerP in CFC and SFC Applications
- Verification
- Limitations and Operational Precautions
- Engineer FAQ
- Technical References
- Related Articles
- Related Tags
Timer Architecture in SIMATIC PCS 7: Library Function Blocks vs SFC Native Timers
In industrial automation, deterministic time delays, pulse generation, and debounce filtering are fundamental requirements across interlocking, actuator control, and sequence orchestration. In SIMATIC PCS 7, engineers migrating from classic Step 7 LAD/STL or third-party PLCs frequently search for simple timer instructions (such as S_ODT or TON).
In PCS 7, timing must comply with cyclic interrupt execution (e.g., OB35 at 100 ms) and multi-instance data encapsulation. The software architecture provides two distinct mechanisms for timing:
-
Continuous Function Chart (CFC) Timer Blocks: Dedicated function blocks placed directly on CFC sheets to provide continuous, autonomous time tracking. In modern systems, this is handled by
TimerP(FB1810) from the Advanced Process Library (APL) orTIMER_P(FB5) from the classic PCS 7 library. -
Sequential Function Chart (SFC) Built-In Step Timers: In sequential processes, steps natively track elapsed time. Every SFC step automatically maintains internal timer attributes (
TI,TMIN,TMAX) that eliminate the need to insert external timer blocks in CFC.
Operating Modes of the APL TimerP Block (Pulse, On-Delay, Off-Delay)
The APL TimerP block is a versatile, multi-mode timer configured via the integer input parameter Mode:
-
Mode = 0(Pulse - TP): When inputIntransitions from 0 to 1, outputQimmediately sets to1and remains high for the exact duration specified byTi. Subsequent transitions onInduring the pulse are ignored until the timer expires. -
Mode = 1(On-Delay - TON): When inputIntransitions from 0 to 1, the timer starts accumulating time. OutputQremains0. When elapsed time reaches or exceeds durationTi, outputQtransitions to1and stays high as long asInremains high. IfIndrops to 0 beforeTiexpires, the timer resets immediately. -
Mode = 2(Off-Delay - TOF): When inputInis 1, outputQis 1. WhenIndrops from 1 to 0, outputQremains1for the durationTi, transitioning to0only afterTihas elapsed. -
Reset(BOOL): An asynchronous reset input that immediately forces outputQ = 0and clears the elapsed time accumulator.
Step-by-Step Parameterization: Triggering Timers from CFC Logic and SFC Steps
Connecting TimerP within a technological program requires understanding data formats and signal handshakes:
-
Time Duration (
Ti): Uses the standard IEC S7TIMEdata format (e.g.,T#5s,T#2m30s,T#500ms). If dynamically calculated by an operator or upstream analog block in seconds (REAL), the real value must be converted using theTime_Ror arithmetic conversion blocks before connecting toTi. -
Triggering from SFC: An SFC step can directly set a trigger bit in its step action table (e.g., in the 'Initialization' phase:
Timer_Start := TRUE;and in the 'Termination' phase:Timer_Start := FALSE;). In CFC,Timer_Startconnects toTimerP.In.
Native SFC Step Timers: Eliminating External Timer Blocks in Sequential Sequences
Before instantiating external timer blocks for batch or recipe phases, engineers should evaluate native SFC timing capabilities:
-
Step Runtime (
StepName.TI): Tracks the exact elapsed time that the current step has been active (data typeTIME). -
Direct Transition Logic: In the transition condition following the step, the engineer can write:
Step1.TI >= T#15s. When the step has executed for 15 seconds, the transition condition evaluates to TRUE, and the sequencer advances. -
Minimum and Maximum Times (
TMIN/TMAX): Configured in step properties.TMINprevents the step from terminating prematurely even if transition conditions are satisfied.TMAXtriggers an automatic step timeout alarm if the process hangs.
Comparative Timing Matrix: TimerP vs IEC Timers vs Native SFC Step Timers
The following table compares timing mechanisms in SIMATIC PCS 7:
TimerP (FB1810)TIME (T#10s)TIMER_P (FB5)TIME / REAL (sec)SFB4 TON)TIME.TI)TIMEStep-by-Step Procedure to Integrate TimerP in CFC and SFC Applications
Follow this procedure to configure an on-delay timer in CFC:
-
Locate Block in Catalog:
- In CFC Editor, expand the catalog on the left pane:Libraries > PCS 7 AP Library V82/V90 > Blocks > Operation.
- DragTimerP(FB1810) into the CFC sheet. -
Configure Operating Mode and Duration:
- Open block properties or parameter list.
- Set parameterMode = 1(On-Delay).
- At parameterTi, enter the desired duration (e.g.,T#10sfor 10 seconds). -
Wire Trigger and Reset Logic:
- Connect the initiating digital condition (e.g., motor running feedbackMotL.FbkRunOut) to inputIn.
- If emergency reset is required, connect an interlock or reset bit toReset. -
Connect Output to Target Equipment:
- Connect output pinQto the downstream logic block (e.g., opening a purge valve or triggering an alarm blockMonDiL). -
Compile and Download:
- Compile CFC (Changes only) and download to the AS in RUN mode.
Verification
Verify timer operation through these checks:
- Open the CFC chart in Test Mode (Ctrl+T).
- Force or simulate the trigger condition on
In = 1. - Monitor output parameter
Time: verify that remaining time decrements smoothly (or elapsed time increments) in 100 ms intervals. - Confirm that output
Qremains 0 while timing. - When
Timereaches zero /Ti, confirm that outputQimmediately transitions to1. - Set
In = 0. Confirm that outputQimmediately returns to0and the timer resets to initial conditions.
Limitations and Operational Precautions
- Cycle Time Granularity:
TimerPexecutes within the cyclic interrupt OB where its CFC chart is assigned (e.g., OB35 at 100 ms). Timer accuracy cannot exceed the cyclic OB scan interval. For sub-millisecond precision, hardware interrupt modules or FM modules are required. - CPU Restart Behavior: Upon CPU warm restart (OB100),
TimerPresets its internal states. Ensure that initialization states (Init = 1) do not cause unintended output pulses upon controller recovery. - SFC Step Re-Entry: If an SFC sequence loops back into a step,
StepName.TIresets toT#0supon each entry.
Engineer FAQ
Can I adjust the timer duration from a WinCC operator faceplate?
Yes. Ti is an OCM-capable parameter (S7_m_c := 'true'). When TimerP is marked with 'Create block icon', operators with Authorization Level 6 can tune Ti directly from the standard APL faceplate.
How do I convert a REAL number in seconds to S7 TIME format?
Use the standard conversion block Time_R from the CFC Math library. Connect the REAL value (e.g., 15.5) to input In; the block outputs T#15s500ms.
Why did my timer not start when In pulsed for one cycle?
In Mode = 1 (On-delay), In must remain continuously TRUE for the entire duration Ti. A momentary pulse will reset the timer. For pulse extenders, use Mode = 0 (Pulse).
Does TimerP consume a Process Object (PO) license?
Yes, if OCM is enabled and compiled into WinCC OS tags. If operator visualization is not required, disable 'OCM possible' in block properties to avoid consuming a PO.
Can TimerP run in faster OBs like OB32 (50 ms)?
Yes. Move the runtime group containing TimerP to OB32 in the Run Sequence Editor to achieve 50 ms resolution.
Technical References
- SIMATIC Process Control System PCS 7 Advanced Process Library (APL) Function Manual - Section 8: Operations and TimerP
- Siemens Industry Online Support (SIOS) Entry ID 182376 - CFC Block for Timing
- SIMATIC Process Control System PCS 7 SFC for S7 (V8.2 / V9.0) Programming and Operating Manual
- SIMATIC S7-300/400 System and Standard Functions Manual - System Function Blocks SFB4 (TON) and SFB5 (TOF)
Related Articles
- Documenting Sequential Function Charts (SFC) in SIMATIC PCS 7 - IEC 61131-3 and ISA-88
- Understanding Step Execution Phases in PCS 7 SFC - Initialization, Processing, and Termination
- Cleaning Up and Optimizing CFC Runtime Groups in SIMATIC PCS 7
- Configuring Automatic-to-Manual Stop Transition on APL MotL and VlvL Blocks
Related Tags
- TimerP
- CFC Timers
- On-Delay
- SFC Timing
- APL
- Time Format
- AS Engineering