122c257abSJames Feist #pragma once 222c257abSJames Feist 322c257abSJames Feist #include "controller.hpp" 422c257abSJames Feist #include "ec/stepwise.hpp" 522c257abSJames Feist #include "fan.hpp" 622c257abSJames Feist 73dfaafdaSJames Feist #include <limits> 822c257abSJames Feist #include <memory> 922c257abSJames Feist #include <vector> 1022c257abSJames Feist 11a076487aSPatrick Venture namespace pid_control 12a076487aSPatrick Venture { 13a076487aSPatrick Venture 1422c257abSJames Feist class ZoneInterface; 1522c257abSJames Feist 1622c257abSJames Feist class StepwiseController : public Controller 1722c257abSJames Feist { 1822c257abSJames Feist public: 19*19300276SPatrick Williams static std::unique_ptr<Controller> createStepwiseController( 20*19300276SPatrick Williams ZoneInterface* owner, const std::string& id, 2122c257abSJames Feist const std::vector<std::string>& inputs, 2222c257abSJames Feist const ec::StepwiseInfo& initial); 2322c257abSJames Feist StepwiseController(const std::string & id,const std::vector<std::string> & inputs,ZoneInterface * owner)2422c257abSJames Feist StepwiseController(const std::string& id, 2522c257abSJames Feist const std::vector<std::string>& inputs, 2622c257abSJames Feist ZoneInterface* owner) : 27bd63bcacSPatrick Williams Controller(), _owner(owner), _id(id), _inputs(inputs) 28a83a3eccSPatrick Venture {} 2922c257abSJames Feist 305f59c0fdSPatrick Venture double inputProc(void) override; 3122c257abSJames Feist 325f59c0fdSPatrick Venture void outputProc(double value) override; 3322c257abSJames Feist 3422c257abSJames Feist void process(void) override; 3522c257abSJames Feist getID(void)36a57477f1SPatrick Venture std::string getID(void) override 3722c257abSJames Feist { 3822c257abSJames Feist return _id; 3922c257abSJames Feist } 4022c257abSJames Feist getStepwiseInfo(void)41eb428204SPatrick Venture ec::StepwiseInfo& getStepwiseInfo(void) 4222c257abSJames Feist { 4322c257abSJames Feist return _stepwise_info; 4422c257abSJames Feist } 4522c257abSJames Feist setStepwiseInfo(const ec::StepwiseInfo & value)46a5cf2086SPatrick Venture void setStepwiseInfo(const ec::StepwiseInfo& value) 47a5cf2086SPatrick Venture { 48a5cf2086SPatrick Venture _stepwise_info = value; 49a5cf2086SPatrick Venture } 50a5cf2086SPatrick Venture 5122c257abSJames Feist protected: 5222c257abSJames Feist ZoneInterface* _owner; 5322c257abSJames Feist 5422c257abSJames Feist private: 5522c257abSJames Feist // parameters 5622c257abSJames Feist ec::StepwiseInfo _stepwise_info; 5722c257abSJames Feist std::string _id; 5822c257abSJames Feist std::vector<std::string> _inputs; 595f59c0fdSPatrick Venture double lastInput = std::numeric_limits<double>::quiet_NaN(); 605f59c0fdSPatrick Venture double lastOutput = std::numeric_limits<double>::quiet_NaN(); 6122c257abSJames Feist }; 62a076487aSPatrick Venture 63a076487aSPatrick Venture } // namespace pid_control 64