Add exit air temp sensor
Exit air temperature is calculated based on system
power and CFM. CFM sensor will be broken out into own
sensor in follow on commit.
Change-Id: I01b68c4de9a17e5a8d623bbbd7e7089f8f9d15d5
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/include/ExitAirTempSensor.hpp b/include/ExitAirTempSensor.hpp
new file mode 100644
index 0000000..44c736c
--- /dev/null
+++ b/include/ExitAirTempSensor.hpp
@@ -0,0 +1,53 @@
+#pragma once
+#include "sensor.hpp"
+
+#include <boost/container/flat_map.hpp>
+#include <chrono>
+#include <limits>
+#include <vector>
+
+struct CFMInfo
+{
+ std::vector<std::string> pwm;
+ int32_t c1;
+ int32_t c2;
+ int32_t maxCFM;
+ double pwmMin;
+ double pwmMax;
+};
+
+struct ExitAirTempSensor : public Sensor
+{
+ boost::container::flat_map<std::string, double> pwmReadings;
+ boost::container::flat_map<std::string, double> powerReadings;
+ std::vector<sdbusplus::bus::match::match> matches;
+
+ double inletTemp = std::numeric_limits<double>::quiet_NaN();
+
+ double powerFactorMin;
+ double powerFactorMax;
+ double qMin;
+ double qMax;
+ double alphaS;
+ double alphaF;
+ double pOffset = 0;
+
+ std::vector<CFMInfo> cfmData;
+ ExitAirTempSensor(std::shared_ptr<sdbusplus::asio::connection> &conn,
+ const std::string &sensorConfiguration,
+ sdbusplus::asio::object_server &objectServer,
+ std::vector<thresholds::Threshold> &&thresholds);
+ ~ExitAirTempSensor();
+
+ void checkThresholds(void) override;
+ void updateReading(void);
+
+ private:
+ double lastReading;
+
+ std::shared_ptr<sdbusplus::asio::connection> dbusConnection;
+ std::chrono::time_point<std::chrono::system_clock> lastTime;
+ int32_t getTotalCFM(void);
+ bool calculate(double &val);
+ void setupMatches(void);
+};
\ No newline at end of file
diff --git a/include/Utils.hpp b/include/Utils.hpp
index 8d9eac5..fd4dde2 100644
--- a/include/Utils.hpp
+++ b/include/Utils.hpp
@@ -12,8 +12,9 @@
const std::regex illegalDbusRegex("[^A-Za-z0-9_]");
using BasicVariantType =
- sdbusplus::message::variant<std::string, int64_t, uint64_t, double, int32_t,
- uint32_t, int16_t, uint16_t, uint8_t, bool>;
+ sdbusplus::message::variant<std::vector<std::string>, std::string, int64_t,
+ uint64_t, double, int32_t, uint32_t, int16_t,
+ uint16_t, uint8_t, bool>;
using ManagedObjectType = boost::container::flat_map<
sdbusplus::message::object_path,