How to Preserve CFC Runtime Execution Sequence During IEA and CMT Instance Generation
CFC runtime execution sequence alters from 1-2-3 to 2-1-3 during IEA or CMT instance generation because the import wizard creates runtime groups based on chart name sorting and default organizational block insertion pointers rather than relative chart positions. When instantiating multiple charts, independent auto-generated runtime groups are placed at the end of the OB execution cycle without structural chaining. To enforce the exact execution sequence permanently, consolidate interdependent blocks into a single user-defined runtime group inside the master template, or configure execution predecessor rules within Control Module Types.
Table of Contents
- Mechanics of CFC Runtime Groups and OB Execution Sequences
- Why Import Wizards Scramble Multi-Chart Execution Sequences
- Engineering Methods to Enforce Deterministic Runtime Order
- Verification
- Limitations and Operational Precautions
- Engineer FAQ
- Technical References
- Related Articles
- Related Tags
Mechanics of CFC Runtime Groups and OB Execution Sequences
In SIMATIC PCS 7, the deterministic execution of control logic within cyclic Organization Blocks (e.g., OB35 at 100 ms or OB32 at 1 s) is managed via Runtime Groups.
Every block placed in a CFC chart must reside in a runtime group assigned to a specific task:
* The execution sequence determines the exact order in which blocks read inputs, calculate algorithms, and write outputs within that scan slice.
* In interconnected control loops (e.g., an analog input driver Pcs7AnIn feeding a PID controller PIDConL, which in turn feeds an analog output Pcs7AnOu), executing blocks in the sequence 1 -> 2 -> 3 ensures that process values propagate through the entire loop in a single CPU cycle.
* If the sequence scrambles to 2 -> 1 -> 3, the PID controller evaluates stale data from the previous scan cycle, introducing artificial dead time (phase lag) into the control loop.
Why Import Wizards Scramble Multi-Chart Execution Sequences
When an engineer engineers a multi-chart technological model and duplicates it across plant units using the Import/Export Assistant (IEA), Process Tag Types (PTT), or Control Module Types (CMT):
- Independent Runtime Group Allocation: If each chart in the template has its own separate default runtime group, the import engine creates separate runtime groups for every newly imported instance.
- Name-Based or Pointer-Based Insertion: The import wizard inserts new runtime groups at the active Predecessor for Insertion marker in the target OB. When processing multiple charts per instance, the import engine inserts them in the order dictated by internal database object IDs or alphabetical chart name sorting rather than the user's manual design intent.
- Loss of Relative Offsets: The import engine preserves relative sequence numbers within a single runtime group, but it does not preserve relative execution order between disconnected runtime groups spread across separate charts.
Engineering Methods to Enforce Deterministic Runtime Order
To guarantee that imported instances maintain strict execution sequences across recurring re-imports:
Method 1: Consolidate Interdependent Blocks into a Single Runtime Group
- Open the master model or Control Module Type in CFC.
- Open the Runtime Editor (
Ctrl+Alt+R). - Create a single, explicitly named user runtime group (e.g.,
RG_Master_Loop). - Move all blocks from charts 1, 2, and 3 into this unified runtime group.
- Order the blocks sequentially:
Block_1->Block_2->Block_3. - When IEA or CMT imports an instance, the entire runtime group is instantiated as an atomic block sequence. The relative internal execution order (1 -> 2 -> 3) remains 100% immune to import sequence scrambling.
Method 2: Configure Predecessor Insertion Pointers in CMT
In modern PCS 7 (V9.0, V9.1):
1. In the Master Data Library, open the Control Module Type (CMT).
2. In the Technological Editor, select the runtime group.
3. Define the Execution Predecessor attribute, linking child groups explicitly to parent groups.
4. When synchronizing with CMT, the generator automatically places the child runtime groups immediately following their designated predecessors in the target OB.
Verification
- In SIMATIC Manager, execute the bulk import via IEA or CMT synchronization.
- Open CFC and launch the Runtime Editor (
Options->Customize->Runtime SequenceorCtrl+Alt+R). - Navigate to the target cyclic OB (e.g.,
OB35). - Locate the newly instantiated runtime groups.
- Confirm that the blocks within the imported instances execute strictly in the intended 1 -> 2 -> 3 order without manual repositioning.
Limitations and Operational Precautions
- Modifying runtime group assignments requires compiling and downloading the AS program. If block orders are restructured significantly, execute a full compile to ensure cross-block pointer integrity.
- Avoid placing excessive blocks into a single runtime group if they belong to different execution cycles (e.g., mixing 100 ms and 1000 ms tasks).
- In multi-user engineering, ensure that all engineers synchronize their Master Data Libraries before generating instances to avoid runtime sequence version conflicts.
Engineer FAQ
- Why does CFC allow blocks from different charts to share a runtime group?
Runtime groups are logical execution containers decoupled from physical chart layouts. A single runtime group can contain blocks originating from multiple distinct CFC charts. - What happens if two blocks with data dependencies execute in reverse order?
The downstream block processes data computed during the previous CPU cycle, adding one execution interval of transport delay. While logic still functions, high-speed closed-loop control stability is degraded. - Can I lock the runtime sequence in CFC?
Yes. In the Runtime Editor, you can disable "Optimize run sequence" and manually configure insertion pointers to prevent the compiler from moving groups automatically.
Technical References
- SIMATIC PCS 7 CFC for S7 / M7 Manual (A5E41356247-AA).
- SIMATIC PCS 7 Engineering System - Runtime Sequence Management and Optimization.
- Siemens Industry Online Support Entry ID 109801081: Runtime Group Handling in IEA and CMT.
Related Articles
- Best Practices for Organizing Cyclic Tasks and Runtime Groups in S7-410 Systems.
- Optimizing Control Loop Dead Time by Eliminating Reverse Execution Sequences in CFC.
Related Tags
PCS 7, CFC, Runtime Sequence, OB35, IEA, CMT, Runtime Groups, S7-400