Skip to content

Commit

Permalink
Revisited VVT TAB logic and added smoothing checkbox and max rpm filt…
Browse files Browse the repository at this point in the history
…er to VVT Tab filters
  • Loading branch information
vimsh committed Jan 22, 2018
1 parent 5156a5e commit 2a3749c
Show file tree
Hide file tree
Showing 14 changed files with 38,409 additions and 38,375 deletions.
32 changes: 16 additions & 16 deletions .classpath
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.7.0"/>
<classpathentry kind="lib" path="lib/jcommon-1.0.21.jar"/>
<classpathentry kind="lib" path="lib/jfreechart-1.0.17.jar"/>
<classpathentry kind="lib" path="lib/log4j-1.2.14.jar"/>
<classpathentry kind="lib" path="lib/jmathplot.jar"/>
<classpathentry kind="lib" path="lib/quicktable-3.0.jar"/>
<classpathentry kind="lib" path="lib/JTattoo-1.6.11.jar"/>
<classpathentry kind="lib" path="lib/CheckBoxTree_1.0.0.jar"/>
<classpathentry kind="lib" path="lib/jmathio.jar"/>
<classpathentry kind="lib" path="lib/commons-math3-3.6.1.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="resources"/>
<classpathentry kind="lib" path="lib/jcommon-1.0.21.jar"/>
<classpathentry kind="lib" path="lib/jfreechart-1.0.17.jar"/>
<classpathentry kind="lib" path="lib/log4j-1.2.14.jar"/>
<classpathentry kind="lib" path="lib/jmathplot.jar"/>
<classpathentry kind="lib" path="lib/quicktable-3.0.jar"/>
<classpathentry kind="lib" path="lib/JTattoo-1.6.11.jar"/>
<classpathentry kind="lib" path="lib/CheckBoxTree_1.0.0.jar"/>
<classpathentry kind="lib" path="lib/jmathio.jar"/>
<classpathentry kind="lib" path="lib/commons-math3-3.6.1.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>
10 changes: 0 additions & 10 deletions .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,6 @@ org.eclipse.jdt.core.circularClasspath=error
org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
org.eclipse.jdt.core.classpath.outputOverlappingAnotherSource=error
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.maxProblemPerUnit=100
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6
org.eclipse.jdt.core.incompatibleJDKLevel=ignore
org.eclipse.jdt.core.incompleteClasspath=error
Binary file modified MafScaling.jar
Binary file not shown.
42 changes: 6 additions & 36 deletions src/com/vgi/mafscaling/AMafScaling.java
Original file line number Diff line number Diff line change
Expand Up @@ -707,42 +707,12 @@ protected void smoothCurve() {
int start = cols[0];
int end = cols[cols.length - 1];
try {
int movWind;
int i;
ArrayList<Double> tmpArray = new ArrayList<Double>();
if (degree == 3) {
movWind = 1;
for (i = movWind + start; i + movWind <= end; ++i)
tmpArray.add(0.25 * smoothGsArray.get(i - 1) +
0.5 * smoothGsArray.get(i) +
0.25 * smoothGsArray.get(i + 1));
for (i = 0; i < tmpArray.size(); ++i)
smoothGsArray.set(i + movWind + start, tmpArray.get(i));
}
if (degree == 5) {
movWind = 2;
for (i = movWind + start; i + movWind <= end; ++i)
tmpArray.add(0.1 * smoothGsArray.get(i - 2) +
0.2 * smoothGsArray.get(i - 1) +
0.4 * smoothGsArray.get(i) +
0.2 * smoothGsArray.get(i + 1) +
0.1 * smoothGsArray.get(i + 2));
for (i = 0; i < tmpArray.size(); ++i)
smoothGsArray.set(i + movWind + start, tmpArray.get(i));
}
if (degree == 7) {
movWind = 3;
for (i = movWind + start; i + movWind <= end; ++i)
tmpArray.add(0.05 * smoothGsArray.get(i - 3) +
0.1 * smoothGsArray.get(i - 2) +
0.15 * smoothGsArray.get(i - 1) +
0.4 * smoothGsArray.get(i) +
0.15 * smoothGsArray.get(i + 1) +
0.1 * smoothGsArray.get(i + 2) +
0.05 * smoothGsArray.get(i + 3));
for (i = 0; i < tmpArray.size(); ++i)
smoothGsArray.set(i + movWind + start, tmpArray.get(i));
}
double[] input = new double[end - start + 1];
for (int i = 0; i < input.length; ++i)
input[i] = smoothGsArray.get(i + start);
double[] output = Utils.getWeightedMovingAverageSmoothing(input, degree);
for (int i = 0; i < output.length; ++i)
smoothGsArray.set(i + start, output[i]);
plotSmoothingLineSlopes();
}
finally {
Expand Down
11 changes: 10 additions & 1 deletion src/com/vgi/mafscaling/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public class Config {
public static final String DefaultMafVMaximum = "5.0";
public static final String DefaultMafVMinimum = "0.0";
public static final String DefaultRPMMaximum = "5000";
public static final String DefaultVVTRPMMaximum = "8000";
public static final String DefaultRPMMinimum = "0";
public static final String DefaultFFBMaximum = "100.0";
public static final String DefaultFFBMinimum = "0.0";
Expand Down Expand Up @@ -564,7 +565,7 @@ public static double getMafVMinimumValue() {
public static void setMafVMinimumValue(double v) {
props.setProperty("MafVMinimum", Double.toString(v));
}

public static int getRPMMaximumValue() {
return Integer.parseInt(props.getProperty("RPMMaximum", DefaultRPMMaximum));
}
Expand All @@ -588,6 +589,14 @@ public static int getVERPMMinimumValue() {
public static void setVERPMMinimumValue(int v) {
props.setProperty("VERPMMinimum", Integer.toString(v));
}

public static int getVVTRPMMaximumValue() {
return Integer.parseInt(props.getProperty("VVTRPMMaximum", DefaultVVTRPMMaximum));
}

public static void setVVTRPMMaximumValue(int v) {
props.setProperty("VVTRPMMaximum", Integer.toString(v));
}

public static double getFFBMaximumValue() {
return Double.parseDouble(props.getProperty("FFBMaximum", DefaultFFBMaximum));
Expand Down
3 changes: 0 additions & 3 deletions src/com/vgi/mafscaling/LCColumnsFiltersSelection.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,10 @@ protected void addFilterSelection() {
maxAfrFilter.setText(String.valueOf(Config.getLCAfrMaximumValue()));
addAFRMinimumFilter();
minAfrFilter.setText(String.valueOf(Config.getLCAfrMinimumValue()));


addManifoldPressureMaximumFilter();
maxMPFilter.setText(String.valueOf(Config.getLCMPMaximumValue()));
addManifoldPressureMinimumFilter();
minMPFilter.setText(String.valueOf(Config.getLCMPMinimumValue()));

addDvDtMaximumFilter();
maxDvdtFilter.setText(String.valueOf(Config.getLCDvDtMaximumValue()));
addCellHitCountMinimumFilter();
Expand Down
2 changes: 1 addition & 1 deletion src/com/vgi/mafscaling/MafScaling.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

public class MafScaling {
private static final Logger logger = Logger.getLogger(MafScaling.class);
private static final String Title = "MAF Scaling - v2.4.2";
private static final String Title = "MAF Scaling - v2.4.3";
private static final String OLTabName = "<html>Open Loop</html>";
private static final String CLTabName = "<html>Closed Loop</html>";
private static final String MRTabName = "<html>MAF Rescale</html>";
Expand Down
210 changes: 105 additions & 105 deletions src/com/vgi/mafscaling/MafTablePane.java
Original file line number Diff line number Diff line change
@@ -1,105 +1,105 @@
package com.vgi.mafscaling;

import java.awt.Color;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;

import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.ListSelectionModel;
import javax.swing.ScrollPaneConstants;
import javax.swing.border.LineBorder;
import javax.swing.border.TitledBorder;
import javax.swing.table.DefaultTableModel;

public class MafTablePane extends JScrollPane {
private static final long serialVersionUID = 4656913571229048807L;
public static final int MafTableColumnCount = 35;
JTable mafTable = null;
JLabel voltLabel = null;
JLabel gsLabel = null;

public MafTablePane(int columnWidth, String tableName, boolean editableFirstRow, boolean editableSecondRow) {
Insets insets0 = new Insets(0, 0, 0, 0);
JPanel dataMafPanel = new JPanel();
GridBagLayout gbl_dataMafPanel = new GridBagLayout();
gbl_dataMafPanel.columnWidths = new int[]{0, 0};
gbl_dataMafPanel.rowHeights = new int[] {0, 0};
gbl_dataMafPanel.columnWeights = new double[]{0.0, 1.0};
gbl_dataMafPanel.rowWeights = new double[]{0.0, 0.0};
dataMafPanel.setLayout(gbl_dataMafPanel);

GridBagConstraints gbc_label = new GridBagConstraints();
gbc_label.anchor = GridBagConstraints.EAST;
gbc_label.insets = insets0;
gbc_label.gridx = 0;
gbc_label.gridy = 0;
voltLabel = new JLabel("volt ");
dataMafPanel.add(voltLabel, gbc_label);
gbc_label.gridy = 1;
gsLabel = new JLabel("g/s ");
dataMafPanel.add(gsLabel, gbc_label);

if (editableFirstRow && editableSecondRow)
mafTable = new JTable();
else if (editableFirstRow) {
mafTable = new JTable() {
private static final long serialVersionUID = 7749582128758153892L;
public boolean isCellEditable(int row, int column) { if (row == 1) return true; return false; };
};
}
else if (editableSecondRow) {
mafTable = new JTable() {
private static final long serialVersionUID = 7749582128758153892L;
public boolean isCellEditable(int row, int column) { if (row == 1) return false; return true; };
};
}
else {
mafTable = new JTable() {
private static final long serialVersionUID = -7484222189491449568L;
public boolean isCellEditable(int row, int column) { return false; };
};
}

mafTable.setColumnSelectionAllowed(true);
mafTable.setCellSelectionEnabled(true);
mafTable.setBorder(new LineBorder(new Color(0, 0, 0)));
mafTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
mafTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
mafTable.setModel(new DefaultTableModel(2, MafTableColumnCount));
mafTable.setTableHeader(null);
mafTable.putClientProperty("terminateEditOnFocusLost", true);
Utils.initializeTable(mafTable, columnWidth);
GridBagConstraints gbc_mafTable = new GridBagConstraints();
gbc_mafTable.insets = insets0;
gbc_mafTable.fill = GridBagConstraints.HORIZONTAL;
gbc_mafTable.weightx = 1.0;
gbc_mafTable.gridx = 1;
gbc_mafTable.gridy = 0;
gbc_mafTable.gridheight = 2;
dataMafPanel.add(mafTable, gbc_mafTable);

setViewportView(dataMafPanel);
if (tableName != null)
setViewportBorder(new TitledBorder(null, tableName, TitledBorder.LEADING, TitledBorder.TOP, null, null));
setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
}

public void hideRowHeaders() {
voltLabel.setVisible(false);
gsLabel.setVisible(false);
}

public void showRowHeaders() {
voltLabel.setVisible(true);
gsLabel.setVisible(true);
}

public JTable getJTable() {
return mafTable;
}
}
package com.vgi.mafscaling;

import java.awt.Color;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;

import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.ListSelectionModel;
import javax.swing.ScrollPaneConstants;
import javax.swing.border.LineBorder;
import javax.swing.border.TitledBorder;
import javax.swing.table.DefaultTableModel;

public class MafTablePane extends JScrollPane {
private static final long serialVersionUID = 4656913571229048807L;
public static final int MafTableColumnCount = 35;
JTable mafTable = null;
JLabel voltLabel = null;
JLabel gsLabel = null;

public MafTablePane(int columnWidth, String tableName, boolean editableFirstRow, boolean editableSecondRow) {
Insets insets0 = new Insets(0, 0, 0, 0);
JPanel dataMafPanel = new JPanel();
GridBagLayout gbl_dataMafPanel = new GridBagLayout();
gbl_dataMafPanel.columnWidths = new int[]{0, 0};
gbl_dataMafPanel.rowHeights = new int[] {0, 0};
gbl_dataMafPanel.columnWeights = new double[]{0.0, 1.0};
gbl_dataMafPanel.rowWeights = new double[]{0.0, 0.0};
dataMafPanel.setLayout(gbl_dataMafPanel);

GridBagConstraints gbc_label = new GridBagConstraints();
gbc_label.anchor = GridBagConstraints.EAST;
gbc_label.insets = insets0;
gbc_label.gridx = 0;
gbc_label.gridy = 0;
voltLabel = new JLabel("volt ");
dataMafPanel.add(voltLabel, gbc_label);
gbc_label.gridy = 1;
gsLabel = new JLabel("g/s ");
dataMafPanel.add(gsLabel, gbc_label);

if (editableFirstRow && editableSecondRow)
mafTable = new JTable();
else if (editableFirstRow) {
mafTable = new JTable() {
private static final long serialVersionUID = 7749582128758153892L;
public boolean isCellEditable(int row, int column) { if (row == 1) return true; return false; };
};
}
else if (editableSecondRow) {
mafTable = new JTable() {
private static final long serialVersionUID = 7749582128758153892L;
public boolean isCellEditable(int row, int column) { if (row == 1) return false; return true; };
};
}
else {
mafTable = new JTable() {
private static final long serialVersionUID = -7484222189491449568L;
public boolean isCellEditable(int row, int column) { return false; };
};
}

mafTable.setColumnSelectionAllowed(true);
mafTable.setCellSelectionEnabled(true);
mafTable.setBorder(new LineBorder(new Color(0, 0, 0)));
mafTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
mafTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
mafTable.setModel(new DefaultTableModel(2, MafTableColumnCount));
mafTable.setTableHeader(null);
mafTable.putClientProperty("terminateEditOnFocusLost", true);
Utils.initializeTable(mafTable, columnWidth);
GridBagConstraints gbc_mafTable = new GridBagConstraints();
gbc_mafTable.insets = insets0;
gbc_mafTable.fill = GridBagConstraints.HORIZONTAL;
gbc_mafTable.weightx = 1.0;
gbc_mafTable.gridx = 1;
gbc_mafTable.gridy = 0;
gbc_mafTable.gridheight = 2;
dataMafPanel.add(mafTable, gbc_mafTable);

setViewportView(dataMafPanel);
if (tableName != null)
setViewportBorder(new TitledBorder(null, tableName, TitledBorder.LEADING, TitledBorder.TOP, null, null));
setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
}

public void hideRowHeaders() {
voltLabel.setVisible(false);
gsLabel.setVisible(false);
}

public void showRowHeaders() {
voltLabel.setVisible(true);
gsLabel.setVisible(true);
}

public JTable getJTable() {
return mafTable;
}
}
Loading

0 comments on commit 2a3749c

Please sign in to comment.