summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Venture <venture@google.com>2019-07-16 10:50:37 -0700
committerPatrick Venture <venture@google.com>2019-07-16 21:16:01 +0000
commit9bbf333d0c4b6bb47959ef6d0395949fa0fe386c (patch)
tree8d588feccb919432d51c041d7bc304ba7eb373ca
parent924dd965ed01e0c09bef4520f754d0d1a10e7ad3 (diff)
downloadphosphor-pid-control-9bbf333d0c4b6bb47959ef6d0395949fa0fe386c.tar.gz
phosphor-pid-control-9bbf333d0c4b6bb47959ef6d0395949fa0fe386c.zip
rename RPMSetPoint to SetPoint
The PIDs were originally focused on collecting RPM set points from thermal PIDs and then having fan PIDs use the highest value collected, it doesn't need to be strictly an RPM set point. It does however need to be one type of value. Signed-off-by: Patrick Venture <venture@google.com> Change-Id: I1d589cf4b2688d7e86030c10496d737dc5bbdadf
-rw-r--r--pid/pidloop.cpp4
-rw-r--r--pid/stepwisecontroller.cpp2
-rw-r--r--pid/thermalcontroller.cpp2
-rw-r--r--pid/zone.cpp12
-rw-r--r--pid/zone.hpp8
-rw-r--r--test/pid_stepwisecontroller_unittest.cpp8
-rw-r--r--test/pid_thermalcontroller_unittest.cpp6
-rw-r--r--test/pid_zone_unittest.cpp8
-rw-r--r--test/zone_mock.hpp2
9 files changed, 26 insertions, 26 deletions
diff --git a/pid/pidloop.cpp b/pid/pidloop.cpp
index 9eed3a8..b86ea4b 100644
--- a/pid/pidloop.cpp
+++ b/pid/pidloop.cpp
@@ -31,8 +31,8 @@ static void processThermals(PIDZone* zone)
{
// Get the latest margins.
zone->updateSensors();
- // Zero out the RPM set point goals.
- zone->clearRPMSetPoints();
+ // Zero out the set point goals.
+ zone->clearSetPoints();
zone->clearRPMCeilings();
// Run the margin PIDs.
zone->processThermals();
diff --git a/pid/stepwisecontroller.cpp b/pid/stepwisecontroller.cpp
index 2408502..c72d61a 100644
--- a/pid/stepwisecontroller.cpp
+++ b/pid/stepwisecontroller.cpp
@@ -101,7 +101,7 @@ void StepwiseController::outputProc(double value)
}
else
{
- _owner->addRPMSetPoint(value);
+ _owner->addSetPoint(value);
}
return;
}
diff --git a/pid/thermalcontroller.cpp b/pid/thermalcontroller.cpp
index d794525..5a5b9cc 100644
--- a/pid/thermalcontroller.cpp
+++ b/pid/thermalcontroller.cpp
@@ -102,7 +102,7 @@ double ThermalController::setptProc(void)
// bmc_set_pid_output
void ThermalController::outputProc(double value)
{
- _owner->addRPMSetPoint(value);
+ _owner->addSetPoint(value);
return;
}
diff --git a/pid/zone.cpp b/pid/zone.cpp
index e206e17..47d6695 100644
--- a/pid/zone.cpp
+++ b/pid/zone.cpp
@@ -61,9 +61,9 @@ int64_t PIDZone::getZoneID(void) const
return _zoneId;
}
-void PIDZone::addRPMSetPoint(double setpoint)
+void PIDZone::addSetPoint(double setpoint)
{
- _RPMSetPoints.push_back(setpoint);
+ _SetPoints.push_back(setpoint);
}
void PIDZone::addRPMCeiling(double ceiling)
@@ -76,9 +76,9 @@ void PIDZone::clearRPMCeilings(void)
_RPMCeilings.clear();
}
-void PIDZone::clearRPMSetPoints(void)
+void PIDZone::clearSetPoints(void)
{
- _RPMSetPoints.clear();
+ _SetPoints.clear();
}
double PIDZone::getFailSafePercent(void) const
@@ -121,9 +121,9 @@ void PIDZone::determineMaxRPMRequest(void)
double max = 0;
std::vector<double>::iterator result;
- if (_RPMSetPoints.size() > 0)
+ if (_SetPoints.size() > 0)
{
- result = std::max_element(_RPMSetPoints.begin(), _RPMSetPoints.end());
+ result = std::max_element(_SetPoints.begin(), _SetPoints.end());
max = *result;
}
diff --git a/pid/zone.hpp b/pid/zone.hpp
index 53139ec..5516bed 100644
--- a/pid/zone.hpp
+++ b/pid/zone.hpp
@@ -28,7 +28,7 @@ class ZoneInterface
virtual ~ZoneInterface() = default;
virtual double getCachedValue(const std::string& name) = 0;
- virtual void addRPMSetPoint(double setpoint) = 0;
+ virtual void addSetPoint(double setpoint) = 0;
virtual void addRPMCeiling(double ceiling) = 0;
virtual double getMaxRPMRequest() const = 0;
virtual bool getFailSafeMode() const = 0;
@@ -67,9 +67,9 @@ class PIDZone : public ZoneInterface, public ModeObject
void setManualMode(bool mode);
bool getFailSafeMode(void) const override;
int64_t getZoneID(void) const;
- void addRPMSetPoint(double setpoint) override;
+ void addSetPoint(double setpoint) override;
void addRPMCeiling(double ceiling) override;
- void clearRPMSetPoints(void);
+ void clearSetPoints(void);
void clearRPMCeilings(void);
double getFailSafePercent(void) const override;
double getMinThermalRPMSetpoint(void) const;
@@ -108,7 +108,7 @@ class PIDZone : public ZoneInterface, public ModeObject
std::set<std::string> _failSafeSensors;
- std::vector<double> _RPMSetPoints;
+ std::vector<double> _SetPoints;
std::vector<double> _RPMCeilings;
std::vector<std::string> _fanInputs;
std::vector<std::string> _thermalInputs;
diff --git a/test/pid_stepwisecontroller_unittest.cpp b/test/pid_stepwisecontroller_unittest.cpp
index 5cf825d..f5f6f9a 100644
--- a/test/pid_stepwisecontroller_unittest.cpp
+++ b/test/pid_stepwisecontroller_unittest.cpp
@@ -39,8 +39,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, addSetPoint(40.0)).Times(2);
+ EXPECT_CALL(z, addSetPoint(60.0)).Times(1);
for (int ii = 0; ii < 3; ii++)
{
@@ -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)).Times(1);
- EXPECT_CALL(z, addRPMSetPoint(60.0)).Times(2);
+ EXPECT_CALL(z, addSetPoint(40.0)).Times(1);
+ EXPECT_CALL(z, addSetPoint(60.0)).Times(2);
for (int ii = 0; ii < 3; ii++)
{
diff --git a/test/pid_thermalcontroller_unittest.cpp b/test/pid_thermalcontroller_unittest.cpp
index ae5c769..d95f16e 100644
--- a/test/pid_thermalcontroller_unittest.cpp
+++ b/test/pid_thermalcontroller_unittest.cpp
@@ -99,7 +99,7 @@ TEST(ThermalControllerTest, OutputProc_BehavesAsExpected)
EXPECT_FALSE(p == nullptr);
double value = 90.0;
- EXPECT_CALL(z, addRPMSetPoint(value));
+ EXPECT_CALL(z, addSetPoint(value));
p->outputProc(value);
}
@@ -170,7 +170,7 @@ TEST(ThermalControllerTest, NegHysteresis_BehavesAsExpected)
.WillOnce(Return(9.0))
.WillOnce(Return(7.0));
- EXPECT_CALL(z, addRPMSetPoint(_)).Times(3);
+ EXPECT_CALL(z, addSetPoint(_)).Times(3);
std::vector<double> lastReadings = {12.0, 12.0, 7.0};
for (auto& reading : lastReadings)
@@ -203,7 +203,7 @@ TEST(ThermalControllerTest, PosHysteresis_BehavesAsExpected)
.WillOnce(Return(13.0))
.WillOnce(Return(14.0));
- EXPECT_CALL(z, addRPMSetPoint(_)).Times(3);
+ EXPECT_CALL(z, addSetPoint(_)).Times(3);
std::vector<double> lastReadings = {8.0, 8.0, 14.0};
for (auto& reading : lastReadings)
diff --git a/test/pid_zone_unittest.cpp b/test/pid_zone_unittest.cpp
index 269b3f8..e0ecd76 100644
--- a/test/pid_zone_unittest.cpp
+++ b/test/pid_zone_unittest.cpp
@@ -121,7 +121,7 @@ TEST_F(PidZoneTest, GetAndSetManualModeTest_BehavesAsExpected)
TEST_F(PidZoneTest, RpmSetPoints_AddMaxClear_BehaveAsExpected)
{
- // Tests addRPMSetPoint, clearRPMSetPoints, determineMaxRPMRequest
+ // Tests addSetPoint, clearSetPoints, determineMaxRPMRequest
// and getMinThermalRPMSetpoint.
// At least one value must be above the minimum thermal setpoint used in
@@ -129,7 +129,7 @@ TEST_F(PidZoneTest, RpmSetPoints_AddMaxClear_BehaveAsExpected)
std::vector<double> values = {100, 200, 300, 400, 500, 5000};
for (auto v : values)
{
- zone->addRPMSetPoint(v);
+ zone->addSetPoint(v);
}
// This will pull the maximum RPM setpoint request.
@@ -137,7 +137,7 @@ TEST_F(PidZoneTest, RpmSetPoints_AddMaxClear_BehaveAsExpected)
EXPECT_EQ(5000, zone->getMaxRPMRequest());
// Clear the values, so it'll choose the minimum thermal setpoint.
- zone->clearRPMSetPoints();
+ zone->clearSetPoints();
// This will go through the RPM set point values and grab the maximum.
zone->determineMaxRPMRequest();
@@ -152,7 +152,7 @@ TEST_F(PidZoneTest, RpmSetPoints_AddBelowMinimum_BehavesAsExpected)
std::vector<double> values = {100, 200, 300, 400, 500};
for (auto v : values)
{
- zone->addRPMSetPoint(v);
+ zone->addSetPoint(v);
}
// This will pull the maximum RPM setpoint request.
diff --git a/test/zone_mock.hpp b/test/zone_mock.hpp
index 4a9c3f8..a81ddeb 100644
--- a/test/zone_mock.hpp
+++ b/test/zone_mock.hpp
@@ -12,7 +12,7 @@ class ZoneMock : public ZoneInterface
virtual ~ZoneMock() = default;
MOCK_METHOD1(getCachedValue, double(const std::string&));
- MOCK_METHOD1(addRPMSetPoint, void(double));
+ MOCK_METHOD1(addSetPoint, void(double));
MOCK_METHOD1(addRPMCeiling, void(double));
MOCK_CONST_METHOD0(getMaxRPMRequest, double());
MOCK_CONST_METHOD0(getFailSafeMode, bool());
OpenPOWER on IntegriCloud