118b1311eSPatrick Venture# Sensor Config
218b1311eSPatrick Venture
318b1311eSPatrick VentureThis program is only meant to control fans given thermal sensor readings.
418b1311eSPatrick Venture
518b1311eSPatrick VentureAll sensors in phosphor-dbus-interfaces for OpenBMC use Sensor.Value as their
618b1311eSPatrick Ventureaccessor.  This provides read-only access to information.  The goal of the
718b1311eSPatrick Ventureconfiguration is to specify how it can be read and if it's a fan, how the PID
818b1311eSPatrick Ventureoutput can be written.  Initially there'll only be sysfs and passive dbus
918b1311eSPatrick Ventureaccess.  If a writePath for a sensor is a dbus path, then the system will need
1018b1311eSPatrick Ventureto verify which Control.Fan* interfaces is registered and send values to the
1118b1311eSPatrick VentureTarget property of that interface.
1218b1311eSPatrick Venture
1318b1311eSPatrick VentureThe min/max specified are to range a writePercent to the sensor.  The current
1418b1311eSPatrick VentureFanController object outputs the new fan speed goal as a PWM percentage.  Other
1518b1311eSPatrick Venturefan PID control objects may not, and they can leave the fields as 0 & 0.
1618b1311eSPatrick Venture
1718b1311eSPatrick VentureThe only requirement for a sensor is that it isn't writeonly.  Only fans are
1818b1311eSPatrick Ventureexpected to have a writePath set, and in this current version non-fan sensors
1918b1311eSPatrick Ventureare assumed readonly.
2018b1311eSPatrick Venture
2118b1311eSPatrick VentureThe sensor names are unique across all zones.
2218b1311eSPatrick Venture
2318b1311eSPatrick Venture"sensors" : [
2418b1311eSPatrick Venture  {
2518b1311eSPatrick Venture    "name": "fan1",  /* Name of the sensor. */
2618b1311eSPatrick Venture    "type": "fan",   /* Type of sensor, fan, temp, margin */
2718b1311eSPatrick Venture    "readPath": "",  /* How the sensor can be read[1] */
2818b1311eSPatrick Venture    "writePath": "", /* How the sensor can be set[2] */
2918b1311eSPatrick Venture    "min": 0,        /* The minimum value used for scaling writes (int64) */
3018b1311eSPatrick Venture    "max": 255,      /* The maximum value used for scaling writes (int64) */
3118b1311eSPatrick Venture    "timeout": 0     /* The timeout value for the sensor, used for failsafe, 0
3218b1311eSPatrick Venture                      * means no timeout (int64) */
3318b1311eSPatrick Venture  },
3418b1311eSPatrick Venture]
3518b1311eSPatrick Venture
3618b1311eSPatrick Venture[1] readPath has multiple options:
3718b1311eSPatrick Venture* If it has "/xyz/openbmc_project/extsensors/" in it, it's an EXTERNAL or
3818b1311eSPatrick Venture  host-provided sensor.
3918b1311eSPatrick Venture* If it has "/xyz/openbmc_project/" in it, it's a sensor whose value is
4018b1311eSPatrick Venture  received passively over dbus.
4118b1311eSPatrick Venture* If it has "/sys/" in it, it's a sensor read directly from sysfs.
4218b1311eSPatrick Venture
4318b1311eSPatrick Venture[2]
4418b1311eSPatrick Venture* This can be left blank if the sensor is read-only.
4518b1311eSPatrick Venture* If it has "/sys/" in it, it's a sensor written to sysfs.
4618b1311eSPatrick Venture  * If min and max are non-zero, it'll convert the value to within the range.
4718b1311eSPatrick Venture    and output that modified value.  So, if it receives a value of .90 and min
4818b1311eSPatrick Venture    is 0, and max is 255, it'll convert that to a value of 229.5 that is then
4918b1311eSPatrick Venture    cast to int64_t.
5018b1311eSPatrick Venture
5118b1311eSPatrick Venture# PID Config
5218b1311eSPatrick Venture
5318b1311eSPatrick VentureThe PID configuration is a list of PIDs per zone.
5418b1311eSPatrick Venture
5518b1311eSPatrick Venture"zones" : [
5618b1311eSPatrick Venture  {
5718b1311eSPatrick Venture    "id": 1, /* zone id. */
58*3484bedaSJames Feist    "minThermalOutput": 3000.0, /* The minimum thermal RPM value. (double) */
5918b1311eSPatrick Venture    "failsafePercent": 75.0, /* The percent to use when the zone is in fail-safe mode. (double) */
6018b1311eSPatrick Venture    "pids": [
6118b1311eSPatrick Venture      {
6218b1311eSPatrick Venture        "name": "fan1-5",           /* PID name */
6318b1311eSPatrick Venture        "type": "fan",              /* Type of PID, fan, temp, or margin. */
6418b1311eSPatrick Venture        "inputs": ["fan1", "fan5"], /* Sensor names that are inputs for the PID */
6518b1311eSPatrick Venture        "setpoint": 90.0,           /* For temp/margin PIDs this is the setpoint, ignored otherwise (double) */
6618b1311eSPatrick Venture        "pid": {
6718b1311eSPatrick Venture          "samplePeriod": 0.1,          /* The input sample period. (double) */
6818b1311eSPatrick Venture          "proportionalCoeff": 0.0,     /* The proportional coefficient. (double) */
6918b1311eSPatrick Venture          "integralCoeff": 0.0,         /* The integral coefficient. (double) */
70903b0427SPatrick Venture          "feedFwdOffsetCoeff": 0.0, /* The feed-forward offset coefficient. (double) */
7118b1311eSPatrick Venture          "feedFwdGainCoeff": 0.010,    /* The feed-forward gain coefficient. (double) */
7218b1311eSPatrick Venture          "integralLimit_min": 0.0,     /* The integral limit clamp, min, max (double) */
7318b1311eSPatrick Venture          "integralLimit_max": 0.0,
7418b1311eSPatrick Venture          "outLim_min": 30.0,           /* the PID output clamp, min, max (double) */
7518b1311eSPatrick Venture          "outLim_max": 100.0,
7618b1311eSPatrick Venture          "slewNeg": 0.0, /* The slew negative value. (double) */
7718b1311eSPatrick Venture          "slewPos": 0.0  /* The slew positive value. (double) */
7818b1311eSPatrick Venture        }
7918b1311eSPatrick Venture      }
8018b1311eSPatrick Venture    ]
8118b1311eSPatrick Venture  }
8218b1311eSPatrick Venture]
83