Resolving 'Error Writing New Run Sequence in OB Task (254:61013)' in CFC

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

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:

  1. The S7_tasklist Attribute: 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.
  2. Mixed Runtime Groups: If generic logic blocks (such as AND, OR, ADD_R, SelA02In) lacking the S7_tasklist attribute 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.
  3. 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):

  • OB100 executes once upon CPU power-up or restart before any cyclic tasks begin.
  • Blocks placed in OB100 execute internal initialization algorithms, memory allocations, and license queries that do not follow continuous I/O data flow.
  • Attempting to optimize OB100 using 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:

  1. Open the Runtime Sequence Editor:
    - In CFC, press Ctrl+F5 (or click Options > Edit Run Sequence).
  2. Isolate Blocks with S7_tasklist:
    - Inspect the task reporting the error (e.g. OB1 or OB35).
    - Create a dedicated runtime group (e.g. Grp_CEMAT_Main).
    - Ensure this runtime group contains only technological blocks sharing the identical S7_tasklist attribute.
    - Move auxiliary logic blocks (AND, OR) into standard, unconstrained runtime groups in standard cyclic OBs (e.g. OB35).
  3. Optimize Individual Tasks Selectively:
    - In the Run Sequence editor tree, select a specific cyclic interrupt task (e.g. OB35 at 100 ms).
    - Select Task > Optimize Run Sequence directly on that specific task, rather than running global multiproject optimization.
    - Never optimize OB100; leave OB100 blocks in their default insertion order.
  4. 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:

Organization Block (OB)Task DescriptionOptimization PermittedOptimization Risk / ConstraintOB1 (Main Cycle)Free cycle taskYes (If no mixed S7_tasklist)In CEMAT, requires dedicated runtime groupsOB30 - OB38 (Cyclic Interrupts)Periodic tasks (e.g. 100 ms)Fully Supported & RecommendedStandard APL target; optimizes signal latencyOB100 (Warm Restart)Startup initializationStrongly DiscouragedNon-cyclic; topological sort causes 254:61013 errorOB80 - OB87 (Fault OBs)System interrupt tasksNot ApplicableFixed system driver allocation; do not optimizeSafety Runtime Groups (F-OBs)PROFIsafe executionManaged by F-CompilerManual optimization forbidden; handled by S7 F-Systems

Verification

Verify clean run sequence optimization:

  1. In the Run Sequence editor, right-click the target task (e.g. OB35) and execute Optimize Run Sequence.
  2. Confirm that optimization completes without displaying error dialog 254:61013.
  3. Verify that upstream channel driver blocks execute prior to technological control blocks in the task list.
  4. In SIMATIC Manager, perform a full CFC compilation (CFC > Compile > Entire program); confirm compilation finishes with 0 Errors.
  5. 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

Related Articles

Related Tags

  • Optimize Run Sequence
  • Error 254:61013
  • S7_tasklist
  • OB1
  • OB100
  • CEMAT Library
6 respuestas