diff options
| author | Patrick Venture <venture@google.com> | 2019-05-08 14:50:00 -0700 |
|---|---|---|
| committer | Patrick Venture <venture@google.com> | 2019-05-08 15:11:43 -0700 |
| commit | de79ee05abd7e1b29b3074b0150b5f4eabf7cf9e (patch) | |
| tree | 1e22485624ee4809345d9060e72dcf19938d6510 /pid | |
| parent | a3cac537f56796226c8406c3ded6b13b83971dd6 (diff) | |
| download | phosphor-pid-control-de79ee05abd7e1b29b3074b0150b5f4eabf7cf9e.tar.gz phosphor-pid-control-de79ee05abd7e1b29b3074b0150b5f4eabf7cf9e.zip | |
split parameters for logging and tuning
add a flag to enable/disable tuning: default off
add an option for specifying a folder for outputting logs.
Closes: #10
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I43864768f1dee8672f13288d3cf5a0c87c373aed
Diffstat (limited to 'pid')
| -rw-r--r-- | pid/fancontroller.cpp | 4 | ||||
| -rw-r--r-- | pid/pidloop.cpp | 4 | ||||
| -rw-r--r-- | pid/tuning.cpp | 6 | ||||
| -rw-r--r-- | pid/tuning.hpp | 10 | ||||
| -rw-r--r-- | pid/zone.cpp | 8 | ||||
| -rw-r--r-- | pid/zone.hpp | 4 |
6 files changed, 21 insertions, 15 deletions
diff --git a/pid/fancontroller.cpp b/pid/fancontroller.cpp index 4c1b56b..1f23e0b 100644 --- a/pid/fancontroller.cpp +++ b/pid/fancontroller.cpp @@ -115,8 +115,8 @@ void FanController::outputProc(double value) { double percent = value; - /* If doing tuning logging, don't go into failsafe mode. */ - if (!tuningLoggingEnabled) + /* If doing tuning, don't go into failsafe mode. */ + if (!tuningEnabled) { if (_owner->getFailSafeMode()) { diff --git a/pid/pidloop.cpp b/pid/pidloop.cpp index b684747..f613c7e 100644 --- a/pid/pidloop.cpp +++ b/pid/pidloop.cpp @@ -45,7 +45,7 @@ void pidControlLoop(PIDZone* zone, boost::asio::steady_timer& timer, bool first, { if (first) { - if (tuningLoggingEnabled) + if (loggingEnabled) { zone->initializeLog(); } @@ -104,7 +104,7 @@ void pidControlLoop(PIDZone* zone, boost::asio::steady_timer& timer, bool first, // Run the fan PIDs every iteration. zone->processFans(); - if (tuningLoggingEnabled) + if (loggingEnabled) { zone->getLogHandle() << "," << zone->getFailSafeMode(); zone->getLogHandle() << std::endl; diff --git a/pid/tuning.cpp b/pid/tuning.cpp index c3f21ed..3422e34 100644 --- a/pid/tuning.cpp +++ b/pid/tuning.cpp @@ -16,5 +16,7 @@ #include <string> -bool tuningLoggingEnabled = false; -std::string tuningLoggingPath; +bool tuningEnabled = false; + +std::string loggingPath; +bool loggingEnabled = false; diff --git a/pid/tuning.hpp b/pid/tuning.hpp index 511c797..ba4ec32 100644 --- a/pid/tuning.hpp +++ b/pid/tuning.hpp @@ -2,8 +2,12 @@ #include <string> -/** Boolean variable controlling whether tuning logging output is enabled +/** Boolean variable controlling whether tuning is enabled * during this run. */ -extern bool tuningLoggingEnabled; -extern std::string tuningLoggingPath; +extern bool tuningEnabled; +/** String variable with the folder for writing logs if logging is enabled. + */ +extern std::string loggingPath; +/** Boolean variable whether loggingPath is non-empty. */ +extern bool loggingEnabled; diff --git a/pid/zone.cpp b/pid/zone.cpp index 928aef5..eef4fde 100644 --- a/pid/zone.cpp +++ b/pid/zone.cpp @@ -139,7 +139,7 @@ void PIDZone::determineMaxRPMRequest(void) */ max = std::max(getMinThermalRPMSetpoint(), max); - if (tuningLoggingEnabled) + if (tuningEnabled) { /* * We received no setpoints from thermal sensors. @@ -217,7 +217,7 @@ void PIDZone::updateFanTelemetry(void) * is disabled? I think it's a waste to try and log things even if the * data is just being dropped though. */ - if (tuningLoggingEnabled) + if (loggingEnabled) { tstamp now = std::chrono::high_resolution_clock::now(); _log << std::chrono::duration_cast<std::chrono::milliseconds>( @@ -237,13 +237,13 @@ void PIDZone::updateFanTelemetry(void) * However, these are the fans, so if I'm not getting updated values * for them... what should I do? */ - if (tuningLoggingEnabled) + if (loggingEnabled) { _log << "," << r.value; } } - if (tuningLoggingEnabled) + if (loggingEnabled) { for (const auto& t : _thermalInputs) { diff --git a/pid/zone.hpp b/pid/zone.hpp index 78ebf0f..fcadac0 100644 --- a/pid/zone.hpp +++ b/pid/zone.hpp @@ -52,9 +52,9 @@ class PIDZone : public ZoneInterface, public ModeObject _minThermalOutputSetPt(minThermalOutput), _failSafePercent(failSafePercent), _mgr(mgr) { - if (tuningLoggingEnabled && !tuningLoggingPath.empty()) + if (loggingEnabled) { - _log.open(tuningLoggingPath + std::to_string(zone)); + _log.open(loggingPath + std::to_string(zone)); } } |

