xref: /openbmc/phosphor-pid-control/conf.hpp (revision f7a2dd5c)
1 #pragma once
2 
3 #include "pid/ec/pid.hpp"
4 #include "pid/ec/stepwise.hpp"
5 
6 #include <map>
7 #include <string>
8 #include <vector>
9 
10 namespace conf
11 {
12 
13 /*
14  * General sensor structure used for configuration.
15  */
16 struct SensorConfig
17 {
18     /* Used for listen if readPath is passive. */
19     std::string type;
20     /* Can be a sensor path or a dbus path. */
21     std::string readPath;
22     std::string writePath;
23     /* min/max values for writing a percentage or error checking. */
24     int64_t min;
25     int64_t max;
26     int64_t timeout;
27 };
28 
29 /*
30  * Structure for holding the configuration of a PID.
31  */
32 struct ControllerInfo
33 {
34     std::string type;                // fan or margin or temp?
35     std::vector<std::string> inputs; // one or more sensors.
36     double setpoint;                 // initial setpoint for thermal.
37     union
38     {
39         ec::pidinfo pidInfo; // pid details
40         ec::StepwiseInfo stepwiseInfo;
41     };
42 };
43 
44 /*
45  * General zone structure used for configuration.  A zone is a list of PIDs
46  * and a set of configuration settings.  This structure gets filled out with
47  * the zone configuration settings and not the PID details.
48  */
49 struct ZoneConfig
50 {
51     /* The minimum set-point value we would ever want (typically in RPM) */
52     double minThermalOutput;
53 
54     /* If the sensors are in fail-safe mode, this is the percentage to use. */
55     double failsafePercent;
56 };
57 
58 using PIDConf = std::map<std::string, struct ControllerInfo>;
59 
60 } // namespace conf
61