auto-sync

This commit is contained in:
rusEfi 2015-12-24 14:02:03 -05:00
parent 4e0ce4dca5
commit 22e5a3bdf0
9 changed files with 68 additions and 8 deletions

View File

@ -107,3 +107,43 @@ void prepareTimingMap(DECLARE_ENGINE_PARAMETER_F) {
iatAdvanceCorrectionMap.init(config->ignitionIatCorrTable, config->ignitionIatCorrLoadBins,
config->ignitionIatCorrRpmBins);
}
/**
* @param octane gas octane number
* @param bore in mm
*/
float getTopAdvanceForBore(chamber_style_e style, int octane, double compression, double bore) {
int octaneCorrection;
if ( octane <= 90) {
octaneCorrection = -2;
} else if (octane < 94) {
octaneCorrection = -1;
} else {
octaneCorrection = 0;
}
int compressionCorrection;
if (compression <= 9) {
compressionCorrection = 2;
} else if (compression <= 10) {
compressionCorrection = 1;
} else if (compression <= 11) {
compressionCorrection = 0;
} else {
// compression ratio above 11
compressionCorrection = -2;
}
int base;
if (style == CS_OPEN) {
base = 33;
} else if (style == CS_CLOSED) {
base = 28;
} else {
// CS_SWIRL_TUMBLE
base = 22;
}
float boreCorrection = (bore - 4 * 25.4) / 25.4 * 6;
float result = base + octaneCorrection + compressionCorrection + boreCorrection;
return ((int)(result * 10)) / 10.0;
}

View File

@ -13,5 +13,6 @@
angle_t getAdvance(int rpm, float engineLoad DECLARE_ENGINE_PARAMETER_S);
void setDefaultIatTimingCorrection(DECLARE_ENGINE_PARAMETER_F);
void prepareTimingMap(DECLARE_ENGINE_PARAMETER_F);
float getTopAdvanceForBore(chamber_style_e style, int octane, double compression, double bore);
#endif /* ADVANCE_H_ */

View File

@ -628,4 +628,13 @@ typedef enum {
Internal_ForceMyEnumIntSize_timing_mode = ENUM_32_BITS,
} timing_mode_e;
typedef enum {
CS_OPEN = 0,
CS_CLOSED = 1,
CS_SWIRL_TUMBLE = 2,
Internal_ForceMyEnumIntSize_chamber_stype = ENUM_32_BITS,
} chamber_style_e;
#endif /* RUSEFI_ENUMS_H_ */

View File

@ -275,5 +275,5 @@ int getRusEfiVersion(void) {
return 123; // this is here to make the compiler happy about the unused array
if (UNUSED_CCM_SIZE[0] * 0 != 0)
return 3211; // this is here to make the compiler happy about the unused array
return 20151218;
return 20151224;
}

View File

@ -8,7 +8,7 @@ public class IgnitionMapBuilder {
public enum ChamberStyle {
OPEN_CHAMBER(33),
CLOSED_CHAMBER(28),
SWITL_TUMBLE(22);
SWIRL_TUMBLE(22);
private final int advance;
@ -16,10 +16,6 @@ public class IgnitionMapBuilder {
ChamberStyle(int advance) {
this.advance = advance;
}
public int getAdvance() {
return advance;
}
}

View File

@ -27,7 +27,7 @@ public class IgnitionMapBuilderTest {
assertEquals(35.0, getTopAdvanceForBore(OPEN_CHAMBER, 98, 8, 101.6));
assertEquals(33.0, getTopAdvanceForBore(OPEN_CHAMBER, 98, 11, 101.6));
assertEquals(22.0, getTopAdvanceForBore(SWITL_TUMBLE, 89, 9, 101.6));
assertEquals(32.2, getTopAdvanceForBore(SWITL_TUMBLE, 89, 9, 145));
assertEquals(22.0, getTopAdvanceForBore(SWIRL_TUMBLE, 89, 9, 101.6));
assertEquals(32.2, getTopAdvanceForBore(SWIRL_TUMBLE, 89, 9, 145));
}
}

View File

@ -140,6 +140,7 @@ int main(void) {
testMenuTree();
testMafLookup();
testIgnitionMapGenerator();
testMafFuelMath();
testPidController();

View File

@ -13,6 +13,7 @@
#include "speed_density.h"
#include "engine_test_helper.h"
#include "maf.h"
#include "advance_map.h"
void testIgnitionPlanning(void) {
printf("*************************************************** testIgnitionPlanning\r\n");
@ -45,6 +46,17 @@ void testEngineMath(void) {
assertEquals(327.6667, getTCharge(4000, 100, 300, 350));
}
void testIgnitionMapGenerator(void) {
printf("*************************************************** testIgnitionMapGenerator\r\n");
assertEquals(35, getTopAdvanceForBore(CS_OPEN, 98, 8, 101.6));
assertEquals(33, getTopAdvanceForBore(CS_OPEN, 98, 11, 101.6));
assertEquals(22.0, getTopAdvanceForBore(CS_SWIRL_TUMBLE, 89, 9, 101.6));
assertEquals(32.2, getTopAdvanceForBore(CS_SWIRL_TUMBLE, 89, 9, 145));
}
void testMafLookup(void) {
printf("*************************************************** testMafLookup\r\n");

View File

@ -11,5 +11,6 @@
void testEngineMath(void);
void testIgnitionPlanning(void);
void testMafLookup(void);
void testIgnitionMapGenerator(void);
#endif /* TEST_ENGINE_MATH_H_ */