Resolving SCL Compiler Errors and FB Interface Collisions After SFC Type Creation in SIMATIC PCS 7 V9.0

Resolving SCL Compiler Errors and FB Interface Collisions After SFC Type Creation in SIMATIC PCS 7 V9.0

When compilation of a SIMATIC PCS 7 V9.0 multiproject halts with SCL compiler errors indicating that an auto-generated Function Block's variable interface is linked to an incorrect block after creating an SFC Type, the failure is caused by block number collisions and desynchronized chart reference data. When an SFC Type is created, SIMATIC Manager automatically generates an underlying FB in the S7 Program. If this FB number conflicts with an existing block in the project library or if the SFC Type interface was edited without updating all instance DBs, the internal SCL compiler fails. To resolve this, assign the SFC Type a unique FB number in a free user range (e.g., FB1100–FB1999), execute 'Options > Block Types' in CFC to clean up and update versions, and run 'File > Reorganize...' on the multiproject to clear orphaned database pointers.

Table of Contents

SFC Type Architecture: Automatic FB Generation and SCL Compilation Engine

In SIMATIC PCS 7, the Sequential Function Chart (SFC) system provides two distinct engineering constructs: individual SFC Charts (non-reusable, standalone sequences) and SFC Types (reusable procedural control classes modeled after ISA-88 equipment phases and operations).

When an engineer authors an SFC Type:

  1. Automatic FB Generation: The SFC Type Editor does not execute directly in CPU memory as a graphic diagram; instead, the system compiles the steps, transitions, setpoints, control strategies, and characteristics into an underlying Function Block (FB) stored in the S7 Program's Blocks folder.

  2. Underlying SCL Code Generation: During full project or chart compilation, the PCS 7 engineering system generates intermediate SCL (Structured Control Language) code representing the state logic and invokes the internal SCL compiler.

  3. Instance DB Creation: In CFC charts, placing an instance of this SFC Type instantiates a dedicated Instance Data Block (DB) mirroring the generated FB's interface.

Mechanics of Block Number Collisions and Interface Desynchronization

The SCL compiler error reported in PCS 7 V9.0 typically reads:

'Error: Variable interface does not match the block type. Compilation aborted with errors in block FBxxxx.'

This occurs due to three structural issues:

  • Block Number Overlap: When creating the SFC Type, Step 7 assigns the first available FB number (e.g., FB1025). If another library, custom block, or driver block already claimed FB1025 in the master library, the compiler attempts to map the SFC Type's variables onto an entirely unrelated block interface, triggering severe syntax violations.

  • Interface Mismatch After Editing: If the engineer adds new characteristics, setpoints, or step actions in the SFC Type and recompiles, the auto-generated FB interface changes. If existing CFC chart instances or cached Y-DB structures in the background still expect the old parameter footprint, the SCL compiler detects an irreconcilable structure conflict.

  • Orphaned Database Pointers: Even if the engineer renames the block number in the SFC Type properties, old symbolic references and cached cross-reference tables in the Step 7 Sybase database retain pointers to the old collision.

Why Simply Changing the FB Number Fails to Clear the SCL Error

A common engineering mistake is merely changing the block number in the SFC Type Object Properties dialog and immediately retrying compilation.

This fails because:

  • Changing the number creates a second FB in the project while leaving the first corrupted FB and its instance DBs orphaned in the Blocks folder.

  • CFC charts where the SFC Type was instantiated continue to reference the old FB number until an explicit 'Update Block Types' command is executed across the charts.

  • The intermediate SCL compiler encounters conflicting type definitions for the same symbolic name in the Symbol Table.

Database Reorganization and Chart Reference Data Cleanup

To permanently eliminate SCL compilation errors, the project database must be structurally purged:

  • Symbol Table Alignment: Verify that the symbolic name assigned to the SFC Type points exclusively to the newly chosen FB number.

  • CFC Block Type Cleanup: In CFC, the 'Block Types' dialog manages the active type instances. Executing 'Clean Up' removes all unused block types and releases locked DB numbers.

  • Multiproject Reorganization: The File > Reorganize... utility compresses the Step 7 relational database, recalculates internal GUID pointers, and purges deleted block fragments.

Comparative Error Resolution Matrix: SFC Type Compilation Faults

The following table compares common SFC Type compilation errors and their proven engineering solutions:

Error SymptomRoot CauseAffected ComponentCorrective Procedure'Variable interface links to wrong block'FB number collision with library blockSCL Compiler / SFC Type FBAssign free FB number (e.g., FB1500); update block types in CFC'Block already exists' during compileOld compiled FB locked in Blocks folderS7 Program Blocks FolderDelete obsolete FB from Blocks folder; recompile SFC TypeSCL Syntax Error: Parameter mismatchAdded setpoint/characteristic desyncCFC Chart Instance DBsRun CFC Options > Block Types > New Version'Chart reference data corrupted'Orphaned DB pointers in Sybase DBStep 7 Project DatabaseExecute File > Reorganize (Slow) in SIMATIC Manager

Step-by-Step Procedure to Resolve SFC Type SCL Compiler Errors

Follow this exact sequence to resolve SFC Type SCL compilation failures in PCS 7 V9.0:

  1. Select a Guaranteed Free FB Number Range:
    - In SIMATIC Manager, open the S7 Program's Blocks folder.
    - Sort by block number and identify an unused block range reserved for user blocks (e.g., FB1200 to FB1499).

  2. Reassign FB Number in SFC Type:
    - In SIMATIC Manager Component View, locate your SFC Type.
    - Right-click the SFC Type -> Object Properties.
    - In the General tab, set the Block Number to your chosen free number (e.g., FB1250).
    - Ensure the symbolic name is concise and unique.

  3. Delete Corrupted Old FB from Blocks Folder:
    - Navigate to S7 Program > Blocks.
    - Locate the old, conflicting FB previously generated by the SFC Type.
    - Delete the old FB from the folder.

  4. Compile SFC Type Independently:
    - Double-click the SFC Type to open the SFC Type Editor.
    - Select menu SFC > Compile...
    - Confirm that the SFC Type compiles cleanly into FB1250 without SCL errors.

  5. Update Block Types in CFC:
    - Open any CFC chart in the project.
    - Select menu Options > Block Types.
    - Select your SFC Type in the Offline Block list and click -> New Version.
    - Click Clean Up to purge obsolete block calls.

  6. Reorganize Multiproject Database:
    - Close all CFC charts and editors.
    - In SIMATIC Manager, select File > Reorganize... (select the active project).
    - Allow the database defragmentation and reference recalculation to finish.

  7. Perform Entire CFC Compile:
    - Open CFC and select CFC > Compile > Entire program.
    - Verify that compilation concludes with 0 errors.

Verification

Validate compiler resolution through these verification checks:

  1. Confirm that the CFC Entire Compile log displays: '0 Error(s), 0 Warning(s)'.
  2. Open the S7 Program's Blocks folder. Confirm that FB1250 exists with the correct symbol name and timestamp.
  3. Open a CFC chart containing an instance of the SFC Type. Verify that all input/output pins, setpoints, and status words are correctly mapped.
  4. Download the program to S7-PLCSIM or the controller. Verify that the CPU remains in RUN and the SFC Type instance executes its state logic flawlessly.

Limitations and Operational Precautions

  • Online Changes Download: Changing the FB number of an SFC Type changes its block identity. This prevents an online Changes Download; the CPU will require a full download (STOP mode) to initialize the new block and its instance DBs.
  • WinCC Block Icons: Reassigning the SFC Type block number and symbol may require updating the corresponding block icon in @PCS7Typicals.pdl and re-running 'Create/Update Block Icons' in WinCC.
  • SIMATIC BATCH Synchronization: If the SFC Type represents an Equipment Phase (EPH) in SIMATIC BATCH, you must re-generate and merge Batch types in Batch Control Center following interface updates.

Engineer FAQ

Why does SIMATIC Manager automatically generate an FB for an SFC Type?

An SFC Type is an object-oriented class template. To execute in the S7-400 CPU, it must be compiled into standard S7 machine code packaged as a reusable Function Block (FB).

Can I view the auto-generated SCL source code?

Yes. During compilation, temporary SCL files are generated in the Sources folder (or can be generated via Options > Customize > Compile > Generate SCL Source).

What is the recommended number range for custom SFC Types?

Siemens reserves FB1 to FB999 for system and standard libraries (APL). Engineers should assign custom SFC Types to numbers between FB1000 and FB1999.

Why did deleting the block in the Blocks folder not clear the error?

If the block is still instantiated in CFC charts, the CFC database will attempt to reference it during compilation. You must update block types in CFC using Options > Block Types.

What does 'File > Reorganize' do in SIMATIC Manager?

File > Reorganize cleans up the internal relational Sybase SQL database of the Step 7 project, eliminating deleted records, fixing broken foreign keys, and repacking project files.

Technical References

Related Articles

Related Tags

  • SFC Types
  • SCL Compiler
  • FB Interface
  • Block Numbers
  • CFC Engineering
  • PCS 7 V9.0
  • Reorganize
6 respuestas