diff options
| author | James Feist <james.feist@linux.intel.com> | 2019-01-31 15:52:22 -0800 |
|---|---|---|
| committer | James Feist <james.feist@linux.intel.com> | 2019-02-05 11:30:05 -0800 |
| commit | 572c43dab62f9e207781b96e7e48b7b38ca024e5 (patch) | |
| tree | 137db460c1d23e7a620a78b8a8cf8dd86891eeb8 /dbus | |
| parent | 1738e2a2b705f64e0c823b095b504dfe397a87ab (diff) | |
| download | phosphor-pid-control-572c43dab62f9e207781b96e7e48b7b38ca024e5.tar.gz phosphor-pid-control-572c43dab62f9e207781b96e7e48b7b38ca024e5.zip | |
Add Hysteresis to pid controllers
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>
Diffstat (limited to 'dbus')
| -rw-r--r-- | dbus/dbusconfiguration.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/dbus/dbusconfiguration.cpp b/dbus/dbusconfiguration.cpp index 3121623..7d01650 100644 --- a/dbus/dbusconfiguration.cpp +++ b/dbus/dbusconfiguration.cpp @@ -428,6 +428,24 @@ void init(sdbusplus::bus::bus& bus) VariantToDoubleVisitor(), base.at("SlewNeg")); info.pidInfo.slew_pos = variant_ns::visit( VariantToDoubleVisitor(), base.at("SlewPos")); + double negativeHysteresis = 0; + double positiveHysteresis = 0; + + auto findNeg = base.find("NegativeHysteresis"); + auto findPos = base.find("PositiveHysteresis"); + if (findNeg != base.end()) + { + negativeHysteresis = variant_ns::visit( + VariantToDoubleVisitor(), findNeg->second); + } + + if (findPos != base.end()) + { + positiveHysteresis = variant_ns::visit( + VariantToDoubleVisitor(), findPos->second); + } + info.pidInfo.negativeHysteresis = negativeHysteresis; + info.pidInfo.positiveHysteresis = positiveHysteresis; } } auto findStepwise = |

