<div dir="ltr">Hi Tom,<div><br></div><div>Thanks for the explanation. But I still see some concerns in this conversion logic.</div><div><div><br></div><div><font color="#3d85c6">For input, we have 4 given parameters as</font></div><div><font color="#3d85c6"> 1. Min and Max values of the sensor (y)</font></div><div><font color="#3d85c6"> 2. the Min and Max values of the byte value (x - assuming this is always 0 to 255). </font></div><div><font color="#3d85c6"><br></font></div><div><font color="#3d85c6">For output, we have 4 paramters to calculate</font></div><div><font color="#3d85c6"> 1. multiplierM (M)</font></div><div><font color="#3d85c6"> 2. offsetB (B)</font></div><div><font color="#3d85c6"> 3. bExp (k1)</font></div><div><font color="#3d85c6"> 4. rExp (k2)</font></div></div><div><font color="#3d85c6"><br></font></div><div><font color="#3d85c6">We have two equations to compute 4 variables in this logic. </font></div><div><div class="gmail_extra"><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Mar 10, 2018 at 9:45 AM, Tom Joseph <span dir="ltr"><<a href="mailto:tomjose@linux.vnet.ibm.com" target="_blank">tomjose@linux.vnet.ibm.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF">
<p>Hello Guhan,</p>
The updated sensor-example.yaml has the Rexp field as well. These
values are calculated based on the minimum and maximum value of the
sensor.<br>
<br>
If a temperature sensor has a range of -127 - +128, means y is -127
to +128 and the range of x is 0-255.<br>
By substituting x = 0 and y = -127 (k2 is the decimal precision and
assume in this case as whole nos) implies Bexp = -127.<br>
Similarly substitute x = 255 and y = 128 and M is evaluated as 1. <br></div></blockquote><div><br></div><div><p class="MsoNormal" style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:Calibri,sans-serif;color:rgb(0,0,0);font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-size:11pt;color:rgb(68,114,196)">In the above example, with 2 values [(0, -127) and (255, 128)] for (x,y) we were able to calculate M and B. We are assuming k2 as 0 since we are taking only whole numbers for our ranges (y values). But we are still assuming the values for k1 as 0.<span class="gmail-Apple-converted-space"> </span></span></p></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div bgcolor="#FFFFFF">
<br>
Regards,<br>
Tom<div><div class="gmail-h5"><br>
<br>
<div class="gmail-m_-4887759536924537063moz-cite-prefix">On Saturday 10 March 2018 08:01 AM,
guhan balasubramanian wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">Hi,
<div><br>
</div>
<div>According to the IPMI spec, we represent all sensor
readings (Volt, Temp, Amp, etc.) as 1-byte. </div>
<div><br>
</div>
<div>Since we represent them as 1-byte, we use a linearization
formula to convert to actual value as follows:</div>
<div><br>
</div>
<div>y = (M*x + B*10^(k1))*10^(k2)</div>
<div><br>
</div>
<div>where x is the 1-byte value that is filled in the get
sensor reading command.</div>
<div><br>
</div>
<div>We see in the ipmitool example on how an example of 3.36 V
is represented as 1-byte. </div>
<div><a href="https://computercheese.blogspot.com/2013/10/ipmi-sensor-reading-conversion-formula.html?q=sensor" target="_blank">https://computercheese.<wbr>blogspot.com/2013/10/ipmi-<wbr>sensor-reading-conversion-<wbr>formula.html?q=sensor</a></div>
<div><br>
</div>
<div>Can any one please help on how the values for M, B, k1 and
k2 are populated for each sensor? </div>
<div><br>
</div>
<div>In the openbmc repo, I believe these values are present in
the config.yaml of phosphor-ipmi-sensor-inventory (based on
the following sample). </div>
<div><br>
</div>
<div>
<div>0xF1:</div>
<div> sensorType: 0x01</div>
<div> path: /xyz/openbmc_project/sensors/<wbr>temperature/temp1</div>
<div> sensorReadingType: 0x01</div>
<div> <b>multiplierM</b>: 511</div>
<div> <b>offsetB</b>: 0</div>
<div> <b>bExp</b>: 0</div>
<div> mutability: Mutability::Write|Mutability::<wbr>Read</div>
<div> serviceInterface: org.freedesktop.DBus.<wbr>Properties</div>
<div> readingType: readingData</div>
<div> interfaces:</div>
<div> xyz.openbmc_project.Sensor.<wbr>Value:</div>
<div> Value:</div>
<div> Offsets:</div>
<div> 0x0:</div>
<div> type: int64_t</div>
</div>
<div>
<table class="gmail-m_-4887759536924537063gmail-highlight gmail-m_-4887759536924537063gmail-tab-size gmail-m_-4887759536924537063gmail-js-file-line-container">
<tbody style="box-sizing:border-box">
<tr style="box-sizing:border-box">
<td id="gmail-m_-4887759536924537063gmail-LC18" class="gmail-m_-4887759536924537063gmail-blob-code gmail-m_-4887759536924537063gmail-blob-code-inner gmail-m_-4887759536924537063gmail-js-file-line" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;color:rgb(36,41,46);word-wrap:normal;white-space:pre-wrap">
</td>
</tr>
</tbody>
</table>
<br>
</div>
<div>Thanks,</div>
<div>Guhan</div>
<div><br></div></div></blockquote></div></div></div></blockquote><div><font color="#3d85c6">With the given information, do you think there is a generic way (algorithm) where we can compute all the 4 variables M, B, k1 and k2? </font></div><div><font color="#3d85c6"><br></font></div><div><font color="#4472c4" face="Calibri, sans-serif"><span style="font-size:14.6667px">Thanks,</span></font></div><div><font color="#4472c4" face="Calibri, sans-serif"><span style="font-size:14.6667px">Guhan</span></font></div></div><br></div></div></div>