Why Module Driver Generation Fails on Channel Blocks Inside Chart-as-Block Types

Why Module Driver Generation Fails on Channel Blocks Inside Chart-as-Block Types

The PCS 7 Module Driver Generator cannot automatically interconnect system inputs (such as Mode, DataXchg, and MS) on channel blocks (Pcs7DiIn or Pcs7AnIn) encapsulated inside a 'Chart as Block type' because the driver generator only parses discrete blocks placed directly on standard CFC charts. Compiling a chart into a monolithic Function Block (FB) hides internal block pins within a private instance data block. Channel driver blocks must reside on open CFC charts where their processed signals feed custom block types, or the logic must be engineered as a Control Module Type (CMT).

Table of Contents

Architecture of the PCS 7 Module Driver Generator

In SIMATIC PCS 7, hardware diagnostic monitoring is fully automated through the Module Driver Generator (Generate module drivers). During CFC compilation:
1. The compiler scans the hardware configuration (HW Config) to discover all digital, analog, and communication modules.
2. It generates system diagnostic blocks (MOD_D16_PN, RACK, SUBNET) in automatically generated system charts prefixed with @.
3. It searches all user CFC charts for peripheral channel blocks (Pcs7DiIn, Pcs7DiOu, Pcs7AnIn, Pcs7AnOu, F_CH_DI).
4. It automatically establishes complex system interconnections:
* Mode: Interconnected to oMode_xx on the module driver block to track operating mode and diagnostic states.
* DataXchg: Interconnected to DataXchg_xx for diagnostic data record exchange.
* MS: Interconnected to o_MS for Maintenance Station asset reporting.

For this automated mechanism to succeed, the compiler must be able to read the symbolic hardware address connected to the channel block's peripheral input (e.g., PV_In linked to IW 512) and dynamically route wires to the block's system pins.

Encapsulation Limits of Chart-as-Block Types

When an engineer places a channel driver block inside a CFC chart and compiles the chart into a reusable block type (Compile -> Chart as Block type):

  1. Compilation into Monolithic Function Block (FB): The CFC compiler translates the entire chart contents into an S7-SCL source file and compiles it into a single binary Function Block (FB).
  2. Hiding Internal Interfaces: The individual blocks inside the chart (such as Pcs7DiIn) lose their discrete identity; they become internal static variables declared within the multi-instance structure of the new FB.
  3. Driver Generator Blind Spot: The Module Driver Generator does not decompile or inspect the internal static declarations of user FBs. When the custom block is placed in a new chart, the compiler only sees the outer pins. Because the compiler cannot reach inside the compiled FB to access the nested Pcs7DiIn.Mode and DataXchg pins, driver generation fails, leaving the channel block unmastered and reporting inactive or bad signal states.

Recommended Engineering Workflows for Modular Logic

To achieve modular, reusable control logic without breaking automated module driver generation, employ one of two certified PCS 7 design patterns:

Design Pattern 1: Separate Channel Blocks from Algorithmic Block Types (Standard Practice)

  1. Keep the custom Function Block purely algorithmic:
    * Create the custom FB (via SCL or Chart-as-Block) with standard inputs (e.g., PV: BOOL or PV_In: Struct). Do not place channel blocks inside the FB.
  2. Place the channel block (Pcs7DiIn) directly on the target CFC chart.
  3. Connect the physical peripheral address (e.g., I 0.0) to Pcs7DiIn.PV_In.
  4. Connect the output of Pcs7DiIn.PV_Out to the input of your custom block.
  5. When compiling with Generate module drivers, the compiler cleanly links the diagnostic drivers to Pcs7DiIn.

Design Pattern 2: Utilize Control Module Types (CMT) in Modern PCS 7

  1. In the Master Data Library, create a Control Module Type (CMT).
  2. Inside the CMT, place both the channel block (Pcs7DiIn) and your custom technological logic blocks.
  3. Interconnect them graphically within the CMT template.
  4. When instantiated across the plant hierarchy, CMTs instantiate real, open CFC charts rather than compiled black-box FBs. The driver generator retains full visibility into every channel block instance.

Verification

  • In SIMATIC Manager, compile the CFC charts containing the separated channel blocks.
  • Ensure the check box Generate module drivers is checked.
  • Open the CFC chart after compilation. Confirm that the channel block's Mode, DataXchg, and MS pins display green dynamic system connections leading to @ diagnostic charts.
  • Switch the CPU to RUN. Confirm that Pcs7DiIn.PV_Out.ST = 16#80 (Good) and that process states propagate correctly into your custom block.

Limitations and Operational Precautions

  • "Chart as Block type" is an older Step 7 concept designed primarily for algorithmic encapsulation; it should never be used to encapsulate hardware I/O interfaces in PCS 7.
  • Control Module Types (CMT) require PCS 7 V8.1 or higher and the Advanced Engineering System license.
  • If a project already contains monolithic FBs with embedded channel blocks, they must be refactored before migrating to newer PCS 7 versions or PROFINET architectures.

Engineer FAQ

  • Can I expose Mode and DataXchg as top-level pins on the Chart-as-Block type?
    Even if you route the pins to the outer interface of the FB, the Module Driver Generator will not recognize the block as a certified channel driver because its block family and attributes do not match the Siemens driver specification.
  • Why does APL use separate channel blocks instead of embedding them in motor blocks?
    Decoupling channel drivers from technological blocks allows the same motor or valve block to interface with different hardware types (standard I/O, HART, PROFIBUS PA, or PROFINET) without changing control algorithms.
  • Can CMT replace Chart-as-Block entirely?
    Yes. Control Module Types provide complete modular standardization, instance synchronization, and type updating in RUN (TCiR) while fully supporting module driver generation.

Technical References

  • SIMATIC PCS 7 CFC for S7 / M7 Manual (A5E41356247-AA).
  • SIMATIC PCS 7 Channel Blocks and Diagnostic Blocks Manual (A5E41356241-AA).
  • Siemens Industry Online Support Entry ID 109801081: Creating Reusable Block Types and CMTs in PCS 7.

Related Articles

Related Tags

PCS 7, CFC, Module Driver Generator, Pcs7DiIn, Chart as Block, Function Blocks, CMT, Hardware Config

20 respuestas