This commit is contained in:
rusefi 2018-09-02 19:26:35 -04:00
parent 4b8ef855d9
commit 16756c86d6
5 changed files with 15 additions and 10 deletions

View File

@ -9,20 +9,21 @@ import com.rusefi.config.Fields;
* 2/23/2016.
*/
public class AfrDataPoint {
public final double AFR;
private final double afr;
private final int rpm;
private final double engineLoad;
int rpmIndex;
int engineLoadIndex;
public AfrDataPoint(double AFR, int rpmIndex, int engineLoadIndex, int rpm, double engineLoad) {
private final int rpmIndex;
private final int engineLoadIndex;
public AfrDataPoint(double afr, int rpmIndex, int engineLoadIndex, int rpm, double engineLoad) {
this.rpm = rpm;
this.engineLoad = engineLoad;
if (rpmIndex < 0 || rpmIndex >= Fields.FUEL_RPM_COUNT)
throw new IllegalStateException("rpmIndex " + rpmIndex);
if (engineLoadIndex < 0 || engineLoadIndex >= Fields.FUEL_LOAD_COUNT)
throw new IllegalStateException("engineLoadIndex " + engineLoadIndex);
this.AFR = AFR;
this.afr = afr;
this.rpmIndex = rpmIndex;
this.engineLoadIndex = engineLoadIndex;
}
@ -51,6 +52,10 @@ public class AfrDataPoint {
return getRpmIndex();
}
public double getAfr() {
return afr;
}
public int getRpm() {
return rpm;
}

View File

@ -150,7 +150,7 @@ public enum FuelAutoTune implements FuelAutoLogic {
double tpsCorrRes = 1; //ktgbcRES[dataPoint.THR_RT_16][dataPoint.RPM_RT_32()];
double ALF = targetAFR / 14.7;
double tmp = (dataPoint.AFR / 14.7 - ALF * (kgbcRES[dataPoint.PRESS_RT_32()][dataPoint.RPM_RT_32()] * tpsCorrRes * corrRes) /
double tmp = (dataPoint.getAfr() / 14.7 - ALF * (kgbcRES[dataPoint.PRESS_RT_32()][dataPoint.RPM_RT_32()] * tpsCorrRes * corrRes) /
(kgbcINIT[dataPoint.PRESS_RT_32()][dataPoint.RPM_RT_32()] * tpsCorrInit * corrInit));
// if (isLogEnabled())

View File

@ -31,7 +31,7 @@ public enum FuelAutoTune2 implements FuelAutoLogic {
return null;
// end
AfrDataPoint s = dataECU.iterator().next();
double delta = (s.AFR - targetAFR) / targetAFR; // privedennoe otklonenie po toplivu
double delta = (s.getAfr() - targetAFR) / targetAFR; // privedennoe otklonenie po toplivu
for (int r = 0; r < SIZE; r++) { //rpmIndex

View File

@ -22,7 +22,7 @@ public class FuelAutoTune2Test {
dataPoints.add(AfrDataPoint.valueOf(13, 1200, 80));
{
System.out.println("Running with one datapoint already at target AFR");
System.out.println("Running with one datapoint already at target afr");
Result r = FuelAutoTune2.INSTANCE.process(false, dataPoints, 0.1, 13, createVeTable(1));
FuelAutoTuneTest.printNotDefault(r.getKgbcRES(), 1);
}

View File

@ -218,9 +218,9 @@ public class FuelTunePane {
return;
try {
dos.writeBytes("Running with " + data.size() + " points\r\n");
dos.writeBytes("AFR\tRPM\tload\r\n");
dos.writeBytes("afr\tRPM\tload\r\n");
for (AfrDataPoint point : data)
dos.writeBytes(point.AFR +"\t" + point.getRpm() + "\t" + point.getEngineLoad() + "\r\n");
dos.writeBytes(point.getAfr() +"\t" + point.getRpm() + "\t" + point.getEngineLoad() + "\r\n");
} catch (IOException e) {
FileLog.MAIN.logLine("Error writing auto-tune log");