1 #pragma once 2 3 #include "ec/pid.hpp" 4 #include "pidcontroller.hpp" 5 6 #include <memory> 7 #include <string> 8 #include <vector> 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 15 enum class ThermalType 16 { 17 margin, 18 absolute 19 }; 20 21 class ThermalController : public PIDController 22 { 23 public: 24 static std::unique_ptr<PIDController> 25 createThermalPid(ZoneInterface* owner, const std::string& id, 26 const std::vector<std::string>& inputs, 27 double setpoint, const ec::pidinfo& initial, 28 const ThermalType& type); 29 30 ThermalController(const std::string& id, 31 const std::vector<std::string>& inputs, 32 const ThermalType& type, ZoneInterface* owner) : 33 PIDController(id, owner), 34 _inputs(inputs), type(type) 35 { 36 } 37 38 double inputProc(void) override; 39 double setptProc(void) override; 40 void outputProc(double value) override; 41 42 private: 43 std::vector<std::string> _inputs; 44 ThermalType type; 45 }; 46