Deleting Blocks in SIMATIC PCS 7 'Blocks' Folder: Compilation Regeneration Rules, Risks, and Recovery
Deleting all blocks in the SIMATIC Manager offline 'Blocks' folder will cripple your automation system. CFC compilation does not regenerate all blocks. While CFC will recreate auto-generated system charts (charts starting with @), module driver blocks (authored by ES_MAP), and runtime instance DBs, it cannot recreate the master block types (FBs and FCs) imported from the Master Data Library or user libraries. If the block folder is cleared, CFC compilation fails with fatal 'Block type not found' errors. To safely recover or recompile, block types must be copied back from the Master Data Library into the Blocks folder.
Table of Contents
- Architecture of the PCS 7 'Blocks' Folder and CFC Database Relationships
- What CFC Compilation Actually Regenerates vs What Is Lost
- Consequences of Deleting Blocks Online vs Offline
- Step-by-Step Recovery Procedure from Master Data Library
- Block Category Regeneration and Persistence Matrix
- Verification
- Limitations and Operational Precautions
- Engineer FAQ
- Technical References
- Related Articles
- Related Tags
Architecture of the PCS 7 'Blocks' Folder and CFC Database Relationships
In SIMATIC PCS 7, the engineering database maintains a strict separation of concerns between graphical Continuous Function Charts (CFC), hardware configurations (HW Config), network configurations (NetPro), and the compiled executable code residing in the S7 Program's Blocks container.
Engineers troubleshooting compiled block inconsistencies, timestamp conflicts, or download mismatches occasionally contemplate deleting all blocks in the 'Blocks' folder with the expectation that recompiling HW Config, NetPro, and CFC will rebuild the entire program cleanly from scratch. This assumption is dangerously false and leads to catastrophic project corruption if attempted without understanding the underlying block origins.
What CFC Compilation Actually Regenerates vs What Is Lost
When CFC compiles, it reads block instances placed on charts and generates executable code based on templates and types already residing in the project:
-
What CFC CAN Regenerate:
- Instance Data Blocks (DBs): Instance DBs for all blocks instantiated in CFC charts.
- Module Driver Blocks and Charts: System charts with the@prefix (e.g.,@2(1),@3(1)) and module driver blocks with AuthorES_MAP(e.g.,CH_AI,MOD_1,RACK,DIAG_INF), provided the source driver types exist.
- SFC Runtime Blocks: Sequential Function Chart coordination DBs and FCs generated by the SFC compiler. -
What CFC CANNOT Regenerate (Permanently Lost):
- Library Function Blocks (FBs) and FCs: The actual block algorithms (e.g.,FB1865 PIDConL,FB1823 MotL,FB1828 VlvL, APL channel drivers, or custom SCL blocks). Without these in the Blocks folder, CFC cannot instantiate or compile them.
- Standard Organization Blocks: Custom OB code not generated by CFC.
- Shared Data Blocks: Manually created communication or recipe DBs that were not generated by CFC.
Consequences of Deleting Blocks Online vs Offline
The consequences differ drastically depending on whether blocks are deleted offline or online:
-
Offline Deletion: Deleting all blocks offline breaks the link between CFC charts and block type headers. Subsequent CFC compilation terminates with hundreds of fatal errors (
Block type FBxxx not found in block folder). The ES cannot perform Delta Download, and any subsequent download attempt mandates a full AS STOP download. -
Online Deletion: Deleting all blocks directly from the CPU online block folder immediately halts the automation processor (CPU STOP), aborts all active control loops, trips plant interlocks, and risks physical process disaster.
Step-by-Step Recovery Procedure from Master Data Library
If the offline Blocks folder was accidentally wiped or corrupted, follow this restoration procedure:
- Never Save or Download Corrupted Charts: Do not attempt an online download while the offline folder is empty.
- Open Master Data Library: In SIMATIC Manager, navigate to the Multiproject's Master Data Library.
- Update Block Types to Project: Select Options > Charts > Update Block Types. In the wizard, select all target S7 programs and click Finish. This automatically copies all required FB and FC block types from the Master Data Library back into the AS Blocks folder.
- Recompile HW Config and NetPro: Open HW Config; save and compile. Open NetPro; save and compile network connections.
- Generate Module Drivers: In CFC, execute Charts > Compile > Charts as Program. Select Entire Program and ensure the checkbox Generate Module Drivers is checked. The compiler regenerates all
@charts, driver FBs, and instance DBs. - Compare Time Stamps: Verify that block type versions match the library to prevent interface discrepancy warnings.
Block Category Regeneration and Persistence Matrix
The following table summarizes which block categories are regenerated during compilation and which must be restored:
Update Block Types)ES_MAP@... ChartsVerification
Verify project integrity and block folder consistency through the following steps:
- Open the offline Blocks folder. Confirm that all required APL/CEMAT FBs, FCs, and system blocks exist with green checkmarks.
- In CFC, execute a full compilation (Charts as Program > Entire Program with Generate Module Drivers). Ensure the compilation logs zero errors and zero warnings.
- Execute a CFC Test Mode connection to the online AS. Verify that all block inputs, outputs, and parameters display live values without 'Type conflict' or 'Block missing' indicators.
- Open the AS-OS connection compile dialog and verify that OS compilation succeeds without missing block structure warnings.
Limitations and Operational Precautions
Consider these vital rules regarding block management in PCS 7:
-
Never Delete Blocks Online While Plant Is In Operation: Deleting an online block causes the CPU to call OB121 (Programming Error) or OB85 (Priority Class Error). If these OBs are missing or execution fails, the CPU immediately enters STOP mode.
-
Delta Download Invalidation: Deleting and restoring blocks offline modifies internal block compilation timestamps. This permanently invalidates Delta Download capability, forcing a full AS download which requires a complete plant shutdown.
-
Always Archive Before Cleanup: Before performing any cleanup of obsolete blocks, execute File > Archive in SIMATIC Manager to create a full project ZIP archive on a secure engineering drive.
Engineer FAQ
How do I safely remove unused blocks from the Blocks folder?
In SIMATIC Manager, select the Blocks folder, click Options > Reference Data > Display, and choose 'Unused Blocks'. You can safely delete only those blocks confirmed to have zero references in CFC, SFC, or HW Config.
What does the Author 'ES_MAP' signify in the Blocks folder?
ES_MAP identifies blocks automatically generated by the PCS 7 Module Driver Generator (such as channel drivers and rack diagnostics) to bridge hardware I/O to software CFC charts.
Where is the Master Data Library located in a PCS 7 Multiproject?
In the SIMATIC Manager project tree, the Master Data Library is listed at the top level alongside the AS and OS projects, containing the standardized and version-controlled block types used across all stations.
Technical References
- SIMATIC Process Control System PCS 7 CFC for S7 / S7-400 Manual (Entry ID: 109780813)
- SIMATIC PCS 7 Engineering System Compendium Part A - Configuration Guidelines
- STEP 7 V5.5 / V5.6 System and Standard Functions Reference Manual
- Siemens Technical Support: Restoring S7 Program Block Containers from Master Data Library
Related Articles
- Understanding OS Compilation Warnings: Structure Type Changed Since Last Compilation
- Identifying Replacements for Obsolete FB205 and FB206 During Migration
- Recovering Disappeared CFC Charts and Resolving HARDWARE_ERROR INVALID_DRIVE
Related Tags
- CFC Compilation
- Blocks Folder
- Master Data Library
- ES_MAP
- AS Download
- PCS 7 Engineering