Changeset 35


Ignore:
Timestamp:
04/18/08 10:38:42 (5 years ago)
Author:
kascade
Message:

updated maf and injector tabs

Location:
trunk/src/enginuity/logger/ecu/ui
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/enginuity/logger/ecu/ui/handler/injector/InjectorUpdateHandler.java

    r27 r35  
    77import org.apache.log4j.Logger; 
    88import javax.swing.SwingUtilities; 
     9import static java.lang.Math.abs; 
     10import static java.lang.System.currentTimeMillis; 
    911import java.util.Set; 
    1012 
     
    1618    private static final String ENGINE_LOAD_32 = "E32"; 
    1719    private InjectorTab injectorTab; 
     20    private double lastMafv; 
     21    private long lastUpdate; 
    1822 
    1923    public synchronized void registerData(LoggerData loggerData) { 
     
    7983                valid = injectorTab.isValidCoolantTemp(temp); 
    8084                LOGGER.trace("INJ:[CT]:    " + valid); 
     85            } 
     86 
     87            // dMAFv/dt check 
     88            if (valid && containsData(response, "P18")) { 
     89                double mafv = findValue(response, "P18"); 
     90                long now = currentTimeMillis(); 
     91                double mafvChange = abs((mafv - lastMafv) / (now - lastUpdate) * 1000); 
     92                LOGGER.trace("INJ:[dMAFv/dt]: " + mafvChange); 
     93                valid = injectorTab.isValidMafvChange(mafvChange); 
     94                LOGGER.trace("INJ:[dMAFv/dt]: " + valid); 
     95                lastMafv = mafv; 
     96                lastUpdate = now; 
    8197            } 
    8298 
  • trunk/src/enginuity/logger/ecu/ui/handler/maf/MafUpdateHandler.java

    r25 r35  
    77import org.apache.log4j.Logger; 
    88import javax.swing.SwingUtilities; 
     9import static java.lang.Math.abs; 
     10import static java.lang.System.currentTimeMillis; 
    911import java.util.Set; 
    1012 
     
    1517    private static final String AF_CORRECTION_1 = "P3"; 
    1618    private MafTab mafTab; 
     19    private double lastMafv; 
     20    private long lastUpdate; 
    1721 
    1822    public synchronized void registerData(LoggerData loggerData) { 
     
    7680                valid = mafTab.isValidCoolantTemp(temp); 
    7781                LOGGER.trace("MAF:[CT]:    " + valid); 
     82            } 
     83 
     84            // dMAFv/dt check 
     85            if (valid && containsData(response, "P18")) { 
     86                double mafv = findValue(response, "P18"); 
     87                long now = currentTimeMillis(); 
     88                double mafvChange = abs((mafv - lastMafv) / (now - lastUpdate) * 1000); 
     89                LOGGER.trace("MAF:[dMAFv/dt]: " + mafvChange); 
     90                valid = mafTab.isValidMafvChange(mafvChange); 
     91                LOGGER.trace("MAF:[dMAFv/dt]: " + valid); 
     92                lastMafv = mafv; 
     93                lastUpdate = now; 
    7894            } 
    7995 
  • trunk/src/enginuity/logger/ecu/ui/tab/Tab.java

    r16 r35  
    55public interface Tab { 
    66    JPanel getPanel(); 
     7 
     8    boolean isValidMafvChange(double value); 
    79} 
  • trunk/src/enginuity/logger/ecu/ui/tab/injector/InjectorControlPanel.java

    r32 r35  
    4848    private static final String INTAKE_AIR_TEMP = "P11"; 
    4949    private static final String MASS_AIR_FLOW = "P12"; 
     50    private static final String MASS_AIR_FLOW_V = "P18"; 
    5051    private static final String AFR = "P58"; 
    5152    private static final String CL_OL_16 = "E3"; 
     
    6667    private final JTextField mafMin = new JTextField("20", 3); 
    6768    private final JTextField mafMax = new JTextField("100", 3); 
    68     private final JTextField iatMin = new JTextField("25", 3); 
    6969    private final JTextField iatMax = new JTextField("35", 3); 
    7070    private final JTextField coolantMin = new JTextField("70", 3); 
     71    private final JTextField mafvChangeMax = new JTextField("0.3", 3); 
    7172    private final JTextField fuelStoichAfr = new JTextField("14.7", 5); 
    7273    private final JTextField fuelDensity = new JTextField("732", 5); 
     
    129130 
    130131    public boolean isValidIntakeAirTemp(double value) { 
    131         return checkInRange("Intake Air Temp.", iatMin, iatMax, value); 
     132        return checkLessThan("Intake Air Temp.", iatMax, value); 
     133    } 
     134 
     135    public boolean isValidMafvChange(double value) { 
     136        return checkLessThan("dMAFv/dt", mafvChangeMax, value); 
    132137    } 
    133138 
     
    163168    } 
    164169 
     170    private boolean checkLessThan(String name, JTextField max, double value) { 
     171        if (isNumber(max)) { 
     172            return value <= parseDouble(max); 
     173        } else { 
     174            showMessageDialog(parent, "Invalid " + name + " specified.", "Error", ERROR_MESSAGE); 
     175            recordDataButton.setSelected(false); 
     176            return false; 
     177        } 
     178    } 
     179 
    165180    private void addControls() { 
    166181        JPanel panel = new JPanel(); 
     
    251266        addMinMaxFilter(panel, gridBagLayout, "RPM Range", rpmMin, rpmMax, 3); 
    252267        addMinMaxFilter(panel, gridBagLayout, "MAF Range (g/s)", mafMin, mafMax, 6); 
    253         addMinMaxFilter(panel, gridBagLayout, "IAT Range", iatMin, iatMax, 9); 
    254         addLabeledComponent(panel, gridBagLayout, "Min. Coolant Temp.", coolantMin, 12); 
    255         addComponent(panel, gridBagLayout, buildRecordDataButton(), 15); 
     268        addLabeledComponent(panel, gridBagLayout, "Min. Coolant Temp.", coolantMin, 9); 
     269        addLabeledComponent(panel, gridBagLayout, "Max. Intake Temp.", iatMax, 12); 
     270        addLabeledComponent(panel, gridBagLayout, "Max. dMAFv/dt (V/s)", mafvChangeMax, 15); 
     271        addComponent(panel, gridBagLayout, buildRecordDataButton(), 18); 
    256272 
    257273        return panel; 
     
    262278            public void actionPerformed(ActionEvent actionEvent) { 
    263279                if (recordDataButton.isSelected()) { 
    264                     registerData(COOLANT_TEMP, ENGINE_SPEED, INTAKE_AIR_TEMP, MASS_AIR_FLOW, AFR, CL_OL_16, CL_OL_32, TIP_IN_THROTTLE_16, TIP_IN_THROTTLE_32, PULSE_WIDTH_16, PULSE_WIDTH_32, ENGINE_LOAD_16, ENGINE_LOAD_32); 
     280                    registerData(COOLANT_TEMP, ENGINE_SPEED, INTAKE_AIR_TEMP, MASS_AIR_FLOW, MASS_AIR_FLOW_V, AFR, CL_OL_16, CL_OL_32, TIP_IN_THROTTLE_16, TIP_IN_THROTTLE_32, PULSE_WIDTH_16, PULSE_WIDTH_32, ENGINE_LOAD_16, ENGINE_LOAD_32); 
    265281                } else { 
    266                     deregisterData(COOLANT_TEMP, ENGINE_SPEED, INTAKE_AIR_TEMP, MASS_AIR_FLOW, AFR, CL_OL_16, CL_OL_32, TIP_IN_THROTTLE_16, TIP_IN_THROTTLE_32, PULSE_WIDTH_16, PULSE_WIDTH_32, ENGINE_LOAD_16, ENGINE_LOAD_32); 
     282                    deregisterData(COOLANT_TEMP, ENGINE_SPEED, INTAKE_AIR_TEMP, MASS_AIR_FLOW, MASS_AIR_FLOW_V, AFR, CL_OL_16, CL_OL_32, TIP_IN_THROTTLE_16, TIP_IN_THROTTLE_32, PULSE_WIDTH_16, PULSE_WIDTH_32, ENGINE_LOAD_16, ENGINE_LOAD_32); 
    267283                } 
    268284            } 
  • trunk/src/enginuity/logger/ecu/ui/tab/injector/InjectorTabImpl.java

    r15 r35  
    6363    } 
    6464 
     65    public boolean isValidMafvChange(double value) { 
     66        return controlPanel.isValidMafvChange(value); 
     67    } 
     68 
    6569    public boolean isValidTipInThrottle(double value) { 
    6670        return controlPanel.isValidTipInThrottle(value); 
  • trunk/src/enginuity/logger/ecu/ui/tab/maf/MafControlPanel.java

    r32 r35  
    6464    private final JTextField mafMin = new JTextField("0", 3); 
    6565    private final JTextField mafMax = new JTextField("100", 3); 
    66     private final JTextField iatMin = new JTextField("25", 3); 
    6766    private final JTextField iatMax = new JTextField("35", 3); 
    6867    private final JTextField coolantMin = new JTextField("70", 3); 
     68    private final JTextField mafvChangeMax = new JTextField("0.3", 3); 
    6969    private final Component parent; 
    7070    private final XYTrendline trendline; 
     
    115115 
    116116    public boolean isValidIntakeAirTemp(double value) { 
    117         return checkInRange("Intake Air Temp.", iatMin, iatMax, value); 
     117        return checkLessThan("Intake Air Temp.", iatMax, value); 
     118    } 
     119 
     120    public boolean isValidMafvChange(double value) { 
     121        return checkLessThan("dMAFv/dt", mafvChangeMax, value); 
    118122    } 
    119123 
     
    142146    } 
    143147 
     148    private boolean checkLessThan(String name, JTextField max, double value) { 
     149        if (isNumber(max)) { 
     150            return value <= parseDouble(max); 
     151        } else { 
     152            showMessageDialog(parent, "Invalid " + name + " specified.", "Error", ERROR_MESSAGE); 
     153            recordDataButton.setSelected(false); 
     154            return false; 
     155        } 
     156    } 
     157 
    144158    private void addControls() { 
    145159        JPanel panel = new JPanel(); 
     
    212226        addMinMaxFilter(panel, gridBagLayout, "RPM Range", rpmMin, rpmMax, 3); 
    213227        addMinMaxFilter(panel, gridBagLayout, "MAF Range (g/s)", mafMin, mafMax, 6); 
    214         addMinMaxFilter(panel, gridBagLayout, "IAT Range", iatMin, iatMax, 9); 
    215         addLabeledComponent(panel, gridBagLayout, "Min. Coolant Temp.", coolantMin, 12); 
    216         addComponent(panel, gridBagLayout, buildRecordDataButton(), 15); 
     228        addLabeledComponent(panel, gridBagLayout, "Min. Coolant Temp.", coolantMin, 9); 
     229        addLabeledComponent(panel, gridBagLayout, "Max. Intake Temp.", iatMax, 12); 
     230        addLabeledComponent(panel, gridBagLayout, "Max. dMAFv/dt (V/s)", mafvChangeMax, 15); 
     231        addComponent(panel, gridBagLayout, buildRecordDataButton(), 18); 
    217232 
    218233        return panel; 
  • trunk/src/enginuity/logger/ecu/ui/tab/maf/MafTabImpl.java

    r10 r35  
    6363    } 
    6464 
     65    public boolean isValidMafvChange(double value) { 
     66        return controlPanel.isValidMafvChange(value); 
     67    } 
     68 
    6569    public boolean isValidTipInThrottle(double value) { 
    6670        return controlPanel.isValidTipInThrottle(value); 
Note: See TracChangeset for help on using the changeset viewer.