Implementing Timer Functions in SIMATIC PCS 7 CFC and SFC - Using the APL TimerP Block vs Built-In Step Timers

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

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:

  1. 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) or TIMER_P (FB5) from the classic PCS 7 library.

  2. 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 input In transitions from 0 to 1, output Q immediately sets to 1 and remains high for the exact duration specified by Ti. Subsequent transitions on In during the pulse are ignored until the timer expires.

  • Mode = 1 (On-Delay - TON): When input In transitions from 0 to 1, the timer starts accumulating time. Output Q remains 0. When elapsed time reaches or exceeds duration Ti, output Q transitions to 1 and stays high as long as In remains high. If In drops to 0 before Ti expires, the timer resets immediately.

  • Mode = 2 (Off-Delay - TOF): When input In is 1, output Q is 1. When In drops from 1 to 0, output Q remains 1 for the duration Ti, transitioning to 0 only after Ti has elapsed.

  • Reset (BOOL): An asynchronous reset input that immediately forces output Q = 0 and 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 S7 TIME data 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 the Time_R or arithmetic conversion blocks before connecting to Ti.

  • 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_Start connects to TimerP.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 type TIME).

  • 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. TMIN prevents the step from terminating prematurely even if transition conditions are satisfied. TMAX triggers 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:

Timing MechanismExecution LocationData Type / FormatFaceplate Monitoring?Best ApplicationAPL TimerP (FB1810)Cyclic OB (CFC Sheet)TIME (T#10s)Yes (APL Standard View)Interlocks, equipment start delays, pump flushingClassic TIMER_P (FB5)Cyclic OB (CFC Sheet)TIME / REAL (sec)Yes (Classic View)Legacy PCS 7 projects prior to APLIEC Timers (SFB4 TON)Cyclic OB (CFC / SCL)TIMENo (Raw System Block)Low-level SCL code, internal block sub-routinesSFC Step Timers (.TI)SFC Sequencer EngineTIMEYes (SFC Visualization)Step durations, dwell times, sequence timeouts

Step-by-Step Procedure to Integrate TimerP in CFC and SFC Applications

Follow this procedure to configure an on-delay timer in CFC:

  1. Locate Block in Catalog:
    - In CFC Editor, expand the catalog on the left pane: Libraries > PCS 7 AP Library V82/V90 > Blocks > Operation.
    - Drag TimerP (FB1810) into the CFC sheet.

  2. Configure Operating Mode and Duration:
    - Open block properties or parameter list.
    - Set parameter Mode = 1 (On-Delay).
    - At parameter Ti, enter the desired duration (e.g., T#10s for 10 seconds).

  3. Wire Trigger and Reset Logic:
    - Connect the initiating digital condition (e.g., motor running feedback MotL.FbkRunOut) to input In.
    - If emergency reset is required, connect an interlock or reset bit to Reset.

  4. Connect Output to Target Equipment:
    - Connect output pin Q to the downstream logic block (e.g., opening a purge valve or triggering an alarm block MonDiL).

  5. Compile and Download:
    - Compile CFC (Changes only) and download to the AS in RUN mode.

Verification

Verify timer operation through these checks:

  1. Open the CFC chart in Test Mode (Ctrl+T).
  2. Force or simulate the trigger condition on In = 1.
  3. Monitor output parameter Time: verify that remaining time decrements smoothly (or elapsed time increments) in 100 ms intervals.
  4. Confirm that output Q remains 0 while timing.
  5. When Time reaches zero / Ti, confirm that output Q immediately transitions to 1.
  6. Set In = 0. Confirm that output Q immediately returns to 0 and the timer resets to initial conditions.

Limitations and Operational Precautions

  • Cycle Time Granularity: TimerP executes 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), TimerP resets 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.TI resets to T#0s upon 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

Related Articles

Related Tags

  • TimerP
  • CFC Timers
  • On-Delay
  • SFC Timing
  • APL
  • Time Format
  • AS Engineering
6 respuestas