blob: ed94acb050c7e35200887c711d6be6441ac5eeba [file] [log] [blame]
Patrick Ventured8012182018-03-08 08:21:38 -08001#pragma once
2
Patrick Ventured8012182018-03-08 08:21:38 -08003#include "controller.hpp"
4#include "ec/pid.hpp"
5
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,
19 std::vector<std::string>& inputs, float setpoint,
20 ec::pidinfo initial);
Patrick Ventured8012182018-03-08 08:21:38 -080021
Patrick Ventureda4a5dd2018-08-31 09:42:48 -070022 ThermalController(const std::string& id, std::vector<std::string>& inputs,
23 ZoneInterface* owner) :
24 PIDController(id, owner),
25 _inputs(inputs)
26 {
27 }
Patrick Ventured8012182018-03-08 08:21:38 -080028
Patrick Ventureda4a5dd2018-08-31 09:42:48 -070029 float input_proc(void) override;
30 float setpt_proc(void) override;
31 void output_proc(float value) override;
Patrick Ventured8012182018-03-08 08:21:38 -080032
Patrick Ventureda4a5dd2018-08-31 09:42:48 -070033 private:
34 std::vector<std::string> _inputs;
Patrick Ventured8012182018-03-08 08:21:38 -080035};