blob: 9b2da7181c9d96153ef89bce08e82d70744a0c10 [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>
18 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 Ventureda4a5dd2018-08-31 09:42:48 -070030 float input_proc(void) override;
31 float setpt_proc(void) override;
32 void output_proc(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};