Proper Procedure to Clean Up Block Types in CFC and Why 'Compile Chart as Block Type' Fails with APL
To completely remove an obsolete block type from the CFC catalog and project in SIMATIC PCS 7, open CFC and select 'Options -> Block Types', click 'Clean Up' to delete the block from the chart folder, and confirm deletion from the offline block folder. Furthermore, Siemens explicitly discourages using 'Compile Chart as Block Type' for custom logic containing Advanced Process Library (APL) blocks because the compiler wizard cannot generate inner structure attributes (s7_xm_c). This prevents WinCC from generating individual tags for structure elements (Value and ST), breaking faceplates and block icons. The certified alternative is the 'Chart-in-Chart' technique or custom SCL programming.
Table of Contents
- Procedure to Delete and Clean Up Block Types from the CFC Catalog
- Why 'Compile Chart as Block Type' Fails with APL Structures
- Comparison Table - Custom Logic Packaging Methods in PCS 7
- Recommended Alternatives - Chart-in-Chart and SCL Development
- Verification
- Limitations and Operational Precautions
- Engineer FAQ
- Technical References
- Related Articles
- Related Tags
Procedure to Delete and Clean Up Block Types from the CFC Catalog
During project engineering and library testing, engineers frequently import or compile experimental block types into their PCS 7 project. When these blocks are no longer needed, simply deleting them from the offline block folder in SIMATIC Manager does not remove them from the CFC catalog, and right-clicking the block inside the CFC catalog offers no delete option.
The Certified Block Clean Up Procedure
To cleanly purge an unused block type from both the CFC catalog and the S7 Program database:
1. Remove All Instances in CFC Charts:
* Before a block type can be deleted, every single call/instance of that block must be deleted from all CFC charts across the multiproject.
2. Open the Block Types Manager:
* Open any CFC chart.
* Click Options -> Block Types.
3. Execute the 'Clean Up' Function:
* In the Block Types dialog, click the Clean Up button.
* The first window displays blocks currently registered in the CFC chart folder that are no longer instantiated in any chart. Select the target block and click OK to remove it from the chart directory.
* A second prompt immediately appears asking whether to delete the block from the offline block folder (S7 Program -> Blocks). Select the block and click OK.
4. Result: The block is completely removed from the project database, eliminating catalog clutter and preventing accidental instantiation.
Why 'Compile Chart as Block Type' Fails with APL Structures
A frequent question among PCS 7 engineers is: Can I build custom technological blocks by assembling standard APL blocks in a CFC chart and selecting 'Chart -> Compile -> Chart as Block Type'?
While this function exists in STEP 7 for standard logic, Siemens explicitly documents that compiling charts containing APL blocks as a block type is not recommended and largely unsupported for OS communication.
The Technical Attribute Problem (s7_m_c vs s7_xm_c)
In classic SIMATIC blocks, an elementary parameter (e.g., REAL) is flagged for WinCC Operator Control and Monitoring (OCM) using a simple attribute:
PvIn {s7_m_c := 'true'} : REAL;
However, the Advanced Process Library uses composite structures for almost all inputs and outputs to encapsulate signal values along with their IEEE 754 quality status byte:
PvIn {s7_m_c := 'true'; s7_xm_c := 'Value,true;'} : STRUCT
Value : REAL := 0.0;
ST : BYTE := 16#80;
END_STRUCT;
The specialized system attribute s7_xm_c instructs the PCS 7 OS compiler to drill down inside the structure and generate distinct WinCC tags for the inner elements (e.g., Motor1.PvIn#Value and Motor1.PvIn#ST).
Where the Wizard Fails
When you use Compile Chart as Block Type, the CFC compiler wizard can only assign the top-level s7_m_c attribute to outer I/O pins. It possesses no mechanism to declare or assign s7_xm_c attributes to individual structure elements!
* During OS Compile, WinCC sees the structure as an opaque blob rather than individual tags.
* Standard APL faceplates and block icons fail to bind to Value and ST.
* The faceplate opens with blank fields, question marks, or script runtime errors.
Comparison Table - Custom Logic Packaging Methods in PCS 7
The following table compares the capabilities, limitations, and operational suitability of methods used to package reusable logic in PCS 7.
s7_xm_c)Update Block Types)Update Block Types)Recommended Alternatives - Chart-in-Chart and SCL Development
To build reusable custom modules that maintain 100% compliance with PCS 7 APL standards, employ one of the two certified methodologies:
Alternative 1: The 'Chart-in-Chart' Technique
If you prefer graphical engineering without writing code:
1. In SIMATIC Manager Plant View, create a new CFC chart (e.g., DosingUnit_Template).
2. Insert standard APL blocks (MonAnL, VlvL, MotSpdCL).
3. Connect internal logic. For external connections, route pins to the chart border (Chart I/Os).
4. Save the chart in your Master Data Library under Templates.
5. In your production plant hierarchy, insert nested charts using Insert New Object -> CFC Chart and copy the template.
6. Because native APL blocks remain intact inside the sub-chart, all s7_m_c and s7_xm_c attributes are perfectly preserved, ensuring flawless OS compilation.
Alternative 2: Custom SCL Function Block Development
If you require a true reusable Function Block (FB):
1. In the Master Data Library, create a new SCL source file in the Sources folder.
2. Declare your formal inputs and outputs using exact APL structure syntax with both {s7_m_c := 'true'} and {s7_xm_c := 'Value,true;'} attributes.
3. Write algorithmic logic in certified SCL.
4. Compile the SCL source to generate the FB in the block folder.
5. Drag the new FB into CFC and run Options -> Update Block Types.
Verification
Confirm that block deletion or alternative packaging functions correctly:
- Verify Block Removal from Catalog:
* Open any CFC chart. Open the block catalog (Ctrl+K).
* Verify that the deleted block type no longer appears under Libraries or Blocks. - Verify Chart-in-Chart OS Compilation:
* If using Chart-in-Chart, execute an OS Compile.
* Open the OS project in WinCC Explorer. Verify that all tag structures (.Value,.ST) are correctly generated in Tag Management. - Verify Faceplate Operation:
* Activate WinCC Runtime.
* Click the block icon associated with your custom module. Confirm that the faceplate opens and displays valid live values without error indicators.
Limitations and Operational Precautions
- Pure Bit Logic Exception: If a chart contains only elementary boolean/integer logic (e.g., standard bit gates
AND,OR,XORfrom the standard library) with zero APL structures and zero OCM requirements, 'Compile Chart as Block Type' can be used safely. - Block Number Conflicts: When compiling custom SCL blocks or charts as block types, ensure the assigned FB number resides within the user-reserved range (typically FB 1000 to FB 1999) to prevent collisions with Siemens system libraries.
- Never Delete Standard APL Blocks: Never use 'Clean Up' to delete standard APL blocks (e.g.,
MonAnL,MotL) from the Master Data Library, as this breaks core system dependencies.
Engineer FAQ
Can 'Compile Chart as Block Type' cause an AS CPU stop?
No. The resulting FB will execute valid arithmetic logic inside the controller. The failure is not an AS crash; rather, it is a failure of the OS compiler to generate valid WinCC tags for structured variables, rendering faceplates useless.
Why can't I delete a block using 'Clean Up'?
The 'Clean Up' dialog will not allow deletion of a block type if even a single instance of that block remains placed inside any CFC chart in the project. You must delete every instance first.
Does Chart-in-Chart consume extra controller memory?
Yes. In Chart-in-Chart, each individual APL block retains its own full instance DB and code execution overhead, consuming more AS memory than a single custom SCL function block.
What tool should I use to edit SCL blocks in PCS 7?
Use the integrated S7-SCL editor included with the PCS 7 Engineering Station. It provides syntax highlighting, automatic attribute validation, and direct compilation into STEP 7 blocks.
Technical References
- SIMATIC Process Control System PCS 7 CFC for S7 (V8.1) Operating Manual
- SIMATIC Process Control System PCS 7 Advanced Process Library Style Guide
- SIMATIC S7-SCL for S7-300 and S7-400 Programming Manual
Related Articles
- Customizing APL MotSpdCL Faceplates and Block Icons with Additional Setpoint Fields
- Best Practices for Updating Block Types in Running PCS 7 Plants
- Resolving S7 F-Systems Safety Compilation Errors - 64 KB Code Section Limits
Related Tags
- CFC
- Block-Types
- APL
- SCL
- Chart-in-Chart
- Clean-Up