Road Dyno(v12) added Elapsed Time and Dyno run averaging.

git-svn-id: https://svn2.assembla.com/svn/romraider/branches/dev_road_dyno@274 38686702-15cf-42e4-a595-3071df8bf5ea
This commit is contained in:
Dale Schultz 2010-03-25 21:07:28 +00:00
parent 24bc8c05b3
commit daf98c014a
7 changed files with 395 additions and 52 deletions

View File

@ -1,4 +1,4 @@
- RomRaider 0.5.3 Beta RC5-rd-v11 -
- RomRaider 0.5.3 Beta RC5-rd-v12 -
Open-Source ECU Tuning -- www.romraider.com
@ -35,16 +35,17 @@ documentation may be incomplete or out of date.
-------------------------------
- 0.5.3b-rd-v11 RC5 Notes (03/19/2010) -
- 0.5.3b-rd-v12 RC5 Notes (03/25/2010) -
-------------------------------
This is the fifth beta release of the upcoming official 0.5.3b release.
This RC includes the new Road Dyno tab, version 11.
This RC includes the new Road Dyno/ET tab, version 12.
To use the Road Dyno:
- Set the Mode button to Dyno
- Clear all parameters from the other tabs to achieve the best data
resolution.
- On the Dyno tab, select you vehicle and adjust the tire size and
- On the Dyno tab, select your vehicle and adjust the tire size and
gear you will be using.
- Once set, press the Clear & Record Data button.
- Once set, press the Record Data button.
- With the button pressed setup to do your WOT run, no need to hurry.
- Hold WOT run to redline. As soon as WOT is no longer detected the
graph will be updated with your estimated wheel power and torque.
@ -52,6 +53,23 @@ To use the Road Dyno:
"recalculate" the results.
- Smoothing, lower is more smooth and higher is less smooth.
- Right click on the graph to Save as...
- If you wish to average two or more consecutive runs, press the
Record Data button again and repeat the WOT run. At the end of
each run the datasets will be combined and the results displayed.
- A Reference Trace can be Saved and displayed at any time for comparison.
- The Clear button will delete all recorded data for a fresh start.
To use the ET feature:
- Set the Mode button to ET
- Clear all parameters from the other tabs to achieve the best data
resolution.
- On the Dyno tab, select the vehicle you will be using.
- Once set and the vehicle is stationary, SPEED = 0, press the Record ET button.
- With the button pressed complete your 1/4 mile run.
- As soon as 1/4 mile distance is covered the graph will be updated with
your elapsed times and speeds.
- Right click on the graph to Save as...
- Or Save a Reference Trace of your times to a text file.
-------------------------------
- 0.5.3b RC5 Notes (11/29/2009) -

View File

@ -44,7 +44,7 @@ public final class DynoUpdateHandler implements DataUpdateHandler {
private DynoTab dynoTab;
// 05 OBXT Cobb Stg1 May 2009, 3rd gear, 200 ft, 60F
private static final long[] logTime = {0, 250, 490, 750, 1000, 1230, 1480, 1720, 1980, 2220, 2470, 2690, 2940, 3170, 3420, 3660, 3920, 4160, 4400, 4650, 4890, 5120, 5370, 5610, 5860, 6130, 6370, 6620, 6860, 7090, 7330, 7600, 7840, 8090, 8330, 8570, 8820, 9050, 9290, 9580, 9830, 10070, 10330, 10560, 10810, 11050, 11290, 11580, 11790, 12040, 12280, 12560, 12790, 13040, 13320, 13550, 13780};
private static final long[] logTime = {1, 250, 490, 750, 1000, 1230, 1480, 1720, 1980, 2220, 2470, 2690, 2940, 3170, 3420, 3660, 3920, 4160, 4400, 4650, 4890, 5120, 5370, 5610, 5860, 6130, 6370, 6620, 6860, 7090, 7330, 7600, 7840, 8090, 8330, 8570, 8820, 9050, 9290, 9580, 9830, 10070, 10330, 10560, 10810, 11050, 11290, 11580, 11790, 12040, 12280, 12560, 12790, 13040, 13320, 13550, 13780};
private static final double[] logRpm = {1690, 1733, 1776, 1852, 1935, 2004, 2091, 2148, 2241, 2325, 2405, 2496, 2597, 2754, 2871, 2943, 3093, 3243, 3350, 3475, 3617, 3780, 3843, 4025, 4125, 4234, 4355, 4511, 4618, 4720, 4835, 4947, 5067, 5138, 5254, 5351, 5485, 5581, 5642, 5735, 5816, 5939, 6041, 6104, 6183, 6280, 6347, 6406, 6483, 6548, 6651, 6693, 6800, 6870, 6924, 6974, 7079};
private static final double[] logThrottle = {49.78, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 10};
private static final double[] logKph = {36, 37, 39, 40, 42, 43, 45, 46, 48, 50, 52, 54, 56, 59, 61, 64, 67, 70, 73, 75, 78, 81, 83, 86, 89, 92, 94, 97, 99, 102, 104, 106, 109, 111, 113, 116, 118, 120, 122, 124, 126, 128, 130, 132, 133, 135, 137, 138, 140, 141, 143, 145, 146, 148, 149, 150, 150};
@ -107,7 +107,8 @@ public final class DynoUpdateHandler implements DataUpdateHandler {
public synchronized void handleDataUpdate(Response response) {
if (dynoTab.isRecordData() && (containsData(response, RPM, TA)
|| containsData(response, VS, TA))) {
|| containsData(response, VS, TA)
|| containsData(response, VS))) {
boolean valid = true;
if (valid && containsData(response, RPM, TA) &&
@ -151,14 +152,32 @@ public final class DynoUpdateHandler implements DataUpdateHandler {
LOGGER.info("DYNO Sample: [Time]: " + now + " [RPM:calc]: " + rpm + " [TA:P13]: " + ta + " [VS:P9]: " + vs);
if (valid) addRawData(now, vs);
}
if (dynoTab.isRecordET() && containsData(response, VS)) {
if (TEST) {
if (i >= logTime.length) {
i = 0;
}
vs = logKph[i];
now = logTime[i];
i++;
}
else {
now = currentTimeMillis();
vs = findValue(response, VS);
}
valid = dynoTab.isValidET(now, vs);
LOGGER.info("DYNO Sample: [Time]: " + now + " [VS:P9]: " + vs);
if (valid) addRawData(now, vs);
}
}
else {
startNow = -999999999;
}
if (dynoTab.getEnv() && containsData(response, IAT, ATM)) {
if (TEST) {
iat = 62;
atm = 12.60;
iat = 27;
atm = 14.54;
}
else {
iat = findValue(response, IAT);
@ -167,6 +186,7 @@ public final class DynoUpdateHandler implements DataUpdateHandler {
dynoTab.updateEnv(iat, atm);
LOGGER.info("DYNO Enviornment: [IAT:P11]: " + iat + " [ATM_Pressure:P24]: " + atm);
}
}
private void addRawData(final long time, final double speed){

View File

@ -95,10 +95,19 @@ public final class DynoChartPanel extends JPanel {
addChart();
}
public void quietUpdate(boolean notify) {
data.setNotify(notify);
data1.setNotify(notify);
}
public synchronized void addRawData(double x, double y) {
logRpm.add(x, y);
}
public synchronized void addData(double x, double y) {
data.add(x, y);
}
public synchronized void addData(double x, double y1, double y2) {
data.add(x, y1);
data1.add(x, y2);
@ -236,6 +245,91 @@ public final class DynoChartPanel extends JPanel {
plot.addAnnotation(stat4);
}
public void updateEtResults(String carInfo, double[] etResults, String units) {
String s60Text = "60 ft";
String s330Text = "330 ft";
String s660Text = "1/2 track";
String s1000Text = "1,000 ft";
String s1320Text = "1/4 mile";
if (units.equalsIgnoreCase("kph")) {
s60Text = "18.3m";
s330Text = "100m";
s1000Text = "305m";
s1320Text = "402m";
}
hpAxis.setLabel("Vehicle Speed (" + units + ")");
String[] car = carInfo.split(",");
car[0] = "LANE 1: " + car[0].substring(0, car[0].length()-3) + " - ET: " + String.format("%1.3f", etResults[8]) + "\" / " + String.format("%1.2f", etResults[9]) + " " + units;
double ySpace = hpAxis.getUpperBound() / 25;
double xMin = ((plot.getDomainAxis().getUpperBound() - plot.getDomainAxis().getLowerBound()) / 7) + plot.getDomainAxis().getLowerBound();
tqAxis.setRange(hpAxis.getLowerBound(), hpAxis.getUpperBound());
final XYAnnotation s60Marker = new XYDrawableAnnotation(etResults[0], etResults[1], 10, 10, cd);
final XYTextAnnotation s60Label = new XYTextAnnotation(s60Text, etResults[0], (etResults[1]+ySpace));
s60Label.setPaint(RED);
s60Label.setTextAnchor(TextAnchor.TOP_RIGHT);
s60Label.setFont(new Font("SansSerif", Font.BOLD,10));
final XYTextAnnotation s60Time = new XYTextAnnotation(String.format("%1.3f", etResults[0]) + "\" / " + String.format("%1.2f", etResults[1]), etResults[0], (etResults[1]-ySpace));
s60Time.setPaint(RED);
s60Time.setTextAnchor(TextAnchor.BOTTOM_LEFT);
s60Time.setFont(new Font("SansSerif", Font.BOLD,10));
final XYAnnotation s330Marker = new XYDrawableAnnotation(etResults[2], etResults[3], 10, 10, cd);
final XYTextAnnotation s330Label = new XYTextAnnotation(s330Text, etResults[2], (etResults[3]+ySpace));
s330Label.setPaint(RED);
s330Label.setTextAnchor(TextAnchor.TOP_RIGHT);
s330Label.setFont(new Font("SansSerif", Font.BOLD,10));
final XYTextAnnotation s330Time = new XYTextAnnotation(String.format("%1.3f", etResults[2]) + "\" / " + String.format("%1.2f", etResults[3]), etResults[2], (etResults[3]-ySpace));
s330Time.setPaint(RED);
s330Time.setTextAnchor(TextAnchor.BOTTOM_LEFT);
s330Time.setFont(new Font("SansSerif", Font.BOLD,10));
final XYAnnotation s660Marker = new XYDrawableAnnotation(etResults[4], etResults[5], 10, 10, cd);
final XYTextAnnotation s660Label = new XYTextAnnotation(s660Text, etResults[4], (etResults[5]+ySpace));
s660Label.setPaint(RED);
s660Label.setTextAnchor(TextAnchor.TOP_RIGHT);
s660Label.setFont(new Font("SansSerif", Font.BOLD,10));
final XYTextAnnotation s660Time = new XYTextAnnotation(String.format("%1.3f", etResults[4]) + "\" / " + String.format("%1.2f", etResults[5]), etResults[4], (etResults[5]-ySpace));
s660Time.setPaint(RED);
s660Time.setTextAnchor(TextAnchor.BOTTOM_LEFT);
s660Time.setFont(new Font("SansSerif", Font.BOLD,10));
final XYAnnotation s1000Marker = new XYDrawableAnnotation(etResults[6], etResults[7], 10, 10, cd);
final XYTextAnnotation s1000Label = new XYTextAnnotation(s1000Text, etResults[6], (etResults[7]+ySpace));
s1000Label.setPaint(RED);
s1000Label.setTextAnchor(TextAnchor.TOP_RIGHT);
s1000Label.setFont(new Font("SansSerif", Font.BOLD,10));
final XYTextAnnotation s1000Time = new XYTextAnnotation(String.format("%1.3f", etResults[6]) + "\" / " + String.format("%1.2f", etResults[7]), etResults[6], (etResults[7]-ySpace));
s1000Time.setPaint(RED);
s1000Time.setTextAnchor(TextAnchor.BOTTOM_LEFT);
s1000Time.setFont(new Font("SansSerif", Font.BOLD,10));
final XYAnnotation s1320Marker = new XYDrawableAnnotation(etResults[8], etResults[9], 10, 10, cd);
final XYTextAnnotation s1320Label = new XYTextAnnotation(s1320Text, etResults[8], (etResults[9]-ySpace));
s1320Label.setPaint(RED);
s1320Label.setTextAnchor(TextAnchor.BOTTOM_CENTER);
s1320Label.setFont(new Font("SansSerif", Font.BOLD,10));
final XYTextAnnotation s1320Time = new XYTextAnnotation(String.format("%1.3f", etResults[8]) + "\" / " + String.format("%1.2f", etResults[9]), (etResults[8]-0.2), etResults[9]);
s1320Time.setPaint(RED);
s1320Time.setTextAnchor(TextAnchor.CENTER_RIGHT);
s1320Time.setFont(new Font("SansSerif", Font.BOLD,10));
final XYTextAnnotation carText = new XYTextAnnotation(car[0], xMin, (hpAxis.getUpperBound()-ySpace));
carText.setPaint(RED);
carText.setTextAnchor(TextAnchor.TOP_LEFT);
carText.setFont(new Font("SansSerif", Font.BOLD,12));
plot.addAnnotation(s60Marker);
plot.addAnnotation(s60Label);
plot.addAnnotation(s60Time);
plot.addAnnotation(s330Marker);
plot.addAnnotation(s330Label);
plot.addAnnotation(s330Time);
plot.addAnnotation(s660Marker);
plot.addAnnotation(s660Label);
plot.addAnnotation(s660Time);
plot.addAnnotation(s1000Marker);
plot.addAnnotation(s1000Label);
plot.addAnnotation(s1000Time);
plot.addAnnotation(s1320Marker);
plot.addAnnotation(s1320Label);
plot.addAnnotation(s1320Time);
plot.addAnnotation(carText);
}
public double[] getPolynomialCoefficients(XYTrendline trendSeries) {
Polyfit fit = trendSeries.getPolyFit();
return fit.getPolynomialCoefficients();
@ -296,6 +390,20 @@ public final class DynoChartPanel extends JPanel {
}
public void setET() {
clear();
plot.getDomainAxis().setLabel("Time (seconds)");
hpAxis.setLabel("Vehicle Speed");
tqAxis.setLabel(" ");
}
public void setDyno() {
clear();
plot.getDomainAxis().setLabel("Engine Speed (RPM)");
hpAxis.setLabel("Calculated Wheel Power");
tqAxis.setLabel("Calculated Engine Torque");
}
public void startPrompt() {
final double x = ((plot.getDomainAxis().getUpperBound() - plot.getDomainAxis().getLowerBound()) / 2) + plot.getDomainAxis().getLowerBound();
final double y = ((hpAxis.getUpperBound() - hpAxis.getLowerBound()) / 2) + hpAxis.getLowerBound();

View File

@ -95,6 +95,8 @@ public final class DynoControlPanel extends JPanel {
private static final String MANUAL = "manual";
private static final String IMPERIAL = "Imperial";
private static final String METRIC = "Metric";
private static final String DYNO_MODE = "Dyno";
private static final String ET_MODE = "ET";
private static final String CAR_MASS_TT ="Base mass of car from factory";
private static final String DELTA_MASS_TT ="Mass of all occupants and accessories added";
private static final String HUMIDITY_TT ="Current relative Humidity";
@ -108,6 +110,10 @@ public final class DynoControlPanel extends JPanel {
private static final String ELEVATION_TT ="Elevation is calculated from ECU ATM sensor";
private static final String AMB_TEMP_TT ="Ambient Temperature is updated from IAT sensor";
private static final String ORDER_TT ="Lower number provides more smoothing";
private static final String RESET_TT ="This clears all recorded or file loaded data";
private static final String RECORD_TT ="Press to acquire data, multiple sets of Dyno data can be acquired";
private static final String DYNO_TT ="Use this mode to estimate Power & Torque";
private static final String ET_TT ="Use this mode to measure trap times";
private static final String COLON = ":";
private static final String COMMA = ",";
private static final String TAB = "\u0009";
@ -206,12 +212,17 @@ public final class DynoControlPanel extends JPanel {
private String[] resultStrings = new String[6];
// private String hpUnits = "hp(I)";
// private String tqUnits = "lbf-ft";
private double distance = 0;
private long lastET = 0;
private double[] etResults = new double[10];
private final JComboBox orderComboBox = buildPolyOrderComboBox();
private final JComboBox carSelectBox = buildCarSelectComboBox();
private final JComboBox gearSelectBox = buildGearComboBox();
private final JButton interpolateButton = new JButton("Recalculate");
private final JToggleButton recordDataButton = new JToggleButton("Clear & Record Data");
private final JToggleButton recordDataButton = new JToggleButton("Record Data");
private final JRadioButton dButton = new JRadioButton(DYNO_MODE);
private final JRadioButton eButton = new JRadioButton(ET_MODE);
private final JRadioButton iButton = new JRadioButton(IMPERIAL);
private final JRadioButton mButton = new JRadioButton(METRIC);
private final JCheckBox loadFileCB = new JCheckBox("Load From File");
@ -351,7 +362,8 @@ public final class DynoControlPanel extends JPanel {
updateChart();
}
public void updateChart() {
private void updateChart() {
chartPanel.quietUpdate(false);
auc = 0;
aucStart = 0;
double maxHp = 0;
@ -410,6 +422,7 @@ public final class DynoControlPanel extends JPanel {
}
}
}
chartPanel.quietUpdate(true);
auc = auc / 1e6 / tToS;
results[0] = maxHp;
results[1] = maxHpRpm;
@ -446,6 +459,78 @@ public final class DynoControlPanel extends JPanel {
parent.repaint();
}
private void updateET() {
chartPanel.quietUpdate(false);
int order = 5;
double x1 = 0;
distance = 0;
lastET = 0;
double[] speedArray = Arrays.copyOf(chartPanel.getRpmCoeff(order), chartPanel.getRpmCoeff(order).length);
LOGGER.info("DYNO Speed Coeffecients: " + Arrays.toString(speedArray));
int samples = chartPanel.getSampleCount();
LOGGER.info("DYNO Sample Count: " + samples);
double timeMin = chartPanel.getTimeSample(0);
double timeMax = chartPanel.getTimeSample(samples - 1);
for (double x = timeMin; x <= timeMax; x=x+1) {
double speedSample = 0;
// Calculate smoothed SPEED from coefficients
for (int i = 0; i <= order; i++) {
int pwr = order - i;
speedSample = speedSample + (Math.pow(x,pwr) * speedArray[i]);
}
chartPanel.addData((x/1000), speedSample);
if (vsLogUnits.equals(LOG_VS_M)) speedSample = (speedSample / KPH_2_MPH);
distance = distance + (speedSample * 5280 / 3600 * (x - lastET) / 1000);
lastET = (long) x;
x1 = x / 1000;
if (distance <= 60) etResults[0] = x1;
if (distance <= 60) etResults[1] = speedSample;
if (distance <= 330) etResults[2] = x1;
if (distance <= 330) etResults[3] = speedSample;
if (distance <= 660) etResults[4] = x1;
if (distance <= 660) etResults[5] = speedSample;
if (distance <= 1000) etResults[6] = x1;
if (distance <= 1000) etResults[7] = speedSample;
if (distance <= 1320) etResults[8] = x1;
if (distance <= 1320) etResults[9] = speedSample;
}
if (vsLogUnits.equals(LOG_VS_M)) {
etResults[1] = etResults[1] * KPH_2_MPH;
etResults[3] = etResults[3] * KPH_2_MPH;
etResults[5] = etResults[5] * KPH_2_MPH;
etResults[7] = etResults[7] * KPH_2_MPH;
etResults[9] = etResults[9] * KPH_2_MPH;
}
chartPanel.quietUpdate(true);
LOGGER.info("Split 60: " + String.format("%1.3f", etResults[0]));
LOGGER.info("Split 330: " + String.format("%1.3f", etResults[2]));
LOGGER.info("Split 1/8: " + String.format("%1.3f", etResults[4]) + " @ " + String.format("%1.2f", etResults[5]));
LOGGER.info("Split 1000: " + String.format("%1.3f", etResults[6]));
LOGGER.info("Split 1/4: " + String.format("%1.3f", etResults[8]) + " @ " + String.format("%1.2f", etResults[9]));
chartPanel.updateEtResults(carInfo, etResults, vsLogUnits);
parent.repaint();
}
public boolean isValidET(long now, double vs) {
if (vs > 0.0) {
if (vsLogUnits.equals(LOG_VS_M)) vs = (vs / KPH_2_MPH);
distance = distance + (vs * 5280 / 3600 * (now - lastET) / 1000);
if (distance > 1330) {
recordDataButton.setSelected(false);
deregisterData(VEHICLE_SPEED);
chartPanel.clearPrompt();
updateET();
return false;
}
lastET = now;
return true;
}
else {
return false;
}
}
public boolean isValidData(double rpm, double ta) {
if (wotSet && (ta < 99)) {
recordDataButton.setSelected(false);
@ -493,10 +578,11 @@ public final class DynoControlPanel extends JPanel {
GridBagLayout gridBagLayout = new GridBagLayout();
panel.setLayout(gridBagLayout);
add(panel, gridBagLayout, buildFilterPanel(), 0, 0, 1, HORIZONTAL);
add(panel, gridBagLayout, buildRadioPanel(), 0, 1, 1, HORIZONTAL);
add(panel, gridBagLayout, buildInterpolatePanel(), 0, 2, 1, HORIZONTAL);
add(panel, gridBagLayout, buildReferencePanel(), 0, 3, 1, HORIZONTAL);
add(panel, gridBagLayout, buildModePanel(), 0, 0, 1, HORIZONTAL);
add(panel, gridBagLayout, buildFilterPanel(), 0, 1, 1, HORIZONTAL);
add(panel, gridBagLayout, buildRadioPanel(), 0, 2, 1, HORIZONTAL);
add(panel, gridBagLayout, buildInterpolatePanel(), 0, 3, 1, HORIZONTAL);
add(panel, gridBagLayout, buildReferencePanel(), 0, 4, 1, HORIZONTAL);
add(panel);
}
@ -518,6 +604,17 @@ public final class DynoControlPanel extends JPanel {
return panel;
}
private JPanel buildModePanel() {
JPanel panel = new JPanel();
panel.setBorder(new TitledBorder("Mode"));
GridBagLayout gridBagLayout = new GridBagLayout();
panel.setLayout(gridBagLayout);
buildModeButtons(panel);
return panel;
}
private JPanel buildInterpolatePanel() {
JPanel panel = new JPanel();
panel.setBorder(new TitledBorder("Recalculate"));
@ -580,6 +677,7 @@ public final class DynoControlPanel extends JPanel {
add(panel, gridBagLayout, carMass, 1, 28, 1, NONE);
addComponent(panel, gridBagLayout, buildRecordDataButton(), 31);
addComponent(panel, gridBagLayout, buildLoadFileCB(), 32);
addComponent(panel, gridBagLayout, buildResetButton(), 33);
// addLabeledComponent(panel, gridBagLayout, "Drag Coeff", dragCoeff, 33);
// addLabeledComponent(panel, gridBagLayout, "Frontal Area", frontalArea, 36);
// addLabeledComponent(panel, gridBagLayout, "Rolling Resist Coeff", rollCoeff, 39);
@ -605,6 +703,21 @@ public final class DynoControlPanel extends JPanel {
elevation.setToolTipText(ELEVATION_TT);
ambTemp.setToolTipText(AMB_TEMP_TT);
orderComboBox.setToolTipText(ORDER_TT);
recordDataButton.setToolTipText(RECORD_TT);
dButton.setToolTipText(DYNO_TT);
eButton.setToolTipText(ET_TT);
}
private JButton buildResetButton() {
JButton resetButton = new JButton("Clear Data");
resetButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent actionEvent) {
chartPanel.clear();
parent.repaint();
}
});
resetButton.setToolTipText(RESET_TT);
return resetButton;
}
private JToggleButton buildRecordDataButton() {
@ -612,28 +725,42 @@ public final class DynoControlPanel extends JPanel {
recordDataButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent actionEvent) {
elevation.setEnabled(true);
if (loadFileCB.isSelected()) {
loadFromFile();
if (dButton.isSelected()){
if (loadFileCB.isSelected()) {
loadFromFile();
}
else {
if (recordDataButton.isSelected()) {
chartPanel.clearGraph();
parent.repaint();
calculateEnv();
if (isManual()) {
registerData(ENGINE_SPEED, THROTTLE_ANGLE);
}
else {
registerData(VEHICLE_SPEED, THROTTLE_ANGLE);
}
chartPanel.startPrompt();
} else {
deregister();
chartPanel.clearPrompt();
}
}
}
else {
if (eButton.isSelected()){
if (recordDataButton.isSelected()) {
chartPanel.clear();
parent.repaint();
calculateEnv();
if (isManual()) {
registerData(ENGINE_SPEED, THROTTLE_ANGLE);
}
else {
registerData(VEHICLE_SPEED, THROTTLE_ANGLE);
}
registerData(VEHICLE_SPEED);
chartPanel.startPrompt();
distance = 0;
} else {
deregister();
deregisterData(VEHICLE_SPEED);
chartPanel.clearPrompt();
}
}
}
}
});
}
else {
@ -646,10 +773,10 @@ public final class DynoControlPanel extends JPanel {
loadFileCB.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent actionEvent) {
if (loadFileCB.isSelected()) {
recordDataButton.setText("Clear & Read From File");
recordDataButton.setText("Read From File");
}
else {
recordDataButton.setText("Clear & Record Data");
recordDataButton.setText("Record Data");
}
}
@ -661,6 +788,37 @@ public final class DynoControlPanel extends JPanel {
return recordDataButton.isSelected();
}
public boolean isRecordET() {
return recordDataButton.isSelected()&& eButton.isSelected();
}
private void buildModeButtons(JPanel panel) {
dButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent actionEvent) {
chartPanel.setDyno();
recordDataButton.setText("Record Data");
interpolateButton.setEnabled(true);
parent.repaint();
}
});
dButton.setSelected(true);
eButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent actionEvent) {
chartPanel.setET();
recordDataButton.setText("Record ET");
interpolateButton.setEnabled(false);
parent.repaint();
}
});
ButtonGroup group = new ButtonGroup();
group.add(dButton);
group.add(eButton);
panel.add(dButton);
panel.add(eButton);
}
private void buildRadioButtons(JPanel panel) {
iButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent actionEvent) {
@ -798,7 +956,7 @@ public final class DynoControlPanel extends JPanel {
path = logFile.getParent();
BufferedReader inputStream = null;
recordDataButton.setSelected(false);
chartPanel.clear();
chartPanel.clearGraph();
parent.repaint();
calculateEnv();
@ -971,22 +1129,46 @@ public final class DynoControlPanel extends JPanel {
BufferedWriter outputStream = null;
try {
outputStream = new BufferedWriter(new FileWriter(traceFile));
LOGGER.info("DYNO Saving trace to file: " + traceFile.getName());
String line = units + COMMA + orderComboBox.getSelectedItem() +
COMMA + resultStrings[1] +
COMMA + fToE +
COMMA + sToE +
COMMA + tToS +
COMMA + auc;
outputStream.write(line, 0, line.length());
outputStream.newLine();
for (int x = 0; x < chartPanel.getPwrTqCount(); x++) {
line = chartPanel.getPwrTq(x);
if (dButton.isSelected()) {
outputStream = new BufferedWriter(new FileWriter(traceFile));
LOGGER.info("DYNO Saving trace to file: " + traceFile.getName());
String line = units + COMMA + orderComboBox.getSelectedItem() +
COMMA + resultStrings[1] +
COMMA + fToE +
COMMA + sToE +
COMMA + tToS +
COMMA + auc;
outputStream.write(line, 0, line.length());
outputStream.newLine();
for (int x = 0; x < chartPanel.getPwrTqCount(); x++) {
line = chartPanel.getPwrTq(x);
outputStream.write(line, 0, line.length());
outputStream.newLine();
}
}
if (eButton.isSelected()) {
outputStream = new BufferedWriter(new FileWriter(traceFile));
LOGGER.info("DYNO Saving ET to file: " + traceFile.getName());
String line = carInfo;
outputStream.write(line, 0, line.length());
outputStream.newLine();
line = "60ft/18.3m:" + TAB + String.format("%1.3f", etResults[0]) + "\" @ " + String.format("%1.2f", etResults[1]) + " " + vsLogUnits;
outputStream.write(line, 0, line.length());
outputStream.newLine();
}
line = "330ft/100m:" + TAB + String.format("%1.3f", etResults[2]) + "\" @ " + String.format("%1.2f", etResults[3]) + " " + vsLogUnits;
outputStream.write(line, 0, line.length());
outputStream.newLine();
line = "1/2 track:" + TAB + String.format("%1.3f", etResults[4]) + "\" @ " + String.format("%1.2f", etResults[5]) + " " + vsLogUnits;
outputStream.write(line, 0, line.length());
outputStream.newLine();
line = "1,000ft/305m:" + TAB + String.format("%1.3f", etResults[6]) + "\" @ " + String.format("%1.2f", etResults[7]) + " " + vsLogUnits;
outputStream.write(line, 0, line.length());
outputStream.newLine();
line = "1/4 mile/402m:" + TAB + String.format("%1.3f", etResults[8]) + "\" @ " + String.format("%1.2f", etResults[9]) + " " + vsLogUnits;
outputStream.write(line, 0, line.length());
outputStream.newLine();
}
outputStream.close();
}
catch (IOException e) {
@ -1084,12 +1266,15 @@ public final class DynoControlPanel extends JPanel {
private JButton buildInterpolateButton( final JComboBox orderComboBox) {
interpolateButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent actionEvent) {
if (isValidRange(rpmMin, rpmMax)) {
calculateEnv();
updateChart();
}
else {
showMessageDialog(parent, "Invalid PRM range specified.", "Error", ERROR_MESSAGE);
if (dButton.isSelected()) {
interpolateButton.setEnabled(true);
if (isValidRange(rpmMin, rpmMax)) {
calculateEnv();
updateChart();
}
else {
showMessageDialog(parent, "Invalid PRM range specified.", "Error", ERROR_MESSAGE);
}
}
}
});

View File

@ -29,6 +29,10 @@ public interface DynoTab extends Tab {
boolean getEnv();
boolean isRecordET();
boolean isValidET(long now, double vs);
void updateEnv(double iat, double pressure);
void addData(double xData, double yData, double y1Data);

View File

@ -36,7 +36,7 @@ import java.util.List;
public final class DynoTabImpl extends JPanel implements DynoTab {
private static final long serialVersionUID = 2787020251963102201L;
private final DynoChartPanel chartPanel = new DynoChartPanel("Engine Speed (RPM)", "Calculated Wheel Power", "Calculated Wheel Torque");
private final DynoChartPanel chartPanel = new DynoChartPanel("Engine Speed (RPM)", "Calculated Wheel Power", "Calculated Engine Torque");
private final DynoControlPanel controlPanel;
public DynoTabImpl(DataRegistrationBroker broker, ECUEditor ecuEditor) {
@ -55,6 +55,14 @@ public final class DynoTabImpl extends JPanel implements DynoTab {
controlPanel.updateEnv(iat, pressure);
}
public boolean isValidET(long now, double vs) {
return controlPanel.isValidET(now, vs);
}
public boolean isRecordET() {
return controlPanel.isRecordET();
}
public boolean isRecordData() {
return controlPanel.isRecordData();
}

View File

@ -23,7 +23,7 @@ version.minor=5
version.patch=3
version.buildnumber=${buildnumber}
version.extra=Beta
version.extra1=RC5-rd-v11
version.extra1=RC5-rd-v12
# the starting class for the application
class.start=com.romraider.ECUExec