1*18b1311eSPatrick Venture# Sensor Config
2*18b1311eSPatrick Venture
3*18b1311eSPatrick VentureThis program is only meant to control fans given thermal sensor readings.
4*18b1311eSPatrick Venture
5*18b1311eSPatrick VentureAll sensors in phosphor-dbus-interfaces for OpenBMC use Sensor.Value as their
6*18b1311eSPatrick Ventureaccessor.  This provides read-only access to information.  The goal of the
7*18b1311eSPatrick Ventureconfiguration is to specify how it can be read and if it's a fan, how the PID
8*18b1311eSPatrick Ventureoutput can be written.  Initially there'll only be sysfs and passive dbus
9*18b1311eSPatrick Ventureaccess.  If a writePath for a sensor is a dbus path, then the system will need
10*18b1311eSPatrick Ventureto verify which Control.Fan* interfaces is registered and send values to the
11*18b1311eSPatrick VentureTarget property of that interface.
12*18b1311eSPatrick Venture
13*18b1311eSPatrick VentureThe min/max specified are to range a writePercent to the sensor.  The current
14*18b1311eSPatrick VentureFanController object outputs the new fan speed goal as a PWM percentage.  Other
15*18b1311eSPatrick Venturefan PID control objects may not, and they can leave the fields as 0 & 0.
16*18b1311eSPatrick Venture
17*18b1311eSPatrick VentureThe only requirement for a sensor is that it isn't writeonly.  Only fans are
18*18b1311eSPatrick Ventureexpected to have a writePath set, and in this current version non-fan sensors
19*18b1311eSPatrick Ventureare assumed readonly.
20*18b1311eSPatrick Venture
21*18b1311eSPatrick VentureThe sensor names are unique across all zones.
22*18b1311eSPatrick Venture
23*18b1311eSPatrick Venture"sensors" : [
24*18b1311eSPatrick Venture  {
25*18b1311eSPatrick Venture    "name": "fan1",  /* Name of the sensor. */
26*18b1311eSPatrick Venture    "type": "fan",   /* Type of sensor, fan, temp, margin */
27*18b1311eSPatrick Venture    "readPath": "",  /* How the sensor can be read[1] */
28*18b1311eSPatrick Venture    "writePath": "", /* How the sensor can be set[2] */
29*18b1311eSPatrick Venture    "min": 0,        /* The minimum value used for scaling writes (int64) */
30*18b1311eSPatrick Venture    "max": 255,      /* The maximum value used for scaling writes (int64) */
31*18b1311eSPatrick Venture    "timeout": 0     /* The timeout value for the sensor, used for failsafe, 0
32*18b1311eSPatrick Venture                      * means no timeout (int64) */
33*18b1311eSPatrick Venture  },
34*18b1311eSPatrick Venture]
35*18b1311eSPatrick Venture
36*18b1311eSPatrick Venture[1] readPath has multiple options:
37*18b1311eSPatrick Venture* If it has "/xyz/openbmc_project/extsensors/" in it, it's an EXTERNAL or
38*18b1311eSPatrick Venture  host-provided sensor.
39*18b1311eSPatrick Venture* If it has "/xyz/openbmc_project/" in it, it's a sensor whose value is
40*18b1311eSPatrick Venture  received passively over dbus.
41*18b1311eSPatrick Venture* If it has "/sys/" in it, it's a sensor read directly from sysfs.
42*18b1311eSPatrick Venture
43*18b1311eSPatrick Venture[2]
44*18b1311eSPatrick Venture* This can be left blank if the sensor is read-only.
45*18b1311eSPatrick Venture* If it has "/sys/" in it, it's a sensor written to sysfs.
46*18b1311eSPatrick Venture  * If min and max are non-zero, it'll convert the value to within the range.
47*18b1311eSPatrick Venture    and output that modified value.  So, if it receives a value of .90 and min
48*18b1311eSPatrick Venture    is 0, and max is 255, it'll convert that to a value of 229.5 that is then
49*18b1311eSPatrick Venture    cast to int64_t.
50*18b1311eSPatrick Venture
51*18b1311eSPatrick Venture# PID Config
52*18b1311eSPatrick Venture
53*18b1311eSPatrick VentureThe PID configuration is a list of PIDs per zone.
54*18b1311eSPatrick Venture
55*18b1311eSPatrick Venture"zones" : [
56*18b1311eSPatrick Venture  {
57*18b1311eSPatrick Venture    "id": 1, /* zone id. */
58*18b1311eSPatrick Venture    "minThermalRpm": 3000.0, /* The minimum thermal RPM value. (double) */
59*18b1311eSPatrick Venture    "failsafePercent": 75.0, /* The percent to use when the zone is in fail-safe mode. (double) */
60*18b1311eSPatrick Venture    "pids": [
61*18b1311eSPatrick Venture      {
62*18b1311eSPatrick Venture        "name": "fan1-5",           /* PID name */
63*18b1311eSPatrick Venture        "type": "fan",              /* Type of PID, fan, temp, or margin. */
64*18b1311eSPatrick Venture        "inputs": ["fan1", "fan5"], /* Sensor names that are inputs for the PID */
65*18b1311eSPatrick Venture        "setpoint": 90.0,           /* For temp/margin PIDs this is the setpoint, ignored otherwise (double) */
66*18b1311eSPatrick Venture        "pid": {
67*18b1311eSPatrick Venture          "samplePeriod": 0.1,          /* The input sample period. (double) */
68*18b1311eSPatrick Venture          "proportionalCoeff": 0.0,     /* The proportional coefficient. (double) */
69*18b1311eSPatrick Venture          "integralCoeff": 0.0,         /* The integral coefficient. (double) */
70*18b1311eSPatrick Venture          "feedFwdOffOffsetCoeff": 0.0, /* The feed-forward offset coefficient. (double) */
71*18b1311eSPatrick Venture          "feedFwdGainCoeff": 0.010,    /* The feed-forward gain coefficient. (double) */
72*18b1311eSPatrick Venture          "integralLimit_min": 0.0,     /* The integral limit clamp, min, max (double) */
73*18b1311eSPatrick Venture          "integralLimit_max": 0.0,
74*18b1311eSPatrick Venture          "outLim_min": 30.0,           /* the PID output clamp, min, max (double) */
75*18b1311eSPatrick Venture          "outLim_max": 100.0,
76*18b1311eSPatrick Venture          "slewNeg": 0.0, /* The slew negative value. (double) */
77*18b1311eSPatrick Venture          "slewPos": 0.0  /* The slew positive value. (double) */
78*18b1311eSPatrick Venture        }
79*18b1311eSPatrick Venture      }
80*18b1311eSPatrick Venture    ]
81*18b1311eSPatrick Venture  }
82*18b1311eSPatrick Venture]
83