Resolving 'Error Writing New Run Sequence in OB Task (254:61013)' in CFC
The error 'Optimize Run Sequence (254:61013) - Error writing the new run sequence in OB\task' in SIMATIC PCS 7 CFC occurs when the optimization algorithm encounters conflicting task assignment attributes (specifically S7_tasklist) on blocks within the targeted task, or when attempting to optimize non-cyclic startup tasks such as OB100. In libraries like CEMAT, blocks possess rigid task attributes (e.g. S7_tasklist := 'OB1'). If generic arithmetic blocks (AND, OR) are intermingled in the same task without identical attributes, the optimizer aborts. To resolve this, exclude OB100 from optimization, segregate blocks with S7_tasklist into isolated runtime groups, or optimize cyclic OBs individually.
Table of Contents
- Operating Principles of CFC Run Sequence Optimization
- Root Causes: S7_tasklist Attributes and Task Conflict Loops
- Why Startup OB100 Fails Under Topological Optimization
- Step-by-Step Task Isolation and Optimization Workflow
- Comparison of Task Optimization Behaviors in PCS 7
- Verification
- Limitations and Operational Precautions
- Engineer FAQ
- Technical References
- Related Articles
- Related Tags
Operating Principles of CFC Run Sequence Optimization
In SIMATIC PCS 7, the Continuous Function Chart (CFC) compiler executes blocks in a deterministic execution order called the Runtime Sequence (Ablaufreihenfolge). To minimize signal propagation latency across blocks, CFC provides the feature Options > Optimize Run Sequence.
The optimizer evaluates data flow connections and reorders blocks inside organization blocks (such as cyclic interrupt tasks OB35 or main cycle OB1) so that upstream producer blocks execute immediately before downstream consumer blocks within the identical CPU timeslice.
Root Causes: S7_tasklist Attributes and Task Conflict Loops
When the optimizer attempts to write the recalculated schedule back into the chart database, error 254:61013 occurs due to specific architectural constraints:
- The
S7_tasklistAttribute: Certain specialized libraries (such as CEMAT, Minerals, or custom technological libraries) declare system attributes inside their block definitions, for example:S7_tasklist := 'OB1'. This informs the CFC editor that the block must execute exclusively in the specified task. - Mixed Runtime Groups: If generic logic blocks (such as
AND,OR,ADD_R,SelA02In) lacking theS7_tasklistattribute are placed in the same runtime group or task, and their interconnections create cross-task dependencies, the topological sorting algorithm encounters an unsolvable dependency loop. - Database Write Failure: Unable to reconcile the conflicting task constraints with signal-flow ordering, the compiler fails to write the new schedule, aborting with error
(254:61013) Error writing the new run sequence in OB\task MAIN TASK.
Why Startup OB100 Fails Under Topological Optimization
A frequent cause of failure occurs when users select global optimization, which attempts to reorder OB100 (Startup Organization Block):
OB100executes once upon CPU power-up or restart before any cyclic tasks begin.- Blocks placed in
OB100execute internal initialization algorithms, memory allocations, and license queries that do not follow continuous I/O data flow. - Attempting to optimize
OB100using signal-flow heuristics creates dependency violations, causing the optimizer to fail.
Step-by-Step Task Isolation and Optimization Workflow
Follow this procedure to resolve the optimization deadlock:
- Open the Runtime Sequence Editor:
- In CFC, pressCtrl+F5(or clickOptions > Edit Run Sequence). - Isolate Blocks with
S7_tasklist:
- Inspect the task reporting the error (e.g.OB1orOB35).
- Create a dedicated runtime group (e.g.Grp_CEMAT_Main).
- Ensure this runtime group contains only technological blocks sharing the identicalS7_tasklistattribute.
- Move auxiliary logic blocks (AND,OR) into standard, unconstrained runtime groups in standard cyclic OBs (e.g.OB35). - Optimize Individual Tasks Selectively:
- In the Run Sequence editor tree, select a specific cyclic interrupt task (e.g.OB35at 100 ms).
- SelectTask > Optimize Run Sequencedirectly on that specific task, rather than running global multiproject optimization.
- Never optimize OB100; leaveOB100blocks in their default insertion order. - Compile AS Charts: Recompile the CFC charts to verify clean code generation.
Comparison of Task Optimization Behaviors in PCS 7
The table below contrasts task types and their suitability for run sequence optimization:
Verification
Verify clean run sequence optimization:
- In the Run Sequence editor, right-click the target task (e.g.
OB35) and executeOptimize Run Sequence. - Confirm that optimization completes without displaying error dialog
254:61013. - Verify that upstream channel driver blocks execute prior to technological control blocks in the task list.
- In SIMATIC Manager, perform a full CFC compilation (
CFC > Compile > Entire program); confirm compilation finishes with 0 Errors. - Download changes to the controller; verify smooth cyclic execution in the CPU diagnostic buffer.
Limitations and Operational Precautions
Observe the following safeguards regarding runtime sequence optimization:
- Backup Multiproject Before Optimization: Optimizing the run sequence permanently restructures runtime groups in the CFC database. Always archive the project (
File > Archive...) before running optimization. - Feedback Loops: True closed feedback loops (e.g. output of Block B wired back into Block A) cannot be topologically ordered without introducing a 1-cycle delay; verify that critical control loops accept the resulting sequence.
- CEMAT Engineering Rules: When engineering with CEMAT, adhere to CEMAT guidelines regarding OB1 allocation and avoid manual block re-grouping without consulting the CEMAT reference manual.
Engineer FAQ
Why does CFC throw error 254:61013 when optimizing OB1 in CEMAT projects?
Because CEMAT blocks enforce the attribute S7_tasklist := 'OB1'. If standard logic blocks lacking this attribute are placed in the same runtime group, the optimizer encounters an unsolvable dependency loop and fails.
Should OB100 ever be optimized using 'Optimize Run Sequence'?
No. OB100 is a non-cyclic startup block executing initialization logic. Applying signal-flow optimization algorithms to OB100 causes immediate compiler conflicts and database write failures.
Can I reverse the run sequence optimization if it introduces unexpected timing delays?
CFC does not have an 'Undo Optimization' button. To revert, you must restore the project from a backup archive or manually re-arrange blocks in the Run Sequence editor.
Technical References
- SIMATIC CFC for S7 / PCS 7 Configuration Manual - Run Sequence Management: https://support.industry.siemens.com/cs/ww/en/view/109756486
- SIMATIC PCS 7 CEMAT Engineering Manual: https://support.industry.siemens.com/cs/ww/en/view/109780765
- SIMATIC S7-300/400 System Software Organization Blocks Guide: https://support.industry.siemens.com/cs/ww/en/view/102601737
Related Articles
- Resolving Initial LockAct State and Protect Interlock Latching After CFC Download in APL Drives
- Resolving CFC Compiler Error 'RefBlockCopy - S7JDAUDB.DLL' During CPU 410-5H Migration
- Decoding Diagnostic Alarm Placeholders (16#@1%X@) in SIMATIC PCS 7 System Driver Charts
Related Tags
- Optimize Run Sequence
- Error 254:61013
- S7_tasklist
- OB1
- OB100
- CEMAT Library