auto-sync

This commit is contained in:
rusEfi 2015-02-16 21:04:27 -06:00
parent 6104c175f0
commit af4fdd3606
3 changed files with 26 additions and 9 deletions

View File

@ -1,6 +1,7 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Launcher 29001" type="Application" factoryName="Application">
<option name="MAIN_CLASS_NAME" value="com.irnems.Launcher" />
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<option name="MAIN_CLASS_NAME" value="com.rusefi.Launcher" />
<option name="VM_PARAMETERS" value="" />
<option name="PROGRAM_PARAMETERS" value="29001" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />

View File

@ -2,6 +2,7 @@ package com.rusefi;
import com.rusefi.waves.WaveChart;
import com.rusefi.waves.WaveReport;
import static com.rusefi.IoUtil.nextChart;
import static com.rusefi.IoUtil.sendCommand;
@ -35,24 +36,37 @@ public class AutoTest {
chart = nextChart();
double x = 100;
assertWave(true, msg, chart, WaveChart.SPARK_1, 0.194433, 0.005, x + 180, x + 540);
assertWave(true, msg, chart, WaveChart.SPARK_1, 0.194433, 0.005, WaveReport.RATIO, x + 180, x + 540);
assertWaveNull(msg, chart, WaveChart.SPARK_2);
assertWave(true, msg, chart, WaveChart.SPARK_3, 0.194433, 0.005, x, x + 360);
assertWave(true, msg, chart, WaveChart.SPARK_3, 0.194433, 0.005, WaveReport.RATIO, x, x + 360);
assertWaveNull(msg, chart, WaveChart.SPARK_4);
x = 176.856;
assertWave(true, msg, chart, WaveChart.INJECTOR_1, 0.008199999999, 0.01, 0.1, x, x + 180, x + 360, x + 540);
assertWave(true, msg, chart, WaveChart.INJECTOR_2, 0.008199999999, 0.01, 0.1, x, x + 180, x + 360, x + 540);
assertWave(true, msg, chart, WaveChart.INJECTOR_3, 0.008199999999, 0.01, 0.1, x, x + 180, x + 360, x + 540);
assertWave(true, msg, chart, WaveChart.INJECTOR_4, 0.008199999999, 0.01, 0.1, x, x + 180, x + 360, x + 540);
msg = "2003 Neon running";
IoUtil.changeRpm(2000);
chart = nextChart();
x = 120;
assertWave(true, msg, chart, WaveChart.SPARK_1, 0.13299999999999998, 0.005, x + 180, x + 540);
assertWave(true, msg, chart, WaveChart.SPARK_1, 0.13299999999999998, 0.005, WaveReport.RATIO, x + 180, x + 540);
assertWaveNull(msg, chart, WaveChart.SPARK_2);
assertWave(true, msg, chart, WaveChart.SPARK_3, 0.13299999999999998, 0.005, x, x + 360);
assertWave(true, msg, chart, WaveChart.SPARK_3, 0.13299999999999998, 0.005, WaveReport.RATIO, x, x + 360);
assertWaveNull(msg, chart, WaveChart.SPARK_4);
x = 168.12;
assertWave(true, msg, chart, WaveChart.INJECTOR_1, 0.03333333333333302, 0.01, 0.1, x + 360);
assertWave(true, msg, chart, WaveChart.INJECTOR_2, 0.03333333333333302, 0.01, 0.1, x + 180);
assertWave(true, msg, chart, WaveChart.INJECTOR_3, 0.03333333333333302, 0.01, 0.1, x + 540);
assertWave(true, msg, chart, WaveChart.INJECTOR_4, 0.03333333333333302, 0.01, 0.1, x);
}
private static void testMazdaProtege() {
sendCommand("set_engine_type 14");
WaveChart chart;
nextChart(); // a bit of extra time to change engine type
IoUtil.changeRpm(200);
String msg = "ProtegeLX cranking";
chart = nextChart();

View File

@ -24,6 +24,8 @@ public class TestingUtils {
if (isCloseEnough(fixAngle(expected), current, ratio))
return;
}
if (expectations.length == 1)
fail(msg + ": Got " + current + " while expecting " + Arrays.toString(expectations) + " ratio=" + Math.abs(1 - expectations[0] / current));
fail(msg + ": Got " + current + " while expecting " + Arrays.toString(expectations));
}
@ -48,7 +50,7 @@ public class TestingUtils {
}
static void assertWave(String msg, WaveChart chart, String key, double width, double... expectedAngles) {
assertWave(true, msg, chart, key, width, WaveReport.RATIO, expectedAngles);
assertWave(true, msg, chart, key, width, WaveReport.RATIO, WaveReport.RATIO, expectedAngles);
}
static void assertWaveFall(WaveChart chart, String key, double width, double... expectedAngles) {
@ -56,10 +58,10 @@ public class TestingUtils {
}
static void assertWaveFall(String msg, WaveChart chart, String key, double width, double... expectedAngles) {
assertWave(false, msg, chart, key, width, WaveReport.RATIO, expectedAngles);
assertWave(false, msg, chart, key, width, WaveReport.RATIO, WaveReport.RATIO, expectedAngles);
}
static void assertWave(boolean rise, String msg, WaveChart chart, String key, double width, double angleRatio, double... expectedAngles) {
static void assertWave(boolean rise, String msg, WaveChart chart, String key, double width, double angleRatio, double widthRatio, double... expectedAngles) {
RevolutionLog revolutionLog = chart.getRevolutionsLog();
if (revolutionLog.keySet().isEmpty())
throw new IllegalStateException(msg + " Empty revolutions in " + chart);
@ -73,7 +75,7 @@ public class TestingUtils {
double angleByTime = revolutionLog.getCrankAngleByTime(eventTime);
assertCloseEnough(msg + " angle for " + key + "@" + eventTime, fixAngle(angleByTime), angleRatio, expectedAngles);
assertCloseEnough(msg + "width for " + key, ud.getDutyCycle(revolutionLog), WaveReport.RATIO, width);
assertCloseEnough(msg + "width for " + key, ud.getDutyCycle(revolutionLog), widthRatio, width);
}
}