summaryrefslogtreecommitdiffstats
path: root/pid/stepwisecontroller.hpp
blob: 4aa811645dc8c6dab3c3341f95eef9585f7f19ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#pragma once

#include "controller.hpp"
#include "ec/stepwise.hpp"
#include "fan.hpp"

#include <limits>
#include <memory>
#include <vector>

class ZoneInterface;

class StepwiseController : public Controller
{
  public:
    static std::unique_ptr<Controller>
        createStepwiseController(ZoneInterface* owner, const std::string& id,
                                 const std::vector<std::string>& inputs,
                                 const ec::StepwiseInfo& initial);

    StepwiseController(const std::string& id,
                       const std::vector<std::string>& inputs,
                       ZoneInterface* owner) :
        Controller(),
        _owner(owner), _id(id), _inputs(inputs)
    {
    }

    double inputProc(void) override;

    void outputProc(double value) override;

    void process(void) override;

    std::string getID(void) override
    {
        return _id;
    }

    ec::StepwiseInfo& get_stepwise_info(void)
    {
        return _stepwise_info;
    }

  protected:
    ZoneInterface* _owner;

  private:
    // parameters
    ec::StepwiseInfo _stepwise_info;
    std::string _id;
    std::vector<std::string> _inputs;
    double lastInput = std::numeric_limits<double>::quiet_NaN();
    double lastOutput = std::numeric_limits<double>::quiet_NaN();
};
OpenPOWER on IntegriCloud