summaryrefslogtreecommitdiffstats
path: root/pid
Commit message (Collapse)AuthorAgeFilesLines
* rename away from RPMPatrick Venture2019-07-164-15/+15
| | | | | | | | | | The SetPoint output from a thermal PID is likely RPM, and that value is then fed into a fan controller PID as the set-point (unit: RPM). This does not have to be RPM, however. Continue renaming variables and methods to remove the explicit unit-naming. Signed-off-by: Patrick Venture <venture@google.com> Change-Id: I570dee0c688338f9a458cac7123314717bee2b42
* rename RPMSetPoint to SetPointPatrick Venture2019-07-165-14/+14
| | | | | | | | | | | 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
* Add stepwise parserHank Liou2019-05-281-19/+62
| | | | | | | | The json parser cannot read stepwise setting from config. This change adds support to stepwise type of pid. Change-Id: I650c5bd6a0040bf25630e33b3bd36abf388f0cd8 Signed-off-by: Hank Liou <Hank.Liou@quantatw.com>
* Check fans for failureWill Liang2019-05-231-1/+29
| | | | | | | | Add check the fan fail. If detect fan fail then into the fail safe mode. Signed-off-by: Will Liang <will.liang@quantatw.com> Change-Id: I6ef9d42e131500c1b38a708e1c6fda15dc712f60
* Make dbusconfiguration reloadable without rebootJames Feist2019-05-091-0/+5
| | | | | | | | | | | | | | | | | Now that asio is being used instead of threads, we can reload the fan configuration without having to restart the application. This moves the ownership of the passive and host bus outside of the SensorManager so that it can be recreated each reload. Tested: Watched logs and saw full fan config get reloaded after changing fan configuration Tested: Ran on json configured system and it behaved as expected. Change-Id: I00e6b27f75384fd41de2017b723f159c9691ae97 Signed-off-by: James Feist <james.feist@linux.intel.com>
* Consolidate all util.hppJames Feist2019-05-082-11/+2
| | | | | | | | This deletes all lower level util.hpp and cats them into the top level util.hpp to avoid name conflicts. Change-Id: Ia11e4a08053a3970b0aadf21d1156ab26def36bd Signed-off-by: James Feist <james.feist@linux.intel.com>
* explicitly expect a directory for loggingPatrick Venture2019-05-081-1/+1
| | | | | | | | Verify the logging parameter is explicitly a directory. Treat the path as a directory for creating the logging files. Signed-off-by: Patrick Venture <venture@google.com> Change-Id: I84d6be79780df3f52deeb1ff1b7a50de6175c055
* split parameters for logging and tuningPatrick Venture2019-05-086-15/+21
| | | | | | | | | 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
* Remove threadsJames Feist2019-04-074-115/+135
| | | | | | | | | | | | | | | This converts phosphor-pid-control into an async single threaded application. The reason for doing this is on our systems phosphor-pid-control had the largest VSZ when viewed under top. Before this patch the VSZ was at 50720, after it is at 7760. Tested-by: Could still interact with all interfaces under rest-dbus and sensor override worked to ramp fans when changing cpu temps. Change-Id: Ie0a837bdf0d1b1df61dc7aff87e5d503b9e0e875 Signed-off-by: James Feist <james.feist@linux.intel.com>
* bugfix: grab hystersis parameter from pid jsonPatrick Venture2019-03-261-2/+2
| | | | | | | | | | The code incorrectly attempts to read the hystersis parameters from the wrong scope of the json object. This fixes it to read from the pid configuration's scope. Tested: Added a new unit-test to hit this case. Change-Id: I808bc907ec33a0b12d68a88fd316c3c9fae41516 Signed-off-by: Patrick Venture <venture@google.com>
* pid: zone: add zone id to log namePatrick Venture2019-03-181-1/+1
| | | | | | | | When a log path is provided, append the zone id to the log so that each zone will have its own log file. Change-Id: I56f92669eda23148127f53fd50e119912a24200b Signed-off-by: Patrick Venture <venture@google.com>
* add tuning enable variablePatrick Venture2019-02-286-57/+93
| | | | | | | | | | | Add a variable that when set, enables tuning logging. This variable is set to false. Tuning can be enabled via "-t" "--tuning" on the command line. With a parameter is the path where to write the logging information. Change-Id: I6eb8035d56cc3301face21e9375c02fc9fcc5b31 Signed-off-by: Patrick Venture <venture@google.com>
* Expand conf namespaceJames Feist2019-02-264-14/+19
| | | | | | | | | Put rest of conf.hpp in the conf namespace. This is largely a sed replace, and wrapping from_json in conf namespace as it failed to build. Change-Id: I9fe5c7b2fface44618c43af2367035afc39bcb64 Signed-off-by: James Feist <james.feist@linux.intel.com>
* s/minThermalRPM/minThermalOutputJames Feist2019-02-264-6/+7
| | | | | | | | | | 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>
* stepwise: Add ceiling typeJames Feist2019-02-265-4/+30
| | | | | | | | | | | 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>
* Allow removal from failsafe if timeout=0James Feist2019-02-251-19/+13
| | | | | | | | | | | | Initialize cache on start adds all sensors to failsafe. Without being able to hit the removal in updatesensors this causes the system to go into failsafe and never remove. Closes #8 Change-Id: I83f495adb1475abc27dba1734022f28d89e03d8f Signed-off-by: James Feist <james.feist@linux.intel.com>
* conf change: s/feedFwdOffOffsetCoeff/feedFwdOffsetCoeff/gPatrick Venture2019-02-201-1/+1
| | | | | | | Fixup spelling mistake for configuration field name. Change-Id: I92d0af06f4e15f4408dd10f0dd9cd71099b77f4f Signed-off-by: Patrick Venture <venture@google.com>
* DBusConfiguration: Fix scalingJames Feist2019-02-152-6/+2
| | | | | | | | | | | | 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
* swap libconfig++ for json in configuration parsingPatrick Venture2019-02-113-169/+0
| | | | | | | Parse the configuration file as json and not libconfig++. Change-Id: Ic3e71cc810195387617b545566cf757c61c71942 Signed-off-by: Patrick Venture <venture@google.com>
* add support to build zones and PIDs from jsonPatrick Venture2019-02-112-0/+124
| | | | | | | Add support to build zones and PIDs from a json configuration file. Change-Id: If8608dcd3e084cebabb71fc39851044df4d5d7c2 Signed-off-by: Patrick Venture <venture@google.com>
* conf change: s/set-point/setpoint/Patrick Venture2019-02-115-10/+10
| | | | | | | Remove the dash from set-point, such that it's one word: setpoint. Change-Id: I4c3033f3c2432a53d850e8f5defbe2ac1510daf8 Signed-off-by: Patrick Venture <venture@google.com>
* conf change: pid: all pid details are now camelCasePatrick Venture2019-02-114-46/+48
| | | | | | | | Convert all PID configuration details are now camelCase instead of snake case. Change-Id: Id132053f122dfcd8abaace17df91c99758eb2b0c Signed-off-by: Patrick Venture <venture@google.com>
* conf change: rename zone variablesPatrick Venture2019-02-112-5/+5
| | | | | | | | | | | Rename the zone variables to make them camelCase as a step towards making all configuration variables camelCase for consistency. Note: This patchset requires a change to your yaml configuration if you're using it, or libconfig if you're using it. Change-Id: If9cf1d7eb8227d305a1625275f2f7082c0d6905a Signed-off-by: Patrick Venture <venture@google.com>
* pid: rename variables with full namesPatrick Venture2019-02-111-20/+21
| | | | | | | | Use full names and camelcase for the variables in the pid loop to improve readability and consistency. Change-Id: I86be69d94d3008faa497eace050d1f3b9b6a9ff4 Signed-off-by: Patrick Venture <venture@google.com>
* pid: rename structure components for stylePatrick Venture2019-02-113-46/+49
| | | | | | | Rename the struct components to camelCase. Change-Id: I0e76c4bd5aed0ec2d78edd31ddef66f852ddc71e Signed-off-by: Patrick Venture <venture@google.com>
* Add Hysteresis to pid controllersJames Feist2019-02-054-2/+46
| | | | | | | | | | | | Add hysteresis to pid controllers to lower pwm changes. It is defaulted to 0 so it should be transparent to any controller that choses not to implement it. This is the same pattern used by the stepwise controller. Tested-by: Unit tests passed Change-Id: Ib47114285b0017258b7f77eaf067d310f95a0c60 Signed-off-by: James Feist <james.feist@linux.intel.com>
* [dbus-configuration] Back out divide by 100James Feist2019-02-041-0/+6
| | | | | | | | | | In the entity-manager configuration files having a outlimitmax of 10000 is confusing as this looks like a tach reading, but is actually 100 percent * 100. Back this out when dealing with dbusconfiguration. Change-Id: I13609573fcf1c9da50afd270ea9aad0411b5768b Signed-off-by: James Feist <james.feist@linux.intel.com>
* pid: add helper methods for thermal controller typesPatrick Venture2018-11-153-12/+32
| | | | | | | | | Add helper methods for thermal controller types, such as checking if a string is a supported thermal type and which type that string corresponds to. Change-Id: I3c782f5825e7726f264dd186df583bde0a0dc861 Signed-off-by: Patrick Venture <venture@google.com>
* Allow multiple inputs to thermal and stepwise controllersJames Feist2018-11-154-16/+57
| | | | | | | | | | | | | Use std::max to determine which input value to apply. Also start throwing when inputs are empty as otherwise there will be a nullptr dereference. Tested-by: Added multiple inputs and application no longer segfaults and verifed max was being used. Also added unit tests. Change-Id: I7c8eda45b99247b8e92e629f036c9a46c98d9fe2 Signed-off-by: James Feist <james.feist@linux.intel.com>
* Move all floats to doublesPatrick Venture2018-11-1116-101/+101
| | | | | | | | | The code was developed initially around a pid loop implemented using floats. Therefore, the code was converting back and forth between double for sensor values as inputs and outputs from this PID loop. Change-Id: I2d2919e1165103040729c9f16bb84fde3dd6b81b Signed-off-by: Patrick Venture <venture@google.com>
* style: s/getMinThermalRpmSetPt/getMinThermalRPMSetpoint/gPatrick Venture2018-10-302-3/+3
| | | | | | | Rename method per openbmc style guide. Change-Id: Ia861028452020ccefd463415093b5fb11f929ea4 Signed-off-by: Patrick Venture <venture@google.com>
* zone: use const reference consistentlyPatrick Venture2018-10-302-4/+4
| | | | | | | | | In this case, the string is copied and placed into the vector's pointer list, so it's not necessary to be passed by const reference. However, for consistency it's a harmless change. Change-Id: I5c02e98b4789e18bc9a6756bdd8c5184ad12a232 Signed-off-by: Patrick Venture <venture@google.com>
* performance: fixup missing const reference in zonePatrick Venture2018-10-302-3/+3
| | | | | | | | | Zone::getSensor is passed directly to the Sensor Manager getSensor which takes the parameter by reference. Make it use an explicit const reference at both layers. Change-Id: I4895ea2935d20b73b88d33972e44b9ac557cd988 Signed-off-by: Patrick Venture <venture@google.com>
* style: use system path for dbus headersPatrick Venture2018-10-301-1/+1
| | | | | | | Use system path for dbus headers. Change-Id: I08088eb0932de738fc410104c28847aaf78d95bd Signed-off-by: Patrick Venture <venture@google.com>
* style: s/getZoneId/getZoneID/gPatrick Venture2018-10-303-3/+3
| | | | | | | | Acronyms are meant to be in the same case within their part of the camel case name. Change-Id: I9e55d4419617a35b0f3a85f3d55543c8fc9bd76f Signed-off-by: Patrick Venture <venture@google.com>
* pid: add missing override specifiersPatrick Venture2018-10-301-4/+4
| | | | | | | | | | | | | | | | | | [pid/controller.hpp:18] -> [pid/pidcontroller.hpp:28]: (style) The function 'inputProc' overrides a function in a base class but is not marked with a 'override' specifier. [pid/controller.hpp:20] -> [pid/pidcontroller.hpp:30]: (style) The function 'outputProc' overrides a function in a base class but is not marked with a 'override' specifier. [pid/controller.hpp:22] -> [pid/pidcontroller.hpp:32]: (style) The function 'process' overrides a function in a base class but is not marked with a 'override' specifier. [pid/controller.hpp:24] -> [pid/pidcontroller.hpp:34]: (style) The function 'getID' overrides a function in a base class but is not marked with a 'override' specifier. Change-Id: I29a6bbe644a5f7aad933eb49e7b6f7fdc6e33f19 Signed-off-by: Patrick Venture <venture@google.com>
* pid: stepwisecontroller: add missing overridePatrick Venture2018-10-301-1/+1
| | | | | | | | | [pid/controller.hpp:24] -> [pid/stepwisecontroller.hpp:35]: (style) The function 'getID' overrides a function in a base class but is not marked with a 'override' specifier. Change-Id: I27f0853e24f6b25aa50f701ce5fad1ea989b618c Signed-off-by: Patrick Venture <venture@google.com>
* style: function names should be lower camelPatrick Venture2018-10-3010-18/+18
| | | | | | | Fix function names to be lower camel. Change-Id: I145e1f4c03d7740bc1525dcffbdce2f78fd61075 Signed-off-by: Patrick Venture <venture@google.com>
* style: member functions should be lower camelPatrick Venture2018-10-3013-59/+59
| | | | | | | Rename member functions to be lower camel instead of snake case. Change-Id: Ib227fd3dadb6d9607290277205223a4324cd4ce5 Signed-off-by: Patrick Venture <venture@google.com>
* style: fixup naming of structuresPatrick Venture2018-10-303-8/+8
| | | | | | | Fixup naming of structures to UpperCamel. Change-Id: I6a9bf0b954298089c85d3362e86cd95b3fc5b944 Signed-off-by: Patrick Venture <venture@google.com>
* cleanup: move from copy and pointer to just const referencePatrick Venture2018-10-236-19/+20
| | | | | | | | | Originally code passed the object by value, and then later by pointer to that copy. Convert the code to be more performant by using a const reference at all layers of access for this object. Change-Id: Icdf0dfdb54d8adc29af4d05d841533626a484921 Signed-off-by: Patrick Venture <venture@google.com>
* cleanup: rename variable per openbmc stylePatrick Venture2018-10-231-2/+2
| | | | | | | Rename PIDConfig to pidConfig per OpenBMC style guide. Change-Id: I41c431b7162af6c49f4a43adb548f0b6ed04e3dc Signed-off-by: Patrick Venture <venture@google.com>
* cleanup: apply constness to read-only iteratorsPatrick Venture2018-10-236-23/+25
| | | | | | | Apply const to read-only iterators to indicate intent more clearly. Change-Id: Ic14304c69361da203d3d3a900180bd54346acc87 Signed-off-by: Patrick Venture <venture@google.com>
* [dbus-passive] Add threshold fan failureJames Feist2018-10-151-1/+5
| | | | | | | | | | | | | | When a threshold is crossed for a monitored sensor, assert fan failure. Tested-by: Changed a sensor threshold so that its current reading made the threshold asserted and noticed via print messages that the sensor went into failure state. Also noticed fans ramp. Wrote unit test to verify sensor can move in and out of error state correctly. Change-Id: I83182536e4874eaba97f3f1d48d53ac110fba833 Signed-off-by: James Feist <james.feist@linux.intel.com>
* cleanup: reduce scope of variablesPatrick Venture2018-10-133-11/+6
| | | | | | | Various things caught by cppcheck that are non-critical. Change-Id: I495453c84bc15788b85036a163ee36b0ac601fa1 Signed-off-by: Patrick Venture <venture@google.com>
* Add hysteresis to stepwise controllerJames Feist2018-09-214-3/+29
| | | | | | | | Tested-by: Ran on platform monitoring output and wrote unit test Change-Id: I74a1d21544c1a9cb4c1cb26dd4a353cbff0442d0 Signed-off-by: James Feist <james.feist@linux.intel.com>
* Add stepwise controllerJames Feist2018-09-1214-74/+326
| | | | | | | | | | | | | | | This adds the ability to use stepwise curves alongside pid control. This creates a base controller class that pidcontroller and stepwise controller inherit from. Note: Hysteresis to come in follow-on patch Tested-by: Created a stepwise controller and noticed that when it crossed a threshold that it contributed to the pwm setting. Change-Id: I6cf842f80eaccafc905d620970afe91e2092d568 Signed-off-by: James Feist <james.feist@linux.intel.com>
* add .clang-formatPatrick Venture2018-08-3117-341/+294
| | | | | Change-Id: I6627b5569c2e0f730be7331403218b823a2c622f Signed-off-by: Patrick Venture <venture@google.com>
* test: pid: fancontrollerPatrick Venture2018-06-223-0/+12
| | | | | | | | | Adds unit-tests for the fancontroller. Bugfix: set point not initialized to 0, although bug has no impact. Tested: Ran on quanta-q71l board and it behaved as expected. Change-Id: I516833d8c9ed806b765ff9333801f3d57932a17b Signed-off-by: Patrick Venture <venture@google.com>
* test: pid: thermalcontrollerPatrick Venture2018-06-221-0/+6
| | | | | | | | | | | | Tests for the pid/thermalcontroller module. Fixes a bug where one could pass an incorrect number of inputs to the thermalcontroller. This can still be side-stepped by calling the constructor directly. Tested: Ran on quanta-q71l board and it behaved as expected. Change-Id: I3153ae4d907d9f90787b03e9d013d4349d911948 Signed-off-by: Patrick Venture <venture@google.com>
OpenPOWER on IntegriCloud