Fixed calculation problem for derived parameters with non-characters in their abbreviation. Also corrected units abbreviation.

This commit is contained in:
Dale Schultz 2012-11-13 19:12:24 -05:00
parent b423e5d3df
commit f3a06269b7
7 changed files with 2557 additions and 2556 deletions

View File

@ -23,7 +23,7 @@ public enum Constants {
IMPERIAL ("imperial"),
IMPERIAL_UNIT ("mph"),
METRIC ("metric"),
METRIC_UNIT ("kph"),
METRIC_UNIT ("km/h"),
KPH_2_MPH ("1.609344"),
TQ_CONSTANT_I ("5252.113122"),
TQ_CONSTANT_M ("9549.296748");

View File

@ -153,6 +153,7 @@ public final class EcuDerivedParameterConvertorImpl implements EcuDerivedParamet
if (convertorUnits == null || convertorUnits.length() == 0) {
return ecuDataId;
} else {
convertorUnits = convertorUnits.replaceAll("[^\\w]", "_");
return '_' + ecuDataId + '_' + convertorUnits + '_';
}
}

View File

@ -37,7 +37,7 @@ public final class EcuDerivedParameterImpl implements EcuParameter {
public EcuDerivedParameterImpl(String id, String name, String description, EcuData[] ecuDatas,
EcuDerivedParameterConvertor[] convertors) {
checkNotNullOrEmpty(name, "id");
checkNotNullOrEmpty(id, "id");
checkNotNullOrEmpty(name, "name");
checkNotNull(description, "description");
checkNotNullOrEmpty(ecuDatas, "ecuDatas");

View File

@ -38,7 +38,7 @@ public final class ConverterMaxMinDefaults {
add("bar", -1.5, 3.0, 0.5);
add("rpm", 0, 8000, 1000.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("g/s", 0.0, 400.0, 20.0);
add("v", 0.0, 5.0, 0.5);
@ -51,14 +51,14 @@ public final class ConverterMaxMinDefaults {
add("lambda", 0.5, 1.5, 0.1);
add("gear", 0.0, 6.0, 1.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("g/rev", 0.0, 4.0, 0.5);
add("g/cyl", 0.0, 2.0, 0.5);
add("multiplier", 0.0, 1.0, 0.1);
add("raw ecu value", 0.0, 16.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) {

View File

@ -254,12 +254,12 @@ public final class DynoChartPanel extends JPanel {
String s1000Text = "1,000 ft";
String s1320Text = "1/4 mile";
String zTo60Text = "60 mph";
if (units.equalsIgnoreCase("kph")) {
if (units.equalsIgnoreCase("km/h")) {
s60Text = "18.3m";
s330Text = "100m";
s1000Text = "305m";
s1320Text = "402m";
zTo60Text = "97 kph";
zTo60Text = "97 km/h";
}
hpAxis.setLabel("Vehicle Speed (" + units + ")");
String[] car = carInfo.split(";");
@ -423,7 +423,7 @@ public final class DynoChartPanel extends JPanel {
public void startPrompt(String select) {
String startPrompt = START_PROMPT;
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 y = ((hpAxis.getUpperBound() - hpAxis.getLowerBound()) / 2) + hpAxis.getLowerBound();
final XYTextAnnotation startMessage = new XYTextAnnotation(startPrompt, x, y);

View File

@ -129,7 +129,7 @@ public final class DynoControlPanel extends JPanel {
private static final String LOG_TA = "Throttle";
private static final String LOG_VS = "Vehicle Speed";
private static final String LOG_VS_I = "mph";
private static final String LOG_VS_M = "kph";
private static final String LOG_VS_M = "km/h";
private static final double KPH_2_MPH = 1.609344;
private final DataRegistrationBroker broker;
private final DynoChartPanel chartPanel;

View File

@ -39,7 +39,7 @@ public enum PlxSensorConversions implements ExternalSensorConversions {
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)),
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_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