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 namespace pid_control 12 { 13 14 class ZoneInterface; 15 16 class StepwiseController : public Controller 17 { 18 public: 19 static std::unique_ptr<Controller> 20 createStepwiseController(ZoneInterface* owner, const std::string& id, 21 const std::vector<std::string>& inputs, 22 const ec::StepwiseInfo& initial); 23 StepwiseController(const std::string & id,const std::vector<std::string> & inputs,ZoneInterface * owner)24 StepwiseController(const std::string& id, 25 const std::vector<std::string>& inputs, 26 ZoneInterface* owner) : 27 Controller(), _owner(owner), _id(id), _inputs(inputs) 28 {} 29 30 double inputProc(void) override; 31 32 void outputProc(double value) override; 33 34 void process(void) override; 35 getID(void)36 std::string getID(void) override 37 { 38 return _id; 39 } 40 getStepwiseInfo(void)41 ec::StepwiseInfo& getStepwiseInfo(void) 42 { 43 return _stepwise_info; 44 } 45 setStepwiseInfo(const ec::StepwiseInfo & value)46 void setStepwiseInfo(const ec::StepwiseInfo& value) 47 { 48 _stepwise_info = value; 49 } 50 51 protected: 52 ZoneInterface* _owner; 53 54 private: 55 // parameters 56 ec::StepwiseInfo _stepwise_info; 57 std::string _id; 58 std::vector<std::string> _inputs; 59 double lastInput = std::numeric_limits<double>::quiet_NaN(); 60 double lastOutput = std::numeric_limits<double>::quiet_NaN(); 61 }; 62 63 } // namespace pid_control 64