Troubleshooting Non-Specific Full Compilation Errors and SCL Crashes in PCS 7 CFC

Troubleshooting Non-Specific Full Compilation Errors and SCL Crashes in PCS 7 CFC

In SIMATIC PCS 7, encountering non-specific compilation aborts during a full CFC program compilation—where the compile log reports fatal errors without pointing to a specific block instance or line of code—is caused by underlying database fragmentation, SCL compiler memory limits, or oversized runtime groups. When an organization block contains too many block calls (exceeding SCL compiler parsing limits) or when corrupted cross-chart textual pointers exist in the project database (ombstx), the internal compiler processes (s7jcfcax.exe and s7scl.exe) terminate prematurely. Resolving this requires inspecting the detailed SCL compiler log, executing "Save with Reorganization (Slow)", and splitting oversized runtime groups.

Table of Contents

CFC Compilation Pipeline and Internal SCL Translation

The compilation of Continuous Function Charts (CFC) in SIMATIC PCS 7 is not a direct machine code generation process. Instead, CFC acts as a graphical preprocessor:
1. Graphical Analysis: The CFC compiler (s7jcfcax.exe) reads all chart drawings, parameter connections, and runtime sequences.
2. Intermediate S7-SCL Code Generation: The compiler translates the charts into intermediate Structured Control Language (S7-SCL) source code stored temporarily on disk.
3. SCL Compilation: The background SCL compiler (s7scl.exe) compiles this intermediate code into executable S7 machine blocks (FCs and DBs).
4. Module Driver Generation: S7JS7CAX.EXE inserts diagnostic drivers and binds system hardware addresses.

Because this multi-stage compilation involves inter-process communication between multiple Windows binaries, an unhandled exception or memory buffer overrun in any sub-compiler aborts the entire transaction without reporting a specific chart name.

Root Causes of Non-Specific Compilation Aborts

When a full compile halts with a blank or generic fatal error, the failure is typically traceable to one of four architectural causes:

Failure Root CauseMechanism / DefectSCL / CFC SymptomResolution StrategyOversized Runtime GroupSingle runtime group in OB35 contains > 100 blocksSCL stack overflow; compiler aborts silentlySplit blocks into multiple runtime groups in Run SequenceDatabase Index CorruptionHeavy chart editing/deletion left orphaned pointersError during phase: Translating chart structuresExecute 'Save with Reorganization (Slow)' in STEP 7Circular Textual LinksCross-chart textual interconnections form an endless loopCompiler hangs or crashes during interconnection resolutionOpen Chart Reference Data; clear textual loopsMissing HW Config SDBsHardware Configuration was modified but not compiledSystem Data Blocks (SDBs) missing for driver generatorSave and Compile HW Config before compiling CFC

A very common trigger is inserting dozens of blocks into a single cyclic OB task without creating partitioned runtime groups, causing the intermediate SCL code block to exceed maximum line and symbol table boundaries.

Inspecting Detailed SCL Compiler Logs on Disk

While the high-level CFC compilation log window may display only a generic error, the underlying SCL compiler writes an unbuffered, detailed diagnostic text log to the hard drive:

  1. Open Windows Explorer and navigate to the project directory:
    <Multiproject_Directory>\<AS_Project_Name>\Global\
  2. Locate the compilation log files:
    - s7scl.log
    - s7jcfcax.log
    - compile.log
  3. Open s7scl.log in Notepad; scroll to the very bottom:
    - The log lists the exact intermediate SCL source block, line number, and error definition (e.g., Error 2501: Nesting depth exceeded or Error 4012: Identifier too long in DB_Instance_X).
  4. Cross-reference the identified block number in SIMATIC Manager Component View to pinpoint the problematic chart.

Step-by-Step Database Reorganization and Task Splitting

To repair the project database and achieve a clean full compile:

  1. Re-Compile Hardware Configuration:
    - Open HW Config for the target AS.
    - Click Station -> Save and Compile. Confirm zero errors.
  2. Execute Deep Project Reorganization:
    - In SIMATIC Manager, close all open CFC and SFC editors.
    - Select the target AS user project.
    - Click File -> Save with Reorganization (Slow)....
    - This purges deleted database pointers, clears fragmentation, and rebuilds the ombstx symbol relational index.
  3. Partition Oversized Runtime Groups:
    - Open any CFC chart and select Edit -> Run Sequence.
    - Inspect OB35 (and other cyclic interrupt OBs).
    - If any single runtime group contains more than 50 blocks, right-click -> Insert Runtime Group.
    - Distribute the blocks across multiple groups (e.g., OB35_Group1, OB35_Group2).
  4. Compile Entire Program:
    - In CFC, click Chart -> Compile -> As Program.
    - Select Entire program and check Generate module drivers.
    - The compilation should now complete with 0 errors.

Verification

To verify that the full compilation defect is resolved:
1. Inspect the CFC compilation log; verify status: Compilation completed with 0 Error(s), 0 Warning(s).
2. Confirm that system data blocks (SDBs) and compiled program blocks are successfully written to the S7 Program blocks folder.
3. Perform a test compilation of 'Changes only'; confirm that incremental compilation functions smoothly.
4. Download the newly compiled program to the target controller (in STOP mode if entire compile altered block addresses, or verify if CiR is available).

Limitations and Operational Precautions

Never execute a full download to an active production controller without verifying whether the full compilation altered block numbers and instance DB allocations. A full compilation on an inconsistent project can renumber instance data blocks, prohibiting download in RUN mode and requiring a CPU STOP. Always archive the project (File -> Archive) before attempting database reorganization or mass chart recompilations.

Engineer FAQ

Why does CFC use an SCL compiler in the background?

CFC is a graphical authoring environment that translates high-level block interconnections into S7-SCL code, which is then compiled into STEP 7 machine code.

What is the maximum number of blocks recommended in a single runtime group?

Siemens recommends limiting individual runtime groups to approximately 50 to 80 blocks to prevent intermediate compiler buffer overflows.

What does 'Save with Reorganization (Slow)' do that standard Save does not?

Standard Save merely appends changes and marks deleted records. 'Save with Reorganization (Slow)' rebuilds the entire database file structure, removing orphaned records and fixing index corruption.

Technical References

Related Articles

Related Tags

  • CFC Compilation
  • SCL Compiler
  • Runtime Groups
  • Database Reorganization
  • Compiler Error
6 respuestas