1 #pragma once
2 
3 #include "controller.hpp"
4 #include "ec/stepwise.hpp"
5 #include "fan.hpp"
6 
7 #include <limits>
8 #include <memory>
9 #include <vector>
10 
11 class ZoneInterface;
12 
13 class StepwiseController : public Controller
14 {
15   public:
16     static std::unique_ptr<Controller>
17         createStepwiseController(ZoneInterface* owner, const std::string& id,
18                                  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)
26     {}
27 
28     double inputProc(void) override;
29 
30     void outputProc(double value) override;
31 
32     void process(void) override;
33 
34     std::string getID(void) override
35     {
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;
52     double lastInput = std::numeric_limits<double>::quiet_NaN();
53     double lastOutput = std::numeric_limits<double>::quiet_NaN();
54 };
55