Engineering question
How should a PLC scale a 4–20 mA transmitter signal while preserving underrange, overrange and fault diagnostics?
A 4–20 mA loop represents a configured lower-range value at 4 mA and upper-range value at 20 mA. The PLC module rarely delivers milliamps directly; it produces raw counts whose 4 mA and 20 mA values depend on the module range and configuration. Scaling should therefore use the documented raw endpoints, not an assumed universal 0–27648 convention.
The live zero is valuable because current below the normal 4 mA region can indicate an open circuit, transmitter fault or module problem. If logic clamps every raw value immediately to the engineering range, operators lose that diagnostic information.
Calculation basis
Formulas and units
Linear scaling
EU = EUmin + (Raw − Rawmin) × (EUmax − EUmin) / (Rawmax − Rawmin)
Rawmin and Rawmax are the module's counts at 4 mA and 20 mA for the configured range.
Normalized fraction
N = (Raw − Rawmin) / (Rawmax − Rawmin)
Retain the unclamped fraction for diagnostics; use a separately clamped value for control if required.
Worked example
Apply the formula
A 0–10 bar transmitter maps 4–20 mA to raw counts 5530–27648. The PLC reads 16,589 counts.
- 1N = (16589 − 5530)/(27648 − 5530) ≈ 0.500.
- 2Pressure = 0 + 0.500 × (10 − 0) ≈ 5.00 bar.
Result: The scaled value is approximately 5.0 bar, subject to the actual module endpoint and transmitter calibration.
Robust function-block behaviour
- Parameters for raw low/high and engineering low/high
- Unclamped engineering value for diagnostics
- Optional clamped process value for control and display
- Underrange, overrange, wire-break and bad-quality states
- Substitution/fallback policy defined by process safety review
- Simulation mode that is authorized, visible and automatically controlled
Loop commissioning
Test at the transmitter or with an approved loop calibrator at 4, 12 and 20 mA, and also test diagnostic values below and above normal range where the equipment permits. Compare the calibrator, transmitter display, PLC raw count, scaled tag, HMI display and historian. Record the module channel configuration and range in the I/O list.
- Verify loop supply and total load resistance.
- Check channel isolation and common reference requirements.
- Confirm shield termination and hazardous-area barriers where applicable.
- Ensure alarms use the intended scaled or quality-qualified signal.
Common mistakes
- Using 0 as Rawmin for a module whose 4 mA value is nonzero
- Integer division before conversion to real
- Clamping before generating diagnostics
- Scaling 0–20 mA when the channel is configured for 4–20 mA
Troubleshooting checks
- Always zero/low: inspect loop supply, polarity, wire break and channel range.
- Scaled value is offset: confirm raw endpoints and transmitter LRV/URV.
- Value jumps with VFD operation: inspect segregation, shielding, grounding and isolation.
- HMI differs from PLC: find duplicate scaling or display-unit conversion.
Assumptions
- Linear transmitter output
- Raw endpoints correspond to 4 and 20 mA
- Module is configured for the intended current range
Limitations
- Does not calibrate the instrument
- Sensor linearization and square-root extraction may require additional processing
- Fault-current conventions depend on the transmitter and project standard
Topic cluster
