| #ifndef THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_THERMAL_CONTROLLER_H_ |
| #define THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_THERMAL_CONTROLLER_H_ |
| |
| #include <string> |
| #include <vector> |
| |
| #include "absl/strings/string_view.h" |
| |
| namespace milotic_tlbmc { |
| namespace thermal { |
| |
| /* |
| * `ThermalController` is the base class for all thermal controllers. |
| * It is responsible for processing the input, the thermal algorithm, and the |
| * output of the thermal loop. |
| * |
| * This class is created based on: |
| * https://source.corp.google.com/piper///depot/google3/third_party/openbmc_phosphor_pid_control/pid/controller.hpp |
| */ |
| class ThermalController { |
| public: |
| virtual ~ThermalController() = default; |
| |
| /* |
| * `ProcessThermalLoop` is the main end-point function for the zone manager to |
| * perform a thermal loop to update the fan speed with all the sensor |
| * readings. It will be called once for each thermal controller in every |
| * thermal control iteration managed by the zone manager. |
| */ |
| virtual void ProcessThermalLoop() = 0; |
| |
| /* |
| * `ProcessInput` is the function to pre-process the input sensor readings for |
| * the thermal controller before feeding the input into the thermal algorithm. |
| * |
| * Returns: |
| * The processed input value for the thermal controller. |
| */ |
| virtual double ProcessInput() = 0; |
| |
| /* |
| * `ProcessOutput` is the function to update the output value of the thermal |
| * loop into its owner zone manager. |
| * |
| * Parameters: |
| * output: The output value from the thermal loop. |
| */ |
| virtual void ProcessOutput(double output) = 0; |
| |
| virtual std::string GetId() const = 0; |
| virtual bool IsFanController() const = 0; |
| // `IsSupportiveController` returns true if the controller is a supportive |
| // controller, which means the controller's setpoint will contribute to the |
| // output from another controller, before being used to calculate the final |
| // setpoint. |
| virtual bool IsSupportiveController() const = 0; |
| virtual const std::vector<std::string>& GetAffectedControllerIds() const = 0; |
| virtual void AdjustSetpoint(double offset) = 0; |
| |
| private: |
| const std::string id_; |
| }; |
| |
| } // namespace thermal |
| } // namespace milotic_tlbmc |
| |
| #endif // THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_THERMAL_CONTROLLER_H_ |