summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJames Feist <james.feist@linux.intel.com>2019-02-15 16:14:31 -0800
committerJames Feist <james.feist@linux.intel.com>2019-02-15 16:34:31 -0800
commitdca2d484ee91ee40fc94509d831ef2c5fa792ca0 (patch)
tree4614f4f40377d6620cbbd19b7ee7177103250194 /test
parent18b1311e7588769c3da0a0250c28c80214cba2af (diff)
downloadphosphor-pid-control-dca2d484ee91ee40fc94509d831ef2c5fa792ca0.tar.gz
phosphor-pid-control-dca2d484ee91ee40fc94509d831ef2c5fa792ca0.zip
DBusConfiguration: Fix scaling
Revert the removal of the /100 because that caused 90% to be passed as 90 instead of .9. To counter-act this multiply the stepwise controller by 100 so that setting 50 is 50%. Tested-by: Used sensor override to make stepwise jump threshold and got desired pwm result. Change-Id: I629bf0d4b0b3bc77660c09fccae82b1bdac4c578
Diffstat (limited to 'test')
-rw-r--r--test/pid_stepwisecontroller_unittest.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/test/pid_stepwisecontroller_unittest.cpp b/test/pid_stepwisecontroller_unittest.cpp
index e3c4f09..5b1e655 100644
--- a/test/pid_stepwisecontroller_unittest.cpp
+++ b/test/pid_stepwisecontroller_unittest.cpp
@@ -12,6 +12,8 @@
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
@@ -38,8 +40,8 @@ TEST(StepwiseControllerTest, HysteresisTestPositive)
.WillOnce(Return(31.0)) // return 40
.WillOnce(Return(32.0)); // return 60
- EXPECT_CALL(z, addRPMSetPoint(40.0)).Times(2);
- EXPECT_CALL(z, addRPMSetPoint(60.0)).Times(1);
+ EXPECT_CALL(z, addRPMSetPoint(40.0 * scale)).Times(2);
+ EXPECT_CALL(z, addRPMSetPoint(60.0 * scale)).Times(1);
for (int ii = 0; ii < 3; ii++)
{
@@ -73,8 +75,8 @@ TEST(StepwiseControllerTest, HysteresisTestNegative)
.WillOnce(Return(27.0)) // return 60
.WillOnce(Return(26.0)); // return 40
- EXPECT_CALL(z, addRPMSetPoint(40.0)).Times(1);
- EXPECT_CALL(z, addRPMSetPoint(60.0)).Times(2);
+ EXPECT_CALL(z, addRPMSetPoint(40.0 * scale)).Times(1);
+ EXPECT_CALL(z, addRPMSetPoint(60.0 * scale)).Times(2);
for (int ii = 0; ii < 3; ii++)
{
OpenPOWER on IntegriCloud