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
- APL Structured Data Types: REAL vs Struct Architecture
- CFC Auto-Conversion Mechanics and Global DB Limitations
- Recommended Solution Patterns: StuAnOu vs Intermediate Blocks
- Data Conversion Method Comparison
- Step-by-Step Implementation Procedure
- Verification
- Limitations and Operational Precautions
- Engineer FAQ
- Technical References
- Related Articles
- Related Tags
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:
- APL Structure Generator (
StuAnOu- FB1882): The standard, vendor-recommended approach.StuAnOuaccepts an elementary REAL value at inputInand a user-defined Signal Status at inputST_In(default16#80), outputting a fully compliantStructatOut. - Intermediate Math / Logic Block: Passing the DB address into an elementary CFC block—such as
ABS_RorSEL_R—allows the block's output pin to leverage CFC's automatic block-to-block structure generation when wired toMonAnL.PV_In.
Data Conversion Method Comparison
The following table compares the different methods for converting global DB variables to APL structured inputs:
StuAnOu (FB1882)ST_In (Good/Bad/Sim)ABS_R / ADD_R16#80 (Good) via auto-wrapperPcs7AnIn (Simulation)Step-by-Step Implementation Procedure
Method 1: Using the APL Converter Block StuAnOu (Recommended)
- Open the target CFC chart in SIMATIC Manager.
- In the CFC catalog, expand Libraries > PCS 7 AP Library > Blocks > Operate and locate
StuAnOu(FB1882). - Drag
StuAnOuonto the chart. - Right-click input
InofStuAnOuand select Interconnection to Operand. - Enter the symbolic or absolute DB address (e.g.,
"Modbus_Data".Flow_RateorDB100.DBD0). - Interconnect output
OutofStuAnOudirectly to inputPV_InofMonAnL. - Leave
ST_Inat its default value16#80(Good), or wire communication heartbeat logic to setST_In = 16#00on gateway timeout.
Method 2: High-Density Tag Handling via Custom SCL Block
- If mapping 100+ Modbus REAL tags, avoid placing 100 individual
StuAnOublocks. - Author an SCL function block that reads the raw DB array and outputs an array of structured REALs.
- 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:
- CFC Interconnection Check: Confirm that the interconnection line between
StuAnOu.OutandMonAnL.PV_Inappears green/solid in CFC with 0 syntax errors. - 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. - Signal Status Check: In CFC, confirm that
MonAnL.PV_In.STreads16#80and 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
StuAnOuandMonAnLin 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
- Siemens Industry Online Support Entry ID 109760968: SIMATIC Process Control System PCS 7 Advanced Process Library Manual
- Siemens AG: SIMATIC PCS 7 CFC for S7 / PCS 7 Manual (Doc No. A5E03415129)
- IEC 61131-3: Programmable Controllers - Data Types and Structs
Related Articles
- https://industrialautomation.net/search?query=pcs7+stuanou+real+to+struct+converter
- https://industrialautomation.net/search?query=apl+signal+status+byte+quality+codes
- https://industrialautomation.net/search?query=modbus+gateway+db+mapping+pcs7
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