mirror of
https://github.com/mck1117/wideband.git
synced 2026-11-09 22:06:31 -05:00
lambda conversion
This commit is contained in:
19
firmware/lambda_conversion.cpp
Normal file
19
firmware/lambda_conversion.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#include "sampling.h"
|
||||
|
||||
static float GetPhi(float pumpCurrent)
|
||||
{
|
||||
// This estimation is accurate within 0.5% from 0.8 to 1.0, and 0.01% from 1 to 1.2 lambda when compared to the lookup table in the Bosch datasheet
|
||||
float gain = pumpCurrent > 0 ? -0.28299f : -0.44817f;
|
||||
|
||||
return gain * pumpCurrent + 0.99559f;
|
||||
}
|
||||
|
||||
float GetLambda()
|
||||
{
|
||||
float pumpCurrent = GetPumpNominalCurrent();
|
||||
|
||||
// Lambda is reciprocal of phi
|
||||
return 1 / GetPhi(pumpCurrent);
|
||||
}
|
||||
Reference in New Issue
Block a user