← Research library
SCHEMATEX / RESEARCH NOTEWorked analysis · Industrial controls

4–20 mA PLC scaling: a 0–250 kPa worked FBD example

Scale 4–20 mA to engineering units with the endpoint formula, verify 13.6 mA = 150 kPa, and keep range diagnostics separate from a limited display value.

KEY RESULT150 kPa

scaled result for 13.6 mA on a linear 0–250 kPa range

FIGURE 01 / REPRODUCIBLE OUTPUTSVG · SCHEMATEX
Function Block Diagram with SUB, DIV, and MUL blocks scaling a 4 to 20 milliamp input to 0 to 250 kilopascals, followed by separate display limiting and range checks
Rendered deterministically by Schematex 1.0.13 from the source reproduced here; strict parsing and rendering succeeded, and the endpoint, midpoint, worked-value, inverse, and out-of-range calculations were independently checked.

For a linear 4–20 mA input mapped to 0–250 kPa, subtract the 4 mA live-zero, divide by the 16 mA input span, then multiply by the 250 kPa engineering span. At 13.6 mA, the normalized input is (13.6 - 4) / 16 = 0.60, so the pressure is 0.60 × 250 = 150 kPa. Calculate and preserve the input-range status before limiting a display value; otherwise a low or high current can look like a valid endpoint.

Function Block Diagram scaling a 4 to 20 milliamp pressure signal into 0 to 250 kilopascals, then limiting the display while preserving under-range and over-range flags
The first network implements the linear equation. The second limits only the display value. The third checks the original current against the stated 4 mA and 20 mA endpoints so limiting cannot erase the range condition.

Scope and terms before the formula

IEC 61131-3:2025 Edition 4 identifies Function Block Diagram (FBD) as one of the graphical languages in the current programmable-controller language suite. The standard establishes the language; it does not make every controller's analog representation, tag names, diagnostic thresholds, execution order, or scaling instruction identical.

This worked example begins after a fictional analog input has provided a REAL value in milliamps. That assumption is important. A real module may instead provide signed counts, unsigned counts, percent of range, or engineering units already scaled in module configuration. Rockwell's September 2025 SCL documentation, for example, describes both floating-point inputs and a case where a module supplies unscaled integer values. Use the endpoints that correspond to the configured data representation—not 4.0 and 20.0 merely because the field loop is labeled 4–20 mA.

The four endpoint terms are:

TermValue hereMeaning
InputMin4.0 mAinput corresponding to the low engineering endpoint
InputMax20.0 mAinput corresponding to the high engineering endpoint
EUMin0 kPalow engineering-unit endpoint
EUMax250 kPahigh engineering-unit endpoint

"Scaling" is the linear conversion. "Limiting" or "clamping" forces a result into a chosen range. "Diagnostics" decides whether the source should be trusted or flagged. They can share endpoints, but they are not the same operation.

The endpoint formula

Rockwell's current SCL reference uses the general endpoint form below for conversion to engineering units:

EU = EUMin
   + (Input - InputMin)
   × (EUMax - EUMin) / (InputMax - InputMin)

Written as normalize, span, and offset steps:

InputSpan  = InputMax - InputMin
EUSpan     = EUMax - EUMin
Normalized = (Input - InputMin) / InputSpan
EU         = EUMin + Normalized × EUSpan

The required invariant is InputMax > InputMin; otherwise InputSpan is zero or negative and the configuration is invalid. Rockwell's SCL instruction reports an invalid raw range rather than silently treating equal endpoints as a useful scale. The exact fault or status mechanism remains controller-specific.

For this example, EUMin is zero, so the final addition disappears:

Pressure_kPa = (Current_mA - 4.0 mA)
             / (20.0 mA - 4.0 mA)
             × (250 kPa - 0 kPa)

             = (Current_mA - 4.0 mA)
             / 16.0 mA
             × 250 kPa

The units expose a common mistake: (mA / mA) is dimensionless, leaving kilopascals. Subtracting 4 without knowing whether the tag holds milliamps or device counts breaks that unit check.

Worked value: 13.6 mA

Use these explicit inputs and assumptions:

InputValue
current value13.6 mA
current endpoints4.0–20.0 mA
pressure endpoints0–250 kPa
relationshiplinear between the configured endpoints
arithmetic typefloating point
calibration and uncertaintynot modeled

First remove the live-zero offset:

13.6 mA - 4.0 mA = 9.6 mA

Then normalize by the 16 mA span:

9.6 mA / 16.0 mA = 0.60

Finally apply the 250 kPa engineering span:

0.60 × 250 kPa = 150 kPa

An inverse calculation catches swapped endpoints and misplaced offsets:

Current_mA = 4.0 mA + (150 kPa / 250 kPa) × 16.0 mA
           = 4.0 mA + 9.6 mA
           = 13.6 mA

The forward and inverse results agree. This proves the arithmetic under the stated linear model; it does not prove that a transmitter actually produced 13.6 mA or that the input channel measured it accurately.

Reproducible Schematex source

fbd "4-20 mA to 0-250 kPa"

var Current_mA: real
var Scaled_kPa: real
var Display_kPa: real
var UnderRange: bool
var OverRange: bool

network 0 "Linear engineering-unit scaling":
  Scaled_kPa = MUL(DIV(SUB(Current_mA, 4.0), 16.0), 250.0)

network 1 "Bound the display only":
  Display_kPa = LIMIT(MN: 0.0, IN: Scaled_kPa, MX: 250.0)

network 2 "Preserve input-range diagnostics":
  UnderRange = LT(IN1: Current_mA, IN2: 4.0)
  OverRange = GT(IN1: Current_mA, IN2: 20.0)

Schematex 1.0.13 strictly parsed and rendered this source on September 1, 2026. The SVG contains three networks; one each of SUB, DIV, MUL, and LIMIT; two comparison blocks; REAL signal paths; BOOL diagnostic outputs; and no parser or renderer diagnostics. The current Schematex FBD syntax reference documents nested math calls, inline constants, declared types, LIMIT, and comparison blocks.

The renderer makes the data flow reviewable, but it does not execute the networks or guarantee a target PLC's scan behavior. The two range comparisons also use the nominal scaling endpoints only to demonstrate separation of concerns. A real project may define different diagnostic limits, delay or debounce a condition, read module status bits, or reject the measurement by another validated rule.

Anchor checks and out-of-range behavior

Three anchor points should pass before testing an arbitrary value:

CurrentCalculationExpected pressure
4.0 mA(4 - 4) / 16 × 2500 kPa
12.0 mA(12 - 4) / 16 × 250125 kPa
20.0 mA(20 - 4) / 16 × 250250 kPa

The midpoint check is especially useful: 12 mA is halfway between 4 and 20 mA, so it must map halfway between 0 and 250 kPa.

Now challenge the range. With the same linear equation, 3.8 mA produces:

(3.8 - 4.0) / 16.0 × 250 = -3.125 kPa

The diagram's LIMIT network would show 0 kPa, while UnderRange remains true because it compares the original current with 4.0 mA. At 20.4 mA, the unrestricted result is 256.25 kPa; the display becomes 250 kPa, and OverRange remains true. This is why downstream logic should not infer measurement health from the clamped display alone.

Rockwell documents the same conceptual separation in its SCL instruction: limiting can bound the output while minimum and maximum input alarms report that the input crossed its configured raw endpoints. Do not copy those exact status names into another platform without its manual.

Checks and invariants

  1. Endpoint order: InputMax > InputMin; the input span is 16.0 mA, not zero.
  2. Low endpoint: 4.0 mA maps exactly to 0 kPa.
  3. High endpoint: 20.0 mA maps exactly to 250 kPa.
  4. Midpoint: 12.0 mA maps to 125 kPa.
  5. Worked value: 13.6 mA maps to 150 kPa, and the inverse formula returns 13.6 mA.
  6. Monotonicity: because both spans are positive, increasing current cannot reduce the calculated pressure.
  7. Representation: the tag's actual units match the configured scaling endpoints. If the tag contains counts, both input endpoints must be counts.
  8. Status preservation: an out-of-range input remains visible to diagnostics after any display limiting.
  9. Precision: intermediate operations use sufficient numeric precision; integer division must not truncate the normalized fraction to zero.

Failure modes and review boundary

Common failures are treating 4 mA as zero before subtracting it, dividing by 20 instead of the 16 mA span, applying a pressure range that differs from the transmitter configuration, using milliamp endpoints against a raw-count tag, performing integer division, swapping low and high endpoints, and clamping before checking the original input. Another failure is assuming every current below 4 mA has one universal meaning. The module manual, transmitter manual, configured diagnostic limits, and project alarm philosophy control that interpretation.

Scaling also does not remove measurement uncertainty. Transmitter accuracy, input-module accuracy, quantization, loop resistance, supply voltage, grounding, shielding, calibration, environmental conditions, and wiring faults can all affect a real value. A mathematically correct 150 kPa is still only as trustworthy as the measurement chain and its diagnostics.

Paste the source into the Schematex playground. Change the engineering endpoints to the real transmitter range, then calculate and test the low endpoint, midpoint, high endpoint, one normal operating value, and at least one value on each side of the accepted input range. In the target PLC, confirm the actual module data representation and observe both the unrestricted result and the independent diagnostic state before accepting the implementation.

References

  1. International Electrotechnical Commission. Programmable controllers - Part 3 - Programming languages. IEC 61131-3:2025, Edition 4.0, 2025. https://webstore.iec.ch/en/publication/68533 Accessed September 1, 2026. [Paywalled]
  2. Rockwell Automation. Logix 5000 Advanced Process Control and Drives Instructions. 1756-RM006P-EN-P, September 2025, 2025. https://literature.rockwellautomation.com/idc/groups/literature/documents/rm/1756-rm006_-en-p.pdf Accessed September 1, 2026.
  3. Rockwell Automation. SCALE. AADvance-Trusted SIS Workstation Help, Version 2.01.00. https://www.rockwellautomation.com/en-us/docs/aadvance-trusted-sis-workstation/2-01-00/aadvance-trusted-sis-workstation-software-ditamap/working-with--tr--applications/global-library-functions-and-function-blocks/scale.html Accessed September 1, 2026.
  4. Schematex Project. Function Block Diagram syntax reference. Schematex FBD engine, Schematex 1.0.13 public documentation, 2026. https://schematex.js.org/docs/fbd Accessed September 1, 2026.

Cite this article

Ray Whitfield. “4–20 mA PLC scaling: a 0–250 kPa worked FBD example.” Schematex Research. Version 2026-09-01. Updated September 1, 2026. https://schematex.js.org/research/4-20ma-plc-scaling-worked-example