1 #pragma once 2 3 #include "conf.hpp" 4 #include "pid/ec/pid.hpp" 5 6 #include <cstdint> 7 #include <limits> 8 #include <map> 9 #include <string> 10 #include <vector> 11 12 namespace pid_control 13 { 14 15 void tryRestartControlLoops(bool first = true); 16 17 /* 18 * Given a configuration structure, fill out the information we use within the 19 * PID loop. 20 */ 21 void initializePIDStruct(ec::pid_info_t* info, const ec::pidinfo& initial); 22 23 void dumpPIDStruct(ec::pid_info_t* info); 24 25 struct SensorThresholds 26 { 27 double lowerThreshold = std::numeric_limits<double>::quiet_NaN(); 28 double upperThreshold = std::numeric_limits<double>::quiet_NaN(); 29 }; 30 31 const std::string sensorintf = "xyz.openbmc_project.Sensor.Value"; 32 const std::string criticalThreshInf = 33 "xyz.openbmc_project.Sensor.Threshold.Critical"; 34 const std::string propertiesintf = "org.freedesktop.DBus.Properties"; 35 36 /* 37 * Given a path that optionally has a glob portion, fill it out. 38 */ 39 std::string FixupPath(std::string original); 40 41 /* 42 * Splice together two vectors, "Inputs" and "TempToMargin" from JSON, 43 * into one vector of SensorInput structures containing info from both. 44 */ 45 std::vector<conf::SensorInput> spliceInputs( 46 const std::vector<std::string>& inputNames, 47 const std::vector<double>& inputTempToMargin, 48 const std::vector<std::string>& missingAcceptableNames); 49 50 /* 51 * Recovers the original "Inputs" vector from spliceInputs(). 52 */ 53 std::vector<std::string> splitNames( 54 const std::vector<conf::SensorInput>& sensorInputs); 55 56 /* 57 * Dump active configuration. 58 */ 59 void debugPrint(const std::map<std::string, conf::SensorConfig>& sensorConfig, 60 const std::map<int64_t, conf::PIDConf>& zoneConfig, 61 const std::map<int64_t, conf::ZoneConfig>& zoneDetailsConfig); 62 63 } // namespace pid_control 64