Sensor value calculation formula

Emily Shaffer emilyshaffer at google.com
Thu Mar 7 09:47:21 AEDT 2019


Hi Tyler,Is this a typo? Do you mean you want to display 21.0 in
ipmitool? I don't know why there is scaling besides power of 10 on
your raw value. That is odd.Assuming it was a typo, what you want to
do is set the scale in the sensor info in order to perform /100
operation. Or you could set the unit, though that might be difficult
with a /100 (rather than increment of 1000).The scaling with m, rExp,
etc is because the IPMI protocol has such a narrow field for sensor
data (1 byte, as you saw; this is value x).So my recommendation to you
is to use the scale to do your 2100->21.0 rounding when displaying
output from ipmitool; and then to use your estimated maximum and
minimum y to try and figure out what kind of coefficients you want to
use.  This doesn't need to be perfect; you will lose some precision if
you choose exponents which give you a much wider range than you need,
but otherwise the operation should be invisible at the other end.If
you really did mean you want 2100 -> 12.0 then that's a different
question, which may require some more massaging on one end or another,
so let us know.

Emily

On Wed, Mar 6, 2019 at 5:33 AM Deng Tyler <tyler.sabdon at gmail.com> wrote:
>
> Hi all:
>     Sensor reading, according to IPMI spec, is calculated as:
>
> y = L[(Mx + B * 10^(bExp)) * 10^(rExp)]
>
> y: the 'final value' as reported by IPMItool
> x: 8 bits, unsigned, reading data encoded in IPMI response packet
> M: 10 bits, signed integer multiplier, multiplierM in YAML
> B: 10 bits, signed additive offset, offsetB in YAML
> bExp: 4 bits, signed, bExp in YAML
> rExp: 4 bits, signed, rExp in YAML
>
>  ipmid calculate raw data by
> double value = variant_ns::get<T>(propValue) * std::pow(10, sensorInfo.scale - sensorInfo.exponentR);
> auto rawData = static_cast<uint8_t>((value - sensorInfo.scaledOffset) / sensorInfo.coefficientM);sue
>
> I am confused about why process raw data with M and rExp? M, offsetB, bExp and rExp shall just responded to ipmitool and calculate with raw
> data. I thought raw data only need calculated by scale if raw data need to be adjust before respond to ipmitool.
> Now I met a problem, I have a raw data is 2100 and I want to display 12.0 in ipmitool sdr command. I don't know how to assign M, rExp and scale value in yaml.
> Could some one tell me how to translate sensor value? tks.
>
> Tyler
>
>


--
Emily Shaffer


More information about the openbmc mailing list