Calibrating Non-Standard 4-20 mA Analog Inputs on Pcs7AnIn Drivers in SIMATIC PCS 7 APL
In SIMATIC PCS 7 Advanced Process Library (APL), when an analog field transmitter delivers a non-standard or offset current loop (such as 4.15 mA to 19.65 mA instead of nominal 4.00 mA to 20.00 mA for 0-100% measurement span), replacing the standard Pcs7AnIn channel driver with a custom function block destroys native hardware diagnostic integration (such as Mode handling, Bad signaling, Namur limit supervision, and Quality Codes). To correct scaling without sacrificing diagnostics, engineers should mathematically pre-expand the Scale.Low and Scale.High parameters directly on the Pcs7AnIn block so that raw counts 259 (4.15 mA) and 27043 (19.65 mA) interpolate to exact 0.0% and 100.0% engineering units. Alternatively, if loop disturbances trip Namur limits, set NamurOff = 1 and configure custom HighLimit and LowLimit thresholds.
Table of Contents
- The Analog Scaling Problem on Standard Pcs7AnIn Drivers
- Diagnostic Penalties of Replacing Pcs7AnIn with Custom Blocks
- Solution 1: Mathematical Pre-Expansion of Scale Parameters
- Solution 2: Cascaded Processing with Quality Code Propagation
- Configuring Custom NAMUR Supervisory Limits
- Analog Scaling and Driver Parameter Matrix
- Verification
- Limitations and Operational Precautions
- Engineer FAQ
- Technical References
- Related Articles
- Related Tags
The Analog Scaling Problem on Standard Pcs7AnIn Drivers
In SIMATIC S7-400 and ET 200 distributed I/O systems, standard analog input modules (such as 6ES7331-7TF01-0AB0 or 6ES7331-7KF02-0AB0) convert an incoming $4-20\text{ mA}$ electrical current into a signed 16-bit integer raw value ranging from $0$ to $27648$ counts:
- $4.00\text{ mA} \rightarrow 0\text{ counts}$
- $12.00\text{ mA} \rightarrow 13824\text{ counts}$
- $20.00\text{ mA} \rightarrow 27648\text{ counts}$
The standard APL channel driver block Pcs7AnIn (FB1869) reads this raw integer from the peripheral input (PV_In), evaluates module diagnostics via the Mode parameter, and linearly scales the value to engineering units (PV_Out.Value):
$$PV_Out = \frac{PV_In - 0}{27648 - 0} \cdot (Scale.High - Scale.Low) + Scale.Low$$
However, in real-world process environments, field transmitters (such as legacy valve position feedback transmitters, pneumatic-to-current converters, or degrading sensors) frequently suffer from zero-shift or span-compression that cannot be re-zeroed in field hardware. For instance, a transmitter may output:
- Valve fully closed ($0.0\%$): $4.15\text{ mA} \rightarrow PV_In \approx 259\text{ counts}$
- Valve fully open ($100.0\%$): $19.65\text{ mA} \rightarrow PV_In \approx 27043\text{ counts}$
If Pcs7AnIn is configured with nominal scaling ($Scale.Low = 0.0$, $Scale.High = 100.0$), the output reads $0.94\%$ when fully closed and $97.81\%$ when fully open. Consequently, downstream interlocks and HMI bar graphs never reach true zero or full stroke.
Diagnostic Penalties of Replacing Pcs7AnIn with Custom Blocks
When faced with non-standard analog scaling, engineers frequently consider writing a custom SCL scaling function block in STEP 7. However, in SIMATIC PCS 7, bypassing Pcs7AnIn introduces severe diagnostic and operational penalties:
- Loss of Automated Module Driver Generation: The PCS 7 compiler command Generate Module Drivers automatically links physical I/O module health (
MOD_...blocks) toPcs7AnIn.Mode. Custom blocks do not participate in automated module driver generation. - Loss of Signal Quality Codes (ST):
Pcs7AnIngenerates a standard IEC 61131-3 Quality Code (PV_Out.ST = 16#80for Good,16#00for Bad). Downstream APL blocks (MonAnL,PIDConL, interlocks) rely on this byte to trigger fallback values and alarm suppression. - Loss of Simulation and Maintenance Modes: Features such as software simulation (
SimOn), maintenance release, and operator freeze are eliminated. - Loss of NAMUR NE 43 Compliance: Standard driver blocks continuously supervise wire breaks ($< 3.6\text{ mA}$) and short circuits ($> 21.0\text{ mA}$). Custom math routines lack this hardware validation.
Solution 1: Mathematical Pre-Expansion of Scale Parameters
The most elegant engineering solution corrects the scaling directly within Pcs7AnIn without altering a single line of code or sacrificing diagnostics.
By applying linear equation expansion, an engineer can compute adjusted virtual scale limits ($Scale.Low^$ and $Scale.High^$) such that:
- When $PV_In = Raw_{min} = 259$, $PV_Out = 0.0\%$
- When $PV_In = Raw_{max} = 27043$, $PV_Out = 100.0\%$
Calculation Derivation:
The linear equation for Pcs7AnIn is:
$$PV_Out = \left(\frac{PV_In}{27648}\right) \cdot (Scale.High^ - Scale.Low^) + Scale.Low^*$$
Let $Span_{raw} = Raw_{max} - Raw_{min} = 27043 - 259 = 26784\text{ counts}$.
The required engineering span is $100.0\%$.
-
Calculate Adjusted Scale.Low:
$$Scale.Low^* = 0.0 - \left(\frac{Raw_{min}}{Span_{raw}}\right) \cdot 100.0\% = 0.0 - \left(\frac{259}{26784}\right) \cdot 100.0\% = -0.967\%$$ -
Calculate Adjusted Scale.High:
$$Scale.High^ = Scale.Low^ + \left(\frac{27648}{Span_{raw}}\right) \cdot 100.0\% = -0.967\% + \left(\frac{27648}{26784}\right) \cdot 100.0\% = +102.261\%$$
Implementation in CFC:
- Open the CFC chart containing
Pcs7AnIn. - Locate the parameter
Scale. - Set
Scale.Low = -0.967. - Set
Scale.High = 102.261. - Now, when the valve delivers $4.15\text{ mA}$ ($259$ counts),
PV_Outreads $0.00\%$. When it delivers $19.65\text{ mA}$ ($27043$ counts),PV_Outreads $100.00\%$. - Full hardware diagnostics,
Modetracking,Badsignaling, and quality codes remain 100% active.
Solution 2: Cascaded Processing with Quality Code Propagation
If the process relationship is non-linear or if raw values must be dynamically adjusted during runtime, use a two-block cascaded architecture:
flowchart LR
A["Peripheral Input (PIW)"] --> B["Pcs7AnIn Channel Driver<br/>(Scale: 0.0 to 100.0)"]
B -- "PV_Out.Value" --> C["APL Smooth / Custom Math FB<br/>(Rescaling Logic)"]
B -- "PV_Out.ST + Bad" --> C
C -- "Calibrated PV + Preserved ST" --> D["MonAnL / PIDConL / Interlocks"]
- Keep
Pcs7AnInconfigured to read the raw input, generating diagnostic bitsBadandPV_Out.ST. - Route
Pcs7AnIn.PV_Outto the input of an auxiliary block (such as a custom SCL block or APLSmooth/Polygonblock). - Inside the custom block, recalculate the scaled engineering value using the two-point formula:
$$Y = \left(\frac{X - X_{min}}{X_{max} - X_{min}}\right) \cdot (Y_{max} - Y_{min}) + Y_{min}$$ - Critical Rule: The custom block must copy
Pcs7AnIn.PV_Out.STto its own outputOut.STand assertBad = Pcs7AnIn.Bad. This ensures downstream interlocks immediately trip if the field module reports wire break or channel failure.
Configuring Custom NAMUR Supervisory Limits
Standard Pcs7AnIn blocks supervise the input current against NAMUR NE 43 limits:
- Normal Operating Range: $3.8\text{ mA} - 20.5\text{ mA}$
- Underflow Fault (Wire Break): $< 3.6\text{ mA}$ ($Raw < -691$)
- Overflow Fault (Short Circuit): $> 21.0\text{ mA}$ ($Raw > 29030$)
If an erratic field transmitter or severe electrical noise causes the signal to dip momentarily to $3.5\text{ mA}$ during valve seating, Pcs7AnIn asserts Bad = 1.
To customize these limits:
1. In CFC, locate Pcs7AnIn.
2. Set parameter NamurOff = 1 (disables hardcoded NAMUR standard limits).
3. Adjust parameter LowLimit (e.g., set to $3.2\text{ mA}$ or equivalent counts) to prevent premature wire-break faults.
4. Adjust parameter HighLimit (e.g., set to $21.5\text{ mA}$) to permit transient overshoots.
Analog Scaling and Driver Parameter Matrix
The following matrix details the key parameters of Pcs7AnIn used in non-standard scaling and diagnostics:
PV_InINT0IW 512)Scale.LowREAL0.0Scale.HighREAL100.0PV_OutSTRUCTST)BadSTRUCTNamurOffBOOL0 (FALSE)1 to override default 3.6 mA - 21.0 mA supervisory limitsLowLimitREAL3.6NamurOff = 1HighLimitREAL21.0NamurOff = 1Verification
To confirm that the adjusted analog scaling behaves accurately while retaining diagnostic integrity:
1. In CFC, open Pcs7AnIn in online monitoring mode.
2. Inject a calibrated current of $4.15\text{ mA}$ using a precision 4-20 mA loop calibrator.
3. Verify that PV_Out.Value displays exactly 0.00 (within $\pm 0.05\%$ measurement tolerance).
4. Inject $19.65\text{ mA}$; verify that PV_Out.Value displays exactly 100.00.
5. Inject $11.90\text{ mA}$ (mid-point); verify that PV_Out.Value displays 50.00.
6. Disconnect the calibrator signal wire (simulating a wire break); verify that Bad.Value transitions to TRUE, PV_Out.ST drops to 16#00, and the WinCC faceplate immediately displays the channel fault icon.
Limitations and Operational Precautions
Observe the following engineering constraints when adjusting analog scaling:
- Physical Calibration Preferred: Re-scaling parameters in software should only be used when physical field transmitter zero/span adjustments or HART re-ranging via SIMATIC PDM cannot be performed.
- Resolution Loss: Compressing the effective raw span (e.g., using 26784 counts instead of 27648) results in a negligible loss of digital resolution (less than $3\%$), which is fully acceptable for standard process loops.
- HART Analog Transmitters: If the device is a HART transmitter, connect via SIMATIC PDM and calibrate the DAC (Digital-to-Analog Converter) or adjust upper/lower range values (URV/LRV) directly in transmitter non-volatile memory rather than pre-expanding software scale parameters.
Engineer FAQ
Why shouldn't I write my own SCL scaling block instead of using Pcs7AnIn?
Replacing Pcs7AnIn eliminates automated module driver generation, hardware fault tracking (Mode), Quality Code propagation (ST), simulation modes, and NAMUR wire-break diagnostics. Adjusting Scale parameters on Pcs7AnIn preserves all system features.
What happens if the current drops below 4.15 mA with adjusted Scale parameters?
The output value will linearly extrapolate below 0.0% (e.g., -0.5%). If the current drops below the NAMUR lower limit (3.6 mA), Pcs7AnIn asserts Bad = 1 and clamps the output or substitutes the configured safe value.
Can I calibrate analog inputs via SIMATIC PDM instead?
Yes. If the field transmitter supports HART, PROFIBUS PA, or Foundation Fieldbus, you should open SIMATIC PDM, execute the 'D/A Trim' or sensor calibration procedure, and realign the physical output to true 4.00-20.00 mA.
Technical References
- SIMATIC Process Control System PCS 7 Advanced Process Library (APL) Function Manual (A5E39142569-AB)
- NAMUR Standard NE 43 - Standardization of the Signal Level for the Failure Information of Digital Transmitters
- SIMATIC S7-400 Automation System Module Data Manual (A5E00850735-08)
Related Articles
- Resolving Bad Quality Faults on Pcs7DiIn Channel Drivers in SIMATIC PCS 7 APL
- Configuring HART Field Devices on AI 8x16Bit HART Modules via SIMATIC PDM
- Developing SCL Custom Motor Blocks for SIMATIC PCS 7
- Exposing Hidden or Non-OCM Block Parameters to WinCC in SIMATIC PCS 7
Related Tags
- Pcs7AnIn
- Analog Scaling
- APL
- NAMUR
- 4-20mA
- SIMATIC PCS 7
- Channel Drivers