xref: /openbmc/phosphor-pid-control/conf.hpp (revision e30916c9)
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     bool ignoreDbusMinMax;
28 };
29 
30 /*
31  * Structure for holding the configuration of a PID.
32  */
33 struct ControllerInfo
34 {
35     std::string type;                // fan or margin or temp?
36     std::vector<std::string> inputs; // one or more sensors.
37     double setpoint;                 // initial setpoint for thermal.
38     union
39     {
40         ec::pidinfo pidInfo; // pid details
41         ec::StepwiseInfo stepwiseInfo;
42     };
43 };
44 
45 /*
46  * General zone structure used for configuration.  A zone is a list of PIDs
47  * and a set of configuration settings.  This structure gets filled out with
48  * the zone configuration settings and not the PID details.
49  */
50 struct ZoneConfig
51 {
52     /* The minimum set-point value we would ever want (typically in RPM) */
53     double minThermalOutput;
54 
55     /* If the sensors are in fail-safe mode, this is the percentage to use. */
56     double failsafePercent;
57 };
58 
59 using PIDConf = std::map<std::string, struct ControllerInfo>;
60 
61 } // namespace conf
62