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
- Mechanics of Block Number Collisions and Interface Desynchronization
- Why Simply Changing the FB Number Fails to Clear the SCL Error
- Database Reorganization and Chart Reference Data Cleanup
- Comparative Error Resolution Matrix: SFC Type Compilation Faults
- Step-by-Step Procedure to Resolve SFC Type SCL Compiler Errors
- Verification
- Limitations and Operational Precautions
- Engineer FAQ
- Technical References
- Related Articles
- Related Tags
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:
-
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
Blocksfolder. -
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.
-
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 claimedFB1025in 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-DBstructures 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
Blocksfolder. -
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:
FB1500); update block types in CFCBlocks folderOptions > Block Types > New VersionFile > Reorganize (Slow) in SIMATIC ManagerStep-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:
-
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.,FB1200toFB1499). -
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. -
Delete Corrupted Old FB from Blocks Folder:
- Navigate toS7 Program > Blocks.
- Locate the old, conflicting FB previously generated by the SFC Type.
- Delete the old FB from the folder. -
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 intoFB1250without SCL errors. -
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. -
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. -
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:
- Confirm that the CFC Entire Compile log displays: '0 Error(s), 0 Warning(s)'.
- Open the S7 Program's
Blocksfolder. Confirm thatFB1250exists with the correct symbol name and timestamp. - Open a CFC chart containing an instance of the SFC Type. Verify that all input/output pins, setpoints, and status words are correctly mapped.
- 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.pdland 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
- SIMATIC Process Control System PCS 7 SFC for S7 (V8.2 / V9.0) Programming and Operating Manual
- Siemens Industry Online Support (SIOS) Entry ID 181231 - SCL compiler error
- SIMATIC S7-SCL V5.6 for S7-300/400 Manual - Error Diagnostics and Compiler Options
- SIMATIC PCS 7 Engineering System (V9.0) Manual - Chapter 8: SFC Types and Batch Integration
Related Articles
- Resolving CFC Download Error - 'The Interface of Block FC-FB Has Been Changed'
- Viewing and Analyzing Background STL Code of CFC Blocks in SIMATIC PCS 7
- Documenting Sequential Function Charts (SFC) in SIMATIC PCS 7 - IEC 61131-3 and ISA-88
- Deriving Block Icon Types and Variants for Custom SCL Function Blocks in SIMATIC PCS 7
Related Tags
- SFC Types
- SCL Compiler
- FB Interface
- Block Numbers
- CFC Engineering
- PCS 7 V9.0
- Reorganize