diff options
| author | James Feist <james.feist@linux.intel.com> | 2019-02-25 13:28:18 -0800 |
|---|---|---|
| committer | Patrick Venture <venture@google.com> | 2019-02-26 18:46:56 +0000 |
| commit | 3484bedaf611a106eeaf418b6cede2c2e42095c8 (patch) | |
| tree | b852399ccab0119f7ccccc3e477635d48da01a48 | |
| parent | 75eb769d351434547899186f73ff70ae00d7934a (diff) | |
| download | phosphor-pid-control-3484bedaf611a106eeaf418b6cede2c2e42095c8.tar.gz phosphor-pid-control-3484bedaf611a106eeaf418b6cede2c2e42095c8.zip | |
s/minThermalRPM/minThermalOutput
The minThermalRPM is only an RPM by the fact that
that is the units of the PID. As the PID units can
be anything, change this to minThermalOutput to allow
for different units (i.e. percent).
Change-Id: Ic53fef1159ade5a413e5d519d407947f3023d8e3
Signed-off-by: James Feist <james.feist@linux.intel.com>
| -rw-r--r-- | conf.hpp | 2 | ||||
| -rw-r--r-- | dbus/dbusconfiguration.cpp | 6 | ||||
| -rw-r--r-- | examples/README | 2 | ||||
| -rw-r--r-- | examples/fan-info.json | 2 | ||||
| -rw-r--r-- | pid/builder.cpp | 2 | ||||
| -rw-r--r-- | pid/buildjson.cpp | 2 | ||||
| -rw-r--r-- | pid/zone.cpp | 2 | ||||
| -rw-r--r-- | pid/zone.hpp | 7 | ||||
| -rw-r--r-- | test/json_parse_unittest.cpp | 8 | ||||
| -rw-r--r-- | test/pid_json_unittest.cpp | 4 | ||||
| -rw-r--r-- | test/pid_zone_unittest.cpp | 13 |
11 files changed, 26 insertions, 24 deletions
@@ -51,7 +51,7 @@ struct ControllerInfo struct ZoneConfig { /* The minimum RPM value we would ever want. */ - double minThermalRpm; + double minThermalOutput; /* If the sensors are in fail-safe mode, this is the percentage to use. */ double failsafePercent; diff --git a/dbus/dbusconfiguration.cpp b/dbus/dbusconfiguration.cpp index 06bcdcc..3c5be34 100644 --- a/dbus/dbusconfiguration.cpp +++ b/dbus/dbusconfiguration.cpp @@ -92,7 +92,7 @@ void debugPrint(void) for (const auto& zone : zoneDetailsConfig) { std::cout << "\t{" << zone.first << ",\n"; - std::cout << "\t\t{" << zone.second.minThermalRpm << ", "; + std::cout << "\t\t{" << zone.second.minThermalOutput << ", "; std::cout << zone.second.failsafePercent << "}\n\t},\n"; } std::cout << "}\n\n"; @@ -299,8 +299,8 @@ void init(sdbusplus::bus::bus& bus) size_t index = getZoneIndex(name, foundZones); auto& details = zoneDetailsConfig[index]; - details.minThermalRpm = - std::visit(VariantToDoubleVisitor(), zone.at("MinThermalRpm")); + details.minThermalOutput = std::visit(VariantToDoubleVisitor(), + zone.at("MinThermalOutput")); details.failsafePercent = std::visit(VariantToDoubleVisitor(), zone.at("FailSafePercent")); } diff --git a/examples/README b/examples/README index df76978..dcbd645 100644 --- a/examples/README +++ b/examples/README @@ -55,7 +55,7 @@ The PID configuration is a list of PIDs per zone. "zones" : [ { "id": 1, /* zone id. */ - "minThermalRpm": 3000.0, /* The minimum thermal RPM value. (double) */ + "minThermalOutput": 3000.0, /* The minimum thermal RPM value. (double) */ "failsafePercent": 75.0, /* The percent to use when the zone is in fail-safe mode. (double) */ "pids": [ { diff --git a/examples/fan-info.json b/examples/fan-info.json index e0b87ee..f1676cb 100644 --- a/examples/fan-info.json +++ b/examples/fan-info.json @@ -62,7 +62,7 @@ "zones" : [ { "id": 1, - "minThermalRpm": 3000.0, + "minThermalOutput": 3000.0, "failsafePercent": 75.0, "pids": [ { diff --git a/pid/builder.cpp b/pid/builder.cpp index 2a64215..2faa1cc 100644 --- a/pid/builder.cpp +++ b/pid/builder.cpp @@ -63,7 +63,7 @@ std::unordered_map<int64_t, std::unique_ptr<PIDZone>> const PIDConf& pidConfig = zi.second; auto zone = std::make_unique<PIDZone>( - zoneId, zoneConf->second.minThermalRpm, + zoneId, zoneConf->second.minThermalOutput, zoneConf->second.failsafePercent, mgr, modeControlBus, getControlPath(zi.first).c_str(), deferSignals); diff --git a/pid/buildjson.cpp b/pid/buildjson.cpp index 97f2bf0..b620439 100644 --- a/pid/buildjson.cpp +++ b/pid/buildjson.cpp @@ -86,7 +86,7 @@ std::pair<std::map<int64_t, PIDConf>, std::map<int64_t, struct ZoneConfig>> /* TODO: using at() throws a specific exception we can catch */ id = zone["id"]; - thisZoneConfig.minThermalRpm = zone["minThermalRpm"]; + thisZoneConfig.minThermalOutput = zone["minThermalOutput"]; thisZoneConfig.failsafePercent = zone["failsafePercent"]; auto pids = zone["pids"]; diff --git a/pid/zone.cpp b/pid/zone.cpp index 065e6d7..7433d30 100644 --- a/pid/zone.cpp +++ b/pid/zone.cpp @@ -87,7 +87,7 @@ double PIDZone::getFailSafePercent(void) const double PIDZone::getMinThermalRPMSetpoint(void) const { - return _minThermalRpmSetPt; + return _minThermalOutputSetPt; } void PIDZone::addFanPID(std::unique_ptr<Controller> pid) diff --git a/pid/zone.hpp b/pid/zone.hpp index 077d272..94082e9 100644 --- a/pid/zone.hpp +++ b/pid/zone.hpp @@ -43,11 +43,12 @@ class ZoneInterface class PIDZone : public ZoneInterface, public ModeObject { public: - PIDZone(int64_t zone, double minThermalRpm, double failSafePercent, + PIDZone(int64_t zone, double minThermalOutput, double failSafePercent, const SensorManager& mgr, sdbusplus::bus::bus& bus, const char* objPath, bool defer) : ModeObject(bus, objPath, defer), - _zoneId(zone), _maximumRPMSetPt(), _minThermalRpmSetPt(minThermalRpm), + _zoneId(zone), _maximumRPMSetPt(), + _minThermalOutputSetPt(minThermalOutput), _failSafePercent(failSafePercent), _mgr(mgr) { #ifdef __TUNING_LOGGING__ @@ -104,7 +105,7 @@ class PIDZone : public ZoneInterface, public ModeObject const int64_t _zoneId; double _maximumRPMSetPt = 0; bool _manualMode = false; - const double _minThermalRpmSetPt; + const double _minThermalOutputSetPt; const double _failSafePercent; std::set<std::string> _failSafeSensors; diff --git a/test/json_parse_unittest.cpp b/test/json_parse_unittest.cpp index ba6ff11..4913461 100644 --- a/test/json_parse_unittest.cpp +++ b/test/json_parse_unittest.cpp @@ -16,7 +16,7 @@ TEST(ConfigurationVerificationTest, VerifyHappy) }], "zones": [{ "id": 1, - "minThermalRpm": 3000.0, + "minThermalOutput": 3000.0, "failsafePercent": 75.0, "pids": [{ "name": "fan1-5", @@ -51,7 +51,7 @@ TEST(ConfigurationVerificationTest, VerifyNoSensorKey) { "zones": [{ "id": 1, - "minThermalRpm": 3000.0, + "minThermalOutput": 3000.0, "failsafePercent": 75.0, "pids": [{ "name": "fan1-5", @@ -103,7 +103,7 @@ TEST(ConfigurationVerificationTest, VerifyNoSensor) "sensors": [], "zones": [{ "id": 1, - "minThermalRpm": 3000.0, + "minThermalOutput": 3000.0, "failsafePercent": 75.0, "pids": [{ "name": "fan1-5", @@ -143,7 +143,7 @@ TEST(ConfigurationVerificationTest, VerifyNoPidInZone) }], "zones": [{ "id": 1, - "minThermalRpm": 3000.0, + "minThermalOutput": 3000.0, "failsafePercent": 75.0, "pids": [] }] diff --git a/test/pid_json_unittest.cpp b/test/pid_json_unittest.cpp index 42402d1..098d9da 100644 --- a/test/pid_json_unittest.cpp +++ b/test/pid_json_unittest.cpp @@ -34,7 +34,7 @@ TEST(ZoneFromJson, oneZoneOnePid) { "zones" : [{ "id": 1, - "minThermalRpm": 3000.0, + "minThermalOutput": 3000.0, "failsafePercent": 75.0, "pids": [{ "name": "fan1-5", @@ -64,5 +64,5 @@ TEST(ZoneFromJson, oneZoneOnePid) EXPECT_EQ(zoneConfig.size(), 1); EXPECT_EQ(pidConfig[1]["fan1-5"].type, "fan"); - EXPECT_DOUBLE_EQ(zoneConfig[1].minThermalRpm, 3000.0); + EXPECT_DOUBLE_EQ(zoneConfig[1].minThermalOutput, 3000.0); } diff --git a/test/pid_zone_unittest.cpp b/test/pid_zone_unittest.cpp index e8c8a2b..2270fa6 100644 --- a/test/pid_zone_unittest.cpp +++ b/test/pid_zone_unittest.cpp @@ -42,7 +42,7 @@ TEST(PidZoneConstructorTest, BoringConstructorTest) bool defer = true; const char* objPath = "/path/"; int64_t zone = 1; - double minThermalRpm = 1000.0; + double minThermalOutput = 1000.0; double failSafePercent = 0.75; int i; @@ -50,8 +50,8 @@ TEST(PidZoneConstructorTest, BoringConstructorTest) SetupDbusObject(&sdbus_mock_mode, defer, objPath, modeInterface, properties, &i); - PIDZone p(zone, minThermalRpm, failSafePercent, m, bus_mock_mode, objPath, - defer); + PIDZone p(zone, minThermalOutput, failSafePercent, m, bus_mock_mode, + objPath, defer); // Success. } @@ -80,8 +80,9 @@ class PidZoneTest : public ::testing::Test SetupDbusObject(&sdbus_mock_mode, defer, objPath, modeInterface, properties, &property_index); - zone = std::make_unique<PIDZone>(zoneId, minThermalRpm, failSafePercent, - mgr, bus_mock_mode, objPath, defer); + zone = + std::make_unique<PIDZone>(zoneId, minThermalOutput, failSafePercent, + mgr, bus_mock_mode, objPath, defer); } // unused @@ -92,7 +93,7 @@ class PidZoneTest : public ::testing::Test sdbusplus::SdBusMock sdbus_mock_host; sdbusplus::SdBusMock sdbus_mock_mode; int64_t zoneId = 1; - double minThermalRpm = 1000.0; + double minThermalOutput = 1000.0; double failSafePercent = 0.75; bool defer = true; const char* objPath = "/path/"; |

