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 | |
Patrick Venture | e620656 | 2018-03-08 15:36:53 -0800 | [diff] [blame] | 10 | /* |
| 11 | * General sensor structure used for configuration. |
| 12 | */ |
Patrick Venture | f325231 | 2018-10-30 08:42:53 -0700 | [diff] [blame] | 13 | struct SensorConfig |
Patrick Venture | e620656 | 2018-03-08 15:36:53 -0800 | [diff] [blame] | 14 | { |
Patrick Venture | 69c5106 | 2019-02-11 09:46:03 -0800 | [diff] [blame] | 15 | /* Used for listen if readPath is passive. */ |
Patrick Venture | e620656 | 2018-03-08 15:36:53 -0800 | [diff] [blame] | 16 | std::string type; |
| 17 | /* Can be a sensor path or a dbus path. */ |
Patrick Venture | 69c5106 | 2019-02-11 09:46:03 -0800 | [diff] [blame] | 18 | std::string readPath; |
| 19 | std::string writePath; |
Patrick Venture | e620656 | 2018-03-08 15:36:53 -0800 | [diff] [blame] | 20 | /* min/max values for writing a percentage or error checking. */ |
| 21 | int64_t min; |
| 22 | int64_t max; |
| 23 | int64_t timeout; |
| 24 | }; |
| 25 | |
| 26 | /* |
| 27 | * Structure for holding the configuration of a PID. |
| 28 | */ |
Patrick Venture | f325231 | 2018-10-30 08:42:53 -0700 | [diff] [blame] | 29 | struct ControllerInfo |
Patrick Venture | e620656 | 2018-03-08 15:36:53 -0800 | [diff] [blame] | 30 | { |
| 31 | std::string type; // fan or margin or temp? |
| 32 | std::vector<std::string> inputs; // one or more sensors. |
Patrick Venture | 5f59c0f | 2018-11-11 12:55:14 -0800 | [diff] [blame] | 33 | double setpoint; // initial setpoint for thermal. |
James Feist | 22c257a | 2018-08-31 14:07:12 -0700 | [diff] [blame] | 34 | union |
| 35 | { |
| 36 | ec::pidinfo pidInfo; // pid details |
| 37 | ec::StepwiseInfo stepwiseInfo; |
| 38 | }; |
Patrick Venture | e620656 | 2018-03-08 15:36:53 -0800 | [diff] [blame] | 39 | }; |
| 40 | |
| 41 | /* |
| 42 | * General zone structure used for configuration. A zone is a list of PIDs |
| 43 | * and a set of configuration settings. This structure gets filled out with |
| 44 | * the zone configuration settings and not the PID details. |
| 45 | */ |
Patrick Venture | f325231 | 2018-10-30 08:42:53 -0700 | [diff] [blame] | 46 | struct ZoneConfig |
Patrick Venture | e620656 | 2018-03-08 15:36:53 -0800 | [diff] [blame] | 47 | { |
| 48 | /* The minimum RPM value we would ever want. */ |
Patrick Venture | 8e2fdb3 | 2019-02-11 09:39:59 -0800 | [diff] [blame] | 49 | double minThermalRpm; |
Patrick Venture | e620656 | 2018-03-08 15:36:53 -0800 | [diff] [blame] | 50 | |
| 51 | /* 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] | 52 | double failsafePercent; |
Patrick Venture | e620656 | 2018-03-08 15:36:53 -0800 | [diff] [blame] | 53 | }; |
| 54 | |
Patrick Venture | f325231 | 2018-10-30 08:42:53 -0700 | [diff] [blame] | 55 | using PIDConf = std::map<std::string, struct ControllerInfo>; |