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>
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 @@
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 @@
.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 @@
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 @@
.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++)
{