Sensor value calculation formula

Emily Shaffer emilyshaffer at google.com
Thu Mar 7 13:02:21 AEDT 2019


It sounds like you may want to convert, on your sensor end, so that
you are expressing 12.0V in DBus. DBus should be holding the value in
units, rather than a raw sensor value. The alternative here would be
for you to put some context-aware conversion into host-ipmid or into
your handler on top of ipmitool, and that's not something anybody
wants :)  Later if you decide to switch to Redfish, you will have the
same problem, due to your value in DBus being a raw reading instead of
something in units.

Is it possible for you to modify your code where the value is being
pushed to DBus?

On Wed, Mar 6, 2019 at 5:54 PM Deng Tyler <tyler.sabdon at gmail.com> wrote:
>
> Hi Emily, thank for your kindly reply. This is not typo. I want to dispaly 12.0V in ipmitool and my raw data in Dbus is 2100.
> I know value x length is 1 byte. I concern that why raw data calculate with M, rExp before response to ipmitool.
>
> Tyler
>
> Emily Shaffer <emilyshaffer at google.com> 於 2019年3月7日 週四 上午6:47寫道:
>>
>> 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



-- 
Emily Shaffer


More information about the openbmc mailing list