blob: 040b22257d788d69bdd8cb81ce972182aab8e3f5 [file] [log] [blame]
Patrick Ventured8012182018-03-08 08:21:38 -08001#pragma once
2
Patrick Ventured8012182018-03-08 08:21:38 -08003#include "ec/pid.hpp"
James Feist22c257a2018-08-31 14:07:12 -07004#include "pidcontroller.hpp"
Patrick Ventured8012182018-03-08 08:21:38 -08005
Patrick Ventureda4a5dd2018-08-31 09:42:48 -07006#include <memory>
7#include <string>
8#include <vector>
Patrick Ventured8012182018-03-08 08:21:38 -08009
10/*
11 * A ThermalController is a PID controller that reads a number of sensors and
12 * provides the set-points for the fans.
13 */
14class ThermalController : public PIDController
15{
Patrick Ventureda4a5dd2018-08-31 09:42:48 -070016 public:
17 static std::unique_ptr<PIDController>
Patrick Venture563a3562018-10-30 09:31:26 -070018 createThermalPid(ZoneInterface* owner, const std::string& id,
Patrick Venture4a2dc4d2018-10-23 09:02:55 -070019 const std::vector<std::string>& inputs, float setpoint,
Patrick Venturef77d5a52018-10-23 09:32:52 -070020 const ec::pidinfo& initial);
Patrick Ventured8012182018-03-08 08:21:38 -080021
Patrick Venture4a2dc4d2018-10-23 09:02:55 -070022 ThermalController(const std::string& id,
23 const std::vector<std::string>& inputs,
Patrick Ventureda4a5dd2018-08-31 09:42:48 -070024 ZoneInterface* owner) :
25 PIDController(id, owner),
26 _inputs(inputs)
27 {
28 }
Patrick Ventured8012182018-03-08 08:21:38 -080029
Patrick Venture563a3562018-10-30 09:31:26 -070030 float inputProc(void) override;
31 float setptProc(void) override;
32 void outputProc(float value) override;
Patrick Ventured8012182018-03-08 08:21:38 -080033
Patrick Ventureda4a5dd2018-08-31 09:42:48 -070034 private:
35 std::vector<std::string> _inputs;
Patrick Ventured8012182018-03-08 08:21:38 -080036};