mirror of https://github.com/rusefi/wideband.git
test sampler AC
This commit is contained in:
parent
1897917dd7
commit
1d7c2284e8
|
@ -14,7 +14,7 @@ int GetESRSupplyR()
|
||||||
return 22000;
|
return 22000;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Sampler, TestDcBehavior)
|
TEST(Sampler, TestDc)
|
||||||
{
|
{
|
||||||
Sampler dut;
|
Sampler dut;
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ TEST(Sampler, TestDcBehavior)
|
||||||
data.PumpCurrentVoltage = 1.75f;
|
data.PumpCurrentVoltage = 1.75f;
|
||||||
constexpr float virtualGroundVoltage = 1.65f;
|
constexpr float virtualGroundVoltage = 1.65f;
|
||||||
|
|
||||||
for (size_t i = 0; i < 10; i++)
|
for (size_t i = 0; i < 5000; i++)
|
||||||
{
|
{
|
||||||
dut.ApplySample(data, virtualGroundVoltage);
|
dut.ApplySample(data, virtualGroundVoltage);
|
||||||
}
|
}
|
||||||
|
@ -31,5 +31,31 @@ TEST(Sampler, TestDcBehavior)
|
||||||
// not exactly 0 because of filtering
|
// not exactly 0 because of filtering
|
||||||
EXPECT_NEAR(0, dut.GetNernstAc(), 1e-3);
|
EXPECT_NEAR(0, dut.GetNernstAc(), 1e-3);
|
||||||
EXPECT_FLOAT_EQ(0.45f, dut.GetNernstDc());
|
EXPECT_FLOAT_EQ(0.45f, dut.GetNernstDc());
|
||||||
EXPECT_NEAR(-0.0295, dut.GetPumpNominalCurrent(), 1e-3);
|
EXPECT_NEAR(-0.1616, dut.GetPumpNominalCurrent(), 1e-3);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(Sampler, TestAc)
|
||||||
|
{
|
||||||
|
Sampler dut;
|
||||||
|
|
||||||
|
AnalogChannelResult dataLow;
|
||||||
|
dataLow.NernstVoltage = 0.45f - 0.1f;
|
||||||
|
dataLow.PumpCurrentVoltage = 1.75f;
|
||||||
|
|
||||||
|
AnalogChannelResult dataHigh;
|
||||||
|
dataHigh.NernstVoltage = 0.45f + 0.1f;
|
||||||
|
dataHigh.PumpCurrentVoltage = 1.75f;
|
||||||
|
|
||||||
|
constexpr float virtualGroundVoltage = 1.65f;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < 5000; i++)
|
||||||
|
{
|
||||||
|
dut.ApplySample(dataLow, virtualGroundVoltage);
|
||||||
|
dut.ApplySample(dataHigh, virtualGroundVoltage);
|
||||||
|
}
|
||||||
|
|
||||||
|
// not exactly 0 because of filtering
|
||||||
|
EXPECT_NEAR(0.2, dut.GetNernstAc(), 1e-3);
|
||||||
|
EXPECT_FLOAT_EQ(0.45f, dut.GetNernstDc());
|
||||||
|
EXPECT_NEAR(-0.1616, dut.GetPumpNominalCurrent(), 1e-3);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue