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 /test | |
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 'test')
-rw-r--r-- | test/pid_stepwisecontroller_unittest.cpp | 12 | ||||
-rw-r--r-- | test/zone_mock.hpp | 1 |
2 files changed, 7 insertions, 6 deletions
diff --git a/test/pid_stepwisecontroller_unittest.cpp b/test/pid_stepwisecontroller_unittest.cpp index 5b1e655..5cf825d 100644 --- a/test/pid_stepwisecontroller_unittest.cpp +++ b/test/pid_stepwisecontroller_unittest.cpp @@ -12,8 +12,6 @@ using ::testing::Return; using ::testing::StrEq; -constexpr size_t scale = 100; // values are 10 for 10% - TEST(StepwiseControllerTest, HysteresisTestPositive) { // Verifies positive hysteresis works as expected @@ -29,6 +27,7 @@ TEST(StepwiseControllerTest, HysteresisTestPositive) initial.reading[2] = std::numeric_limits<double>::quiet_NaN(); initial.output[0] = 40.0; initial.output[1] = 60.0; + initial.isCeiling = false; std::unique_ptr<Controller> p = StepwiseController::createStepwiseController(&z, "foo", inputs, @@ -40,8 +39,8 @@ TEST(StepwiseControllerTest, HysteresisTestPositive) .WillOnce(Return(31.0)) // return 40 .WillOnce(Return(32.0)); // return 60 - EXPECT_CALL(z, addRPMSetPoint(40.0 * scale)).Times(2); - EXPECT_CALL(z, addRPMSetPoint(60.0 * scale)).Times(1); + EXPECT_CALL(z, addRPMSetPoint(40.0)).Times(2); + EXPECT_CALL(z, addRPMSetPoint(60.0)).Times(1); for (int ii = 0; ii < 3; ii++) { @@ -64,6 +63,7 @@ TEST(StepwiseControllerTest, HysteresisTestNegative) initial.reading[2] = std::numeric_limits<double>::quiet_NaN(); initial.output[0] = 40.0; initial.output[1] = 60.0; + initial.isCeiling = false; std::unique_ptr<Controller> p = StepwiseController::createStepwiseController(&z, "foo", inputs, @@ -75,8 +75,8 @@ TEST(StepwiseControllerTest, HysteresisTestNegative) .WillOnce(Return(27.0)) // return 60 .WillOnce(Return(26.0)); // return 40 - EXPECT_CALL(z, addRPMSetPoint(40.0 * scale)).Times(1); - EXPECT_CALL(z, addRPMSetPoint(60.0 * scale)).Times(2); + EXPECT_CALL(z, addRPMSetPoint(40.0)).Times(1); + EXPECT_CALL(z, addRPMSetPoint(60.0)).Times(2); for (int ii = 0; ii < 3; ii++) { diff --git a/test/zone_mock.hpp b/test/zone_mock.hpp index 35a6b32..4a9c3f8 100644 --- a/test/zone_mock.hpp +++ b/test/zone_mock.hpp @@ -13,6 +13,7 @@ class ZoneMock : public ZoneInterface MOCK_METHOD1(getCachedValue, double(const std::string&)); MOCK_METHOD1(addRPMSetPoint, void(double)); + MOCK_METHOD1(addRPMCeiling, void(double)); MOCK_CONST_METHOD0(getMaxRPMRequest, double()); MOCK_CONST_METHOD0(getFailSafeMode, bool()); MOCK_CONST_METHOD0(getFailSafePercent, double()); |