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