mirror of https://github.com/rusefi/RomRaider.git
Fixed calculation problem for derived parameters with non-characters in their abbreviation. Also corrected units abbreviation.
This commit is contained in:
parent
b423e5d3df
commit
f3a06269b7
|
@ -1,40 +1,40 @@
|
||||||
/*
|
/*
|
||||||
* RomRaider Open-Source Tuning, Logging and Reflashing
|
* RomRaider Open-Source Tuning, Logging and Reflashing
|
||||||
* Copyright (C) 2006-2012 RomRaider.com
|
* Copyright (C) 2006-2012 RomRaider.com
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License along
|
* You should have received a copy of the GNU General Public License along
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.romraider.logger.car.util;
|
package com.romraider.logger.car.util;
|
||||||
|
|
||||||
public enum Constants {
|
public enum Constants {
|
||||||
IMPERIAL ("imperial"),
|
IMPERIAL ("imperial"),
|
||||||
IMPERIAL_UNIT ("mph"),
|
IMPERIAL_UNIT ("mph"),
|
||||||
METRIC ("metric"),
|
METRIC ("metric"),
|
||||||
METRIC_UNIT ("kph"),
|
METRIC_UNIT ("km/h"),
|
||||||
KPH_2_MPH ("1.609344"),
|
KPH_2_MPH ("1.609344"),
|
||||||
TQ_CONSTANT_I ("5252.113122"),
|
TQ_CONSTANT_I ("5252.113122"),
|
||||||
TQ_CONSTANT_M ("9549.296748");
|
TQ_CONSTANT_M ("9549.296748");
|
||||||
|
|
||||||
private final String value;
|
private final String value;
|
||||||
|
|
||||||
Constants (String value) {
|
Constants (String value) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String value(){
|
public String value(){
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,160 +1,161 @@
|
||||||
/*
|
/*
|
||||||
* RomRaider Open-Source Tuning, Logging and Reflashing
|
* RomRaider Open-Source Tuning, Logging and Reflashing
|
||||||
* Copyright (C) 2006-2012 RomRaider.com
|
* Copyright (C) 2006-2012 RomRaider.com
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License along
|
* You should have received a copy of the GNU General Public License along
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.romraider.logger.ecu.definition;
|
package com.romraider.logger.ecu.definition;
|
||||||
|
|
||||||
import com.romraider.logger.ecu.ui.handler.dash.GaugeMinMax;
|
import com.romraider.logger.ecu.ui.handler.dash.GaugeMinMax;
|
||||||
import static com.romraider.util.JEPUtil.evaluate;
|
import static com.romraider.util.JEPUtil.evaluate;
|
||||||
import static com.romraider.util.ParamChecker.checkNotNull;
|
import static com.romraider.util.ParamChecker.checkNotNull;
|
||||||
import static com.romraider.util.ParamChecker.checkNotNullOrEmpty;
|
import static com.romraider.util.ParamChecker.checkNotNullOrEmpty;
|
||||||
import static java.util.Collections.synchronizedMap;
|
import static java.util.Collections.synchronizedMap;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public final class EcuDerivedParameterConvertorImpl implements EcuDerivedParameterConvertor {
|
public final class EcuDerivedParameterConvertorImpl implements EcuDerivedParameterConvertor {
|
||||||
private EcuData[] ecuDatas;
|
private EcuData[] ecuDatas;
|
||||||
private final String units;
|
private final String units;
|
||||||
private final String expression;
|
private final String expression;
|
||||||
private final DecimalFormat format;
|
private final DecimalFormat format;
|
||||||
private final Map<String, String> replaceMap;
|
private final Map<String, String> replaceMap;
|
||||||
private final Map<String, ExpressionInfo> expressionInfoMap = synchronizedMap(new HashMap<String, ExpressionInfo>());
|
private final Map<String, ExpressionInfo> expressionInfoMap = synchronizedMap(new HashMap<String, ExpressionInfo>());
|
||||||
private final GaugeMinMax gaugeMinMax;
|
private final GaugeMinMax gaugeMinMax;
|
||||||
|
|
||||||
public EcuDerivedParameterConvertorImpl(String units, String expression, String format, Map<String, String> replaceMap, GaugeMinMax gaugeMinMax) {
|
public EcuDerivedParameterConvertorImpl(String units, String expression, String format, Map<String, String> replaceMap, GaugeMinMax gaugeMinMax) {
|
||||||
checkNotNullOrEmpty(units, "units");
|
checkNotNullOrEmpty(units, "units");
|
||||||
checkNotNullOrEmpty(expression, "expression");
|
checkNotNullOrEmpty(expression, "expression");
|
||||||
checkNotNullOrEmpty(format, "format");
|
checkNotNullOrEmpty(format, "format");
|
||||||
checkNotNull(replaceMap, "replaceMap");
|
checkNotNull(replaceMap, "replaceMap");
|
||||||
checkNotNull(gaugeMinMax, "gaugeMinMax");
|
checkNotNull(gaugeMinMax, "gaugeMinMax");
|
||||||
this.units = units;
|
this.units = units;
|
||||||
this.expression = expression;
|
this.expression = expression;
|
||||||
this.format = new DecimalFormat(format);
|
this.format = new DecimalFormat(format);
|
||||||
this.replaceMap = replaceMap;
|
this.replaceMap = replaceMap;
|
||||||
this.gaugeMinMax = gaugeMinMax;
|
this.gaugeMinMax = gaugeMinMax;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double convert(byte[] bytes) {
|
public double convert(byte[] bytes) {
|
||||||
Map<String, Double> valueMap = new HashMap<String, Double>();
|
Map<String, Double> valueMap = new HashMap<String, Double>();
|
||||||
String exp = expression;
|
String exp = expression;
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (EcuData ecuData : ecuDatas) {
|
for (EcuData ecuData : ecuDatas) {
|
||||||
int length = ecuData.getAddress().getLength();
|
int length = ecuData.getAddress().getLength();
|
||||||
byte[] tmp = new byte[length];
|
byte[] tmp = new byte[length];
|
||||||
System.arraycopy(bytes, index, tmp, 0, length);
|
System.arraycopy(bytes, index, tmp, 0, length);
|
||||||
ExpressionInfo expressionInfo = expressionInfoMap.get(ecuData.getId());
|
ExpressionInfo expressionInfo = expressionInfoMap.get(ecuData.getId());
|
||||||
valueMap.put(expressionInfo.getReplacementKey(), expressionInfo.getConvertor().convert(tmp));
|
valueMap.put(expressionInfo.getReplacementKey(), expressionInfo.getConvertor().convert(tmp));
|
||||||
exp = exp.replace(buildParameterKey(expressionInfo), expressionInfo.getReplacementKey());
|
exp = exp.replace(buildParameterKey(expressionInfo), expressionInfo.getReplacementKey());
|
||||||
index += length;
|
index += length;
|
||||||
}
|
}
|
||||||
double result = evaluate(exp, valueMap);
|
double result = evaluate(exp, valueMap);
|
||||||
return Double.isNaN(result) || Double.isInfinite(result) ? 0.0 : result;
|
return Double.isNaN(result) || Double.isInfinite(result) ? 0.0 : result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUnits() {
|
public String getUnits() {
|
||||||
return units;
|
return units;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GaugeMinMax getGaugeMinMax() {
|
public GaugeMinMax getGaugeMinMax() {
|
||||||
return gaugeMinMax;
|
return gaugeMinMax;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFormat() {
|
public String getFormat() {
|
||||||
return format.toPattern();
|
return format.toPattern();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String format(double value) {
|
public String format(double value) {
|
||||||
String formattedValue = format.format(value);
|
String formattedValue = format.format(value);
|
||||||
if (replaceMap.containsKey(formattedValue)) {
|
if (replaceMap.containsKey(formattedValue)) {
|
||||||
return replaceMap.get(formattedValue);
|
return replaceMap.get(formattedValue);
|
||||||
} else {
|
} else {
|
||||||
return formattedValue;
|
return formattedValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEcuDatas(EcuData[] ecuDatas) {
|
public void setEcuDatas(EcuData[] ecuDatas) {
|
||||||
checkNotNullOrEmpty(ecuDatas, "ecuDatas");
|
checkNotNullOrEmpty(ecuDatas, "ecuDatas");
|
||||||
this.ecuDatas = ecuDatas;
|
this.ecuDatas = ecuDatas;
|
||||||
for (EcuData ecuData : ecuDatas) {
|
for (EcuData ecuData : ecuDatas) {
|
||||||
addExpressionInfo(ecuData);
|
addExpressionInfo(ecuData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return getUnits();
|
return getUnits();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addExpressionInfo(EcuData ecuData) {
|
private void addExpressionInfo(EcuData ecuData) {
|
||||||
String id = ecuData.getId();
|
String id = ecuData.getId();
|
||||||
String lookup = '[' + id + ':';
|
String lookup = '[' + id + ':';
|
||||||
int i = expression.indexOf(lookup);
|
int i = expression.indexOf(lookup);
|
||||||
if (i >= 0) {
|
if (i >= 0) {
|
||||||
int start = i + lookup.length();
|
int start = i + lookup.length();
|
||||||
int end = expression.indexOf("]", start);
|
int end = expression.indexOf("]", start);
|
||||||
String units = expression.substring(start, end);
|
String units = expression.substring(start, end);
|
||||||
EcuDataConvertor selectedConvertor = null;
|
EcuDataConvertor selectedConvertor = null;
|
||||||
EcuDataConvertor[] convertors = ecuData.getConvertors();
|
EcuDataConvertor[] convertors = ecuData.getConvertors();
|
||||||
for (EcuDataConvertor convertor : convertors) {
|
for (EcuDataConvertor convertor : convertors) {
|
||||||
if (units.equals(convertor.getUnits())) {
|
if (units.equals(convertor.getUnits())) {
|
||||||
selectedConvertor = convertor;
|
selectedConvertor = convertor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
expressionInfoMap.put(id, new ExpressionInfo(id, selectedConvertor, true));
|
expressionInfoMap.put(id, new ExpressionInfo(id, selectedConvertor, true));
|
||||||
} else {
|
} else {
|
||||||
expressionInfoMap.put(id, new ExpressionInfo(id, ecuData.getSelectedConvertor(), false));
|
expressionInfoMap.put(id, new ExpressionInfo(id, ecuData.getSelectedConvertor(), false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String buildParameterKey(ExpressionInfo expressionInfo) {
|
private String buildParameterKey(ExpressionInfo expressionInfo) {
|
||||||
return '[' + expressionInfo.getEcuDataId() + ':' + expressionInfo.getConvertor().getUnits() + ']';
|
return '[' + expressionInfo.getEcuDataId() + ':' + expressionInfo.getConvertor().getUnits() + ']';
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final class ExpressionInfo {
|
private static final class ExpressionInfo {
|
||||||
private final String ecuDataId;
|
private final String ecuDataId;
|
||||||
private final EcuDataConvertor convertor;
|
private final EcuDataConvertor convertor;
|
||||||
private final String replacementKey;
|
private final String replacementKey;
|
||||||
|
|
||||||
public ExpressionInfo(String ecuDataId, EcuDataConvertor convertor, boolean compositeKey) {
|
public ExpressionInfo(String ecuDataId, EcuDataConvertor convertor, boolean compositeKey) {
|
||||||
checkNotNull(ecuDataId, convertor);
|
checkNotNull(ecuDataId, convertor);
|
||||||
this.ecuDataId = ecuDataId;
|
this.ecuDataId = ecuDataId;
|
||||||
this.convertor = convertor;
|
this.convertor = convertor;
|
||||||
this.replacementKey = compositeKey ? buildCompositeKey(ecuDataId, convertor.getUnits()) : ecuDataId;
|
this.replacementKey = compositeKey ? buildCompositeKey(ecuDataId, convertor.getUnits()) : ecuDataId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getEcuDataId() {
|
public String getEcuDataId() {
|
||||||
return ecuDataId;
|
return ecuDataId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getReplacementKey() {
|
public String getReplacementKey() {
|
||||||
return replacementKey;
|
return replacementKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EcuDataConvertor getConvertor() {
|
public EcuDataConvertor getConvertor() {
|
||||||
return convertor;
|
return convertor;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String buildCompositeKey(String ecuDataId, String convertorUnits) {
|
private String buildCompositeKey(String ecuDataId, String convertorUnits) {
|
||||||
if (convertorUnits == null || convertorUnits.length() == 0) {
|
if (convertorUnits == null || convertorUnits.length() == 0) {
|
||||||
return ecuDataId;
|
return ecuDataId;
|
||||||
} else {
|
} else {
|
||||||
return '_' + ecuDataId + '_' + convertorUnits + '_';
|
convertorUnits = convertorUnits.replaceAll("[^\\w]", "_");
|
||||||
}
|
return '_' + ecuDataId + '_' + convertorUnits + '_';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,129 +1,129 @@
|
||||||
/*
|
/*
|
||||||
* RomRaider Open-Source Tuning, Logging and Reflashing
|
* RomRaider Open-Source Tuning, Logging and Reflashing
|
||||||
* Copyright (C) 2006-2012 RomRaider.com
|
* Copyright (C) 2006-2012 RomRaider.com
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License along
|
* You should have received a copy of the GNU General Public License along
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.romraider.logger.ecu.definition;
|
package com.romraider.logger.ecu.definition;
|
||||||
|
|
||||||
import static com.romraider.logger.ecu.definition.EcuDataType.PARAMETER;
|
import static com.romraider.logger.ecu.definition.EcuDataType.PARAMETER;
|
||||||
import static com.romraider.util.ParamChecker.checkNotNull;
|
import static com.romraider.util.ParamChecker.checkNotNull;
|
||||||
import static com.romraider.util.ParamChecker.checkNotNullOrEmpty;
|
import static com.romraider.util.ParamChecker.checkNotNullOrEmpty;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public final class EcuDerivedParameterImpl implements EcuParameter {
|
public final class EcuDerivedParameterImpl implements EcuParameter {
|
||||||
private final String id;
|
private final String id;
|
||||||
private final String name;
|
private final String name;
|
||||||
private final String description;
|
private final String description;
|
||||||
private final EcuDerivedParameterConvertor[] convertors;
|
private final EcuDerivedParameterConvertor[] convertors;
|
||||||
private final EcuAddress address;
|
private final EcuAddress address;
|
||||||
private final Set<ConvertorUpdateListener> listeners = new HashSet<ConvertorUpdateListener>();
|
private final Set<ConvertorUpdateListener> listeners = new HashSet<ConvertorUpdateListener>();
|
||||||
private int selectedConvertorIndex;
|
private int selectedConvertorIndex;
|
||||||
private boolean selected;
|
private boolean selected;
|
||||||
|
|
||||||
public EcuDerivedParameterImpl(String id, String name, String description, EcuData[] ecuDatas,
|
public EcuDerivedParameterImpl(String id, String name, String description, EcuData[] ecuDatas,
|
||||||
EcuDerivedParameterConvertor[] convertors) {
|
EcuDerivedParameterConvertor[] convertors) {
|
||||||
checkNotNullOrEmpty(name, "id");
|
checkNotNullOrEmpty(id, "id");
|
||||||
checkNotNullOrEmpty(name, "name");
|
checkNotNullOrEmpty(name, "name");
|
||||||
checkNotNull(description, "description");
|
checkNotNull(description, "description");
|
||||||
checkNotNullOrEmpty(ecuDatas, "ecuDatas");
|
checkNotNullOrEmpty(ecuDatas, "ecuDatas");
|
||||||
checkNotNullOrEmpty(convertors, "convertors");
|
checkNotNullOrEmpty(convertors, "convertors");
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
this.convertors = convertors;
|
this.convertors = convertors;
|
||||||
this.address = buildCombinedAddress(ecuDatas);
|
this.address = buildCombinedAddress(ecuDatas);
|
||||||
setEcuDatas(ecuDatas);
|
setEcuDatas(ecuDatas);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EcuAddress getAddress() {
|
public EcuAddress getAddress() {
|
||||||
return address;
|
return address;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EcuDataConvertor getSelectedConvertor() {
|
public EcuDataConvertor getSelectedConvertor() {
|
||||||
return convertors[selectedConvertorIndex];
|
return convertors[selectedConvertorIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
public EcuDataConvertor[] getConvertors() {
|
public EcuDataConvertor[] getConvertors() {
|
||||||
return convertors;
|
return convertors;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void selectConvertor(EcuDataConvertor convertor) {
|
public void selectConvertor(EcuDataConvertor convertor) {
|
||||||
if (convertor != getSelectedConvertor()) {
|
if (convertor != getSelectedConvertor()) {
|
||||||
for (int i = 0; i < convertors.length; i++) {
|
for (int i = 0; i < convertors.length; i++) {
|
||||||
EcuDerivedParameterConvertor parameterConvertor = convertors[i];
|
EcuDerivedParameterConvertor parameterConvertor = convertors[i];
|
||||||
if (convertor == parameterConvertor) {
|
if (convertor == parameterConvertor) {
|
||||||
selectedConvertorIndex = i;
|
selectedConvertorIndex = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
notifyUpdateListeners();
|
notifyUpdateListeners();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public EcuDataType getDataType() {
|
public EcuDataType getDataType() {
|
||||||
return PARAMETER;
|
return PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSelected() {
|
public boolean isSelected() {
|
||||||
return selected;
|
return selected;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSelected(boolean selected) {
|
public void setSelected(boolean selected) {
|
||||||
this.selected = selected;
|
this.selected = selected;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addConvertorUpdateListener(ConvertorUpdateListener listener) {
|
public void addConvertorUpdateListener(ConvertorUpdateListener listener) {
|
||||||
checkNotNull(listener, "listener");
|
checkNotNull(listener, "listener");
|
||||||
listeners.add(listener);
|
listeners.add(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
private EcuAddress buildCombinedAddress(EcuData[] ecuDatas) {
|
private EcuAddress buildCombinedAddress(EcuData[] ecuDatas) {
|
||||||
String[] addresses = new String[0];
|
String[] addresses = new String[0];
|
||||||
for (EcuData ecuData : ecuDatas) {
|
for (EcuData ecuData : ecuDatas) {
|
||||||
String[] newAddresses = ecuData.getAddress().getAddresses();
|
String[] newAddresses = ecuData.getAddress().getAddresses();
|
||||||
String[] tmp = new String[addresses.length + newAddresses.length];
|
String[] tmp = new String[addresses.length + newAddresses.length];
|
||||||
System.arraycopy(addresses, 0, tmp, 0, addresses.length);
|
System.arraycopy(addresses, 0, tmp, 0, addresses.length);
|
||||||
System.arraycopy(newAddresses, 0, tmp, addresses.length, newAddresses.length);
|
System.arraycopy(newAddresses, 0, tmp, addresses.length, newAddresses.length);
|
||||||
addresses = tmp;
|
addresses = tmp;
|
||||||
}
|
}
|
||||||
return new EcuAddressImpl(addresses);
|
return new EcuAddressImpl(addresses);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setEcuDatas(EcuData[] ecuDatas) {
|
private void setEcuDatas(EcuData[] ecuDatas) {
|
||||||
for (EcuDerivedParameterConvertor convertor : convertors) {
|
for (EcuDerivedParameterConvertor convertor : convertors) {
|
||||||
convertor.setEcuDatas(ecuDatas);
|
convertor.setEcuDatas(ecuDatas);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void notifyUpdateListeners() {
|
private void notifyUpdateListeners() {
|
||||||
for (ConvertorUpdateListener listener : listeners) {
|
for (ConvertorUpdateListener listener : listeners) {
|
||||||
listener.notifyConvertorUpdate(this);
|
listener.notifyConvertorUpdate(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,98 +1,98 @@
|
||||||
/*
|
/*
|
||||||
* RomRaider Open-Source Tuning, Logging and Reflashing
|
* RomRaider Open-Source Tuning, Logging and Reflashing
|
||||||
* Copyright (C) 2006-2012 RomRaider.com
|
* Copyright (C) 2006-2012 RomRaider.com
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License along
|
* You should have received a copy of the GNU General Public License along
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.romraider.logger.ecu.definition.xml;
|
package com.romraider.logger.ecu.definition.xml;
|
||||||
|
|
||||||
import com.romraider.logger.ecu.ui.handler.dash.GaugeMinMax;
|
import com.romraider.logger.ecu.ui.handler.dash.GaugeMinMax;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public final class ConverterMaxMinDefaults {
|
public final class ConverterMaxMinDefaults {
|
||||||
private static final Map<String, GaugeMinMax> DEFAULTS = new HashMap<String, GaugeMinMax>();
|
private static final Map<String, GaugeMinMax> DEFAULTS = new HashMap<String, GaugeMinMax>();
|
||||||
private static final double MIN_DEFAULT = 0.0;
|
private static final double MIN_DEFAULT = 0.0;
|
||||||
private static final double MAX_DEFAULT = 100.0;
|
private static final double MAX_DEFAULT = 100.0;
|
||||||
private static final double STEP_DEFAULT = 10.0;
|
private static final double STEP_DEFAULT = 10.0;
|
||||||
private static final GaugeMinMax DEFAULT = new GaugeMinMax(MIN_DEFAULT, MAX_DEFAULT, STEP_DEFAULT);
|
private static final GaugeMinMax DEFAULT = new GaugeMinMax(MIN_DEFAULT, MAX_DEFAULT, STEP_DEFAULT);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
add("%", 0.0, 100.0, 10.0);
|
add("%", 0.0, 100.0, 10.0);
|
||||||
add("f", 0.0, 400.0, 40.0);
|
add("f", 0.0, 400.0, 40.0);
|
||||||
add("c", -20.0, 200.0, 20.0);
|
add("c", -20.0, 200.0, 20.0);
|
||||||
add("psi", -20.0, 40.0, 5.0);
|
add("psi", -20.0, 40.0, 5.0);
|
||||||
add("bar", -1.5, 3.0, 0.5);
|
add("bar", -1.5, 3.0, 0.5);
|
||||||
add("rpm", 0, 8000, 1000.0);
|
add("rpm", 0, 8000, 1000.0);
|
||||||
add("mph", 0.0, 200.0, 20.0);
|
add("mph", 0.0, 200.0, 20.0);
|
||||||
add("kph", 0.0, 300.0, 20.0);
|
add("km/h", 0.0, 300.0, 20.0);
|
||||||
add("degrees", -15, 60.0, 5.0);
|
add("degrees", -15, 60.0, 5.0);
|
||||||
add("g/s", 0.0, 400.0, 20.0);
|
add("g/s", 0.0, 400.0, 20.0);
|
||||||
add("v", 0.0, 5.0, 0.5);
|
add("v", 0.0, 5.0, 0.5);
|
||||||
add("ms", 0.0, 100.0, 10.0);
|
add("ms", 0.0, 100.0, 10.0);
|
||||||
add("a", 0.0, 20.0, 5.0);
|
add("a", 0.0, 20.0, 5.0);
|
||||||
add("ma", 0.0, 100.0, 10.0);
|
add("ma", 0.0, 100.0, 10.0);
|
||||||
add("steps", 0.0, 100.0, 10.0);
|
add("steps", 0.0, 100.0, 10.0);
|
||||||
add("ohms", 0.0, 100.0, 10.0);
|
add("ohms", 0.0, 100.0, 10.0);
|
||||||
add("afr", 10.0, 20.0, 1.0);
|
add("afr", 10.0, 20.0, 1.0);
|
||||||
add("lambda", 0.5, 1.5, 0.1);
|
add("lambda", 0.5, 1.5, 0.1);
|
||||||
add("gear", 0.0, 6.0, 1.0);
|
add("gear", 0.0, 6.0, 1.0);
|
||||||
add("misfire count", 0.0, 20.0, 5.0);
|
add("misfire count", 0.0, 20.0, 5.0);
|
||||||
add("mpa", 0.0, 0.5, 0.1);
|
add("MPa", 0.0, 0.5, 0.1);
|
||||||
add("2*g/rev", 0.0, 8.0, 1.0);
|
add("2*g/rev", 0.0, 8.0, 1.0);
|
||||||
add("g/rev", 0.0, 4.0, 0.5);
|
add("g/rev", 0.0, 4.0, 0.5);
|
||||||
add("g/cyl", 0.0, 2.0, 0.5);
|
add("g/cyl", 0.0, 2.0, 0.5);
|
||||||
add("multiplier", 0.0, 1.0, 0.1);
|
add("multiplier", 0.0, 1.0, 0.1);
|
||||||
add("raw ecu value", 0.0, 16.0, 1.0);
|
add("raw ecu value", 0.0, 16.0, 1.0);
|
||||||
add("status", 0.0, 10.0, 1.0);
|
add("status", 0.0, 10.0, 1.0);
|
||||||
add("mmhg", 0.0, 2000.0, 100.0);
|
add("mmHg", 0.0, 2000.0, 100.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double getMin(String units) {
|
public static double getMin(String units) {
|
||||||
String key = units.toLowerCase();
|
String key = units.toLowerCase();
|
||||||
if (!DEFAULTS.containsKey(key)) return MIN_DEFAULT;
|
if (!DEFAULTS.containsKey(key)) return MIN_DEFAULT;
|
||||||
return DEFAULTS.get(key).min;
|
return DEFAULTS.get(key).min;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double getMax(String units) {
|
public static double getMax(String units) {
|
||||||
String key = units.toLowerCase();
|
String key = units.toLowerCase();
|
||||||
if (!DEFAULTS.containsKey(key)) return MAX_DEFAULT;
|
if (!DEFAULTS.containsKey(key)) return MAX_DEFAULT;
|
||||||
return DEFAULTS.get(key).max;
|
return DEFAULTS.get(key).max;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double getStep(String units) {
|
public static double getStep(String units) {
|
||||||
String key = units.toLowerCase();
|
String key = units.toLowerCase();
|
||||||
if (!DEFAULTS.containsKey(key)) return STEP_DEFAULT;
|
if (!DEFAULTS.containsKey(key)) return STEP_DEFAULT;
|
||||||
return DEFAULTS.get(key).step;
|
return DEFAULTS.get(key).step;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GaugeMinMax getDefault() {
|
public static GaugeMinMax getDefault() {
|
||||||
return DEFAULT;
|
return DEFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GaugeMinMax getMaxMin(String units) {
|
public static GaugeMinMax getMaxMin(String units) {
|
||||||
double min = getMin(units);
|
double min = getMin(units);
|
||||||
double max = getMax(units);
|
double max = getMax(units);
|
||||||
double step = getStep(units);
|
double step = getStep(units);
|
||||||
return new GaugeMinMax(min, max, step);
|
return new GaugeMinMax(min, max, step);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void add(String units, double min, double max, double step) {
|
private static void add(String units, double min, double max, double step) {
|
||||||
String key = units.toLowerCase();
|
String key = units.toLowerCase();
|
||||||
GaugeMinMax value = new GaugeMinMax(min, max, step);
|
GaugeMinMax value = new GaugeMinMax(min, max, step);
|
||||||
DEFAULTS.put(key, value);
|
DEFAULTS.put(key, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,480 +1,480 @@
|
||||||
/*
|
/*
|
||||||
* RomRaider Open-Source Tuning, Logging and Reflashing
|
* RomRaider Open-Source Tuning, Logging and Reflashing
|
||||||
* Copyright (C) 2006-2012 RomRaider.com
|
* Copyright (C) 2006-2012 RomRaider.com
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License along
|
* You should have received a copy of the GNU General Public License along
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.romraider.logger.ecu.ui.tab.dyno;
|
package com.romraider.logger.ecu.ui.tab.dyno;
|
||||||
|
|
||||||
import com.romraider.logger.ecu.ui.handler.graph.SpringUtilities;
|
import com.romraider.logger.ecu.ui.handler.graph.SpringUtilities;
|
||||||
import com.romraider.logger.ecu.ui.tab.CircleDrawer;
|
import com.romraider.logger.ecu.ui.tab.CircleDrawer;
|
||||||
import com.romraider.logger.ecu.ui.tab.XYTrendline;
|
import com.romraider.logger.ecu.ui.tab.XYTrendline;
|
||||||
|
|
||||||
import static com.romraider.util.ParamChecker.checkNotNull;
|
import static com.romraider.util.ParamChecker.checkNotNull;
|
||||||
import jamlab.Polyfit;
|
import jamlab.Polyfit;
|
||||||
import static java.awt.Color.BLACK;
|
import static java.awt.Color.BLACK;
|
||||||
import static java.awt.Color.BLUE;
|
import static java.awt.Color.BLUE;
|
||||||
import static java.awt.Color.GREEN;
|
import static java.awt.Color.GREEN;
|
||||||
import static java.awt.Color.RED;
|
import static java.awt.Color.RED;
|
||||||
import static java.awt.Color.WHITE;
|
import static java.awt.Color.WHITE;
|
||||||
import static java.awt.Color.YELLOW;
|
import static java.awt.Color.YELLOW;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import static org.apache.log4j.Logger.getLogger;
|
import static org.apache.log4j.Logger.getLogger;
|
||||||
import static org.jfree.chart.ChartFactory.createScatterPlot;
|
import static org.jfree.chart.ChartFactory.createScatterPlot;
|
||||||
import org.jfree.chart.ChartPanel;
|
import org.jfree.chart.ChartPanel;
|
||||||
import org.jfree.chart.JFreeChart;
|
import org.jfree.chart.JFreeChart;
|
||||||
import org.jfree.chart.annotations.XYAnnotation;
|
import org.jfree.chart.annotations.XYAnnotation;
|
||||||
import org.jfree.chart.annotations.XYDrawableAnnotation;
|
import org.jfree.chart.annotations.XYDrawableAnnotation;
|
||||||
import org.jfree.chart.annotations.XYPointerAnnotation;
|
import org.jfree.chart.annotations.XYPointerAnnotation;
|
||||||
import org.jfree.chart.annotations.XYTextAnnotation;
|
import org.jfree.chart.annotations.XYTextAnnotation;
|
||||||
import org.jfree.chart.axis.AxisLocation;
|
import org.jfree.chart.axis.AxisLocation;
|
||||||
import org.jfree.chart.axis.NumberAxis;
|
import org.jfree.chart.axis.NumberAxis;
|
||||||
import static org.jfree.chart.plot.PlotOrientation.VERTICAL;
|
import static org.jfree.chart.plot.PlotOrientation.VERTICAL;
|
||||||
import org.jfree.chart.plot.XYPlot;
|
import org.jfree.chart.plot.XYPlot;
|
||||||
import org.jfree.chart.renderer.xy.StandardXYItemRenderer;
|
import org.jfree.chart.renderer.xy.StandardXYItemRenderer;
|
||||||
import org.jfree.data.xy.XYDataset;
|
import org.jfree.data.xy.XYDataset;
|
||||||
import org.jfree.data.xy.XYSeries;
|
import org.jfree.data.xy.XYSeries;
|
||||||
import org.jfree.data.xy.XYSeriesCollection;
|
import org.jfree.data.xy.XYSeriesCollection;
|
||||||
import org.jfree.ui.TextAnchor;
|
import org.jfree.ui.TextAnchor;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.SpringLayout;
|
import javax.swing.SpringLayout;
|
||||||
import java.awt.BasicStroke;
|
import java.awt.BasicStroke;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
|
|
||||||
public final class DynoChartPanel extends JPanel {
|
public final class DynoChartPanel extends JPanel {
|
||||||
private static final long serialVersionUID = -6577979878171615665L;
|
private static final long serialVersionUID = -6577979878171615665L;
|
||||||
private static final Logger LOGGER = getLogger(DynoChartPanel.class);
|
private static final Logger LOGGER = getLogger(DynoChartPanel.class);
|
||||||
private static final Color DARK_GREY = new Color(80, 80, 80);
|
private static final Color DARK_GREY = new Color(80, 80, 80);
|
||||||
private static final Color LIGHT_GREY = new Color(110, 110, 110);
|
private static final Color LIGHT_GREY = new Color(110, 110, 110);
|
||||||
private static final String START_PROMPT = "Accelerate using WOT when ready!!";
|
private static final String START_PROMPT = "Accelerate using WOT when ready!!";
|
||||||
private static final String ET_PROMPT_I = "Accelerate for 1/4 mile when ready!!";
|
private static final String ET_PROMPT_I = "Accelerate for 1/4 mile when ready!!";
|
||||||
private static final String ET_PROMPT_M = "Accelerate for 402 meters when ready!!";
|
private static final String ET_PROMPT_M = "Accelerate for 402 meters when ready!!";
|
||||||
private final XYSeries data = new XYSeries("Raw HP"); // series for HorsePower/RPM
|
private final XYSeries data = new XYSeries("Raw HP"); // series for HorsePower/RPM
|
||||||
private final XYSeries data1 = new XYSeries("Raw TQ"); // series for Torque/RPM
|
private final XYSeries data1 = new XYSeries("Raw TQ"); // series for Torque/RPM
|
||||||
private final XYSeries logRpm = new XYSeries("Logger RPM"); // series for raw sample time/RPM
|
private final XYSeries logRpm = new XYSeries("Logger RPM"); // series for raw sample time/RPM
|
||||||
private final XYTrendline rpmTrend = new XYTrendline(logRpm);
|
private final XYTrendline rpmTrend = new XYTrendline(logRpm);
|
||||||
private final XYSeries hpRef = new XYSeries("HP Ref"); // series for reference HP/RPM
|
private final XYSeries hpRef = new XYSeries("HP Ref"); // series for reference HP/RPM
|
||||||
private final XYSeries tqRef = new XYSeries("TQ Ref"); // series for reference TQ/RPM
|
private final XYSeries tqRef = new XYSeries("TQ Ref"); // series for reference TQ/RPM
|
||||||
private final String labelX;
|
private final String labelX;
|
||||||
private String labelY1 = null;
|
private String labelY1 = null;
|
||||||
private String labelY2 = null;
|
private String labelY2 = null;
|
||||||
private StandardXYItemRenderer rendererY1 = new StandardXYItemRenderer();
|
private StandardXYItemRenderer rendererY1 = new StandardXYItemRenderer();
|
||||||
private StandardXYItemRenderer rendererY2 = new StandardXYItemRenderer();
|
private StandardXYItemRenderer rendererY2 = new StandardXYItemRenderer();
|
||||||
private NumberAxis hpAxis = new NumberAxis("pwr");
|
private NumberAxis hpAxis = new NumberAxis("pwr");
|
||||||
private NumberAxis tqAxis = new NumberAxis("tq");
|
private NumberAxis tqAxis = new NumberAxis("tq");
|
||||||
private XYPlot plot;
|
private XYPlot plot;
|
||||||
private final CircleDrawer cd = new CircleDrawer(RED, new BasicStroke(1.0f), null);
|
private final CircleDrawer cd = new CircleDrawer(RED, new BasicStroke(1.0f), null);
|
||||||
private final CircleDrawer cdGreen = new CircleDrawer(GREEN, new BasicStroke(1.0f), null);
|
private final CircleDrawer cdGreen = new CircleDrawer(GREEN, new BasicStroke(1.0f), null);
|
||||||
private XYAnnotation bestHp;
|
private XYAnnotation bestHp;
|
||||||
private XYAnnotation bestTq;
|
private XYAnnotation bestTq;
|
||||||
private final XYPointerAnnotation hpPointer = new XYPointerAnnotation(
|
private final XYPointerAnnotation hpPointer = new XYPointerAnnotation(
|
||||||
"Max HP", 1, 1, 3.0 * Math.PI / 6.0);
|
"Max HP", 1, 1, 3.0 * Math.PI / 6.0);
|
||||||
private final XYPointerAnnotation tqPointer = new XYPointerAnnotation(
|
private final XYPointerAnnotation tqPointer = new XYPointerAnnotation(
|
||||||
"Max TQ", 1, 1, 3.0 * Math.PI / 6.0);
|
"Max TQ", 1, 1, 3.0 * Math.PI / 6.0);
|
||||||
private final XYTextAnnotation refStat = new XYTextAnnotation(" ", 0, 0);
|
private final XYTextAnnotation refStat = new XYTextAnnotation(" ", 0, 0);
|
||||||
|
|
||||||
public DynoChartPanel(String labelX, String labelY1, String labelY2) {
|
public DynoChartPanel(String labelX, String labelY1, String labelY2) {
|
||||||
super(new SpringLayout());
|
super(new SpringLayout());
|
||||||
checkNotNull(labelX, labelY1, labelY2);
|
checkNotNull(labelX, labelY1, labelY2);
|
||||||
this.labelX = labelX;
|
this.labelX = labelX;
|
||||||
this.labelY1 = labelY1;
|
this.labelY1 = labelY1;
|
||||||
this.labelY2 = labelY2;
|
this.labelY2 = labelY2;
|
||||||
addChart();
|
addChart();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void quietUpdate(boolean notify) {
|
public void quietUpdate(boolean notify) {
|
||||||
data.setNotify(notify);
|
data.setNotify(notify);
|
||||||
data1.setNotify(notify);
|
data1.setNotify(notify);
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void addRawData(double x, double y) {
|
public synchronized void addRawData(double x, double y) {
|
||||||
logRpm.add(x, y);
|
logRpm.add(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void addData(double x, double y) {
|
public synchronized void addData(double x, double y) {
|
||||||
data.add(x, y);
|
data.add(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void addData(double x, double y1, double y2) {
|
public synchronized void addData(double x, double y1, double y2) {
|
||||||
data.add(x, y1);
|
data.add(x, y1);
|
||||||
data1.add(x, y2);
|
data1.add(x, y2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void setRefTrace(double x, double y1, double y2) {
|
public synchronized void setRefTrace(double x, double y1, double y2) {
|
||||||
hpRef.add(x, y1);
|
hpRef.add(x, y1);
|
||||||
tqRef.add(x, y2);
|
tqRef.add(x, y2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateRefTrace(String[] line) {
|
public void updateRefTrace(String[] line) {
|
||||||
if (hpRef.getItemCount() > 0) {
|
if (hpRef.getItemCount() > 0) {
|
||||||
refStat.setText("Reference: " + line[2] + " (" +
|
refStat.setText("Reference: " + line[2] + " (" +
|
||||||
String.format("%1.2f", Double.parseDouble(line[3])) + "; " +
|
String.format("%1.2f", Double.parseDouble(line[3])) + "; " +
|
||||||
String.format("%1.2f", Double.parseDouble(line[4])) + "; " +
|
String.format("%1.2f", Double.parseDouble(line[4])) + "; " +
|
||||||
String.format("%1.2f", Double.parseDouble(line[5])) + "; " +
|
String.format("%1.2f", Double.parseDouble(line[5])) + "; " +
|
||||||
String.format("%1.2f", Double.parseDouble(line[6])) + ")");
|
String.format("%1.2f", Double.parseDouble(line[6])) + ")");
|
||||||
refStat.setX(plot.getDomainAxis().getLowerBound() + 10);
|
refStat.setX(plot.getDomainAxis().getLowerBound() + 10);
|
||||||
refStat.setY(hpAxis.getUpperBound());
|
refStat.setY(hpAxis.getUpperBound());
|
||||||
plot.addAnnotation(refStat);
|
plot.addAnnotation(refStat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPwrTqCount() {
|
public int getPwrTqCount() {
|
||||||
return (int) data.getItemCount();
|
return (int) data.getItemCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPwrTq(int x) {
|
public String getPwrTq(int x) {
|
||||||
String dataSet = data.getX(x) + "," + data.getY(x) + "," + data1.getY(x);
|
String dataSet = data.getX(x) + "," + data.getY(x) + "," + data1.getY(x);
|
||||||
return dataSet;
|
return dataSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clearRefTrace() {
|
public void clearRefTrace() {
|
||||||
refStat.setText(" ");
|
refStat.setText(" ");
|
||||||
plot.removeAnnotation(refStat);
|
plot.removeAnnotation(refStat);
|
||||||
hpRef.clear();
|
hpRef.clear();
|
||||||
tqRef.clear();
|
tqRef.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clear() {
|
public void clear() {
|
||||||
logRpm.clear();
|
logRpm.clear();
|
||||||
rpmTrend.clear();
|
rpmTrend.clear();
|
||||||
clearGraph();
|
clearGraph();
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getTimeSample(int index) {
|
public long getTimeSample(int index) {
|
||||||
return logRpm.getX(index).longValue();
|
return logRpm.getX(index).longValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSampleCount() {
|
public int getSampleCount() {
|
||||||
clearGraph();
|
clearGraph();
|
||||||
return logRpm.getItemCount();
|
return logRpm.getItemCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clearGraph() {
|
public void clearGraph() {
|
||||||
data.clear();
|
data.clear();
|
||||||
data1.clear();
|
data1.clear();
|
||||||
rendererY1.removeAnnotation(bestHp);
|
rendererY1.removeAnnotation(bestHp);
|
||||||
rendererY2.removeAnnotation(bestTq);
|
rendererY2.removeAnnotation(bestTq);
|
||||||
rendererY1.removeAnnotation(hpPointer);
|
rendererY1.removeAnnotation(hpPointer);
|
||||||
rendererY2.removeAnnotation(tqPointer);
|
rendererY2.removeAnnotation(tqPointer);
|
||||||
hpAxis.setAutoRange(true);
|
hpAxis.setAutoRange(true);
|
||||||
tqAxis.setAutoRange(true);
|
tqAxis.setAutoRange(true);
|
||||||
plot.clearAnnotations();
|
plot.clearAnnotations();
|
||||||
}
|
}
|
||||||
|
|
||||||
public double[] getRpmCoeff(int order) {
|
public double[] getRpmCoeff(int order) {
|
||||||
rpmTrend.update(order);
|
rpmTrend.update(order);
|
||||||
return getPolynomialCoefficients(rpmTrend);
|
return getPolynomialCoefficients(rpmTrend);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void interpolate(double[] results, String[] resultStrings) {
|
public void interpolate(double[] results, String[] resultStrings) {
|
||||||
hpAxis.setAutoRange(true);
|
hpAxis.setAutoRange(true);
|
||||||
tqAxis.setAutoRange(true);
|
tqAxis.setAutoRange(true);
|
||||||
double rangeMin = Math.min(tqAxis.getLowerBound(), hpAxis.getLowerBound());
|
double rangeMin = Math.min(tqAxis.getLowerBound(), hpAxis.getLowerBound());
|
||||||
double yMin = Math.round(rangeMin);
|
double yMin = Math.round(rangeMin);
|
||||||
double ySpace = (hpAxis.getUpperBound() - hpAxis.getLowerBound()) / 25;
|
double ySpace = (hpAxis.getUpperBound() - hpAxis.getLowerBound()) / 25;
|
||||||
double xMin = ((plot.getDomainAxis().getUpperBound() - plot.getDomainAxis().getLowerBound()) / 7) + plot.getDomainAxis().getLowerBound();
|
double xMin = ((plot.getDomainAxis().getUpperBound() - plot.getDomainAxis().getLowerBound()) / 7) + plot.getDomainAxis().getLowerBound();
|
||||||
hpAxis.setRange(Math.round(rangeMin), Math.round(hpAxis.getUpperBound() + ySpace));
|
hpAxis.setRange(Math.round(rangeMin), Math.round(hpAxis.getUpperBound() + ySpace));
|
||||||
tqAxis.setRange(Math.round(rangeMin), Math.round(tqAxis.getUpperBound() + ySpace));
|
tqAxis.setRange(Math.round(rangeMin), Math.round(tqAxis.getUpperBound() + ySpace));
|
||||||
bestHp = new XYDrawableAnnotation(results[1], results[0], 10, 10, cd);
|
bestHp = new XYDrawableAnnotation(results[1], results[0], 10, 10, cd);
|
||||||
hpPointer.setX(results[1]);
|
hpPointer.setX(results[1]);
|
||||||
hpPointer.setY(results[0]);
|
hpPointer.setY(results[0]);
|
||||||
hpPointer.setArrowPaint(BLUE);
|
hpPointer.setArrowPaint(BLUE);
|
||||||
hpPointer.setTipRadius(7.0);
|
hpPointer.setTipRadius(7.0);
|
||||||
hpPointer.setBaseRadius(30.0);
|
hpPointer.setBaseRadius(30.0);
|
||||||
hpPointer.setFont(new Font("SansSerif", Font.BOLD, 10));
|
hpPointer.setFont(new Font("SansSerif", Font.BOLD, 10));
|
||||||
hpPointer.setPaint(BLUE);
|
hpPointer.setPaint(BLUE);
|
||||||
bestTq = new XYDrawableAnnotation(results[3], results[2], 10, 10, cd);
|
bestTq = new XYDrawableAnnotation(results[3], results[2], 10, 10, cd);
|
||||||
tqPointer.setX(results[3]);
|
tqPointer.setX(results[3]);
|
||||||
tqPointer.setY(results[2]);
|
tqPointer.setY(results[2]);
|
||||||
tqPointer.setArrowPaint(YELLOW);
|
tqPointer.setArrowPaint(YELLOW);
|
||||||
tqPointer.setTipRadius(7.0);
|
tqPointer.setTipRadius(7.0);
|
||||||
tqPointer.setBaseRadius(30.0);
|
tqPointer.setBaseRadius(30.0);
|
||||||
tqPointer.setFont(new Font("SansSerif", Font.BOLD, 10));
|
tqPointer.setFont(new Font("SansSerif", Font.BOLD, 10));
|
||||||
tqPointer.setPaint(YELLOW);
|
tqPointer.setPaint(YELLOW);
|
||||||
final XYTextAnnotation dynoResults = new XYTextAnnotation(resultStrings[1], xMin, yMin + (ySpace * 5));
|
final XYTextAnnotation dynoResults = new XYTextAnnotation(resultStrings[1], xMin, yMin + (ySpace * 5));
|
||||||
dynoResults.setPaint(RED);
|
dynoResults.setPaint(RED);
|
||||||
dynoResults.setTextAnchor(TextAnchor.BOTTOM_LEFT);
|
dynoResults.setTextAnchor(TextAnchor.BOTTOM_LEFT);
|
||||||
dynoResults.setFont(new Font("SansSerif", Font.BOLD, 14));
|
dynoResults.setFont(new Font("SansSerif", Font.BOLD, 14));
|
||||||
final XYTextAnnotation carText = new XYTextAnnotation(resultStrings[0], xMin, yMin + (ySpace * 4));
|
final XYTextAnnotation carText = new XYTextAnnotation(resultStrings[0], xMin, yMin + (ySpace * 4));
|
||||||
carText.setPaint(RED);
|
carText.setPaint(RED);
|
||||||
carText.setTextAnchor(TextAnchor.BOTTOM_LEFT);
|
carText.setTextAnchor(TextAnchor.BOTTOM_LEFT);
|
||||||
carText.setFont(new Font("SansSerif", Font.BOLD, 12));
|
carText.setFont(new Font("SansSerif", Font.BOLD, 12));
|
||||||
final XYTextAnnotation stat1 = new XYTextAnnotation(resultStrings[2], xMin, yMin + (ySpace * 3));
|
final XYTextAnnotation stat1 = new XYTextAnnotation(resultStrings[2], xMin, yMin + (ySpace * 3));
|
||||||
stat1.setPaint(RED);
|
stat1.setPaint(RED);
|
||||||
stat1.setTextAnchor(TextAnchor.BOTTOM_LEFT);
|
stat1.setTextAnchor(TextAnchor.BOTTOM_LEFT);
|
||||||
stat1.setFont(new Font("SansSerif", Font.BOLD, 12));
|
stat1.setFont(new Font("SansSerif", Font.BOLD, 12));
|
||||||
final XYTextAnnotation stat2 = new XYTextAnnotation(resultStrings[3], xMin, yMin + ySpace * 2);
|
final XYTextAnnotation stat2 = new XYTextAnnotation(resultStrings[3], xMin, yMin + ySpace * 2);
|
||||||
stat2.setPaint(RED);
|
stat2.setPaint(RED);
|
||||||
stat2.setTextAnchor(TextAnchor.BOTTOM_LEFT);
|
stat2.setTextAnchor(TextAnchor.BOTTOM_LEFT);
|
||||||
stat2.setFont(new Font("SansSerif", Font.BOLD, 12));
|
stat2.setFont(new Font("SansSerif", Font.BOLD, 12));
|
||||||
final XYTextAnnotation stat3 = new XYTextAnnotation(resultStrings[4], xMin, yMin + ySpace);
|
final XYTextAnnotation stat3 = new XYTextAnnotation(resultStrings[4], xMin, yMin + ySpace);
|
||||||
stat3.setPaint(RED);
|
stat3.setPaint(RED);
|
||||||
stat3.setTextAnchor(TextAnchor.BOTTOM_LEFT);
|
stat3.setTextAnchor(TextAnchor.BOTTOM_LEFT);
|
||||||
stat3.setFont(new Font("SansSerif", Font.BOLD, 12));
|
stat3.setFont(new Font("SansSerif", Font.BOLD, 12));
|
||||||
final XYTextAnnotation stat4 = new XYTextAnnotation(resultStrings[5], xMin, yMin);
|
final XYTextAnnotation stat4 = new XYTextAnnotation(resultStrings[5], xMin, yMin);
|
||||||
stat4.setPaint(RED);
|
stat4.setPaint(RED);
|
||||||
stat4.setTextAnchor(TextAnchor.BOTTOM_LEFT);
|
stat4.setTextAnchor(TextAnchor.BOTTOM_LEFT);
|
||||||
stat4.setFont(new Font("SansSerif", Font.BOLD, 12));
|
stat4.setFont(new Font("SansSerif", Font.BOLD, 12));
|
||||||
if (!refStat.equals(" ")) {
|
if (!refStat.equals(" ")) {
|
||||||
refStat.setX(plot.getDomainAxis().getLowerBound() + 10);
|
refStat.setX(plot.getDomainAxis().getLowerBound() + 10);
|
||||||
refStat.setY(hpAxis.getUpperBound());
|
refStat.setY(hpAxis.getUpperBound());
|
||||||
plot.addAnnotation(refStat);
|
plot.addAnnotation(refStat);
|
||||||
}
|
}
|
||||||
rendererY1.addAnnotation(bestHp);
|
rendererY1.addAnnotation(bestHp);
|
||||||
rendererY2.addAnnotation(bestTq);
|
rendererY2.addAnnotation(bestTq);
|
||||||
rendererY1.addAnnotation(hpPointer);
|
rendererY1.addAnnotation(hpPointer);
|
||||||
rendererY2.addAnnotation(tqPointer);
|
rendererY2.addAnnotation(tqPointer);
|
||||||
plot.addAnnotation(dynoResults);
|
plot.addAnnotation(dynoResults);
|
||||||
plot.addAnnotation(carText);
|
plot.addAnnotation(carText);
|
||||||
plot.addAnnotation(stat1);
|
plot.addAnnotation(stat1);
|
||||||
plot.addAnnotation(stat2);
|
plot.addAnnotation(stat2);
|
||||||
plot.addAnnotation(stat3);
|
plot.addAnnotation(stat3);
|
||||||
plot.addAnnotation(stat4);
|
plot.addAnnotation(stat4);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateEtResults(String carInfo, double[] etResults, String units) {
|
public void updateEtResults(String carInfo, double[] etResults, String units) {
|
||||||
String s60Text = "60 ft";
|
String s60Text = "60 ft";
|
||||||
String s330Text = "330 ft";
|
String s330Text = "330 ft";
|
||||||
String s660Text = "1/2 track";
|
String s660Text = "1/2 track";
|
||||||
String s1000Text = "1,000 ft";
|
String s1000Text = "1,000 ft";
|
||||||
String s1320Text = "1/4 mile";
|
String s1320Text = "1/4 mile";
|
||||||
String zTo60Text = "60 mph";
|
String zTo60Text = "60 mph";
|
||||||
if (units.equalsIgnoreCase("kph")) {
|
if (units.equalsIgnoreCase("km/h")) {
|
||||||
s60Text = "18.3m";
|
s60Text = "18.3m";
|
||||||
s330Text = "100m";
|
s330Text = "100m";
|
||||||
s1000Text = "305m";
|
s1000Text = "305m";
|
||||||
s1320Text = "402m";
|
s1320Text = "402m";
|
||||||
zTo60Text = "97 kph";
|
zTo60Text = "97 km/h";
|
||||||
}
|
}
|
||||||
hpAxis.setLabel("Vehicle Speed (" + units + ")");
|
hpAxis.setLabel("Vehicle Speed (" + units + ")");
|
||||||
String[] car = carInfo.split(";");
|
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;
|
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 ySpace = hpAxis.getUpperBound() / 25;
|
||||||
double xMin = ((plot.getDomainAxis().getUpperBound() - plot.getDomainAxis().getLowerBound()) / 7) + plot.getDomainAxis().getLowerBound();
|
double xMin = ((plot.getDomainAxis().getUpperBound() - plot.getDomainAxis().getLowerBound()) / 7) + plot.getDomainAxis().getLowerBound();
|
||||||
tqAxis.setRange(hpAxis.getLowerBound(), hpAxis.getUpperBound());
|
tqAxis.setRange(hpAxis.getLowerBound(), hpAxis.getUpperBound());
|
||||||
final XYAnnotation s60Marker = new XYDrawableAnnotation(etResults[0], etResults[1], 10, 10, cd);
|
final XYAnnotation s60Marker = new XYDrawableAnnotation(etResults[0], etResults[1], 10, 10, cd);
|
||||||
final XYTextAnnotation s60Label = new XYTextAnnotation(s60Text, etResults[0], (etResults[1] + ySpace));
|
final XYTextAnnotation s60Label = new XYTextAnnotation(s60Text, etResults[0], (etResults[1] + ySpace));
|
||||||
s60Label.setPaint(RED);
|
s60Label.setPaint(RED);
|
||||||
s60Label.setTextAnchor(TextAnchor.TOP_RIGHT);
|
s60Label.setTextAnchor(TextAnchor.TOP_RIGHT);
|
||||||
s60Label.setFont(new Font("SansSerif", Font.BOLD, 10));
|
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));
|
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.setPaint(RED);
|
||||||
s60Time.setTextAnchor(TextAnchor.BOTTOM_LEFT);
|
s60Time.setTextAnchor(TextAnchor.BOTTOM_LEFT);
|
||||||
s60Time.setFont(new Font("SansSerif", Font.BOLD, 10));
|
s60Time.setFont(new Font("SansSerif", Font.BOLD, 10));
|
||||||
final XYAnnotation s330Marker = new XYDrawableAnnotation(etResults[2], etResults[3], 10, 10, cd);
|
final XYAnnotation s330Marker = new XYDrawableAnnotation(etResults[2], etResults[3], 10, 10, cd);
|
||||||
final XYTextAnnotation s330Label = new XYTextAnnotation(s330Text, etResults[2], (etResults[3] + ySpace));
|
final XYTextAnnotation s330Label = new XYTextAnnotation(s330Text, etResults[2], (etResults[3] + ySpace));
|
||||||
s330Label.setPaint(RED);
|
s330Label.setPaint(RED);
|
||||||
s330Label.setTextAnchor(TextAnchor.TOP_RIGHT);
|
s330Label.setTextAnchor(TextAnchor.TOP_RIGHT);
|
||||||
s330Label.setFont(new Font("SansSerif", Font.BOLD, 10));
|
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));
|
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.setPaint(RED);
|
||||||
s330Time.setTextAnchor(TextAnchor.BOTTOM_LEFT);
|
s330Time.setTextAnchor(TextAnchor.BOTTOM_LEFT);
|
||||||
s330Time.setFont(new Font("SansSerif", Font.BOLD, 10));
|
s330Time.setFont(new Font("SansSerif", Font.BOLD, 10));
|
||||||
final XYAnnotation s660Marker = new XYDrawableAnnotation(etResults[4], etResults[5], 10, 10, cd);
|
final XYAnnotation s660Marker = new XYDrawableAnnotation(etResults[4], etResults[5], 10, 10, cd);
|
||||||
final XYTextAnnotation s660Label = new XYTextAnnotation(s660Text, etResults[4], (etResults[5] + ySpace));
|
final XYTextAnnotation s660Label = new XYTextAnnotation(s660Text, etResults[4], (etResults[5] + ySpace));
|
||||||
s660Label.setPaint(RED);
|
s660Label.setPaint(RED);
|
||||||
s660Label.setTextAnchor(TextAnchor.TOP_RIGHT);
|
s660Label.setTextAnchor(TextAnchor.TOP_RIGHT);
|
||||||
s660Label.setFont(new Font("SansSerif", Font.BOLD, 10));
|
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));
|
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.setPaint(RED);
|
||||||
s660Time.setTextAnchor(TextAnchor.BOTTOM_LEFT);
|
s660Time.setTextAnchor(TextAnchor.BOTTOM_LEFT);
|
||||||
s660Time.setFont(new Font("SansSerif", Font.BOLD, 10));
|
s660Time.setFont(new Font("SansSerif", Font.BOLD, 10));
|
||||||
final XYAnnotation s1000Marker = new XYDrawableAnnotation(etResults[6], etResults[7], 10, 10, cd);
|
final XYAnnotation s1000Marker = new XYDrawableAnnotation(etResults[6], etResults[7], 10, 10, cd);
|
||||||
final XYTextAnnotation s1000Label = new XYTextAnnotation(s1000Text, etResults[6], (etResults[7] + ySpace));
|
final XYTextAnnotation s1000Label = new XYTextAnnotation(s1000Text, etResults[6], (etResults[7] + ySpace));
|
||||||
s1000Label.setPaint(RED);
|
s1000Label.setPaint(RED);
|
||||||
s1000Label.setTextAnchor(TextAnchor.TOP_RIGHT);
|
s1000Label.setTextAnchor(TextAnchor.TOP_RIGHT);
|
||||||
s1000Label.setFont(new Font("SansSerif", Font.BOLD, 10));
|
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));
|
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.setPaint(RED);
|
||||||
s1000Time.setTextAnchor(TextAnchor.BOTTOM_LEFT);
|
s1000Time.setTextAnchor(TextAnchor.BOTTOM_LEFT);
|
||||||
s1000Time.setFont(new Font("SansSerif", Font.BOLD, 10));
|
s1000Time.setFont(new Font("SansSerif", Font.BOLD, 10));
|
||||||
final XYAnnotation s1320Marker = new XYDrawableAnnotation(etResults[8], etResults[9], 10, 10, cd);
|
final XYAnnotation s1320Marker = new XYDrawableAnnotation(etResults[8], etResults[9], 10, 10, cd);
|
||||||
final XYTextAnnotation s1320Label = new XYTextAnnotation(s1320Text, etResults[8], (etResults[9] - ySpace));
|
final XYTextAnnotation s1320Label = new XYTextAnnotation(s1320Text, etResults[8], (etResults[9] - ySpace));
|
||||||
s1320Label.setPaint(RED);
|
s1320Label.setPaint(RED);
|
||||||
s1320Label.setTextAnchor(TextAnchor.BOTTOM_CENTER);
|
s1320Label.setTextAnchor(TextAnchor.BOTTOM_CENTER);
|
||||||
s1320Label.setFont(new Font("SansSerif", Font.BOLD, 10));
|
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]);
|
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.setPaint(RED);
|
||||||
s1320Time.setTextAnchor(TextAnchor.CENTER_RIGHT);
|
s1320Time.setTextAnchor(TextAnchor.CENTER_RIGHT);
|
||||||
s1320Time.setFont(new Font("SansSerif", Font.BOLD, 10));
|
s1320Time.setFont(new Font("SansSerif", Font.BOLD, 10));
|
||||||
final XYTextAnnotation carText = new XYTextAnnotation(car[0], (plot.getDomainAxis().getUpperBound() - 0.2), (hpAxis.getLowerBound() + ySpace));
|
final XYTextAnnotation carText = new XYTextAnnotation(car[0], (plot.getDomainAxis().getUpperBound() - 0.2), (hpAxis.getLowerBound() + ySpace));
|
||||||
carText.setPaint(RED);
|
carText.setPaint(RED);
|
||||||
carText.setTextAnchor(TextAnchor.BOTTOM_RIGHT);
|
carText.setTextAnchor(TextAnchor.BOTTOM_RIGHT);
|
||||||
carText.setFont(new Font("SansSerif", Font.BOLD, 12));
|
carText.setFont(new Font("SansSerif", Font.BOLD, 12));
|
||||||
final XYAnnotation zTo60Marker = new XYDrawableAnnotation(etResults[10], etResults[11], 10, 10, cdGreen);
|
final XYAnnotation zTo60Marker = new XYDrawableAnnotation(etResults[10], etResults[11], 10, 10, cdGreen);
|
||||||
final XYTextAnnotation zTo60Label = new XYTextAnnotation(zTo60Text, etResults[10], (etResults[11] + ySpace));
|
final XYTextAnnotation zTo60Label = new XYTextAnnotation(zTo60Text, etResults[10], (etResults[11] + ySpace));
|
||||||
zTo60Label.setPaint(GREEN);
|
zTo60Label.setPaint(GREEN);
|
||||||
zTo60Label.setTextAnchor(TextAnchor.TOP_RIGHT);
|
zTo60Label.setTextAnchor(TextAnchor.TOP_RIGHT);
|
||||||
zTo60Label.setFont(new Font("SansSerif", Font.BOLD, 10));
|
zTo60Label.setFont(new Font("SansSerif", Font.BOLD, 10));
|
||||||
final XYTextAnnotation zTo60Time = new XYTextAnnotation((String.format("%1.3f", etResults[10]) + "\""), etResults[10], (etResults[11] - ySpace));
|
final XYTextAnnotation zTo60Time = new XYTextAnnotation((String.format("%1.3f", etResults[10]) + "\""), etResults[10], (etResults[11] - ySpace));
|
||||||
zTo60Time.setPaint(GREEN);
|
zTo60Time.setPaint(GREEN);
|
||||||
zTo60Time.setTextAnchor(TextAnchor.BOTTOM_LEFT);
|
zTo60Time.setTextAnchor(TextAnchor.BOTTOM_LEFT);
|
||||||
zTo60Time.setFont(new Font("SansSerif", Font.BOLD, 10));
|
zTo60Time.setFont(new Font("SansSerif", Font.BOLD, 10));
|
||||||
plot.addAnnotation(s60Marker);
|
plot.addAnnotation(s60Marker);
|
||||||
plot.addAnnotation(s60Label);
|
plot.addAnnotation(s60Label);
|
||||||
plot.addAnnotation(s60Time);
|
plot.addAnnotation(s60Time);
|
||||||
plot.addAnnotation(s330Marker);
|
plot.addAnnotation(s330Marker);
|
||||||
plot.addAnnotation(s330Label);
|
plot.addAnnotation(s330Label);
|
||||||
plot.addAnnotation(s330Time);
|
plot.addAnnotation(s330Time);
|
||||||
plot.addAnnotation(s660Marker);
|
plot.addAnnotation(s660Marker);
|
||||||
plot.addAnnotation(s660Label);
|
plot.addAnnotation(s660Label);
|
||||||
plot.addAnnotation(s660Time);
|
plot.addAnnotation(s660Time);
|
||||||
plot.addAnnotation(s1000Marker);
|
plot.addAnnotation(s1000Marker);
|
||||||
plot.addAnnotation(s1000Label);
|
plot.addAnnotation(s1000Label);
|
||||||
plot.addAnnotation(s1000Time);
|
plot.addAnnotation(s1000Time);
|
||||||
plot.addAnnotation(s1320Marker);
|
plot.addAnnotation(s1320Marker);
|
||||||
plot.addAnnotation(s1320Label);
|
plot.addAnnotation(s1320Label);
|
||||||
plot.addAnnotation(s1320Time);
|
plot.addAnnotation(s1320Time);
|
||||||
plot.addAnnotation(carText);
|
plot.addAnnotation(carText);
|
||||||
plot.addAnnotation(zTo60Marker);
|
plot.addAnnotation(zTo60Marker);
|
||||||
plot.addAnnotation(zTo60Label);
|
plot.addAnnotation(zTo60Label);
|
||||||
plot.addAnnotation(zTo60Time);
|
plot.addAnnotation(zTo60Time);
|
||||||
}
|
}
|
||||||
|
|
||||||
public double[] getPolynomialCoefficients(XYTrendline trendSeries) {
|
public double[] getPolynomialCoefficients(XYTrendline trendSeries) {
|
||||||
Polyfit fit = trendSeries.getPolyFit();
|
Polyfit fit = trendSeries.getPolyFit();
|
||||||
return fit.getPolynomialCoefficients();
|
return fit.getPolynomialCoefficients();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addChart() {
|
private void addChart() {
|
||||||
ChartPanel chartPanel = new ChartPanel(createChart(), false, true, true, true, true);
|
ChartPanel chartPanel = new ChartPanel(createChart(), false, true, true, true, true);
|
||||||
chartPanel.setMinimumSize(new Dimension(400, 300));
|
chartPanel.setMinimumSize(new Dimension(400, 300));
|
||||||
chartPanel.setPreferredSize(new Dimension(500, 400));
|
chartPanel.setPreferredSize(new Dimension(500, 400));
|
||||||
add(chartPanel);
|
add(chartPanel);
|
||||||
SpringUtilities.makeCompactGrid(this, 1, 1, 2, 2, 2, 2);
|
SpringUtilities.makeCompactGrid(this, 1, 1, 2, 2, 2, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
private JFreeChart createChart() {
|
private JFreeChart createChart() {
|
||||||
JFreeChart chart = createScatterPlot(null, labelX, labelY1, null, VERTICAL, false, true, false);
|
JFreeChart chart = createScatterPlot(null, labelX, labelY1, null, VERTICAL, false, true, false);
|
||||||
chart.setBackgroundPaint(BLACK);
|
chart.setBackgroundPaint(BLACK);
|
||||||
configurePlot(chart);
|
configurePlot(chart);
|
||||||
addSeries1(chart, 0, data, BLUE);
|
addSeries1(chart, 0, data, BLUE);
|
||||||
addSeries2(chart, 1, data1, YELLOW);
|
addSeries2(chart, 1, data1, YELLOW);
|
||||||
addRef(chart, 2, hpRef, BLUE);
|
addRef(chart, 2, hpRef, BLUE);
|
||||||
addRef(chart, 3, tqRef, YELLOW);
|
addRef(chart, 3, tqRef, YELLOW);
|
||||||
return chart;
|
return chart;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void configurePlot(JFreeChart chart) {
|
private void configurePlot(JFreeChart chart) {
|
||||||
plot = chart.getXYPlot();
|
plot = chart.getXYPlot();
|
||||||
plot.setOutlinePaint(DARK_GREY);
|
plot.setOutlinePaint(DARK_GREY);
|
||||||
plot.setBackgroundPaint(BLACK);
|
plot.setBackgroundPaint(BLACK);
|
||||||
// X axis settings
|
// X axis settings
|
||||||
plot.setDomainAxisLocation(AxisLocation.BOTTOM_OR_RIGHT);
|
plot.setDomainAxisLocation(AxisLocation.BOTTOM_OR_RIGHT);
|
||||||
plot.getDomainAxis().setLabelPaint(WHITE);
|
plot.getDomainAxis().setLabelPaint(WHITE);
|
||||||
plot.getDomainAxis().setTickLabelPaint(LIGHT_GREY);
|
plot.getDomainAxis().setTickLabelPaint(LIGHT_GREY);
|
||||||
plot.setDomainGridlinePaint(DARK_GREY);
|
plot.setDomainGridlinePaint(DARK_GREY);
|
||||||
// Y1 axis (left) settings
|
// Y1 axis (left) settings
|
||||||
hpAxis.setLabel(labelY1);
|
hpAxis.setLabel(labelY1);
|
||||||
hpAxis.setLabelPaint(BLUE);
|
hpAxis.setLabelPaint(BLUE);
|
||||||
hpAxis.setTickLabelPaint(LIGHT_GREY);
|
hpAxis.setTickLabelPaint(LIGHT_GREY);
|
||||||
hpAxis.setAutoRangeIncludesZero(false);
|
hpAxis.setAutoRangeIncludesZero(false);
|
||||||
hpAxis.setAutoRange(true);
|
hpAxis.setAutoRange(true);
|
||||||
plot.setRangeAxis(0, hpAxis);
|
plot.setRangeAxis(0, hpAxis);
|
||||||
plot.setRangeAxisLocation(0, AxisLocation.TOP_OR_LEFT);
|
plot.setRangeAxisLocation(0, AxisLocation.TOP_OR_LEFT);
|
||||||
plot.mapDatasetToRangeAxis(0, 0);
|
plot.mapDatasetToRangeAxis(0, 0);
|
||||||
plot.mapDatasetToRangeAxis(2, 0);
|
plot.mapDatasetToRangeAxis(2, 0);
|
||||||
// Y2 axis (right) settings
|
// Y2 axis (right) settings
|
||||||
tqAxis.setLabel(labelY2);
|
tqAxis.setLabel(labelY2);
|
||||||
tqAxis.setLabelPaint(YELLOW);
|
tqAxis.setLabelPaint(YELLOW);
|
||||||
tqAxis.setTickLabelPaint(LIGHT_GREY);
|
tqAxis.setTickLabelPaint(LIGHT_GREY);
|
||||||
tqAxis.setAutoRangeIncludesZero(false);
|
tqAxis.setAutoRangeIncludesZero(false);
|
||||||
tqAxis.setAutoRange(true);
|
tqAxis.setAutoRange(true);
|
||||||
plot.setRangeAxis(1, tqAxis);
|
plot.setRangeAxis(1, tqAxis);
|
||||||
plot.setRangeAxisLocation(1, AxisLocation.BOTTOM_OR_RIGHT);
|
plot.setRangeAxisLocation(1, AxisLocation.BOTTOM_OR_RIGHT);
|
||||||
plot.mapDatasetToRangeAxis(1, 1);
|
plot.mapDatasetToRangeAxis(1, 1);
|
||||||
plot.mapDatasetToRangeAxis(3, 1);
|
plot.mapDatasetToRangeAxis(3, 1);
|
||||||
plot.setRangeGridlinePaint(DARK_GREY);
|
plot.setRangeGridlinePaint(DARK_GREY);
|
||||||
refStat.setPaint(WHITE);
|
refStat.setPaint(WHITE);
|
||||||
refStat.setTextAnchor(TextAnchor.TOP_LEFT);
|
refStat.setTextAnchor(TextAnchor.TOP_LEFT);
|
||||||
refStat.setFont(new Font("SansSerif", Font.BOLD, 12));
|
refStat.setFont(new Font("SansSerif", Font.BOLD, 12));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setET() {
|
public void setET() {
|
||||||
clear();
|
clear();
|
||||||
plot.getDomainAxis().setLabel("Time (seconds)");
|
plot.getDomainAxis().setLabel("Time (seconds)");
|
||||||
hpAxis.setLabel("Vehicle Speed");
|
hpAxis.setLabel("Vehicle Speed");
|
||||||
tqAxis.setLabel(" ");
|
tqAxis.setLabel(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDyno() {
|
public void setDyno() {
|
||||||
clear();
|
clear();
|
||||||
plot.getDomainAxis().setLabel("Engine Speed (RPM)");
|
plot.getDomainAxis().setLabel("Engine Speed (RPM)");
|
||||||
hpAxis.setLabel("Calculated Wheel Power");
|
hpAxis.setLabel("Calculated Wheel Power");
|
||||||
tqAxis.setLabel("Calculated Engine Torque");
|
tqAxis.setLabel("Calculated Engine Torque");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startPrompt(String select) {
|
public void startPrompt(String select) {
|
||||||
String startPrompt = START_PROMPT;
|
String startPrompt = START_PROMPT;
|
||||||
if (select.equalsIgnoreCase("mph")) startPrompt = ET_PROMPT_I;
|
if (select.equalsIgnoreCase("mph")) startPrompt = ET_PROMPT_I;
|
||||||
if (select.equalsIgnoreCase("kph")) startPrompt = ET_PROMPT_M;
|
if (select.equalsIgnoreCase("km/h")) startPrompt = ET_PROMPT_M;
|
||||||
final double x = ((plot.getDomainAxis().getUpperBound() - plot.getDomainAxis().getLowerBound()) / 2) + plot.getDomainAxis().getLowerBound();
|
final double x = ((plot.getDomainAxis().getUpperBound() - plot.getDomainAxis().getLowerBound()) / 2) + plot.getDomainAxis().getLowerBound();
|
||||||
final double y = ((hpAxis.getUpperBound() - hpAxis.getLowerBound()) / 2) + hpAxis.getLowerBound();
|
final double y = ((hpAxis.getUpperBound() - hpAxis.getLowerBound()) / 2) + hpAxis.getLowerBound();
|
||||||
final XYTextAnnotation startMessage = new XYTextAnnotation(startPrompt, x, y);
|
final XYTextAnnotation startMessage = new XYTextAnnotation(startPrompt, x, y);
|
||||||
startMessage.setPaint(GREEN);
|
startMessage.setPaint(GREEN);
|
||||||
startMessage.setTextAnchor(TextAnchor.BOTTOM_CENTER);
|
startMessage.setTextAnchor(TextAnchor.BOTTOM_CENTER);
|
||||||
startMessage.setFont(new Font("Arial", Font.BOLD, 20));
|
startMessage.setFont(new Font("Arial", Font.BOLD, 20));
|
||||||
plot.addAnnotation(startMessage);
|
plot.addAnnotation(startMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clearPrompt() {
|
public void clearPrompt() {
|
||||||
plot.clearAnnotations();
|
plot.clearAnnotations();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addSeries1(JFreeChart chart, int index, XYSeries series, Color color) {
|
private void addSeries1(JFreeChart chart, int index, XYSeries series, Color color) {
|
||||||
XYDataset dataset = new XYSeriesCollection(series);
|
XYDataset dataset = new XYSeriesCollection(series);
|
||||||
XYPlot plot = chart.getXYPlot();
|
XYPlot plot = chart.getXYPlot();
|
||||||
plot.setDataset(index, dataset);
|
plot.setDataset(index, dataset);
|
||||||
plot.setRenderer(index, buildTrendLineRendererY1(color));
|
plot.setRenderer(index, buildTrendLineRendererY1(color));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addSeries2(JFreeChart chart, int index, XYSeries series, Color color) {
|
private void addSeries2(JFreeChart chart, int index, XYSeries series, Color color) {
|
||||||
XYDataset dataset = new XYSeriesCollection(series);
|
XYDataset dataset = new XYSeriesCollection(series);
|
||||||
XYPlot plot = chart.getXYPlot();
|
XYPlot plot = chart.getXYPlot();
|
||||||
plot.setDataset(index, dataset);
|
plot.setDataset(index, dataset);
|
||||||
plot.setRenderer(index, buildTrendLineRendererY2(color));
|
plot.setRenderer(index, buildTrendLineRendererY2(color));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addRef(JFreeChart chart, int index, XYSeries series, Color color) {
|
private void addRef(JFreeChart chart, int index, XYSeries series, Color color) {
|
||||||
XYDataset dataset = new XYSeriesCollection(series);
|
XYDataset dataset = new XYSeriesCollection(series);
|
||||||
XYPlot plot = chart.getXYPlot();
|
XYPlot plot = chart.getXYPlot();
|
||||||
plot.setDataset(index, dataset);
|
plot.setDataset(index, dataset);
|
||||||
plot.setRenderer(index, buildTrendLineRenderer(color));
|
plot.setRenderer(index, buildTrendLineRenderer(color));
|
||||||
}
|
}
|
||||||
|
|
||||||
private StandardXYItemRenderer buildTrendLineRenderer(Color color) {
|
private StandardXYItemRenderer buildTrendLineRenderer(Color color) {
|
||||||
StandardXYItemRenderer renderer = new StandardXYItemRenderer();
|
StandardXYItemRenderer renderer = new StandardXYItemRenderer();
|
||||||
renderer.setSeriesPaint(0, color);
|
renderer.setSeriesPaint(0, color);
|
||||||
float dash[] = {2.0f};
|
float dash[] = {2.0f};
|
||||||
renderer.setSeriesStroke(0, new BasicStroke(0.8f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, dash, 0.0f));
|
renderer.setSeriesStroke(0, new BasicStroke(0.8f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, dash, 0.0f));
|
||||||
return renderer;
|
return renderer;
|
||||||
}
|
}
|
||||||
|
|
||||||
private StandardXYItemRenderer buildTrendLineRendererY1(Color color) {
|
private StandardXYItemRenderer buildTrendLineRendererY1(Color color) {
|
||||||
rendererY1.setSeriesPaint(0, color);
|
rendererY1.setSeriesPaint(0, color);
|
||||||
rendererY1.setSeriesStroke(0, new BasicStroke(1.6f));
|
rendererY1.setSeriesStroke(0, new BasicStroke(1.6f));
|
||||||
return rendererY1;
|
return rendererY1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private StandardXYItemRenderer buildTrendLineRendererY2(Color color) {
|
private StandardXYItemRenderer buildTrendLineRendererY2(Color color) {
|
||||||
rendererY2.setSeriesPaint(0, color);
|
rendererY2.setSeriesPaint(0, color);
|
||||||
rendererY2.setSeriesStroke(0, new BasicStroke(1.6f));
|
rendererY2.setSeriesStroke(0, new BasicStroke(1.6f));
|
||||||
return rendererY2;
|
return rendererY2;
|
||||||
}
|
}
|
||||||
}
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,72 +1,72 @@
|
||||||
/*
|
/*
|
||||||
* RomRaider Open-Source Tuning, Logging and Reflashing
|
* RomRaider Open-Source Tuning, Logging and Reflashing
|
||||||
* Copyright (C) 2006-2012 RomRaider.com
|
* Copyright (C) 2006-2012 RomRaider.com
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License along
|
* You should have received a copy of the GNU General Public License along
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.romraider.logger.external.plx.plugin;
|
package com.romraider.logger.external.plx.plugin;
|
||||||
|
|
||||||
import com.romraider.logger.ecu.ui.handler.dash.GaugeMinMax;
|
import com.romraider.logger.ecu.ui.handler.dash.GaugeMinMax;
|
||||||
import com.romraider.logger.external.core.ExternalSensorConversions;
|
import com.romraider.logger.external.core.ExternalSensorConversions;
|
||||||
|
|
||||||
public enum PlxSensorConversions implements ExternalSensorConversions {
|
public enum PlxSensorConversions implements ExternalSensorConversions {
|
||||||
LAMBDA ("Lambda", "(x/3.75+68)/100", "0.00", new GaugeMinMax(0.6,1.4,0.08)),
|
LAMBDA ("Lambda", "(x/3.75+68)/100", "0.00", new GaugeMinMax(0.6,1.4,0.08)),
|
||||||
AFR_147 ("AFR Gasoline", "(x/2.55+100)/10", "0.00", new GaugeMinMax(9,20,1)), // gasoline
|
AFR_147 ("AFR Gasoline", "(x/2.55+100)/10", "0.00", new GaugeMinMax(9,20,1)), // gasoline
|
||||||
AFR_90 ("AFR Ethonal", "(x/4.167+61.7)/10", "0.00", new GaugeMinMax(5,12,1)), // ethanol
|
AFR_90 ("AFR Ethonal", "(x/4.167+61.7)/10", "0.00", new GaugeMinMax(5,12,1)), // ethanol
|
||||||
AFR_146 ("AFR Diesel", "(x/2.58+100)/10", "0.00", new GaugeMinMax(9,20,1)), // diesel
|
AFR_146 ("AFR Diesel", "(x/2.58+100)/10", "0.00", new GaugeMinMax(9,20,1)), // diesel
|
||||||
AFR_64 ("AFR Methonal", "(x/5.856+43.5)/10", "0.00", new GaugeMinMax(4,9,1)),// methanol
|
AFR_64 ("AFR Methonal", "(x/5.856+43.5)/10", "0.00", new GaugeMinMax(4,9,1)),// methanol
|
||||||
AFR_155 ("AFR LPG", "(x/2.417+105.6)/10", "0.00", new GaugeMinMax(9,20,1)), // LPG
|
AFR_155 ("AFR LPG", "(x/2.417+105.6)/10", "0.00", new GaugeMinMax(9,20,1)), // LPG
|
||||||
AFR_172 ("AFR CNG", "(x/2.18+117)/10", "0.00", new GaugeMinMax(9,20,1)), // CNG
|
AFR_172 ("AFR CNG", "(x/2.18+117)/10", "0.00", new GaugeMinMax(9,20,1)), // CNG
|
||||||
AFR_34 ("AFR Hydrogen", "(x/3.75+68)*0.34", "0.00", new GaugeMinMax(20,46,2.5)), // Hydrogen
|
AFR_34 ("AFR Hydrogen", "(x/3.75+68)*0.34", "0.00", new GaugeMinMax(20,46,2.5)), // Hydrogen
|
||||||
VACUUM_IN ("in/Hg", "-(x/11.39-29.93)", "0.00", new GaugeMinMax(-20,0,2)),
|
VACUUM_IN ("in/Hg", "-(x/11.39-29.93)", "0.00", new GaugeMinMax(-20,0,2)),
|
||||||
VACUUM_MM ("mm/Hg", "-(x*2.23+760.4)", "0.00", new GaugeMinMax(-500,0,50)),
|
VACUUM_MM ("mm/Hg", "-(x*2.23+760.4)", "0.00", new GaugeMinMax(-500,0,50)),
|
||||||
BOOST_PSI ("psi", "x/22.73", "0.00", new GaugeMinMax(-10,30,5)),
|
BOOST_PSI ("psi", "x/22.73", "0.00", new GaugeMinMax(-10,30,5)),
|
||||||
BOOST_BAR ("bar", "x*0.00303333", "0.00", new GaugeMinMax(-0.5,2.5,0.3)), // converts from PSI to bar
|
BOOST_BAR ("bar", "x*0.00303333", "0.00", new GaugeMinMax(-0.5,2.5,0.3)), // converts from PSI to bar
|
||||||
BOOST_KPA ("kPa", "x*0.30333292", "0.0", new GaugeMinMax(98,120,2)), // converts from PSI to kpa
|
BOOST_KPA ("kPa", "x*0.30333292", "0.0", new GaugeMinMax(98,120,2)), // converts from PSI to kpa
|
||||||
BOOST_KGCM2 ("kg/cm^2", "x/329.47", "0.00", new GaugeMinMax(-0.5,2.5,0.3)),
|
BOOST_KGCM2 ("kg/cm^2", "x/329.47", "0.00", new GaugeMinMax(-0.5,2.5,0.3)),
|
||||||
RPM ("rpm", "x*19.55", "0", new GaugeMinMax(0,10000,1000)),
|
RPM ("rpm", "x*19.55", "0", new GaugeMinMax(0,10000,1000)),
|
||||||
MPH ("mph", "x/6.39", "0.0", new GaugeMinMax(0,200,20)),
|
MPH ("mph", "x/6.39", "0.0", new GaugeMinMax(0,200,20)),
|
||||||
KPH ("kph", "x/3.97", "0.0", new GaugeMinMax(0,300,30)),
|
KPH ("km/h", "x/3.97", "0.0", new GaugeMinMax(0,300,30)),
|
||||||
FLUID_PSI ("psi", "x/5.115", "0.00", new GaugeMinMax(0,150,15)),
|
FLUID_PSI ("psi", "x/5.115", "0.00", new GaugeMinMax(0,150,15)),
|
||||||
FLUID_BAR ("bar", "x/74.22", "0.00", new GaugeMinMax(0,10,1)),
|
FLUID_BAR ("bar", "x/74.22", "0.00", new GaugeMinMax(0,10,1)),
|
||||||
FLUID_KPA ("kPa", "x*1.34794864", "0.00", new GaugeMinMax(0,1035,100)), // converts from PSI to kpa
|
FLUID_KPA ("kPa", "x*1.34794864", "0.00", new GaugeMinMax(0,1035,100)), // converts from PSI to kpa
|
||||||
FLUID_KGCM2 ("kg/cm^2", "x/72.73", "0.00", new GaugeMinMax(0,10,1)),
|
FLUID_KGCM2 ("kg/cm^2", "x/72.73", "0.00", new GaugeMinMax(0,10,1)),
|
||||||
DEGREES ("deg", "x-64", "0.00", new GaugeMinMax(-10,50,5)),
|
DEGREES ("deg", "x-64", "0.00", new GaugeMinMax(-10,50,5)),
|
||||||
FUEL_TRIM ("%", "x-100", "0.00", new GaugeMinMax(-30,30,5)),
|
FUEL_TRIM ("%", "x-100", "0.00", new GaugeMinMax(-30,30,5)),
|
||||||
NB_P ("%", "x", "0.00", new GaugeMinMax(0,100,10)),
|
NB_P ("%", "x", "0.00", new GaugeMinMax(0,100,10)),
|
||||||
NB_V ("vdc", "x/78.43", "0.00", new GaugeMinMax(-5,5,1)),
|
NB_V ("vdc", "x/78.43", "0.00", new GaugeMinMax(-5,5,1)),
|
||||||
BATTERY ("vdc", "x/51.15", "0.00", new GaugeMinMax(0,12,1)),
|
BATTERY ("vdc", "x/51.15", "0.00", new GaugeMinMax(0,12,1)),
|
||||||
KNOCK_VDC ("vdc", "x/204.6", "0.00", new GaugeMinMax(0,5,0.5)),
|
KNOCK_VDC ("vdc", "x/204.6", "0.00", new GaugeMinMax(0,5,0.5)),
|
||||||
DC_POS ("+%", "x/10.23", "0.0", new GaugeMinMax(0,100,10)),
|
DC_POS ("+%", "x/10.23", "0.0", new GaugeMinMax(0,100,10)),
|
||||||
DC_NEG ("-%", "100-(x/10.23)", "0.0", new GaugeMinMax(-100,0,10));
|
DC_NEG ("-%", "100-(x/10.23)", "0.0", new GaugeMinMax(-100,0,10));
|
||||||
|
|
||||||
private final String units;
|
private final String units;
|
||||||
private final String expression;
|
private final String expression;
|
||||||
private final String format;
|
private final String format;
|
||||||
private final GaugeMinMax gaugeMinMax;
|
private final GaugeMinMax gaugeMinMax;
|
||||||
|
|
||||||
PlxSensorConversions(String units, String expression, String format, GaugeMinMax gaugeMinMax) {
|
PlxSensorConversions(String units, String expression, String format, GaugeMinMax gaugeMinMax) {
|
||||||
this.units = units;
|
this.units = units;
|
||||||
this.expression = expression;
|
this.expression = expression;
|
||||||
this.format = format;
|
this.format = format;
|
||||||
this.gaugeMinMax = gaugeMinMax;
|
this.gaugeMinMax = gaugeMinMax;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String units() { return units; }
|
public String units() { return units; }
|
||||||
public String expression() { return expression; }
|
public String expression() { return expression; }
|
||||||
public String format() { return format; }
|
public String format() { return format; }
|
||||||
public GaugeMinMax gaugeMinMax() {return gaugeMinMax; }
|
public GaugeMinMax gaugeMinMax() {return gaugeMinMax; }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue