The short answer
Analog Scaling: Raw Counts to Engineering Units
Analog scaling converts the raw integer an analog input card produces into a meaningful engineering unit using a linear mapping. The formula is EU = (Raw − Raw_min) ÷ (Raw_max − Raw_min) × (EU_max − EU_min) + EU_min. The critical requirement is that the card range, the transmitter calibrated range, and the scaling constants in the program all describe the same thing.
Key points
- Scaling is a straight-line map from a raw count range to an engineering unit range.
- The transmitter range, the card range, and the program constants must agree or the reading is wrong.
- Document the calibrated range on the loop sheet, not only in the program.
- Clamp the output and flag out-of-range values instead of letting bad data look plausible.
- Square-root extraction is needed for differential pressure flow, and must be applied exactly once.
What the card gives you
An analog input module converts the current on the loop into a number using an analog-to-digital converter. The number itself is arbitrary and depends entirely on the module. A 16-bit card configured for 4-20 mA might present 0 to 32767, or 6242 to 31208, or engineering units directly if the card supports it. There is no universal value; read the module documentation and, better, verify it by injecting a known current.
The linear scaling formula
EU = (Raw − Raw_min) ÷ (Raw_max − Raw_min) × (EU_max − EU_min) + EU_min
- EU — the engineering unit result, for example feet of level
- Raw — the current value from the analog input
- Raw_min, Raw_max — the card counts corresponding to 4 mA and 20 mA
- EU_min, EU_max — the transmitter calibrated range, for example 0 and 25 feet
Worked example: a card producing 0 to 32767 counts across 4-20 mA, a radar transmitter calibrated 0 to 25.0 feet, and a present reading of 13107 counts.
EU = (13107 - 0) / (32767 - 0) * (25.0 - 0.0) + 0.0
= 0.4000 * 25.0
= 10.0 feet
Sanity check: 13107 of 32767 counts is 40% of span.
40% of a 0-25 ft range is 10 ft, and 40% of 4-20 mA is 10.4 mA.
All three agree, so the scaling is right.The three ranges that must agree
Nearly every scaling problem is a mismatch between three separate places where a range is recorded.
- 01The transmitter calibrated range: what 4 mA and 20 mA actually mean at the device. A radar might be set 0-25 ft, or 0-30 ft, or 2-27 ft.
- 02The analog card range configuration: whether the module is set for 4-20 mA or 0-20 mA, and what count range it reports.
- 03The scaling constants in the PLC program: the numbers a programmer typed, often from a drawing rather than from the device.
When a level reads 20% high across the whole range and nobody can find a wiring fault, the usual answer is that someone re-ranged the transmitter in the field and did not update the program. This is why the calibrated range belongs on the loop sheet and in the instrument list, not only in code.
Clamping and validity
Raw scaling arithmetic will happily produce a level of negative four feet or a pressure of 340 psi on a 100 psi transmitter. Do not let those values into control logic.
- Clamp the scaled result to the calibrated range so downstream logic never sees a physically impossible number.
- Test the raw value against the NAMUR thresholds and set a separate fault bit when it is below 3.6 mA or above 21 mA equivalent counts.
- Hold the last good value when the input is faulted, and make the held state visible on the HMI so an operator knows they are looking at stale data.
- Alarm the fault. A silently held value is more dangerous than an obviously wrong one.
Square root extraction
Differential pressure flow measurement produces a signal proportional to the square of flow. Getting flow requires taking the square root of the normalized signal before applying the flow range.
Flow = √( (Raw − Raw_min) ÷ (Raw_max − Raw_min) ) × Flow_max
The trap is applying it twice. Many transmitters can perform square root extraction internally. If the transmitter is set to linear output and the PLC extracts, that is correct. If the transmitter extracts and the PLC also extracts, the reading is wrong everywhere except at zero and full scale, which is exactly where people check. Decide where extraction happens, write it on the loop sheet, and verify at 50%.
Analog outputs scale the same way, backwards
An analog output takes an engineering value and produces counts. The arithmetic is the inverse of the input case. The thing people forget is the output range at the far end: a valve positioner calibrated 4-20 mA for 0-100% open behaves very differently from one calibrated for a split range of 4-12 mA. Confirm what the receiving device expects before assuming 20 mA means fully open.
Frequently asked questions
- Why does my level read correctly at zero but wrong at full?
- That is a span error, not an offset error. The two ranges disagree about what 20 mA means. Compare the transmitter calibrated upper range value against the EU_max constant in the program, and check the analog card is configured for 4-20 mA rather than 0-20 mA.
- What raw count corresponds to 4 mA?
- It depends entirely on the module and its configuration. Do not assume. Read the manual, then verify by injecting 4 mA with a calibrator and observing the raw value online.
- Should scaling be done in the PLC or the SCADA system?
- In the PLC. The controller makes the control decisions, so it needs the correct engineering value regardless of whether SCADA is running. Scaling in SCADA leads to two different numbers for the same measurement, which is a very hard problem to unwind later.
- How do I handle a transmitter with a suppressed zero?
- A transmitter ranged 2 to 27 feet simply means EU_min is 2 and EU_max is 27. The formula handles it without modification. The mistake is leaving EU_min at zero, which produces an error of exactly the suppression amount at every point.
Related topics
- 4-20 mA Current LoopsWhy the industry standardized on current instead of voltage, how a two-wire loop is powered, what the live zero buys you, and how to read a loop with a meter.
- Engineering UnitsChoosing and documenting the units a tag carries: where the unit is decided, how it flows from transmitter range to controller scaling to screen and historian, the conventions used in water and wastewater, and the mismatches that put a wrong number on screen.
- Signal ValidationCatching a failed analog input in logic before it runs a pump on a dead transmitter: range checks, module status bits, frozen-value detection, rate checks, and what the program does with a bad value.
- How to Scale a 4-20 mA Input in a PLCTurn raw analog counts into engineering units, verify at three points, and add the validity checks that stop a failed transmitter from producing a believable number.
- Raw CountsWhat an analog input module actually hands the program: the count range, where 4 mA and 20 mA fall in it, how under-range and over-range show up, and why the module manual is the only source that counts.
- PID Control for Pumps and ValvesWhat each term actually does, how to tune a loop on a real pump station, and the handful of mistakes that cause most of the oscillation people blame on tuning.
Direct contact
Have a controls question?
Reach Eric Sullivan directly about anything on this site, a controls or automation topic, or one of his personal projects.