Scale SCALE
Maps Input from one range onto another, like 4–20 mA to 0–100 %.
SCALE_LINEAR
InGlobal.Raw_mA12In LoGlobal.mA_Lo4In HiGlobal.mA_Hi20Out LoGlobal.Pct_Lo0Out HiGlobal.Pct_Hi100DestGlobal.LevelPct50
| Tag | After two scans |
|---|---|
| LevelPct | 50 |
| mA_Hi | 20 |
| mA_Lo | 4 |
| Pct_Hi | 100 |
| Pct_Lo | 0 |
| Raw_mA | 12 |
How it works
While the rung is true, maps Input from its range (Input Low to Input High) onto the output range (Output Low to Output High), so 12 in 4 to 20 becomes 50 in 0 to 100. All values are REAL. An Input outside its range gives a result outside the output range.
How it's used
Use SCALE to turn a raw signal into units, such as 4–20 mA into 0–100 %.
SCALE_LINEAR
InGlobal.Raw_mA18.8In Lo4In Hi20Out Lo0Out Hi100DestGlobal.LevelPct92.5
GRT
AGlobal.LevelPct92.5B90
Global.HighLevelOTE
| Tag | Value |
|---|---|
| Raw_mA | 18.8 |
| LevelPct | 92.5 |
| HighLevel | 1 |
18.8 mA is 92.5 %, so HighLevel is on.
Operands
| Operand | Data type | Read or write |
|---|---|---|
| Input | REAL or a number | Reads |
| In low | REAL or a number | Reads |
| In high | REAL or a number | Reads |
| Out low | REAL or a number | Reads |
| Out high | REAL or a number | Reads |
| Dest | REAL | Writes |
Common mistakes
- Expecting the result to stop at the range endsSCALE does not limit. An Input outside its range goes outside the output range. Add a LIM if needed.