diff options
| author | James Feist <james.feist@linux.intel.com> | 2019-02-25 10:01:42 -0800 |
|---|---|---|
| committer | James Feist <james.feist@linux.intel.com> | 2019-02-26 18:31:58 +0000 |
| commit | 608304da320f232b9adc591301581a5fa5949fff (patch) | |
| tree | 9916d7a2cb714cac305d9a2ff34ed3471a50c895 /pid | |
| parent | 2642cb54945d1500992559fc55241b48afce3551 (diff) | |
| download | phosphor-pid-control-608304da320f232b9adc591301581a5fa5949fff.tar.gz phosphor-pid-control-608304da320f232b9adc591301581a5fa5949fff.zip | |
stepwise: Add ceiling type
Add a stepwise ceiling type, this is used as a
upper clipping curve to limit the max output based
on a temperature sensor. This is commonly used for
quiet fan mode where CPU throttling is allowed to
preserve a max fan noise.
Change-Id: I181d5913c92e5498a34e6d3f67cf99b67471479c
Signed-off-by: James Feist <james.feist@linux.intel.com>
Diffstat (limited to 'pid')
| -rw-r--r-- | pid/ec/stepwise.hpp | 1 | ||||
| -rw-r--r-- | pid/pidthread.cpp | 1 | ||||
| -rw-r--r-- | pid/stepwisecontroller.cpp | 12 | ||||
| -rw-r--r-- | pid/zone.cpp | 16 | ||||
| -rw-r--r-- | pid/zone.hpp | 4 |
5 files changed, 30 insertions, 4 deletions
diff --git a/pid/ec/stepwise.hpp b/pid/ec/stepwise.hpp index bc7c204..3ce847a 100644 --- a/pid/ec/stepwise.hpp +++ b/pid/ec/stepwise.hpp @@ -31,6 +31,7 @@ struct StepwiseInfo double output[maxStepwisePoints]; double positiveHysteresis; double negativeHysteresis; + bool isCeiling; }; double stepwise(const ec::StepwiseInfo& info, double value); diff --git a/pid/pidthread.cpp b/pid/pidthread.cpp index 44c5e86..08fb513 100644 --- a/pid/pidthread.cpp +++ b/pid/pidthread.cpp @@ -31,6 +31,7 @@ static void processThermals(PIDZone* zone) zone->updateSensors(); // Zero out the RPM set point goals. zone->clearRPMSetPoints(); + zone->clearRPMCeilings(); // Run the margin PIDs. zone->processThermals(); // Get the maximum RPM setpoint. diff --git a/pid/stepwisecontroller.cpp b/pid/stepwisecontroller.cpp index fee25ab..2408502 100644 --- a/pid/stepwisecontroller.cpp +++ b/pid/stepwisecontroller.cpp @@ -95,9 +95,13 @@ double StepwiseController::inputProc(void) void StepwiseController::outputProc(double value) { - // values are 10 for 10% - value *= 100; - _owner->addRPMSetPoint(value); - + if (get_stepwise_info().isCeiling) + { + _owner->addRPMCeiling(value); + } + else + { + _owner->addRPMSetPoint(value); + } return; } diff --git a/pid/zone.cpp b/pid/zone.cpp index fc0b40b..065e6d7 100644 --- a/pid/zone.cpp +++ b/pid/zone.cpp @@ -65,6 +65,16 @@ void PIDZone::addRPMSetPoint(double setpoint) _RPMSetPoints.push_back(setpoint); } +void PIDZone::addRPMCeiling(double ceiling) +{ + _RPMCeilings.push_back(ceiling); +} + +void PIDZone::clearRPMCeilings(void) +{ + _RPMCeilings.clear(); +} + void PIDZone::clearRPMSetPoints(void) { _RPMSetPoints.clear(); @@ -116,6 +126,12 @@ void PIDZone::determineMaxRPMRequest(void) max = *result; } + if (_RPMCeilings.size() > 0) + { + result = std::min_element(_RPMCeilings.begin(), _RPMCeilings.end()); + max = std::min(max, *result); + } + /* * If the maximum RPM setpoint output is below the minimum RPM * setpoint, set it to the minimum. diff --git a/pid/zone.hpp b/pid/zone.hpp index 223f3cb..077d272 100644 --- a/pid/zone.hpp +++ b/pid/zone.hpp @@ -28,6 +28,7 @@ class ZoneInterface virtual double getCachedValue(const std::string& name) = 0; virtual void addRPMSetPoint(double setpoint) = 0; + virtual void addRPMCeiling(double ceiling) = 0; virtual double getMaxRPMRequest() const = 0; virtual bool getFailSafeMode() const = 0; virtual double getFailSafePercent() const = 0; @@ -64,7 +65,9 @@ class PIDZone : public ZoneInterface, public ModeObject bool getFailSafeMode(void) const override; int64_t getZoneID(void) const; void addRPMSetPoint(double setpoint) override; + void addRPMCeiling(double ceiling) override; void clearRPMSetPoints(void); + void clearRPMCeilings(void); double getFailSafePercent(void) const override; double getMinThermalRPMSetpoint(void) const; @@ -107,6 +110,7 @@ class PIDZone : public ZoneInterface, public ModeObject std::set<std::string> _failSafeSensors; std::vector<double> _RPMSetPoints; + std::vector<double> _RPMCeilings; std::vector<std::string> _fanInputs; std::vector<std::string> _thermalInputs; std::map<std::string, double> _cachedValuesByName; |

