27 lines
582 B
C++
27 lines
582 B
C++
//
|
|
// Created by fly on 2022/4/6.
|
|
//
|
|
|
|
#include "temperature_drift.h"
|
|
|
|
void temperature_drift::set_config(nlohmann::json const &config) {
|
|
try {
|
|
eval_time_ = 0;
|
|
amplitude_ = jsonValue(config, "TEMPERATURE_DRIFT_AMPLITUDE");
|
|
amplitude_base_ = jsonValue(config, "TEMPERATURE_DRIFT_AMPLITUDE_BASE");
|
|
config_ = config;
|
|
} catch (...) {
|
|
|
|
}
|
|
}
|
|
|
|
nlohmann::json temperature_drift::config() {
|
|
return config_;
|
|
}
|
|
|
|
|
|
double temperature_drift::eval(double value) {
|
|
return value + amplitude_base_ + (amplitude_ * ++eval_time_);
|
|
}
|
|
|