<div><br><br>On Wed, Aug 19, 2020 at 10:41 AM Maxim Sloyko <<a href="mailto:maxims@google.com" target="_blank">maxims@google.com</a>> wrote:<br><br>><br><br>> Hi OpenBMC!<br><br><br><br>Hi!</div><div><br><br><br><br>><br><br>> We would like to have a value reported by a certain sensor changed according to our calibration results. This is a temperature sensor and the calibration has nothing to do with the sensor itself -- so no need to change the driver or anything -- but with a sensor placement on the board. Basically we want to infer the temperature at a different location by calibrating the sensor.<br><br><br></div><div><br>Do you have more details on what the transfer function is?  Is it a simple offset, or is it a more complicated lookup table?  Does it include multiple sensors to generate this new value, or is it a single sensor?  Is it intended to "replace" the existing value, or is it intended to complement it?<br><br><br><br>The ideas I've heard before that this might be:<br><br>1. The temp sensor isn't that accurate, so we want to calibrate it to a better transfer function that we determined empirically.<br><br>2. The temp sensor is adjacent to the thing we really want to measure, so we want to create an offset including the CFM that approximates the temperature of the thing we can't measure directly.<br><br>3. I want to transform the value of the sensor into different units, (Power + CFM to exit air air, or power + time to energy)</div><div><br><br><br><br>><br><br>> Are there any tools in OpenBMC that would allow us to add the calibration curve to, say, phosphor-hwmon and have it report the value different from the one reported by the underlying sensor? Did anybody else have to deal with something like this and what was your solution? Do people more familiar with sensor architecture have any recommendations on how best to handle this?<br><br><br></div><div><br>The closest examples that come to mind for dbus-sensors type architectures are:<br><br>CFM sensor and Exit air temp sensor.  Both pull in a number of other sensors, and run them through a math transform to come up with a "new" sensor value derived from the other inputs.  This sounds similar to what you want, although it's probably more complex than you're looking for.<br><br>The "virtual sensor" proposal currently in review, which I personally have technical issues with, and have left comments as such.  I don't believe there's a working implementation of this yet, but there are those working on it.<br><br><br><br>If it were me, and I wanted to add a simple lookup table to dbus sensors, I'd probably model it in an entity manager config for the temperature sensor, similar to how the stepwise controller models it, and add that into the Hwmon temp sensor daemon.  The below example adds a +5 celcius offset to the bmc temp sensor as an example.  Bear in mind, this wouldn't work today, you'd have to adjust hwmontempsensor to take this into account.<br><br><br><br>{<br><br>    "Address": "0x4A",<br><br>    "Bus": 6,<br><br>    "Name": "BMC Temp",<br><br>    "Thresholds": [],<br><br>    "Type": "TMP75",<br><br>    "CalibrationOutput": [<br><br>        5.0,<br><br>        105.0<br><br>    ],<br><br>    "CalibrationReading": [<br><br>         0.0,<br><br>        100.0<br><br>    ],<br><br>}<br><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">-Ed</div></div>