Interconnecting Global Data Block REAL Variables to APL Structured Inputs in PCS 7 CFC

Interconnecting Global Data Block REAL Variables to APL Structured Inputs in PCS 7 CFC

Directly connecting an elementary REAL variable from a global Data Block (e.g. Modbus gateway data at DB100.DBD0) to the PV_In input of an APL block (such as MonAnL) fails with the CFC error 'Invalid Interconnection, The ends are not the same type' because APL inputs require a structured data type consisting of a REAL value and an ST (Signal Status) byte. While CFC automatically inserts hidden conversion blocks when interconnecting between two CFC blocks, it cannot auto-wrap global DB addresses. To resolve this, use the standard APL converter block StuAnOu (FB1882) or an intermediate CFC block (such as SEL_R or ABS_R) to package the DB value into a valid APL structure.

Table of Contents

Executive Summary

When integrating third-party systems (such as Modbus RTU/TCP gateways, packaged skid PLCs, or OPC servers) into SIMATIC PCS 7, process data typically arrives in raw global Data Blocks (DBs) formatted as arrays of elementary data types (such as REAL, INT, or WORD). When engineers attempt to wire these DB addresses directly to the process variable input (PV_In) of Advanced Process Library (APL) monitoring blocks like MonAnL in the Continuous Function Chart (CFC) editor, the connection is rejected with an invalid data type error. This occurs because APL utilizes IEEE 754 floating-point values encapsulated within structured types containing a Signal Status quality byte. This technical guide details the root cause and provides field-tested methods to interface global DB tags cleanly into APL.

APL Structured Data Types: REAL vs Struct Architecture

Standard STEP 7 utilizes elementary 32-bit floating-point numbers (REAL). However, the PCS 7 Advanced Process Library implements structured process values to carry NAMUR NE107 signal quality metadata alongside numerical data.

The input PV_In on MonAnL (FB1845) is defined as a structure:
* Value (REAL): 32-bit floating-point process measurement.
* ST (BYTE): Signal Status quality code (e.g., 16#80 = Good, 16#60 = Simulated, 16#00 = Bad).

Because a global DB address (e.g., DB10.DBD4) provides only 4 bytes of raw floating-point data without the 5th status byte, the CFC type-checking compiler rejects direct interconnections.

CFC Auto-Conversion Mechanics and Global DB Limitations

When connecting two CFC block pins—such as connecting the elementary OUT pin of a standard mathematical block (ADD_R.OUT) to MonAnL.PV_In—the CFC editor detects the type mismatch and automatically instantiates a hidden conversion wrapper in the background, populating ST = 16#80 (Good).

However, this automatic wrapper generation functions strictly between CFC block pins. The CFC compiler cannot generate automatic wrapper logic for arbitrary global DB addresses, forcing engineers to insert an explicit conversion mechanism.

Recommended Solution Patterns: StuAnOu vs Intermediate Blocks

Engineers can choose between two primary methods to bridge DB values into APL:

  1. APL Structure Generator (StuAnOu - FB1882): The standard, vendor-recommended approach. StuAnOu accepts an elementary REAL value at input In and a user-defined Signal Status at input ST_In (default 16#80), outputting a fully compliant Struct at Out.
  2. Intermediate Math / Logic Block: Passing the DB address into an elementary CFC block—such as ABS_R or SEL_R—allows the block's output pin to leverage CFC's automatic block-to-block structure generation when wired to MonAnL.PV_In.

Data Conversion Method Comparison

The following table compares the different methods for converting global DB variables to APL structured inputs:

MethodBlock UtilizedMemory & CPU OverheadQuality Code HandlingRecommended Application ScopeAPL Struct BlockStuAnOu (FB1882)Minimal (~80 bytes load memory)Full control over ST_In (Good/Bad/Sim)Standard PCS 7 engineering best practiceElementary BlockABS_R / ADD_RVery low (~40 bytes)Fixed at 16#80 (Good) via auto-wrapperQuick bench testing or simple math bridgesCustom SCL FCUser-coded FunctionModerateProgrammable dynamic quality codesHigh-density Modbus gateways (100+ tags)APL DriverPcs7AnIn (Simulation)Higher (~300 bytes)Emulates full field channel driverSafety loops or loops requiring substitute values

Step-by-Step Implementation Procedure

Method 1: Using the APL Converter Block StuAnOu (Recommended)

  1. Open the target CFC chart in SIMATIC Manager.
  2. In the CFC catalog, expand Libraries > PCS 7 AP Library > Blocks > Operate and locate StuAnOu (FB1882).
  3. Drag StuAnOu onto the chart.
  4. Right-click input In of StuAnOu and select Interconnection to Operand.
  5. Enter the symbolic or absolute DB address (e.g., "Modbus_Data".Flow_Rate or DB100.DBD0).
  6. Interconnect output Out of StuAnOu directly to input PV_In of MonAnL.
  7. Leave ST_In at its default value 16#80 (Good), or wire communication heartbeat logic to set ST_In = 16#00 on gateway timeout.

Method 2: High-Density Tag Handling via Custom SCL Block

  1. If mapping 100+ Modbus REAL tags, avoid placing 100 individual StuAnOu blocks.
  2. Author an SCL function block that reads the raw DB array and outputs an array of structured REALs.
  3. Compile the SCL source with attribute { S7_m_c := 'true' } to allow direct WinCC tag generation.

Verification

To verify that the DB value propagates correctly into the APL monitoring block:

  1. CFC Interconnection Check: Confirm that the interconnection line between StuAnOu.Out and MonAnL.PV_In appears green/solid in CFC with 0 syntax errors.
  2. Online Monitoring: Switch CFC to Test Mode (Debug > Test Mode). Verify that numerical values changing in the source DB reflect accurately at MonAnL.PV_In.Value.
  3. Signal Status Check: In CFC, confirm that MonAnL.PV_In.ST reads 16#80 and that the block icon on WinCC displays the process value with no bad-quality badges.

Limitations and Operational Precautions

  • Signal Status Integrity: Wiring a DB tag directly through an intermediate block forces ST = 16#80 (Good). If the Modbus gateway communication fails, the last frozen value may continue to report 'Good' unless communication watchdog logic actively forces bad quality (ST = 16#00).
  • Execution Order: Ensure that the gateway communication DB update logic executes before StuAnOu and MonAnL in the cyclic interrupt runtime sequence (OB35).
  • Byte-Swapping Issues: Modbus gateways frequently transmit floating-point data with reversed word or byte orders (Endianness). Verify that raw REAL values in the DB are decoded correctly before routing to APL.

Engineer FAQ

Why doesn't Siemens allow direct connection from DB to APL blocks in CFC?

Because global DB addresses are untyped memory locations in STEP 7 that lack the metadata attributes and Signal Status byte demanded by the APL structure standard.

Can StuAnOu be used to route quality codes from communication gateways?

Yes. If the gateway provides a communication health bit, you can use a selection block to toggle StuAnOu.ST_In between 16#80 (Good) and 16#00 (Bad), enabling APL alarm generation on bus loss.

Does using StuAnOu consume an AS Process Object (PO) license?

No. Elementary converter blocks and utility blocks like StuAnOu do not consume AS RT PO licenses in PCS 7.

Technical References

Related Articles

Related Tags

  • https://industrialautomation.net/search?query=simatic-pcs7
  • https://industrialautomation.net/search?query=advanced-process-library
  • https://industrialautomation.net/search?query=cfc-editor
  • https://industrialautomation.net/search?query=data-types
6 respuestas