mirror of https://github.com/rusefi/rusefi-1.git
ETB is sticky around zero and does not want to close all the way #943
This commit is contained in:
parent
344919a60b
commit
15ade5ca9e
|
@ -48,7 +48,7 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
|
|||
* @see EngineSnifferPanel
|
||||
*/
|
||||
public class Launcher {
|
||||
public static final int CONSOLE_VERSION = 20190919;
|
||||
public static final int CONSOLE_VERSION = 20190922;
|
||||
public static final String INI_FILE_PATH = System.getProperty("ini_file_path", "..");
|
||||
public static final String INPUT_FILES_PATH = System.getProperty("input_files_path", "..");
|
||||
public static final String TOOLS_PATH = System.getProperty("tools_path", ".");
|
||||
|
|
|
@ -47,6 +47,7 @@ public class EtbCommandsPanel {
|
|||
content.add(testParameters);
|
||||
content.add(spotsPane);
|
||||
content.add(UiUtils.wrap(new EtbMonteCarloSequence().getButton()));
|
||||
content.add(UiUtils.wrap(new EtbReturnToNeutral().getContent()));
|
||||
|
||||
content.add(AnyCommand.createArea(new Node(), CMD_ETB_DUTY + " " + "10", false, false).getContent());
|
||||
|
||||
|
|
|
@ -9,8 +9,6 @@ import com.rusefi.etb.TestSequenceStep;
|
|||
import com.rusefi.io.CommandQueue;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import static com.romraider.util.ThreadUtil.sleep;
|
||||
|
@ -30,7 +28,6 @@ public class EtbMonteCarloSequence {
|
|||
private static final double DEFAULT_POSITION = 7;
|
||||
private static final int CLT_THRESHOLD = 75;
|
||||
private final JButton button = new JButton("ETB I feel lucky!");
|
||||
private final static Random r = new Random();
|
||||
private int counter;
|
||||
|
||||
private double bestResultSoFar = 750;
|
||||
|
|
|
@ -17,7 +17,11 @@ import static com.rusefi.config.generated.Fields.CMD_ETB_DUTY;
|
|||
*/
|
||||
public class EtbReturnToNeutral {
|
||||
private static final int ZERO_POSITION = 0;
|
||||
private static final int NEUTRAL_POSITION = 3;
|
||||
private static final int NEUTRAL_POSITION = 7;
|
||||
private static final int ACCEPTABLE_ERROR = 1;
|
||||
private static final int CYCLES_COUNT = 10;
|
||||
private static final String ZERO_DUTY_CYCLE_COMMAND = CMD_ETB_DUTY + " " + 0;
|
||||
|
||||
private JButton button = new JButton("ETB Spring Test");
|
||||
|
||||
private final static float SHUT_CLOSED = -30;
|
||||
|
@ -46,34 +50,44 @@ public class EtbReturnToNeutral {
|
|||
|
||||
private void testSequence() throws InterruptedException {
|
||||
|
||||
CommandQueue.getInstance().write(CMD_ETB_DUTY + " " + 0);
|
||||
CommandQueue.getInstance().write(ZERO_DUTY_CYCLE_COMMAND);
|
||||
// longer pause in the beginning just in case
|
||||
Thread.sleep(2 * SECOND);
|
||||
assertPosition("First neutral position expected", NEUTRAL_POSITION);
|
||||
assertPosition("First neutral position expected.", NEUTRAL_POSITION);
|
||||
|
||||
int errorCount = 0;
|
||||
|
||||
for (int i = 1; i <= 10; i++) {
|
||||
CommandQueue.getInstance().write(CMD_ETB_DUTY + " " + 0);
|
||||
Thread.sleep(1 * SECOND);
|
||||
for (int i = 1; i <= CYCLES_COUNT; i++) {
|
||||
CommandQueue.getInstance().write(ZERO_DUTY_CYCLE_COMMAND);
|
||||
Thread.sleep(SECOND);
|
||||
|
||||
assertPosition(i + ": Neutral position expected", NEUTRAL_POSITION);
|
||||
boolean isError = assertPosition(i + ": Neutral position expected.", NEUTRAL_POSITION);
|
||||
if (isError)
|
||||
errorCount++;
|
||||
|
||||
|
||||
CommandQueue.getInstance().write(CMD_ETB_DUTY + " " + SHUT_CLOSED);
|
||||
Thread.sleep(SECOND);
|
||||
assertPosition(i + ": Should be shot closed", 0);
|
||||
isError = assertPosition(i + ": Should be shot closed", 0);
|
||||
if (isError)
|
||||
errorCount++;
|
||||
}
|
||||
|
||||
|
||||
CommandQueue.getInstance().write(DirectDrivePanel.CANCEL_DIRECT_DRIVE_COMMAND);
|
||||
|
||||
CommandQueue.getInstance().write(ZERO_DUTY_CYCLE_COMMAND);
|
||||
// CommandQueue.getInstance().write(DirectDrivePanel.CANCEL_DIRECT_DRIVE_COMMAND);
|
||||
MessagesCentral.getInstance().postMessage(getClass(), "Cycles = " + CYCLES_COUNT + ", errors = " + errorCount);
|
||||
}
|
||||
|
||||
private void assertPosition(String msg, float expectedPosition) {
|
||||
/**
|
||||
* @return true in case of error: TPS is too far from expected position
|
||||
*/
|
||||
private boolean assertPosition(String msg, float expectedPosition) {
|
||||
double tps = SensorCentral.getInstance().getValue(Sensor.TPS);
|
||||
MessagesCentral.getInstance().postMessage(getClass(), msg + tps);
|
||||
if (Math.abs(tps - expectedPosition) > 1)
|
||||
MessagesCentral.getInstance().postMessage(getClass(), msg + " NOT GREAT " + tps + " while expected " + expectedPosition);
|
||||
MessagesCentral.getInstance().postMessage(getClass(), msg + " TPS=" + tps);
|
||||
boolean isError = Math.abs(tps - expectedPosition) > ACCEPTABLE_ERROR;
|
||||
if (isError)
|
||||
MessagesCentral.getInstance().postMessage(getClass(), msg + " NOT GREAT " + tps + " while expected " + expectedPosition);
|
||||
return isError;
|
||||
}
|
||||
|
||||
public JComponent getContent() {
|
||||
|
|
Loading…
Reference in New Issue