Programming Methodologies in PCS 7 SIMATIC Manager - Integrating SCL, STL, and LAD Within a DCS Architecture
SIMATIC Manager in PCS 7 supports traditional STEP 7 programming languages (STL, LAD, FBD, S7-SCL) alongside high-level Continuous Function Charts (CFC) and Sequential Function Charts (SFC). However, standard DCS engineering rules strictly prohibit writing raw ladder or statement list code directly in cyclic Organization Blocks (such as OB1 or OB35) or creating standalone FCs. In PCS 7 architecture, custom logic programmed in SCL, STL, or LAD must be encapsulated within reusable Function Blocks (FBs) with defined technological interfaces, stored in the Master Data Library, and instantiated within CFC charts. This encapsulation guarantees automated module driver generation, AS-OS engineering tag compilation, and seamless WinCC faceplate integration.
Table of Contents
- Executive Summary
- Architecture and Fundamental Mechanics
- Step-by-Step Implementation Procedure
- Verification
- Limitations and Operational Precautions
- Engineer FAQ
- Technical References
- Related Articles
- Related Tags
Executive Summary
Engineers transitioning from discrete PLC programming (STEP 7 V5.5 or TIA Portal) to SIMATIC PCS 7 frequently wonder whether familiar languages like Ladder Diagram (LAD) and Statement List (STL) are permitted. While the underlying STEP 7 editor suite remains accessible, PCS 7 operates as an integrated Distributed Control System where memory allocation, task scheduling, and SCADA tag generation are automated by the compiler. Writing raw, unencapsulated LAD/STL routines breaks the plant hierarchy and bypasses the Advanced Process Library framework. Adopting the proper methodology—authoring custom algorithms inside modular Function Blocks in SCL or STL and instantiating them within CFC—preserves system integrity and full DCS functionality.
Architecture and Fundamental Mechanics
The execution and compiler architecture of SIMATIC PCS 7 distinguishes raw PLC execution from technological DCS structures:
- The Automated Task Management Model:
* In standard STEP 7 V5.x, an engineer manually programs OB1 (cyclic main), OB35 (cyclic interrupt), and calls FCs and FBs with explicit memory addresses (DB10.DBX0.0,M0.0).
* In PCS 7, the CFC Compiler manages the Organization Blocks entirely. It reserves OB30 through OB38, instantiates runtime groups, and assigns execution sequences automatically. Manually inserting code into OB1 or cyclic OBs conflicts with CFC compiler code generation, causing memory overwrites or compile aborts. - The Encapsulation Requirement:
* Custom algorithms (complex mathematical formulas, specialized communication drivers, proprietary machine logic) are fully permitted, provided they are structured as Function Blocks (FBs).
* S7-SCL is the preferred language for custom PCS 7 blocks due to its strict type checking, structured flow control, and high execution efficiency.
* LAD/FBD/STL can also be used to author FBs in the S7 Program block folder. - The Role of Block Attributes:
* When an FB is authored, special system attributes prepare it for PCS 7 automation:S7_m_c := 'true': Marks parameters for automatic WinCC tag generation.S7_tasklist := 'OB35': Designates the default cyclic execution interrupt.S7_alarm := 'true': Enables automated message generation viaALARM_8P.- When placed in a CFC chart, CFC automatically generates instance DBs, addresses pointers, and compiles tags to WinCC.
- Migration Realities (STEP 7 V5.x to PCS 7):
* Migrating an existing S7-300/400 project written in raw LAD/STL into PCS 7 cannot be achieved by copying OBs.
* The raw logic must be refactored into discrete FBs, imported into the Master Data Library, and wired into CFC charts aligned with the Plant Hierarchy.
Step-by-Step Implementation Procedure
Follow these procedures to author, encapsulate, and deploy custom logic in PCS 7:
- Author the Custom Algorithm inside an FB:
* In SIMATIC Manager, navigate to theMaster Data Library > S7 Program > Sources(orBlocks).
* Insert a new SCL Source (recommended) or create a new FB in LAD/STL.
* Define strict formal inputs (VAR_INPUT), outputs (VAR_OUTPUT), and static variables (VAR).
* Annotate operator-controlled variables withS7_m_c := 'true'. - Compile the Block into the Master Data Library:
* Compile the source into an executable Function Block (e.g.,FB 1050).
* Assign a unique FB number outside the APL reserved range (avoid FB 1800 to FB 1999).
* Assign appropriate Family and Name attributes (e.g.,Family : 'Custom',Name : 'CalcFlt'). - Update Block Types across the Multiproject:
* In the Master Data Library, select theBlocksfolder.
* SelectOptions > Charts > Update Block Types....
* Propagate the newly created FB into all active AS projects. - Instantiate the Block in CFC:
* Open the target CFC chart in the appropriate Plant Hierarchy folder.
* From the catalog pane, drag the custom FB from the Master Data Library onto the chart canvas.
* Wire process inputs from channel drivers (Pcs7AnIn) and connect outputs to downstream logic. - Compile and Download:
* Compile the S7 Program with 'Changes only' and 'Generate module drivers'.
* Perform an OS compile to automatically generate WinCC process tags for all variables flagged withS7_m_c = true.
* Download changes to the AS controller in RUN.
Verification
In CFC test mode, verify that the custom FB executes cyclically, calculates outputs correctly according to the SCL/LAD algorithm, and updates downstream blocks. Open WinCC Tag Management; confirm that tags for the custom block appear automatically under the S7 Named Connection. In WinCC Graphics Designer, place an indicator or faceplate bound to the block's S7_m_c tags and verify bidirectional runtime communication.
Limitations and Operational Precautions
Never write code directly into OB1 or create unassigned Organization Blocks in a PCS 7 project. Never manually create instance DBs for blocks intended for CFC; the CFC compiler manages all instance DB numbers automatically. Avoid using global memory bit markers (M) or direct absolute addressing (DBx.DBDx); always utilize formal block parameters.
Engineer FAQ
Can I write Ladder (LAD) logic inside a CFC chart directly?
No. CFC is a graphical interconnection tool. However, you can write an FB in LAD, compile it, and place that FB into the CFC chart.
Why is SCL preferred over STL/LAD in PCS 7?
SCL provides superior mathematical handling, array indexing, string manipulation, and strict type safety compliant with IEC 61131-3, making it the industry standard for custom DCS blocks.
Can I migrate an S7-300 LAD project directly into PCS 7?
No. PCS 7 runs exclusively on S7-400 and CPU 410-5H architectures. The LAD algorithms must be refactored into FBs and integrated into CFC charts.
What does the S7_m_c attribute do?
S7_m_c ('Message and Control') instructs the AS-OS compiler to automatically generate corresponding WinCC tags and enable operator control on the SCADA.
Technical References
- SIMATIC Process Control System PCS 7 Engineering System (V9.0 SP3) Manual
- SIMATIC S7-SCL V5.6 for S7-300/400 Manual
- Siemens Industry Online Support Entry 109780813 - PCS 7 Licensing and Engineering Guidelines
Related Articles
- Architectural Distinctions Between PCS 7 SIMATIC Manager and Standalone STEP 7 V5.x with TIA Portal Migration Realities
- Integrating ALARM_8P Messages and Loop-In Capabilities in Custom PCS 7 SCL Blocks
- Preserving Delta Download Capability (Changes-Only Download) When Unpacking PCS 7 Multiprojects
Related Tags
- S7-SCL
- LAD in PCS 7
- Function Blocks
- Custom Blocks
- S7_m_c
- CFC Architecture