Improve base VE and Timing maps #5521

This commit is contained in:
rusefillc 2024-03-06 01:50:02 -05:00 committed by Andrey
parent 5345069862
commit 534d619470
2 changed files with 30 additions and 2 deletions

View File

@ -52,6 +52,7 @@ float getInitialAdvance(int rpm, float map, float advanceMax) {
/**
* this method builds a good-enough base timing advance map bases on a number of heuristics
*/
#if (IGN_LOAD_COUNT != DEFAULT_IGN_LOAD_COUNT) || (IGN_RPM_COUNT != DEFAULT_IGN_RPM_COUNT)
static void buildTimingMap(float advanceMax) {
if (engineConfiguration->fuelAlgorithm != LM_SPEED_DENSITY) {
warning(ObdCode::CUSTOM_WRONG_ALGORITHM, "wrong algorithm for MAP-based timing");
@ -68,6 +69,33 @@ static void buildTimingMap(float advanceMax) {
}
}
}
#endif
static void cannedignitionTable() {
#if (IGN_LOAD_COUNT == DEFAULT_IGN_LOAD_COUNT) && (IGN_RPM_COUNT == DEFAULT_IGN_RPM_COUNT)
static const float hardCodedignitionTable[16][16] = {
{12.100, 15.300, 15.000, 17.200, 20.000, 27.000, 30.000, 35.000, 35.000, 35.000, 35.000, 35.000, 35.000, 35.000, 35.000, 35.000, },
{11.800, 14.900, 15.000, 17.200, 20.000, 27.000, 30.000, 35.000, 35.000, 35.000, 35.000, 35.000, 35.000, 35.000, 35.000, 35.000, },
{11.600, 14.600, 15.000, 17.200, 20.000, 27.000, 30.000, 35.000, 35.000, 35.000, 35.000, 35.000, 35.000, 35.000, 35.000, 35.000, },
{10.500, 13.100, 15.200, 17.300, 20.000, 21.000, 30.000, 35.000, 35.000, 35.000, 35.000, 35.000, 35.000, 35.000, 35.000, 35.000, },
{11.500, 14.100, 16.200, 18.300, 21.000, 22.000, 27.000, 29.900, 30.200, 30.500, 30.800, 31.100, 31.400, 31.700, 31.900, 32.000, },
{12.500, 15.100, 17.200, 19.300, 22.000, 23.000, 24.000, 24.700, 25.400, 26.000, 26.600, 27.200, 27.700, 28.300, 28.700, 29.000, },
{11.500, 14.100, 16.200, 18.300, 21.000, 22.000, 23.000, 23.700, 24.400, 25.000, 25.600, 26.200, 26.700, 27.300, 27.700, 28.000, },
{10.500, 13.100, 15.200, 17.300, 20.000, 21.000, 22.000, 22.700, 23.400, 24.000, 24.600, 25.200, 25.400, 26.300, 26.700, 27.000, },
{8.400, 11.000, 13.100, 15.200, 17.900, 18.900, 19.900, 20.600, 21.300, 21.900, 22.500, 23.100, 23.600, 24.200, 24.600, 24.900, },
{6.300, 8.900, 11.000, 13.100, 15.800, 16.800, 17.800, 18.500, 19.200, 19.800, 20.400, 21.000, 21.500, 22.100, 22.500, 22.800, },
{4.100, 6.700, 8.800, 10.900, 13.600, 14.600, 15.600, 16.300, 17.000, 17.600, 18.200, 18.800, 19.300, 19.900, 20.300, 20.600, },
{2.000, 4.600, 6.700, 8.800, 11.500, 12.500, 13.500, 14.200, 14.900, 15.500, 16.100, 16.700, 17.200, 17.800, 18.200, 18.500, },
{-0.100, 2.500, 4.600, 6.700, 9.400, 10.400, 11.400, 12.100, 12.800, 13.400, 14.000, 14.600, 15.100, 15.700, 16.100, 16.400, },
{-2.200, 0.400, 2.500, 4.600, 7.300, 8.300, 9.300, 10.000, 10.700, 11.300, 11.900, 12.500, 13.000, 13.600, 14.000, 14.300, },
{-4.400, -1.800, 0.300, 2.400, 5.100, 6.100, 7.100, 7.800, 8.500, 9.100, 9.700, 10.300, 10.800, 11.400, 11.800, 12.100, },
{-6.500, -3.900, -1.800, 0.300, 3.000, 4.000, 5.000, 5.700, 6.400, 7.000, 7.600, 8.200, 8.700, 9.300, 9.700, 10.000, },
};
copyTable(config->ignitionTable, hardCodedignitionTable);
#else
buildTimingMap(35);
#endif
}
void setDefaultIgnition() {
// Ignition base settings
@ -91,7 +119,7 @@ void setDefaultIgnition() {
// Ignition advance table
setLinearCurve(config->ignitionLoadBins, 20, 120, 3);
setTimingRpmBin(800, 7000);
buildTimingMap(35);
cannedignitionTable();
engineConfiguration->trailingSparkAngle = 10;

View File

@ -57,7 +57,7 @@ static void test(int engineSyncCam, float camOffsetAdd) {
// On Nissan VQ, all cams have the same pattern, so all should be equally good for engine sync. Check them all!
TEST(realCrankingVQ40, normalCrankingSyncCam1) {
test(0, 0);
test(1, 0);
}
TEST(realCrankingVQ40, normalCrankingSyncCam2) {