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 29 float input_proc(void) override; 30 31 void output_proc(float value) override; 32 33 void process(void) override; 34 35 std::string get_id(void) 36 { 37 return _id; 38 } 39 40 ec::StepwiseInfo& get_stepwise_info(void) 41 { 42 return _stepwise_info; 43 } 44 45 protected: 46 ZoneInterface* _owner; 47 48 private: 49 // parameters 50 ec::StepwiseInfo _stepwise_info; 51 std::string _id; 52 std::vector<std::string> _inputs; 53 float lastInput = std::numeric_limits<float>::quiet_NaN(); 54 float lastOutput = std::numeric_limits<float>::quiet_NaN(); 55 }; 56