Patrick Venture | d801218 | 2018-03-08 08:21:38 -0800 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Patrick Venture | d801218 | 2018-03-08 08:21:38 -0800 | [diff] [blame] | 3 | #include "ec/pid.hpp" |
James Feist | 22c257a | 2018-08-31 14:07:12 -0700 | [diff] [blame] | 4 | #include "pidcontroller.hpp" |
Patrick Venture | d801218 | 2018-03-08 08:21:38 -0800 | [diff] [blame] | 5 | |
Patrick Venture | da4a5dd | 2018-08-31 09:42:48 -0700 | [diff] [blame] | 6 | #include <memory> |
| 7 | #include <string> |
| 8 | #include <vector> |
Patrick Venture | d801218 | 2018-03-08 08:21:38 -0800 | [diff] [blame] | 9 | |
| 10 | /* |
| 11 | * A ThermalController is a PID controller that reads a number of sensors and |
| 12 | * provides the set-points for the fans. |
| 13 | */ |
| 14 | class ThermalController : public PIDController |
| 15 | { |
Patrick Venture | da4a5dd | 2018-08-31 09:42:48 -0700 | [diff] [blame] | 16 | public: |
| 17 | static std::unique_ptr<PIDController> |
Patrick Venture | 563a356 | 2018-10-30 09:31:26 -0700 | [diff] [blame] | 18 | createThermalPid(ZoneInterface* owner, const std::string& id, |
Patrick Venture | 4a2dc4d | 2018-10-23 09:02:55 -0700 | [diff] [blame] | 19 | const std::vector<std::string>& inputs, float setpoint, |
Patrick Venture | f77d5a5 | 2018-10-23 09:32:52 -0700 | [diff] [blame] | 20 | const ec::pidinfo& initial); |
Patrick Venture | d801218 | 2018-03-08 08:21:38 -0800 | [diff] [blame] | 21 | |
Patrick Venture | 4a2dc4d | 2018-10-23 09:02:55 -0700 | [diff] [blame] | 22 | ThermalController(const std::string& id, |
| 23 | const std::vector<std::string>& inputs, |
Patrick Venture | da4a5dd | 2018-08-31 09:42:48 -0700 | [diff] [blame] | 24 | ZoneInterface* owner) : |
| 25 | PIDController(id, owner), |
| 26 | _inputs(inputs) |
| 27 | { |
| 28 | } |
Patrick Venture | d801218 | 2018-03-08 08:21:38 -0800 | [diff] [blame] | 29 | |
Patrick Venture | 563a356 | 2018-10-30 09:31:26 -0700 | [diff] [blame] | 30 | float inputProc(void) override; |
| 31 | float setptProc(void) override; |
| 32 | void outputProc(float value) override; |
Patrick Venture | d801218 | 2018-03-08 08:21:38 -0800 | [diff] [blame] | 33 | |
Patrick Venture | da4a5dd | 2018-08-31 09:42:48 -0700 | [diff] [blame] | 34 | private: |
| 35 | std::vector<std::string> _inputs; |
Patrick Venture | d801218 | 2018-03-08 08:21:38 -0800 | [diff] [blame] | 36 | }; |