Author: Vijay Khemka vijaykhemka@fb.com; <vijay!>
Created: 2020-05-13
There are some sensors in the system whose values are derived from actual sensor data and some other factor like fan speed for temperature sensors, some complex and non standard scale factors or some other algorithmic calculations. Some of Virtual sensor examples are:
This design will allow to generate a new virtual sensors which are defined to be specific manipulation/function of existing sensors.
None.
This should implement a new virtual sensor for every given sensor and update them as per changes in existing sensors. This implementation should provide
Create a D-bus service "xyz.openbmc_project.VirtualSensor" with object paths for each sensor: "/xyz/openbmc_project/sensor/temperature/sensor_name"
There is a JSON configuration file for name, old path and algorithm. For example,
{ "Desc" : { "Name" : "Virtual_Inlet_Temp", "SensorType" : "temperature" }, "Params": { "ConstParam" : [ { "ParamName" : "P1", "Value" : 1.1 } ], "DbusParam" : [ { "ParamName" : "P2", "Desc" : { "Name" : "MB_INLET_TEMP", "SensorType" : "temperature" } }, { "ParamName" : "P3", "Desc" : { "Name" : "MB_FAN0_TACH", "SensorType" : "fan_tach" } } ] }, "Expression": "P1 + P2 + 5 - P3 * 0.1", "Thresholds": { "CriticalHigh": 90, "CriticalLow": 20, "WarningHigh": 70, "WarningLow": 30 } } Desc: It defines name and unit of a sensor. Main Desc object defines details about new virtual sensor and inside DbusParam object, it defines details about existing dbus sensors. Name: Name of virtual sensor SensorType: Unit type of sensors and supported Expression: An algorithm to be used to calculate sensor value Params: There are currently 2 types of parameter supported ConstParam and DbusParam. Every pamas should have a name to be reffered in expression ConstParam: This is a parameter which has a constant value defined here DbusParam: This is an existing/virtual sensor which is listed in dbus and it's value can be read from dbus path Thresholds: It has critical and warning high/low value to monitor sensor value and used as per sensor interface defined in phosphor-dbus-interfaces.
None
This application is monitoring existing sensors whenever they change values then only it will update this sensors so impact should be very minimal.
Testing can be done by monitoring data read from dbus interface over a period of time and also can see these data if it changes by comparing with given sensors.