#pragma once #include #include #include #include #include #include #include #include struct ExitAirTempSensor; struct CFMSensor : public Sensor, std::enable_shared_from_this { std::vector tachs; double c1 = 0.0; double c2 = 0.0; double maxCFM = 0.0; double tachMinPercent = 0.0; double tachMaxPercent = 0.0; std::shared_ptr parent; CFMSensor(std::shared_ptr& conn, const std::string& name, const std::string& sensorConfiguration, sdbusplus::asio::object_server& objectServer, std::vector&& thresholdData, std::shared_ptr& parent); ~CFMSensor() override; bool calculate(double& /*value*/); void updateReading(); void setupMatches(); void createMaxCFMIface(); void addTachRanges(const std::string& serviceName, const std::string& path); void checkThresholds() override; uint64_t getMaxRpm(uint64_t cfmMax) const; private: std::vector matches; boost::container::flat_map tachReadings; boost::container::flat_map> tachRanges; std::shared_ptr pwmLimitIface; std::shared_ptr cfmLimitIface; sdbusplus::asio::object_server& objServer; }; struct ExitAirTempSensor : public Sensor, std::enable_shared_from_this { double powerFactorMin = 0.0; double powerFactorMax = 0.0; double qMin = 0.0; double qMax = 0.0; double alphaS = 0.0; double alphaF = 0.0; double pOffset = 0.0; ExitAirTempSensor(std::shared_ptr& conn, const std::string& name, const std::string& sensorConfiguration, sdbusplus::asio::object_server& objectServer, std::vector&& thresholdData); ~ExitAirTempSensor() override; void checkThresholds() override; void updateReading(); void setupMatches(); private: double lastReading = 0.0; std::vector matches; double inletTemp = std::numeric_limits::quiet_NaN(); boost::container::flat_map powerReadings; sdbusplus::asio::object_server& objServer; std::chrono::time_point lastTime; static double getTotalCFM(); bool calculate(double& val); };