James Feist | 22c257a | 2018-08-31 14:07:12 -0700 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include "controller.hpp" |
| 4 | #include "ec/stepwise.hpp" |
| 5 | #include "fan.hpp" |
| 6 | |
James Feist | 3dfaafd | 2018-09-20 15:46:58 -0700 | [diff] [blame] | 7 | #include <limits> |
James Feist | 22c257a | 2018-08-31 14:07:12 -0700 | [diff] [blame] | 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> |
Patrick Venture | 563a356 | 2018-10-30 09:31:26 -0700 | [diff] [blame] | 17 | createStepwiseController(ZoneInterface* owner, const std::string& id, |
James Feist | 22c257a | 2018-08-31 14:07:12 -0700 | [diff] [blame] | 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 | |
Patrick Venture | 5f59c0f | 2018-11-11 12:55:14 -0800 | [diff] [blame] | 29 | double inputProc(void) override; |
James Feist | 22c257a | 2018-08-31 14:07:12 -0700 | [diff] [blame] | 30 | |
Patrick Venture | 5f59c0f | 2018-11-11 12:55:14 -0800 | [diff] [blame] | 31 | void outputProc(double value) override; |
James Feist | 22c257a | 2018-08-31 14:07:12 -0700 | [diff] [blame] | 32 | |
| 33 | void process(void) override; |
| 34 | |
Patrick Venture | a57477f | 2018-10-30 13:28:14 -0700 | [diff] [blame] | 35 | std::string getID(void) override |
James Feist | 22c257a | 2018-08-31 14:07:12 -0700 | [diff] [blame] | 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; |
Patrick Venture | 5f59c0f | 2018-11-11 12:55:14 -0800 | [diff] [blame] | 53 | double lastInput = std::numeric_limits<double>::quiet_NaN(); |
| 54 | double lastOutput = std::numeric_limits<double>::quiet_NaN(); |
James Feist | 22c257a | 2018-08-31 14:07:12 -0700 | [diff] [blame] | 55 | }; |