blob: 8089da160ad4a5c4d755eb99cd2f7fcc9ce49bf4 [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 Venture5f59c0f2018-11-11 12:55:14 -080019 const std::vector<std::string>& inputs,
20 double setpoint, 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 Venture5f59c0f2018-11-11 12:55:14 -080030 double inputProc(void) override;
31 double setptProc(void) override;
32 void outputProc(double 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};