blob: 90e2317722f888894b34891932989f4b691b69a2 [file] [log] [blame]
James Feist22c257a2018-08-31 14:07:12 -07001#pragma once
2
3#include "controller.hpp"
4#include "ec/stepwise.hpp"
5#include "fan.hpp"
6
James Feist3dfaafd2018-09-20 15:46:58 -07007#include <limits>
James Feist22c257a2018-08-31 14:07:12 -07008#include <memory>
9#include <vector>
10
11class ZoneInterface;
12
13class StepwiseController : public Controller
14{
15 public:
16 static std::unique_ptr<Controller>
Patrick Venture563a3562018-10-30 09:31:26 -070017 createStepwiseController(ZoneInterface* owner, const std::string& id,
James Feist22c257a2018-08-31 14:07:12 -070018 const std::vector<std::string>& inputs,
19 const ec::StepwiseInfo& initial);
20
21 StepwiseController(const std::string& id,
22 const std::vector<std::string>& inputs,
23 ZoneInterface* owner) :
24 Controller(),
25 _owner(owner), _id(id), _inputs(inputs)
Patrick Venturea83a3ec2020-08-04 09:52:05 -070026 {}
James Feist22c257a2018-08-31 14:07:12 -070027
Patrick Venture5f59c0f2018-11-11 12:55:14 -080028 double inputProc(void) override;
James Feist22c257a2018-08-31 14:07:12 -070029
Patrick Venture5f59c0f2018-11-11 12:55:14 -080030 void outputProc(double value) override;
James Feist22c257a2018-08-31 14:07:12 -070031
32 void process(void) override;
33
Patrick Venturea57477f2018-10-30 13:28:14 -070034 std::string getID(void) override
James Feist22c257a2018-08-31 14:07:12 -070035 {
36 return _id;
37 }
38
39 ec::StepwiseInfo& get_stepwise_info(void)
40 {
41 return _stepwise_info;
42 }
43
44 protected:
45 ZoneInterface* _owner;
46
47 private:
48 // parameters
49 ec::StepwiseInfo _stepwise_info;
50 std::string _id;
51 std::vector<std::string> _inputs;
Patrick Venture5f59c0f2018-11-11 12:55:14 -080052 double lastInput = std::numeric_limits<double>::quiet_NaN();
53 double lastOutput = std::numeric_limits<double>::quiet_NaN();
James Feist22c257a2018-08-31 14:07:12 -070054};