clean-up
This commit is contained in:
parent
4b8ef855d9
commit
16756c86d6
|
@ -9,20 +9,21 @@ import com.rusefi.config.Fields;
|
||||||
* 2/23/2016.
|
* 2/23/2016.
|
||||||
*/
|
*/
|
||||||
public class AfrDataPoint {
|
public class AfrDataPoint {
|
||||||
public final double AFR;
|
private final double afr;
|
||||||
private final int rpm;
|
private final int rpm;
|
||||||
private final double engineLoad;
|
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.rpm = rpm;
|
||||||
this.engineLoad = engineLoad;
|
this.engineLoad = engineLoad;
|
||||||
if (rpmIndex < 0 || rpmIndex >= Fields.FUEL_RPM_COUNT)
|
if (rpmIndex < 0 || rpmIndex >= Fields.FUEL_RPM_COUNT)
|
||||||
throw new IllegalStateException("rpmIndex " + rpmIndex);
|
throw new IllegalStateException("rpmIndex " + rpmIndex);
|
||||||
if (engineLoadIndex < 0 || engineLoadIndex >= Fields.FUEL_LOAD_COUNT)
|
if (engineLoadIndex < 0 || engineLoadIndex >= Fields.FUEL_LOAD_COUNT)
|
||||||
throw new IllegalStateException("engineLoadIndex " + engineLoadIndex);
|
throw new IllegalStateException("engineLoadIndex " + engineLoadIndex);
|
||||||
this.AFR = AFR;
|
this.afr = afr;
|
||||||
this.rpmIndex = rpmIndex;
|
this.rpmIndex = rpmIndex;
|
||||||
this.engineLoadIndex = engineLoadIndex;
|
this.engineLoadIndex = engineLoadIndex;
|
||||||
}
|
}
|
||||||
|
@ -51,6 +52,10 @@ public class AfrDataPoint {
|
||||||
return getRpmIndex();
|
return getRpmIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getAfr() {
|
||||||
|
return afr;
|
||||||
|
}
|
||||||
|
|
||||||
public int getRpm() {
|
public int getRpm() {
|
||||||
return rpm;
|
return rpm;
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,7 +150,7 @@ public enum FuelAutoTune implements FuelAutoLogic {
|
||||||
double tpsCorrRes = 1; //ktgbcRES[dataPoint.THR_RT_16][dataPoint.RPM_RT_32()];
|
double tpsCorrRes = 1; //ktgbcRES[dataPoint.THR_RT_16][dataPoint.RPM_RT_32()];
|
||||||
|
|
||||||
double ALF = targetAFR / 14.7;
|
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));
|
(kgbcINIT[dataPoint.PRESS_RT_32()][dataPoint.RPM_RT_32()] * tpsCorrInit * corrInit));
|
||||||
|
|
||||||
// if (isLogEnabled())
|
// if (isLogEnabled())
|
||||||
|
|
|
@ -31,7 +31,7 @@ public enum FuelAutoTune2 implements FuelAutoLogic {
|
||||||
return null;
|
return null;
|
||||||
// end
|
// end
|
||||||
AfrDataPoint s = dataECU.iterator().next();
|
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
|
for (int r = 0; r < SIZE; r++) { //rpmIndex
|
||||||
|
|
|
@ -22,7 +22,7 @@ public class FuelAutoTune2Test {
|
||||||
dataPoints.add(AfrDataPoint.valueOf(13, 1200, 80));
|
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));
|
Result r = FuelAutoTune2.INSTANCE.process(false, dataPoints, 0.1, 13, createVeTable(1));
|
||||||
FuelAutoTuneTest.printNotDefault(r.getKgbcRES(), 1);
|
FuelAutoTuneTest.printNotDefault(r.getKgbcRES(), 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -218,9 +218,9 @@ public class FuelTunePane {
|
||||||
return;
|
return;
|
||||||
try {
|
try {
|
||||||
dos.writeBytes("Running with " + data.size() + " points\r\n");
|
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)
|
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) {
|
} catch (IOException e) {
|
||||||
FileLog.MAIN.logLine("Error writing auto-tune log");
|
FileLog.MAIN.logLine("Error writing auto-tune log");
|
||||||
|
|
Loading…
Reference in New Issue