<div dir="ltr">Hi Emily, thank for your kindly reply. I understood how it wok now. But I still have a question, which customized file can assign scale value to Dbus? It seems always equal -3.<div><br></div><div>Tyler</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Emily Shaffer <<a href="mailto:emilyshaffer@google.com">emilyshaffer@google.com</a>> 於 2019年3月7日 週四 上午11:46寫道:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Tyler,<br>
<br>
In the example you cited, ideally that DBus entry reads Value: 4986;<br>
Unit: Volts; Scale: -3.<br>
<br>
<a href="https://github.com/openbmc/phosphor-dbus-interfaces/blob/master/xyz/openbmc_project/Sensor/Value.interface.yaml" rel="noreferrer" target="_blank">https://github.com/openbmc/phosphor-dbus-interfaces/blob/master/xyz/openbmc_project/Sensor/Value.interface.yaml</a><br>
<br>
This essentially means the DBus entry is expressing 4986 millivolts,<br>
or 4986*10^-3 volts.<br>
<br>
On Wed, Mar 6, 2019 at 7:39 PM Deng Tyler <<a href="mailto:tyler.sabdon@gmail.com" target="_blank">tyler.sabdon@gmail.com</a>> wrote:<br>
><br>
> Hi Emily, thank for your reply and you are really help me a lot. I use "GAIN_in1=5.0" in configuration file convert 2100 to 10500. Now Dbus store value is 10500 and it mean 10.5V in ipmitool end. But I still have some doubt about " DBus should be holding the value in units". There is a example in openbmc sensor document as below:<br>
> ====<br>
> so for a DBus sensor value of 4986 meaning 4.986V, phosphor-ipmi-host would encode it as<br>
><br>
> x: 4986 / 20 = 249<br>
> M: 20<br>
> rExp: -3<br>
><br>
> When ipmitool sensor list is called, the tool fetches sensor factors and computes value as:<br>
><br>
> y = 20 * 249 * 10^-3 = 4.98 (V)<br>
><br>
> ====<br>
> In above description, Dbus store value is 4986 but it is not real value in unit. If user switch to REST or redfish for getting sensor then 4986 will be display in same time. Is it correct?<br>
><br>
> Tyler<br>
><br>
> Emily Shaffer <<a href="mailto:emilyshaffer@google.com" target="_blank">emilyshaffer@google.com</a>> 於 2019年3月7日 週四 上午10:02寫道:<br>
>><br>
>> It sounds like you may want to convert, on your sensor end, so that<br>
>> you are expressing 12.0V in DBus. DBus should be holding the value in<br>
>> units, rather than a raw sensor value. The alternative here would be<br>
>> for you to put some context-aware conversion into host-ipmid or into<br>
>> your handler on top of ipmitool, and that's not something anybody<br>
>> wants :) Later if you decide to switch to Redfish, you will have the<br>
>> same problem, due to your value in DBus being a raw reading instead of<br>
>> something in units.<br>
>><br>
>> Is it possible for you to modify your code where the value is being<br>
>> pushed to DBus?<br>
>><br>
>> On Wed, Mar 6, 2019 at 5:54 PM Deng Tyler <<a href="mailto:tyler.sabdon@gmail.com" target="_blank">tyler.sabdon@gmail.com</a>> wrote:<br>
>> ><br>
>> > 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.<br>
>> > I know value x length is 1 byte. I concern that why raw data calculate with M, rExp before response to ipmitool.<br>
>> ><br>
>> > Tyler<br>
>> ><br>
>> > Emily Shaffer <<a href="mailto:emilyshaffer@google.com" target="_blank">emilyshaffer@google.com</a>> 於 2019年3月7日 週四 上午6:47寫道:<br>
>> >><br>
>> >> Hi Tyler,Is this a typo? Do you mean you want to display 21.0 in<br>
>> >> ipmitool? I don't know why there is scaling besides power of 10 on<br>
>> >> your raw value. That is odd.Assuming it was a typo, what you want to<br>
>> >> do is set the scale in the sensor info in order to perform /100<br>
>> >> operation. Or you could set the unit, though that might be difficult<br>
>> >> with a /100 (rather than increment of 1000).The scaling with m, rExp,<br>
>> >> etc is because the IPMI protocol has such a narrow field for sensor<br>
>> >> data (1 byte, as you saw; this is value x).So my recommendation to you<br>
>> >> is to use the scale to do your 2100->21.0 rounding when displaying<br>
>> >> output from ipmitool; and then to use your estimated maximum and<br>
>> >> minimum y to try and figure out what kind of coefficients you want to<br>
>> >> use. This doesn't need to be perfect; you will lose some precision if<br>
>> >> you choose exponents which give you a much wider range than you need,<br>
>> >> but otherwise the operation should be invisible at the other end.If<br>
>> >> you really did mean you want 2100 -> 12.0 then that's a different<br>
>> >> question, which may require some more massaging on one end or another,<br>
>> >> so let us know.<br>
>> >><br>
>> >> Emily<br>
>> >><br>
>> >> On Wed, Mar 6, 2019 at 5:33 AM Deng Tyler <<a href="mailto:tyler.sabdon@gmail.com" target="_blank">tyler.sabdon@gmail.com</a>> wrote:<br>
>> >> ><br>
>> >> > Hi all:<br>
>> >> > Sensor reading, according to IPMI spec, is calculated as:<br>
>> >> ><br>
>> >> > y = L[(Mx + B * 10^(bExp)) * 10^(rExp)]<br>
>> >> ><br>
>> >> > y: the 'final value' as reported by IPMItool<br>
>> >> > x: 8 bits, unsigned, reading data encoded in IPMI response packet<br>
>> >> > M: 10 bits, signed integer multiplier, multiplierM in YAML<br>
>> >> > B: 10 bits, signed additive offset, offsetB in YAML<br>
>> >> > bExp: 4 bits, signed, bExp in YAML<br>
>> >> > rExp: 4 bits, signed, rExp in YAML<br>
>> >> ><br>
>> >> > ipmid calculate raw data by<br>
>> >> > double value = variant_ns::get<T>(propValue) * std::pow(10, sensorInfo.scale - sensorInfo.exponentR);<br>
>> >> > auto rawData = static_cast<uint8_t>((value - sensorInfo.scaledOffset) / sensorInfo.coefficientM);sue<br>
>> >> ><br>
>> >> > 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<br>
>> >> > data. I thought raw data only need calculated by scale if raw data need to be adjust before respond to ipmitool.<br>
>> >> > 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.<br>
>> >> > Could some one tell me how to translate sensor value? tks.<br>
>> >> ><br>
>> >> > Tyler<br>
>> >> ><br>
>> >> ><br>
>> >><br>
>> >><br>
>> >> --<br>
>> >> Emily Shaffer<br>
>><br>
>><br>
>><br>
>> --<br>
>> Emily Shaffer<br>
<br>
<br>
<br>
-- <br>
Emily Shaffer<br>
</blockquote></div>