The essence of engineering is multiplying by unity
To answer the scaling question, you need to know the Secret of Engineering: the act of [multiplying by one] describes 80% or more of all engineering tasks; the rest is determining the value of one for each task.
For example, say someone tells you that it takes them 4.3 hours to drive from Accra to Kumasi, and they want to know how many minutes that is. You know that one hour is sixty minutes, and you write that down as an equation:
Then you divide both sides of the equation by one hour:
Code:
1 hour 60 minute
------ = ---------
1 hour 1 hour
(one hour) divided by (one hour) is 1, as is anything divided by itself, so the equation simplifies to
Code:
1 = (60/1) (minute/hour)
1 = 60 minute/hour
The multiplicative identity property states that any time you multiply a number by 1, the result, or product, is that original number. So you multiply your original 1.5 hours by 1, and then replace the 1 with [60 minutes/hour], which is the same as 1 as shown above:
Code:
4.3 hours x 1 = <<<---Multiplying by 1!
4.3 hour (60 minutes)
x (----------) = <<<---Also multiplying by 1!
( hour )
4.3 x 60 hour minute
--------------------
hour
The [hour] units in the numerator and denominator cancel:
Code:
(4.3 x 60) minute = 258 minutes
So 4.3hours is the same as 258 minutes, and we know that because we multiplied the former by one (in the form or 60 minute/hour) to get the latter, and the multiplicative identity property tells us that the product of a number and one is same as the original number.
In the same way, the task of scaling physical values in a digital can usually be reduced to the task of multiplying by 1. There may be some second-order steps required, such as if the two scales do not meet at zero, or if the sensor output is non-linear with respect to the physical property measured, but that all falls in the 20% of the task of determining the value of one.
For example, consider a flowmeter that you have calibrated in your process: at a flowrate of 0 m3/h it sends a signal of 0V to your PLC analog input; at a flowrate of 123 m3/h it sends a signal of 6V. Using the same approach, we can say that 6V is the same as 123 m3/h:
Code:
6V = 123m3/h
6V/6V = 123m3/h / 6V
1 = 20.5 (m3/h)/V <<<---The “value” of 1
Furthermore, the 0-10V signal into the analog input of the PLC is converted to a numeric value, which I will call a Data Number, or DN. For this example: at 0V, the DN is 0; at 10V the DN is 16383; so 16383DN is the same as 10V:
Code:
16383DN = 10V
16383DN/16383DN = 10V/16383DN
1 = 0.000610389 V/DN <<< Another “value” of 1
Note that we can combine these values for 1 by multiplication (or division), and the value will still represent 1:
Code:
1 x 1 = [20.5 (m3/h)/V] x [0.000610389 V/DN] =
[20.5 x 0.000610389] [(m3/h)/V V/DN] =
0.012512971 (m3/h) / DN <<< Yet a third “value” of 1
And for a sanity check, the DN values for 6V (123 m3/h) would be 60% of 16383DN which would be a little less than 10kDN, and 10kDN x 0.0125... (m3/h)/DN would be about 123m3/h, as expected.
That is the essential approach to take for scaling, and that is the essence of engineering in general.
One case not covered abvoe is when the two related representations (e.g. Volts and m3/h above) are not both zero at the same point. One example would be a typical current-based analog inputs that scale 4-20ma to 0-16383DN or a thermocouple channel where zero DN corresponds to some non-zero temperature (e.g. one type L thermocouple input module specifies a temperature range of 300 to 1800°C corresponds to a range of -76.5mV to +76.5mV and a range of -32768DN to +32767DN).
Ignoring the non-linearity of thermocouple systems for the purpose of this illustration, the solution is to use the general form of the scaling equation:
Code:
(CalibrationTemperature – 300)°C (MeasuredTemperature - 300)°C
-------------------------------- = -----------------------------
(CalibrationDN - (-32768))DN (MeasuredDN - (-32768))DN
Where all values except MeasuredTemperature are known. This post has been using this form implicitly all along, but the subtrahends (300 and -32768 in this case) were both zero, which reduces the scaling equation to this:
Code:
FullRangeValue(engineering units) MeasuredValue(engineering units)
--------------------------------- = --------------------------------
FullRangeDN(DN units) MeasuredDN(DN units
Solving for the measured value from that general form of the scaling equation yields this:
Code:
(CalVal – CalLowVal)
MeasuredVal = -------------------- x (MeasuredDN – CalLowDN) + CalLowVal
(CalDN – CalLowDN)
Which is more commonly expressed as
And that is exactly what Rson gave as the answer to the OP: [m] is a “value” of 1;
is an offset.