Added Linear ecuation on test algorithm

This commit is contained in:
miguel5612
2020-03-28 12:58:25 -05:00
parent ab77a7a4d7
commit 70fbaa9115
3 changed files with 11 additions and 4 deletions

View File

@ -112,9 +112,9 @@ float MQUnifiedsensor::validateEcuation(float ratioInput)
if(_regressionMethod == 1) _PPM= _a*pow(ratioInput, _b);
else
{
// https://jayconsystems.com/blog/understanding-a-gas-sensor
double ppm_log = (log10(_ratio)-_b)/_a; //Get ppm value in linear scale according to the the ratio value
_PPM = pow(10, ppm_log); //Convert ppm value to log scale
// https://jayconsystems.com/blog/understanding-a-gas-sensor
double ppm_log = (log10(ratioInput)-_b)/_a; //Get ppm value in linear scale according to the the ratio value
_PPM = pow(10, ppm_log); //Convert ppm value to log scale
}
//Serial.println("Regression Method: "); Serial.println(_regressionMethod);
//Serial.println("Result: "); Serial.println(_PPM);