updated maf scaler

git-svn-id: https://svn2.assembla.com/svn/romraider/trunk@3 38686702-15cf-42e4-a595-3071df8bf5ea
This commit is contained in:
kascade 2008-04-02 11:19:55 +00:00
parent a285b62809
commit 49cc37e19e
6 changed files with 36 additions and 17 deletions

View File

@ -51,19 +51,19 @@ public final class LoggerControllerImpl implements LoggerController {
public void setFileLoggerSwitchMonitor(FileLoggerControllerSwitchMonitor monitor) { public void setFileLoggerSwitchMonitor(FileLoggerControllerSwitchMonitor monitor) {
checkNotNull(monitor); checkNotNull(monitor);
LOGGER.debug("Setting file logger switch monitor: " + monitor.getEcuSwitch().getName()); LOGGER.debug("Setting file logger switch monitor: [" + monitor.getEcuSwitch().getId() + "] " + monitor.getEcuSwitch().getName());
queryManager.setFileLoggerSwitchMonitor(monitor); queryManager.setFileLoggerSwitchMonitor(monitor);
} }
public void addLogger(String callerId, LoggerData loggerData) { public void addLogger(String callerId, LoggerData loggerData) {
checkNotNull(loggerData); checkNotNull(loggerData);
LOGGER.debug("Adding logger: " + loggerData.getName()); LOGGER.debug("Adding logger: [" + loggerData.getId() + "] " + loggerData.getName());
queryManager.addQuery(callerId, loggerData); queryManager.addQuery(callerId, loggerData);
} }
public void removeLogger(String callerId, LoggerData loggerData) { public void removeLogger(String callerId, LoggerData loggerData) {
checkNotNull(loggerData, "ecuParam"); checkNotNull(loggerData, "ecuParam");
LOGGER.debug("Removing logger: " + loggerData.getName()); LOGGER.debug("Removing logger: [" + loggerData.getId() + "] " + loggerData.getName());
queryManager.removeQuery(callerId, loggerData); queryManager.removeQuery(callerId, loggerData);
} }

View File

@ -29,7 +29,6 @@ import enginuity.logger.ecu.definition.LoggerData;
import enginuity.logger.ecu.exception.ConfigurationException; import enginuity.logger.ecu.exception.ConfigurationException;
import static enginuity.util.ParamChecker.checkNotNull; import static enginuity.util.ParamChecker.checkNotNull;
import static enginuity.util.ParamChecker.isNullOrEmpty; import static enginuity.util.ParamChecker.isNullOrEmpty;
import java.util.Map; import java.util.Map;
public final class UserProfileImpl implements UserProfile { public final class UserProfileImpl implements UserProfile {
@ -83,7 +82,7 @@ public final class UserProfileImpl implements UserProfile {
return convertor; return convertor;
} }
} }
throw new ConfigurationException("Unknown default units, '" + defaultUnits + "', specified for " + loggerData.getName()); throw new ConfigurationException("Unknown default units, '" + defaultUnits + "', specified for [" + loggerData.getId() + "] " + loggerData.getName());
} }
} }
return loggerData.getSelectedConvertor(); return loggerData.getSelectedConvertor();

View File

@ -1,11 +1,11 @@
package enginuity.logger.ecu.ui.handler.maf; package enginuity.logger.ecu.ui.handler.maf;
import java.util.Set;
import javax.swing.SwingUtilities;
import enginuity.logger.ecu.comms.query.Response; import enginuity.logger.ecu.comms.query.Response;
import enginuity.logger.ecu.definition.LoggerData; import enginuity.logger.ecu.definition.LoggerData;
import enginuity.logger.ecu.ui.handler.DataUpdateHandler; import enginuity.logger.ecu.ui.handler.DataUpdateHandler;
import enginuity.logger.ecu.ui.tab.maf.MafTab; import enginuity.logger.ecu.ui.tab.maf.MafTab;
import javax.swing.SwingUtilities;
import java.util.Set;
public final class MafUpdateHandler implements DataUpdateHandler { public final class MafUpdateHandler implements DataUpdateHandler {
private static final String MAFV = "P18"; private static final String MAFV = "P18";
@ -56,6 +56,12 @@ public final class MafUpdateHandler implements DataUpdateHandler {
valid = mafTab.isValidCoolantTemp(temp); valid = mafTab.isValidCoolantTemp(temp);
} }
// intake air temp check
if (valid && containsData(response, "P11")) {
double temp = findValue(response, "P11");
valid = mafTab.isValidIntakeAirTemp(temp);
}
if (valid) { if (valid) {
final double mafv = findValue(response, MAFV); final double mafv = findValue(response, MAFV);
final double learning = findValue(response, AF_LEARNING_1); final double learning = findValue(response, AF_LEARNING_1);

View File

@ -45,6 +45,7 @@ public final class MafControlPanel extends JPanel {
private static final String AF_CORRECTION_1 = "P3"; private static final String AF_CORRECTION_1 = "P3";
private static final String AF_LEARNING_1 = "P4"; private static final String AF_LEARNING_1 = "P4";
private static final String ENGINE_SPEED = "P8"; private static final String ENGINE_SPEED = "P8";
private static final String INTAKE_AIR_TEMP = "P11";
private static final String MASS_AIR_FLOW = "P12"; private static final String MASS_AIR_FLOW = "P12";
private static final String MASS_AIR_FLOW_V = "P18"; private static final String MASS_AIR_FLOW_V = "P18";
private static final String AFR = "P58"; private static final String AFR = "P58";
@ -59,6 +60,8 @@ public final class MafControlPanel extends JPanel {
private final JTextField rpmMax = new JTextField("4500", 3); private final JTextField rpmMax = new JTextField("4500", 3);
private final JTextField mafMin = new JTextField("0", 3); private final JTextField mafMin = new JTextField("0", 3);
private final JTextField mafMax = new JTextField("100", 3); private final JTextField mafMax = new JTextField("100", 3);
private final JTextField iatMin = new JTextField("25", 3);
private final JTextField iatMax = new JTextField("35", 3);
private final JTextField coolantMin = new JTextField("70", 3); private final JTextField coolantMin = new JTextField("70", 3);
private final JCheckBox clCheckbox = new JCheckBox("Closed Loop Only", true); private final JCheckBox clCheckbox = new JCheckBox("Closed Loop Only", true);
private final Component parent; private final Component parent;
@ -108,6 +111,10 @@ public final class MafControlPanel extends JPanel {
return checkGreaterThan("Coolant Temp.", coolantMin, value); return checkGreaterThan("Coolant Temp.", coolantMin, value);
} }
public boolean isValidIntakeAirTemp(double value) {
return checkInRange("Intake Air Temp.", iatMin, iatMax, value);
}
private boolean checkInRange(String name, JTextField min, JTextField max, double value) { private boolean checkInRange(String name, JTextField min, JTextField max, double value) {
if (isValidRange(min, max)) { if (isValidRange(min, max)) {
return inRange(value, min, max); return inRange(value, min, max);
@ -199,8 +206,9 @@ public final class MafControlPanel extends JPanel {
addMinMaxFilter(panel, gridBagLayout, "AFR Range", afrMin, afrMax, 1); addMinMaxFilter(panel, gridBagLayout, "AFR Range", afrMin, afrMax, 1);
addMinMaxFilter(panel, gridBagLayout, "RPM Range", rpmMin, rpmMax, 4); addMinMaxFilter(panel, gridBagLayout, "RPM Range", rpmMin, rpmMax, 4);
addMinMaxFilter(panel, gridBagLayout, "MAF Range (g/s)", mafMin, mafMax, 7); addMinMaxFilter(panel, gridBagLayout, "MAF Range (g/s)", mafMin, mafMax, 7);
addLabeledComponent(panel, gridBagLayout, "Min. Coolant Temp.", coolantMin, 10); addMinMaxFilter(panel, gridBagLayout, "IAT Range", iatMin, iatMax, 10);
addComponent(panel, gridBagLayout, buildRecordDataButton(), 13); addLabeledComponent(panel, gridBagLayout, "Min. Coolant Temp.", coolantMin, 13);
addComponent(panel, gridBagLayout, buildRecordDataButton(), 16);
return panel; return panel;
} }
@ -209,9 +217,9 @@ public final class MafControlPanel extends JPanel {
recordDataButton.addActionListener(new ActionListener() { recordDataButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent actionEvent) { public void actionPerformed(ActionEvent actionEvent) {
if (recordDataButton.isSelected()) { if (recordDataButton.isSelected()) {
registerData(COOLANT_TEMP, AF_CORRECTION_1, AF_LEARNING_1, ENGINE_SPEED, MASS_AIR_FLOW, MASS_AIR_FLOW_V, AFR, CL_OL_16, CL_OL_32); registerData(COOLANT_TEMP, AF_CORRECTION_1, AF_LEARNING_1, ENGINE_SPEED, INTAKE_AIR_TEMP, MASS_AIR_FLOW, MASS_AIR_FLOW_V, AFR, CL_OL_16, CL_OL_32);
} else { } else {
deregisterData(COOLANT_TEMP, AF_CORRECTION_1, AF_LEARNING_1, ENGINE_SPEED, MASS_AIR_FLOW, MASS_AIR_FLOW_V, AFR, CL_OL_16, CL_OL_32); deregisterData(COOLANT_TEMP, AF_CORRECTION_1, AF_LEARNING_1, ENGINE_SPEED, INTAKE_AIR_TEMP, MASS_AIR_FLOW, MASS_AIR_FLOW_V, AFR, CL_OL_16, CL_OL_32);
} }
} }
}); });

View File

@ -1,10 +1,10 @@
package enginuity.logger.ecu.ui.tab.maf; package enginuity.logger.ecu.ui.tab.maf;
import java.util.List;
import enginuity.logger.ecu.definition.EcuParameter; import enginuity.logger.ecu.definition.EcuParameter;
import enginuity.logger.ecu.definition.EcuSwitch; import enginuity.logger.ecu.definition.EcuSwitch;
import enginuity.logger.ecu.definition.ExternalData; import enginuity.logger.ecu.definition.ExternalData;
import enginuity.logger.ecu.ui.tab.Tab; import enginuity.logger.ecu.ui.tab.Tab;
import java.util.List;
public interface MafTab extends Tab { public interface MafTab extends Tab {
boolean isRecordData(); boolean isRecordData();
@ -19,6 +19,8 @@ public interface MafTab extends Tab {
boolean isValidCoolantTemp(double value); boolean isValidCoolantTemp(double value);
boolean isValidIntakeAirTemp(double value);
void addData(double mafv, double correction); void addData(double mafv, double correction);
void setEcuParams(List<EcuParameter> params); void setEcuParams(List<EcuParameter> params);

View File

@ -1,10 +1,5 @@
package enginuity.logger.ecu.ui.tab.maf; package enginuity.logger.ecu.ui.tab.maf;
import java.awt.BorderLayout;
import static java.awt.BorderLayout.CENTER;
import static java.awt.BorderLayout.WEST;
import java.util.List;
import javax.swing.JPanel;
import enginuity.ECUEditor; import enginuity.ECUEditor;
import enginuity.logger.ecu.definition.EcuParameter; import enginuity.logger.ecu.definition.EcuParameter;
import enginuity.logger.ecu.definition.EcuSwitch; import enginuity.logger.ecu.definition.EcuSwitch;
@ -12,6 +7,11 @@ import enginuity.logger.ecu.definition.ExternalData;
import enginuity.logger.ecu.ui.DataRegistrationBroker; import enginuity.logger.ecu.ui.DataRegistrationBroker;
import enginuity.logger.ecu.ui.handler.maf.XYTrendline; import enginuity.logger.ecu.ui.handler.maf.XYTrendline;
import org.jfree.data.xy.XYSeries; import org.jfree.data.xy.XYSeries;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import static java.awt.BorderLayout.CENTER;
import static java.awt.BorderLayout.WEST;
import java.util.List;
public final class MafTabImpl extends JPanel implements MafTab { public final class MafTabImpl extends JPanel implements MafTab {
private final XYSeries series = new XYSeries("MAF Analysis"); private final XYSeries series = new XYSeries("MAF Analysis");
@ -57,6 +57,10 @@ public final class MafTabImpl extends JPanel implements MafTab {
return controlPanel.isValidCoolantTemp(value); return controlPanel.isValidCoolantTemp(value);
} }
public boolean isValidIntakeAirTemp(double value) {
return controlPanel.isValidIntakeAirTemp(value);
}
public void addData(double mafv, double correction) { public void addData(double mafv, double correction) {
series.add(mafv, correction); series.add(mafv, correction);
} }