mirror of https://github.com/rusefi/RomRaider.git
Road Dyno(v9) now supports reading and saving a reference trace as well as reading previously stored log files.
git-svn-id: https://svn2.assembla.com/svn/romraider/branches/dev_road_dyno@271 38686702-15cf-42e4-a595-3071df8bf5ea
This commit is contained in:
parent
2bf1a40385
commit
8a83c13efa
52
.classpath
52
.classpath
|
@ -2,30 +2,32 @@
|
|||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="lib" path="lib/Graph3d/windows/lib/j3dcore.jar"/>
|
||||
<classpathentry kind="lib" path="lib/Graph3d/windows/lib/j3dutils.jar"/>
|
||||
<classpathentry kind="lib" path="lib/Graph3d/windows/lib/vecmath.jar"/>
|
||||
<classpathentry kind="lib" path="lib/Graph3d/windows/Graph3d.jar"/>
|
||||
<classpathentry kind="lib" path="lib/Graph3d/jama-1.0.2.jar"/>
|
||||
<classpathentry kind="lib" path="lib/BareBonesBrowserLaunch.jar"/>
|
||||
<classpathentry kind="lib" path="lib/jep.jar"/>
|
||||
<classpathentry kind="lib" path="lib/Jama.jar"/>
|
||||
<classpathentry kind="lib" path="lib/jamlab.jar"/>
|
||||
<classpathentry kind="lib" path="lib/JFontChooser.jar"/>
|
||||
<classpathentry kind="lib" path="lib/log4j-1.2.14.jar"/>
|
||||
<classpathentry kind="lib" path="lib/swing-layout-1.0.jar"/>
|
||||
<classpathentry kind="lib" path="lib/tts/cmu_time_awb.jar"/>
|
||||
<classpathentry kind="lib" path="lib/tts/cmu_us_kal.jar"/>
|
||||
<classpathentry kind="lib" path="lib/tts/cmudict04.jar"/>
|
||||
<classpathentry kind="lib" path="lib/tts/cmulex.jar"/>
|
||||
<classpathentry kind="lib" path="lib/tts/cmutimelex.jar"/>
|
||||
<classpathentry kind="lib" path="lib/tts/en_us.jar"/>
|
||||
<classpathentry kind="lib" path="lib/tts/freetts.jar"/>
|
||||
<classpathentry kind="lib" path="lib/logger/rxtx/RXTXcomm.jar"/>
|
||||
<classpathentry kind="lib" path="lib/jdic/windows/jdic_stub.jar"/>
|
||||
<classpathentry kind="lib" path="lib/jdic/jdic.jar"/>
|
||||
<classpathentry kind="lib" path="lib/logger/jfreechart-1.0.9.jar"/>
|
||||
<classpathentry kind="lib" path="lib/logger/jcommon-1.0.12.jar"/>
|
||||
<classpathentry kind="lib" path="lib/logger/jinvoke-3.0.3.jar"/>
|
||||
<classpathentry kind="lib" path="lib/windows/registry.jar"/>
|
||||
<classpathentry kind="lib" path="lib/common/com4j.jar"/>
|
||||
<classpathentry kind="lib" path="lib/windows/j3dcore.jar"/>
|
||||
<classpathentry kind="lib" path="lib/windows/j3dutils.jar"/>
|
||||
<classpathentry kind="lib" path="lib/windows/vecmath.jar"/>
|
||||
<classpathentry kind="lib" path="lib/windows/Graph3d.jar"/>
|
||||
<classpathentry kind="lib" path="lib/common/jama-1.0.2.jar"/>
|
||||
<classpathentry kind="lib" path="lib/common/BareBonesBrowserLaunch.jar"/>
|
||||
<classpathentry kind="lib" path="lib/common/jep.jar"/>
|
||||
<classpathentry kind="lib" path="lib/common/Jama.jar"/>
|
||||
<classpathentry kind="lib" path="lib/common/jamlab.jar"/>
|
||||
<classpathentry kind="lib" path="lib/common/JFontChooser.jar"/>
|
||||
<classpathentry kind="lib" path="lib/common/log4j-1.2.14.jar"/>
|
||||
<classpathentry kind="lib" path="lib/common/swing-layout-1.0.jar"/>
|
||||
<classpathentry kind="lib" path="lib/common/cmu_time_awb.jar"/>
|
||||
<classpathentry kind="lib" path="lib/common/cmu_us_kal.jar"/>
|
||||
<classpathentry kind="lib" path="lib/common/cmudict04.jar"/>
|
||||
<classpathentry kind="lib" path="lib/common/cmulex.jar"/>
|
||||
<classpathentry kind="lib" path="lib/common/cmutimelex.jar"/>
|
||||
<classpathentry kind="lib" path="lib/common/en_us.jar"/>
|
||||
<classpathentry kind="lib" path="lib/common/freetts.jar"/>
|
||||
<classpathentry kind="lib" path="lib/common/RXTXcomm.jar"/>
|
||||
<classpathentry kind="lib" path="lib/windows/jdic_stub.jar"/>
|
||||
<classpathentry kind="lib" path="lib/common/jdic.jar"/>
|
||||
<classpathentry kind="lib" path="lib/common/jfreechart-1.0.9.jar"/>
|
||||
<classpathentry kind="lib" path="lib/common/jcommon-1.0.12.jar"/>
|
||||
<classpathentry kind="lib" path="lib/common/jinvoke-3.0.3.jar"/>
|
||||
<classpathentry kind="output" path="build/classes"/>
|
||||
</classpath>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -44,9 +44,9 @@ public final class DynoUpdateHandler implements DataUpdateHandler {
|
|||
private DynoTab dynoTab;
|
||||
|
||||
// 05 OBXT Cobb Stg1 May 2009, 3rd gear, 200 ft, 60F
|
||||
private static final long[] logTime = {0, 250, 490, 750, 1000, 1230, 1480, 1720, 1980, 2220, 2470, 2690, 2940, 3170, 3420, 3660, 3920, 4160, 4400, 4650, 4890, 5120, 5370, 5610, 5860, 6130, 6370, 6620, 6860, 7090, 7330, 7600, 7840, 8090, 8330, 8570, 8820, 9050, 9290, 9580, 9830, 10070, 10330, 10560, 10810, 11050, 11290, 11580, 11790, 12040, 12280, 12560, 12790, 13040, 13320, 13550, 13780};
|
||||
private static final double[] logRpm = {1690, 1733, 1776, 1852, 1935, 2004, 2091, 2148, 2241, 2325, 2405, 2496, 2597, 2754, 2871, 2943, 3093, 3243, 3350, 3475, 3617, 3780, 3843, 4025, 4125, 4234, 4355, 4511, 4618, 4720, 4835, 4947, 5067, 5138, 5254, 5351, 5485, 5581, 5642, 5735, 5816, 5939, 6041, 6104, 6183, 6280, 6347, 6406, 6483, 6548, 6651, 6693, 6800, 6870, 6924, 6974, 7079};
|
||||
private static final double[] logThrottle = {49.78, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 10};
|
||||
// private static final long[] logTime = {0, 250, 490, 750, 1000, 1230, 1480, 1720, 1980, 2220, 2470, 2690, 2940, 3170, 3420, 3660, 3920, 4160, 4400, 4650, 4890, 5120, 5370, 5610, 5860, 6130, 6370, 6620, 6860, 7090, 7330, 7600, 7840, 8090, 8330, 8570, 8820, 9050, 9290, 9580, 9830, 10070, 10330, 10560, 10810, 11050, 11290, 11580, 11790, 12040, 12280, 12560, 12790, 13040, 13320, 13550, 13780};
|
||||
// private static final double[] logRpm = {1690, 1733, 1776, 1852, 1935, 2004, 2091, 2148, 2241, 2325, 2405, 2496, 2597, 2754, 2871, 2943, 3093, 3243, 3350, 3475, 3617, 3780, 3843, 4025, 4125, 4234, 4355, 4511, 4618, 4720, 4835, 4947, 5067, 5138, 5254, 5351, 5485, 5581, 5642, 5735, 5816, 5939, 6041, 6104, 6183, 6280, 6347, 6406, 6483, 6548, 6651, 6693, 6800, 6870, 6924, 6974, 7079};
|
||||
// private static final double[] logThrottle = {49.78, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 10};
|
||||
private static final double[] logKph = {36, 37, 39, 40, 42, 43, 45, 46, 48, 50, 52, 54, 56, 59, 61, 64, 67, 70, 73, 75, 78, 81, 83, 86, 89, 92, 94, 97, 99, 102, 104, 106, 109, 111, 113, 116, 118, 120, 122, 124, 126, 128, 130, 132, 133, 135, 137, 138, 140, 141, 143, 145, 146, 148, 149, 150, 150};
|
||||
|
||||
// 05 LGT tingtang (http://legacygt.com/forums/showpost.php?p=2783186&postcount=185) 3rd gear, 5800ft, 45 degrees F
|
||||
|
@ -65,9 +65,9 @@ public final class DynoUpdateHandler implements DataUpdateHandler {
|
|||
// smoothed RPM from Airboy SS
|
||||
// private static final double[] logRpm = {2029, 2079.12776, 2128.70831, 2183.374046, 2232.954597, 2281.318373, 2351.923543, 2427.351978, 2506.207436, 2583.915691, 2671.162641, 2761.967057, 2862.985225, 2962.323119, 3062.697066, 3175.904917, 3281.036045, 3380.281832, 3484.964687, 3593.266196, 3700.250711, 3798.571429, 3892.575574, 4000.355604, 4096.780475, 4193.40157, 4284.464728, 4380.0873, 4484.619382, 4584.589724, 4673.170346, 4776.132747, 4859.278292, 4956.101945, 5042.857143, 5130.635704, 5212.007526, 5297.823159, 5377.854146, 5448.484312, 5527.570262, 5600.215485, 5662.965742, 5726.67913, 5794.11765, 5859.697531, 5927.956025, 5995.118562, 6059.296969, 6125.865145, 6183.582871, 6240.889946, 6298.623784, 6358.806827, 6407.230158, 6458.300943, 6510.258872, 6568.310398, 6620.961783, 6673.613168};
|
||||
// 05 LGT Legend 225/40-18, 3520lbs, 62F (http://legacygt.com/forums/showpost.php?p=2414502&postcount=26)
|
||||
// private static final long[] logTime = {0, 60, 120, 190, 250, 320, 401, 461, 521, 601, 651, 711, 781, 841, 901, 971, 1031, 1092, 1162, 1222, 1312, 1362, 1432, 1492, 1572, 1652, 1702, 1762, 1833, 1903, 1963, 2023, 2083, 2143, 2233, 2293, 2353, 2413, 2484, 2544, 2624, 2684, 2754, 2814, 2904, 2954, 3024, 3084, 3154, 3215, 3275, 3335, 3405, 3465, 3525, 3595, 3685, 3735, 3795, 3865, 3926, 3986, 4056, 4146, 4196, 4266, 4336, 4416, 4466, 4526, 4597, 4677, 4747, 4797, 4867, 4927, 4997, 5057, 5117, 5177, 5247, 5338, 5388, 5458, 5518, 5588, 5648, 5708, 5768, 5838, 5898, 5959, 6029, 6089, 6149, 6219, 6299, 6369, 6419, 6499, 6559, 6619, 6680, 6740, 6810, 6870, 6940, 7000, 7060, 7140, 7200, 7280, 7330, 7391, 7461, 7521, 7581, 7651, 7721, 7771, 7851, 7901, 7981, 8031, 8092, 8162, 8222, 8282, 8352, 8412, 8472, 8562, 8632, 8682, 8743, 8813, 8873, 8953, 9013, 9093, 9143, 9203, 9273, 9343, 9393, 9464, 9524, 9594, 9664, 9714, 9794, 9844, 9914, 9984, 10044, 10104, 10165, 10225, 10285, 10355, 10435, 10495, 10555, 10635, 10685, 10765, 10826, 10906, 10976};
|
||||
// private static final double[] logRpm = {1896, 1924, 1951, 1952, 1968, 1987, 2012, 2003, 2015, 2028, 2068, 2073, 2062, 2081, 2088, 2124, 2141, 2136, 2174, 2182, 2209, 2204, 2246, 2246, 2277, 2284, 2314, 2313, 2352, 2351, 2392, 2396, 2424, 2465, 2450, 2520, 2509, 2551, 2586, 2573, 2607, 2660, 2686, 2727, 2740, 2778, 2810, 2826, 2876, 2890, 2942, 2962, 3024, 3064, 3070, 3152, 3174, 3215, 3290, 3291, 3352, 3388, 3436, 3476, 3531, 3553, 3618, 3669, 3720, 3773, 3800, 3822, 3894, 3922, 3933, 4022, 4076, 4050, 4162, 4141, 4190, 4238, 4296, 4338, 4367, 4440, 4442, 4474, 4554, 4584, 4632, 4672, 4706, 4755, 4783, 4817, 4869, 4875, 4948, 4954, 4993, 5070, 5074, 5139, 5132, 5217, 5212, 5292, 5272, 5369, 5362, 5432, 5460, 5520, 5471, 5522, 5563, 5588, 5631, 5650, 5733, 5711, 5800, 5841, 5848, 5836, 5905, 5945, 5925, 6012, 5996, 6060, 6047, 6117, 6099, 6172, 6168, 6201, 6218, 6238, 6312, 6344, 6324, 6350, 6407, 6436, 6472, 6448, 6466, 6491, 6508, 6536, 6560, 6586, 6607, 6633, 6697, 6719, 6738, 6760, 6733, 6759, 6844, 6851, 6818, 6836, 6864, 6900, 6929};
|
||||
// private static final double[] logThrottle = {10, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 10};
|
||||
private static final long[] logTime = {0, 60, 120, 190, 250, 320, 401, 461, 521, 601, 651, 711, 781, 841, 901, 971, 1031, 1092, 1162, 1222, 1312, 1362, 1432, 1492, 1572, 1652, 1702, 1762, 1833, 1903, 1963, 2023, 2083, 2143, 2233, 2293, 2353, 2413, 2484, 2544, 2624, 2684, 2754, 2814, 2904, 2954, 3024, 3084, 3154, 3215, 3275, 3335, 3405, 3465, 3525, 3595, 3685, 3735, 3795, 3865, 3926, 3986, 4056, 4146, 4196, 4266, 4336, 4416, 4466, 4526, 4597, 4677, 4747, 4797, 4867, 4927, 4997, 5057, 5117, 5177, 5247, 5338, 5388, 5458, 5518, 5588, 5648, 5708, 5768, 5838, 5898, 5959, 6029, 6089, 6149, 6219, 6299, 6369, 6419, 6499, 6559, 6619, 6680, 6740, 6810, 6870, 6940, 7000, 7060, 7140, 7200, 7280, 7330, 7391, 7461, 7521, 7581, 7651, 7721, 7771, 7851, 7901, 7981, 8031, 8092, 8162, 8222, 8282, 8352, 8412, 8472, 8562, 8632, 8682, 8743, 8813, 8873, 8953, 9013, 9093, 9143, 9203, 9273, 9343, 9393, 9464, 9524, 9594, 9664, 9714, 9794, 9844, 9914, 9984, 10044, 10104, 10165, 10225, 10285, 10355, 10435, 10495, 10555, 10635, 10685, 10765, 10826, 10906, 10976};
|
||||
private static final double[] logRpm = {1896, 1924, 1951, 1952, 1968, 1987, 2012, 2003, 2015, 2028, 2068, 2073, 2062, 2081, 2088, 2124, 2141, 2136, 2174, 2182, 2209, 2204, 2246, 2246, 2277, 2284, 2314, 2313, 2352, 2351, 2392, 2396, 2424, 2465, 2450, 2520, 2509, 2551, 2586, 2573, 2607, 2660, 2686, 2727, 2740, 2778, 2810, 2826, 2876, 2890, 2942, 2962, 3024, 3064, 3070, 3152, 3174, 3215, 3290, 3291, 3352, 3388, 3436, 3476, 3531, 3553, 3618, 3669, 3720, 3773, 3800, 3822, 3894, 3922, 3933, 4022, 4076, 4050, 4162, 4141, 4190, 4238, 4296, 4338, 4367, 4440, 4442, 4474, 4554, 4584, 4632, 4672, 4706, 4755, 4783, 4817, 4869, 4875, 4948, 4954, 4993, 5070, 5074, 5139, 5132, 5217, 5212, 5292, 5272, 5369, 5362, 5432, 5460, 5520, 5471, 5522, 5563, 5588, 5631, 5650, 5733, 5711, 5800, 5841, 5848, 5836, 5905, 5945, 5925, 6012, 5996, 6060, 6047, 6117, 6099, 6172, 6168, 6201, 6218, 6238, 6312, 6344, 6324, 6350, 6407, 6436, 6472, 6448, 6466, 6491, 6508, 6536, 6560, 6586, 6607, 6633, 6697, 6719, 6738, 6760, 6733, 6759, 6844, 6851, 6818, 6836, 6864, 6900, 6929};
|
||||
private static final double[] logThrottle = {10, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 10};
|
||||
// 04 WRX WGN 6MT*, 225/45/17, 48F
|
||||
// private static final long[] logTime = {820,840,860,880,900,920,940,960,980,1000,1020,1040,1060,1080,1100,1120,1140,1160,1180,1200,1220,1240,1260,1280,1300,1320,1340,1360,1380,1400,1420,1440,1460,1480,1500,1520,1540,1560,1580,1600,1620,1640,1660,1680,1700,1720,1740,1760,1780,1800,1820,1840,1860,1880,1900,1920,1940,1960,1980,2000,2020,2040,2060,2080,2100,2120,2140,2160,2180,2200,2220,2240,2260,2280,2300,2320,2340,2360,2380,2400,2420,2440,2460,2480,2500,2520,2540,2560,2580,2600,2620,2640,2660,2680,2700,2720,2740,2760,2780,2800,2820,2840,2860,2880,
|
||||
// 2900,2920,2940,2960,2980,3000,3020,3040,3060,3080,3100,3120,3140,3160,3180,3200,3220,3240,3260,3280,3300,3320,3340,3360,3380,3400,3420,3440,3460,3480,3500,3520,3540,3560,3580,3600,3620,3640,3660,3680,3700,3720,3740,3760,3780,3800,3820,3840,3860,3880,3900,3920,3940,3960,3980,4000,4020,4040,4060,4080,4100,4120,4140,4160,4180,4200,4220,4240,4260,4280,4300,4320,4340,4360,4380,4400,4420,4440,4460,4480,4500,4520,4540,4560,4580,4600,4620,4640,4660,4680,4700,4720,4740,4760,4780,4800,4820,4840,4860,4880,4900,4920,4940,4960,4980,
|
||||
|
@ -102,8 +102,7 @@ public final class DynoUpdateHandler implements DataUpdateHandler {
|
|||
private double vs;
|
||||
private double ta;
|
||||
private long now;
|
||||
private long startNow = 0;
|
||||
private boolean started = false;
|
||||
private long startNow = -999999999;
|
||||
private double iat;
|
||||
private double atm;
|
||||
|
||||
|
@ -157,6 +156,7 @@ public final class DynoUpdateHandler implements DataUpdateHandler {
|
|||
}
|
||||
else {
|
||||
x = 0;
|
||||
startNow = -999999999;
|
||||
}
|
||||
if (dynoTab.getEnv() && containsData(response, IAT) && containsData(response, ATM)) {
|
||||
if (TEST) {
|
||||
|
@ -173,20 +173,12 @@ public final class DynoUpdateHandler implements DataUpdateHandler {
|
|||
}
|
||||
|
||||
private void addRawData(final int sample, final long time, final double speed){
|
||||
long sampleTime = time;
|
||||
if (!started) {
|
||||
startNow = sampleTime;
|
||||
sampleTime = 0;
|
||||
started = true;
|
||||
}
|
||||
else {
|
||||
sampleTime = sampleTime - startNow;
|
||||
}
|
||||
final long logTime = sampleTime;
|
||||
if (startNow == -999999999) startNow = time;
|
||||
final long sampleTime = time - startNow;
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
// dynoTab.addData(sample, time, speed);
|
||||
dynoTab.addRawData(sample, logTime, speed);
|
||||
dynoTab.addRawData(sample, sampleTime, speed);
|
||||
}
|
||||
});
|
||||
x++;
|
||||
|
|
|
@ -0,0 +1,110 @@
|
|||
/* ===========================================================
|
||||
* JFreeChart : a free chart library for the Java(tm) platform
|
||||
* ===========================================================
|
||||
*
|
||||
* (C) Copyright 2000-2004, by Object Refinery Limited and Contributors.
|
||||
*
|
||||
* Project Info: http://www.jfree.org/jfreechart/index.html
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it under the terms
|
||||
* of the GNU Lesser General Public License as published by the Free Software Foundation;
|
||||
* either version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along with this
|
||||
* library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
|
||||
* in the United States and other countries.]
|
||||
*
|
||||
* -----------------
|
||||
* CircleDrawer.java
|
||||
* -----------------
|
||||
* (C) Copyright 2003, 2004, by Object Refinery Limited and Contributors.
|
||||
*
|
||||
* Original Author: David Gilbert (for Object Refinery Limited);
|
||||
* Contributor(s): -;
|
||||
*
|
||||
* $Id: CircleDrawer.java,v 1.1 2005/04/28 16:29:17 harrym_nu Exp $
|
||||
*
|
||||
* Changes
|
||||
* -------
|
||||
* 21-May-2003 : Version 1 (DG);
|
||||
*
|
||||
*/
|
||||
package com.romraider.logger.ecu.ui.tab;
|
||||
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Paint;
|
||||
import java.awt.Stroke;
|
||||
import java.awt.geom.Ellipse2D;
|
||||
import java.awt.geom.Line2D;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
|
||||
import org.jfree.ui.Drawable;
|
||||
|
||||
/**
|
||||
* An implementation of the {Drawable} interface.
|
||||
*
|
||||
* @author David Gilbert
|
||||
*/
|
||||
public class CircleDrawer implements Drawable {
|
||||
|
||||
/** The outline paint. */
|
||||
private Paint outlinePaint;
|
||||
|
||||
/** The outline stroke. */
|
||||
private Stroke outlineStroke;
|
||||
|
||||
/** The fill paint. */
|
||||
private Paint fillPaint;
|
||||
|
||||
/**
|
||||
* Creates a new instance.
|
||||
*
|
||||
* @param outlinePaint the outline paint.
|
||||
* @param outlineStroke the outline stroke.
|
||||
* @param fillPaint the fill paint.
|
||||
*/
|
||||
public CircleDrawer(Paint outlinePaint, Stroke outlineStroke, Paint fillPaint) {
|
||||
this.outlinePaint = outlinePaint;
|
||||
this.outlineStroke = outlineStroke;
|
||||
this.fillPaint = fillPaint;
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws the circle.
|
||||
*
|
||||
* @param g2 the graphics device.
|
||||
* @param area the area in which to draw.
|
||||
*/
|
||||
public void draw(Graphics2D g2, Rectangle2D area) {
|
||||
Ellipse2D ellipse = new Ellipse2D.Double(area.getX(), area.getY(),
|
||||
area.getWidth(), area.getHeight());
|
||||
if (this.fillPaint != null) {
|
||||
g2.setPaint(this.fillPaint);
|
||||
g2.fill(ellipse);
|
||||
}
|
||||
if (this.outlinePaint != null && this.outlineStroke != null) {
|
||||
g2.setPaint(this.outlinePaint);
|
||||
g2.setStroke(this.outlineStroke);
|
||||
g2.draw(ellipse);
|
||||
}
|
||||
|
||||
g2.setPaint(Color.black);
|
||||
g2.setStroke(new BasicStroke(1.0f));
|
||||
Line2D line1 = new Line2D.Double(area.getCenterX(), area.getMinY(),
|
||||
area.getCenterX(), area.getMaxY());
|
||||
Line2D line2 = new Line2D.Double(area.getMinX(), area.getCenterY(),
|
||||
area.getMaxX(), area.getCenterY());
|
||||
g2.draw(line1);
|
||||
g2.draw(line2);
|
||||
}
|
||||
}
|
||||
|
|
@ -64,6 +64,7 @@ public final class DynoChartPanel extends JPanel {
|
|||
private static final Logger LOGGER = getLogger(DynoChartPanel.class);
|
||||
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 String START_PROMPT = "Accelerate using WOT when ready!!";
|
||||
private final XYSeries data = new XYSeries("Raw HP"); // series for HorsePower
|
||||
private final XYSeries data1 = new XYSeries("Raw TQ"); // series for Torque
|
||||
private final XYTrendline trendline = new XYTrendline(data);
|
||||
|
@ -72,18 +73,28 @@ public final class DynoChartPanel extends JPanel {
|
|||
private final XYSeries logRpm = new XYSeries("Logger RPM"); // series for raw sample RPM
|
||||
private final XYTrendline timeTrend = new XYTrendline(logTime);
|
||||
private final XYTrendline rpmTrend = new XYTrendline(logRpm);
|
||||
private final XYSeries hpRef = new XYSeries("HP Ref"); // series for reference HP
|
||||
private final XYSeries tqRef = new XYSeries("TQ Ref"); // series for reference TQ
|
||||
private final XYTrendline hpTrend = new XYTrendline(hpRef);
|
||||
private final XYTrendline tqTrend = new XYTrendline(tqRef);
|
||||
private final String labelX;
|
||||
private String labelY1 = "";
|
||||
private String labelY2 = "";
|
||||
private String labelY1 = null;
|
||||
private String labelY2 = null;
|
||||
private String refResults = " ";
|
||||
private StandardXYItemRenderer rendererY1 = new StandardXYItemRenderer();
|
||||
private StandardXYItemRenderer rendererY2 = new StandardXYItemRenderer();
|
||||
private NumberAxis hpAxis = new NumberAxis("pwr");
|
||||
private NumberAxis tqAxis = new NumberAxis("tq");
|
||||
private XYPlot plot;
|
||||
// private CircleDrawer hpCd = new CircleDrawer(RED, new BasicStroke(1.0f), null);
|
||||
// private XYAnnotation bestHp = new XYDrawableAnnotation(1, 1, 10, 10, hpCd);
|
||||
private final CircleDrawer cd = new CircleDrawer(RED, new BasicStroke(1.0f), null);
|
||||
private XYAnnotation bestHp;
|
||||
private XYAnnotation bestTq;
|
||||
private final XYPointerAnnotation hpPointer = new XYPointerAnnotation(
|
||||
"Max HP", 1, 1, 3.0 * Math.PI / 6.0);
|
||||
private final XYPointerAnnotation tqPointer = new XYPointerAnnotation(
|
||||
"Max TQ", 1, 1, 3.0 * Math.PI / 6.0);
|
||||
private final XYTextAnnotation refStat = new XYTextAnnotation(refResults,0,0);
|
||||
|
||||
public DynoChartPanel(String labelX, String labelY1, String labelY2) {
|
||||
super(new SpringLayout());
|
||||
checkNotNull(labelX, labelY1, labelY2);
|
||||
|
@ -103,29 +114,71 @@ public final class DynoChartPanel extends JPanel {
|
|||
data1.add(x, y1);
|
||||
}
|
||||
|
||||
public synchronized void setRefTrace(double x, double y1, double y2){
|
||||
hpRef.add(x, y1);
|
||||
tqRef.add(x, y2);
|
||||
}
|
||||
|
||||
public void updateRefTrace(int order) {
|
||||
if (hpRef.getItemCount() > 0) {
|
||||
hpTrend.update(order);
|
||||
tqTrend.update(order);
|
||||
refStat.setText(refResults);
|
||||
refStat.setX(plot.getDomainAxis().getLowerBound() + 10);
|
||||
refStat.setY(hpAxis.getUpperBound());
|
||||
plot.addAnnotation(refStat);
|
||||
}
|
||||
}
|
||||
|
||||
public int getPwrTqCount() {
|
||||
return (int) data.getItemCount();
|
||||
}
|
||||
|
||||
public String getPwrTq(int x){
|
||||
String set = data.getX(x) + "," + data.getY(x) + "," + data1.getY(x);
|
||||
return set;
|
||||
}
|
||||
|
||||
public void setRefResults(String line) {
|
||||
refResults = "Reference: " + line;
|
||||
}
|
||||
|
||||
public void clearRefTrace() {
|
||||
refResults = " ";
|
||||
plot.removeAnnotation(refStat);
|
||||
hpRef.clear();
|
||||
tqRef.clear();
|
||||
hpTrend.clear();
|
||||
tqTrend.clear();
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
hpAxis.setAutoRange(true);
|
||||
tqAxis.setAutoRange(true);
|
||||
trendline.clear();
|
||||
trendline1.clear();
|
||||
data.clear();
|
||||
data1.clear();
|
||||
logTime.clear();
|
||||
logRpm.clear();
|
||||
timeTrend.clear();
|
||||
rpmTrend.clear();
|
||||
plot.clearAnnotations();
|
||||
clearGraph();
|
||||
}
|
||||
|
||||
public int getSampleCount() {
|
||||
trendline.clear();
|
||||
clearGraph();
|
||||
return (int) logTime.getItemCount();
|
||||
}
|
||||
|
||||
public void clearGraph(){
|
||||
trendline.clear();
|
||||
trendline1.clear();
|
||||
data.clear();
|
||||
data1.clear();
|
||||
rendererY1.removeAnnotation(bestHp);
|
||||
rendererY2.removeAnnotation(bestTq);
|
||||
rendererY1.removeAnnotation(hpPointer);
|
||||
rendererY2.removeAnnotation(tqPointer);
|
||||
hpAxis.setAutoRange(true);
|
||||
tqAxis.setAutoRange(true);
|
||||
plot.clearAnnotations();
|
||||
return (int) logTime.getItemCount();
|
||||
}
|
||||
|
||||
|
||||
public double[] getTimeCoeff(int order) {
|
||||
timeTrend.update(order);
|
||||
return getPolynomialCoefficients(timeTrend);
|
||||
|
@ -136,8 +189,9 @@ public final class DynoChartPanel extends JPanel {
|
|||
return getPolynomialCoefficients(rpmTrend);
|
||||
}
|
||||
|
||||
public void interpolate(int order, double min, double max, String carInfo, double fToE, double sToE, double tToS, String units) {
|
||||
hpAxis.setAutoRange(true);
|
||||
public String interpolate(int order, double min, double max, String carInfo, double fToE, double sToE, double tToS, String units) {
|
||||
// updateRefTrace(order);
|
||||
hpAxis.setAutoRange(true);
|
||||
tqAxis.setAutoRange(true);
|
||||
trendline.update(order);
|
||||
trendline1.update(order);
|
||||
|
@ -180,11 +234,12 @@ public final class DynoChartPanel extends JPanel {
|
|||
}
|
||||
// double yMax = Math.max(maxTq, maxHp);
|
||||
double rangeMin = Math.min(tqAxis.getLowerBound(), hpAxis.getLowerBound());
|
||||
hpAxis.setRange(Math.round(rangeMin), Math.round(hpAxis.getUpperBound()));
|
||||
tqAxis.setRange(Math.round(rangeMin), Math.round(tqAxis.getUpperBound()));
|
||||
double yMin = Math.round(rangeMin);
|
||||
double ySpace = (hpAxis.getUpperBound() - hpAxis.getLowerBound()) / 25;
|
||||
double xMin = (max < 5000) ? 2100 : 2550;
|
||||
double xMin = ((plot.getDomainAxis().getUpperBound() - plot.getDomainAxis().getLowerBound()) / 7) + plot.getDomainAxis().getLowerBound();
|
||||
// double xMin = (max < 5000) ? 2100 : 2550;
|
||||
hpAxis.setRange(Math.round(rangeMin), Math.round(hpAxis.getUpperBound() + ySpace));
|
||||
tqAxis.setRange(Math.round(rangeMin), Math.round(tqAxis.getUpperBound() + ySpace));
|
||||
// LOGGER.trace("yMin:" + yMin + " yMax:" + yMax + " ySpace:" + ySpace);
|
||||
|
||||
String hpUnits = " hp(I)";
|
||||
|
@ -208,26 +263,20 @@ public final class DynoChartPanel extends JPanel {
|
|||
LOGGER.info("DYNO Results: " + stat1Text);
|
||||
LOGGER.info("DYNO Results: " + stat2Text);
|
||||
LOGGER.info("DYNO Results: " + stat3Text);
|
||||
// final CircleDrawer hpCd = new CircleDrawer(RED, new BasicStroke(1.0f), null);
|
||||
// final XYAnnotation bestHp = new XYDrawableAnnotation(maxHpRpm, maxHp, 10, 10, hpCd);
|
||||
// final XYAnnotation hpPointer = new XYPointerAnnotation(
|
||||
// "Max HP", maxHpRpm, maxHp, 3.0 * Math.PI / 6.0);
|
||||
bestHp = new XYDrawableAnnotation(maxHpRpm, maxHp, 10, 10, cd);
|
||||
hpPointer.setX(maxHpRpm);
|
||||
hpPointer.setY(maxHp);
|
||||
hpPointer.setArrowPaint(BLUE);
|
||||
hpPointer.setTipRadius(2.0);
|
||||
hpPointer.setBaseRadius(20.0);
|
||||
hpPointer.setTipRadius(7.0);
|
||||
hpPointer.setBaseRadius(30.0);
|
||||
hpPointer.setFont(new Font("SansSerif",Font.BOLD,10));
|
||||
hpPointer.setPaint(BLUE);
|
||||
// final CircleDrawer tqCd = new CircleDrawer(RED, new BasicStroke(1.0f), null);
|
||||
// final XYAnnotation bestTq = new XYDrawableAnnotation(maxTqRpm, maxTq, 10, 10, tqCd);
|
||||
// final XYPointerAnnotation tqPointer = new XYPointerAnnotation(
|
||||
// "Max TQ", maxTqRpm, maxTq, 3.0 * Math.PI / 6.0);
|
||||
bestTq = new XYDrawableAnnotation(maxTqRpm, maxTq, 10, 10, cd);
|
||||
tqPointer.setX(maxTqRpm);
|
||||
tqPointer.setY(maxTq);
|
||||
tqPointer.setArrowPaint(YELLOW);
|
||||
tqPointer.setTipRadius(2.0);
|
||||
tqPointer.setBaseRadius(20.0);
|
||||
tqPointer.setTipRadius(7.0);
|
||||
tqPointer.setBaseRadius(30.0);
|
||||
tqPointer.setFont(new Font("SansSerif",Font.BOLD,10));
|
||||
tqPointer.setPaint(YELLOW);
|
||||
final XYTextAnnotation dynoResults = new XYTextAnnotation(resultsText, xMin, yMin+(ySpace*4));
|
||||
|
@ -250,15 +299,21 @@ public final class DynoChartPanel extends JPanel {
|
|||
stat3.setPaint(RED);
|
||||
stat3.setTextAnchor(TextAnchor.BOTTOM_LEFT);
|
||||
stat3.setFont(new Font("SansSerif", Font.PLAIN,12));
|
||||
// plot.addAnnotation(bestHp);
|
||||
// plot.addAnnotation(bestTq);
|
||||
// plot.addAnnotation(hpPointer);
|
||||
// plot.addAnnotation(tqPointer);
|
||||
if (!refResults.equals(" ")){
|
||||
refStat.setX(plot.getDomainAxis().getLowerBound() + 10);
|
||||
refStat.setY(hpAxis.getUpperBound());
|
||||
plot.addAnnotation(refStat);
|
||||
}
|
||||
rendererY1.addAnnotation(bestHp);
|
||||
rendererY2.addAnnotation(bestTq);
|
||||
rendererY1.addAnnotation(hpPointer);
|
||||
rendererY2.addAnnotation(tqPointer);
|
||||
plot.addAnnotation(dynoResults);
|
||||
plot.addAnnotation(carText);
|
||||
plot.addAnnotation(stat1);
|
||||
plot.addAnnotation(stat2);
|
||||
plot.addAnnotation(stat3);
|
||||
return resultsText;
|
||||
}
|
||||
|
||||
public double[] calculate(XYTrendline trendSeries, double[] x) {
|
||||
|
@ -285,7 +340,12 @@ public final class DynoChartPanel extends JPanel {
|
|||
addTrendLineY1(chart, 0, trendline, BLUE);
|
||||
addTrendLineY2(chart, 1, trendline1, YELLOW);
|
||||
addSeries(chart, 2, data, 1, RED);
|
||||
addSeries(chart, 3, data1, 1, GREEN);
|
||||
addSeries(chart, 3, data1, 1, MAGENTA);
|
||||
addSeries(chart, 4, hpRef, 1, BLACK);
|
||||
addSeries(chart, 5, tqRef, 1, BLACK);
|
||||
addTrendLine(chart, 6, hpTrend, BLUE);
|
||||
addTrendLine(chart, 7, tqTrend, YELLOW);
|
||||
|
||||
return chart;
|
||||
}
|
||||
|
||||
|
@ -308,6 +368,8 @@ public final class DynoChartPanel extends JPanel {
|
|||
plot.setRangeAxisLocation(0, AxisLocation.TOP_OR_LEFT);
|
||||
plot.mapDatasetToRangeAxis(0, 0);
|
||||
plot.mapDatasetToRangeAxis(2, 0);
|
||||
plot.mapDatasetToRangeAxis(4, 0);
|
||||
plot.mapDatasetToRangeAxis(6, 0);
|
||||
// Y2 axis (right) settings
|
||||
tqAxis.setLabel(labelY2);
|
||||
tqAxis.setLabelPaint(YELLOW);
|
||||
|
@ -318,12 +380,19 @@ public final class DynoChartPanel extends JPanel {
|
|||
plot.setRangeAxisLocation(1, AxisLocation.BOTTOM_OR_RIGHT);
|
||||
plot.mapDatasetToRangeAxis(1, 1);
|
||||
plot.mapDatasetToRangeAxis(3, 1);
|
||||
plot.mapDatasetToRangeAxis(5, 1);
|
||||
plot.mapDatasetToRangeAxis(7, 1);
|
||||
plot.setRangeGridlinePaint(DARK_GREY);
|
||||
plot.setRenderer(buildScatterRenderer(2, RED));
|
||||
refStat.setPaint(WHITE);
|
||||
refStat.setTextAnchor(TextAnchor.TOP_LEFT);
|
||||
refStat.setFont(new Font("SansSerif", Font.BOLD,12));
|
||||
|
||||
}
|
||||
|
||||
public void startPrompt() {
|
||||
final XYTextAnnotation startMessage = new XYTextAnnotation("Accelerate using WOT now!!", 0.4, 0.55);
|
||||
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(START_PROMPT, x, y);
|
||||
startMessage.setPaint(GREEN);
|
||||
startMessage.setTextAnchor(TextAnchor.BOTTOM_CENTER);
|
||||
startMessage.setFont(new Font("Arial", Font.BOLD,20));
|
||||
|
@ -342,6 +411,12 @@ public final class DynoChartPanel extends JPanel {
|
|||
return renderer;
|
||||
}
|
||||
|
||||
private void addTrendLine(JFreeChart chart, int index, XYTrendline trendline, Color color) {
|
||||
XYPlot plot = chart.getXYPlot();
|
||||
plot.setDataset(index, trendline);
|
||||
plot.setRenderer(index, buildTrendLineRenderer(color));
|
||||
}
|
||||
|
||||
private void addTrendLineY1(JFreeChart chart, int index, XYTrendline trendline, Color color) {
|
||||
XYPlot plot = chart.getXYPlot();
|
||||
plot.setDataset(index, trendline);
|
||||
|
@ -361,17 +436,21 @@ public final class DynoChartPanel extends JPanel {
|
|||
plot.setRenderer(index, buildScatterRenderer(size, color));
|
||||
}
|
||||
|
||||
private StandardXYItemRenderer buildTrendLineRendererY1(Color color) {
|
||||
StandardXYItemRenderer renderer = new StandardXYItemRenderer();
|
||||
private StandardXYItemRenderer buildTrendLineRenderer(Color color) {
|
||||
StandardXYItemRenderer renderer = new StandardXYItemRenderer();
|
||||
renderer.setSeriesPaint(0, color);
|
||||
renderer.addAnnotation(hpPointer); // ties annotation to the Y1 range axis
|
||||
float dash[] = { 2.0f };
|
||||
renderer.setSeriesStroke(0, new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1.0f, dash, 0.0f));
|
||||
return renderer;
|
||||
}
|
||||
|
||||
private StandardXYItemRenderer buildTrendLineRendererY1(Color color) {
|
||||
rendererY1.setSeriesPaint(0, color);
|
||||
return rendererY1;
|
||||
}
|
||||
|
||||
private StandardXYItemRenderer buildTrendLineRendererY2(Color color) {
|
||||
StandardXYItemRenderer renderer = new StandardXYItemRenderer();
|
||||
renderer.setSeriesPaint(0, color);
|
||||
renderer.addAnnotation(tqPointer); // ties annotation to the Y2 range axis
|
||||
return renderer;
|
||||
rendererY2.setSeriesPaint(0, color);
|
||||
return rendererY2;
|
||||
}
|
||||
}
|
|
@ -36,7 +36,12 @@ import java.awt.GridBagConstraints;
|
|||
import java.awt.GridBagLayout;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
@ -44,8 +49,10 @@ import java.util.List;
|
|||
import javax.swing.ButtonGroup;
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JRadioButton;
|
||||
|
@ -98,6 +105,17 @@ public final class DynoControlPanel extends JPanel {
|
|||
private static final String ELEVATION_TT ="Elevation is calculated from ECU ATM sensor";
|
||||
private static final String AMB_TEMP_TT ="Ambient Temperature is updated from IAT sensor";
|
||||
private static final String ORDER_TT ="Lower number provides more smoothing";
|
||||
private static final String COLON = ":";
|
||||
private static final String COMMA = ",";
|
||||
private static final String TAB = "\u0009";
|
||||
private static final String RR_LOG_TIME = "Time";
|
||||
private static final String COBB_AP_TIME = "Seconds";
|
||||
private static final String COBB_ATR_TIME = "Time Stamp";
|
||||
private static final String AEM_LOG_TIME = "Time/s";
|
||||
private static final String LOG_RPM = "RPM";
|
||||
private static final String LOG_ES = "Engine Speed";
|
||||
private static final String LOG_VS = "Vehicle Speed";
|
||||
private static final String LOG_TA = "Throttle";
|
||||
private final DataRegistrationBroker broker;
|
||||
private final DynoChartPanel chartPanel;
|
||||
private final Component parent;
|
||||
|
@ -126,7 +144,7 @@ public final class DynoControlPanel extends JPanel {
|
|||
private long eTime = 0;
|
||||
private long ttTime = 0;
|
||||
private long stTime = 0;
|
||||
private int order;
|
||||
// private int order;
|
||||
private boolean getEnv = false;
|
||||
private boolean wotSet = false;
|
||||
private String carInfo;
|
||||
|
@ -173,14 +191,19 @@ public final class DynoControlPanel extends JPanel {
|
|||
private String iatLogUnits = "F";
|
||||
private String atmLogUnits = "psi";
|
||||
private String vsLogUnits = "mph";
|
||||
private String currentResult = null;
|
||||
// private String hpUnits = "hp(I)";
|
||||
// private String tqUnits = "lbf-ft";
|
||||
|
||||
private final JComboBox orderComboBox = buildPolyOrderComboBox();
|
||||
private final JComboBox carSelectBox = buildCarSelectComboBox();
|
||||
private final JComboBox gearSelectBox = buildGearComboBox();
|
||||
private final JButton interpolateButton = new JButton("Recalculate");
|
||||
private final JToggleButton recordDataButton = new JToggleButton("Clear & Record Data");
|
||||
private final JRadioButton iButton = new JRadioButton(IMPERIAL);
|
||||
private final JRadioButton mButton = new JRadioButton(METRIC);
|
||||
private final JCheckBox loadFileCB = new JCheckBox("Load From File");
|
||||
|
||||
|
||||
public DynoControlPanel(Component parent, DataRegistrationBroker broker, ECUEditor ecuEditor, DynoChartPanel chartPanel) {
|
||||
checkNotNull(parent, broker, chartPanel);
|
||||
|
@ -317,7 +340,7 @@ public final class DynoControlPanel extends JPanel {
|
|||
}
|
||||
|
||||
public void updateChart() {
|
||||
order = (Integer) orderComboBox.getSelectedItem();
|
||||
int order = (Integer) orderComboBox.getSelectedItem();
|
||||
timeArray = Arrays.copyOf(chartPanel.getTimeCoeff(1), chartPanel.getTimeCoeff(1).length);
|
||||
LOGGER.info("DYNO Time Coeffecients: " + Arrays.toString(timeArray));
|
||||
speedArray = Arrays.copyOf(chartPanel.getRpmCoeff(order), chartPanel.getRpmCoeff(order).length);
|
||||
|
@ -355,7 +378,7 @@ public final class DynoControlPanel extends JPanel {
|
|||
lastRpm = speedSample;
|
||||
// LOGGER.trace("time: " + timeSample + " rpm: " + speedSample + " hp: " + nowHp + " tq: " + nowTq);
|
||||
}
|
||||
chartPanel.interpolate(order, parseDouble(rpmMin), parseDouble(rpmMax), carInfo, fToE, sToE, tToS, units);
|
||||
currentResult = chartPanel.interpolate(order, parseDouble(rpmMin), parseDouble(rpmMax), carInfo, fToE, sToE, tToS, units);
|
||||
parent.repaint();
|
||||
}
|
||||
|
||||
|
@ -409,6 +432,7 @@ public final class DynoControlPanel extends JPanel {
|
|||
add(panel, gridBagLayout, buildFilterPanel(), 0, 0, 1, HORIZONTAL);
|
||||
add(panel, gridBagLayout, buildRadioPanel(), 0, 1, 1, HORIZONTAL);
|
||||
add(panel, gridBagLayout, buildInterpolatePanel(), 0, 2, 1, HORIZONTAL);
|
||||
add(panel, gridBagLayout, buildReferencePanel(), 0, 3, 1, HORIZONTAL);
|
||||
add(panel);
|
||||
}
|
||||
|
||||
|
@ -449,6 +473,19 @@ public final class DynoControlPanel extends JPanel {
|
|||
return panel;
|
||||
}
|
||||
|
||||
private JPanel buildReferencePanel() {
|
||||
JPanel panel = new JPanel();
|
||||
panel.setBorder(new TitledBorder("Reference Trace"));
|
||||
|
||||
GridBagLayout gridBagLayout = new GridBagLayout();
|
||||
panel.setLayout(gridBagLayout);
|
||||
add(panel, gridBagLayout, buildOpenReferenceButton(), 0, 0, 1, NONE);
|
||||
add(panel, gridBagLayout, buildSaveReferenceButton(), 1, 0, 1, NONE);
|
||||
add(panel, gridBagLayout, buildClearReferenceButton(), 2, 0, 1, NONE);
|
||||
|
||||
return panel;
|
||||
}
|
||||
|
||||
private void addLabeledComponent(JPanel panel, GridBagLayout gridBagLayout, String name, JComponent component, int y) {
|
||||
add(panel, gridBagLayout, new JLabel(name), 0, y, 3, HORIZONTAL);
|
||||
add(panel, gridBagLayout, component, 0, y + 1, 3, NONE);
|
||||
|
@ -474,6 +511,7 @@ public final class DynoControlPanel extends JPanel {
|
|||
add(panel, gridBagLayout, carMassLabel, 0, 27, 3, HORIZONTAL);
|
||||
add(panel, gridBagLayout, carMass, 1, 28, 1, NONE);
|
||||
addComponent(panel, gridBagLayout, buildRecordDataButton(), 31);
|
||||
addComponent(panel, gridBagLayout, buildLoadFileCB(), 32);
|
||||
// addLabeledComponent(panel, gridBagLayout, "Drag Coeff", dragCoeff, 33);
|
||||
// addLabeledComponent(panel, gridBagLayout, "Frontal Area", frontalArea, 36);
|
||||
// addLabeledComponent(panel, gridBagLayout, "Rolling Resist Coeff", rollCoeff, 39);
|
||||
|
@ -500,21 +538,26 @@ public final class DynoControlPanel extends JPanel {
|
|||
if (!carTypeArr[0].trim().equals(MISSING_CAR_DEF)) {
|
||||
recordDataButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
if (recordDataButton.isSelected()) {
|
||||
chartPanel.clear();
|
||||
parent.repaint();
|
||||
calculateEnv();
|
||||
if (isManual()) {
|
||||
registerData(ENGINE_SPEED, THROTTLE_ANGLE);
|
||||
}
|
||||
else {
|
||||
registerData(ENGINE_SPEED, VEHICLE_SPEED, THROTTLE_ANGLE);
|
||||
}
|
||||
chartPanel.startPrompt();
|
||||
} else {
|
||||
deregister();
|
||||
chartPanel.clearPrompt();
|
||||
}
|
||||
if (loadFileCB.isSelected()) {
|
||||
loadFromFile();
|
||||
}
|
||||
else {
|
||||
if (recordDataButton.isSelected()) {
|
||||
chartPanel.clear();
|
||||
parent.repaint();
|
||||
calculateEnv();
|
||||
if (isManual()) {
|
||||
registerData(ENGINE_SPEED, THROTTLE_ANGLE);
|
||||
}
|
||||
else {
|
||||
registerData(ENGINE_SPEED, VEHICLE_SPEED, THROTTLE_ANGLE);
|
||||
}
|
||||
chartPanel.startPrompt();
|
||||
} else {
|
||||
deregister();
|
||||
chartPanel.clearPrompt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -525,28 +568,40 @@ public final class DynoControlPanel extends JPanel {
|
|||
return recordDataButton;
|
||||
}
|
||||
|
||||
private JCheckBox buildLoadFileCB() {
|
||||
loadFileCB.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
if (loadFileCB.isSelected()) {
|
||||
recordDataButton.setText("Clear & Read From File");
|
||||
}
|
||||
else {
|
||||
recordDataButton.setText("Clear & Record Data");
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
return loadFileCB;
|
||||
}
|
||||
|
||||
public boolean isRecordData() {
|
||||
return recordDataButton.isSelected();
|
||||
}
|
||||
|
||||
private void buildRadioButtons(JPanel panel) {
|
||||
//Create the radio buttons.
|
||||
// JRadioButton iButton = new JRadioButton(IMPERIAL);
|
||||
iButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
buttonAction(iButton);
|
||||
}
|
||||
});
|
||||
iButton.setActionCommand(IMPERIAL);
|
||||
// iButton.setActionCommand(IMPERIAL);
|
||||
iButton.setSelected(true);
|
||||
|
||||
final JRadioButton mButton = new JRadioButton(METRIC);
|
||||
mButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
buttonAction(mButton);
|
||||
}
|
||||
});
|
||||
mButton.setActionCommand(METRIC);
|
||||
// mButton.setActionCommand(METRIC);
|
||||
|
||||
// final JRadioButton sButton = new JRadioButton(SI);
|
||||
// sButton.addActionListener(new ActionListener() {
|
||||
|
@ -653,10 +708,223 @@ public final class DynoControlPanel extends JPanel {
|
|||
// deltaMassLabel.setText("Delta Weight (kg)");
|
||||
// carMassLabel.setText("Base Weight (kg)");
|
||||
// }
|
||||
if (currentResult != null) interpolateButton.doClick();
|
||||
LOGGER.info("DYNO: Measurement units selected: " + units);
|
||||
}
|
||||
|
||||
private void registerData(String... ids) {
|
||||
private void loadFromFile() {
|
||||
final JFileChooser openFile = new JFileChooser();
|
||||
final JButton openButton = new JButton("Open");
|
||||
|
||||
int returnVal = openFile.showOpenDialog(openButton);
|
||||
|
||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||
final File traceFile = openFile.getSelectedFile();
|
||||
BufferedReader inputStream = null;
|
||||
recordDataButton.setSelected(false);
|
||||
chartPanel.clear();
|
||||
parent.repaint();
|
||||
|
||||
try {
|
||||
inputStream = new BufferedReader(new FileReader(traceFile));
|
||||
LOGGER.info("DYNO: Opening log file: " + traceFile.getName());
|
||||
boolean atrTime = false;
|
||||
double timeMult = 1;
|
||||
double startTime = -999999999;
|
||||
int timeCol = 0;
|
||||
int rpmCol = 0;
|
||||
int vsCol = 0;
|
||||
int taCol = 0;
|
||||
int sample = 0;
|
||||
double minSpeed = 3500;
|
||||
double maxSpeed = 0;
|
||||
String delimiter = COMMA;
|
||||
String line = inputStream.readLine();
|
||||
String[] headers;
|
||||
headers = line.split(COMMA);
|
||||
if (headers.length < 3) {
|
||||
headers = line.split(TAB);
|
||||
if (headers.length > 2) delimiter = TAB;
|
||||
}
|
||||
for (int x =0; x < headers.length; x++){
|
||||
if (headers[x].contains(RR_LOG_TIME)) timeCol = x;
|
||||
if (headers[x].contains(COBB_AP_TIME) || headers[x].contains(AEM_LOG_TIME)) {
|
||||
timeCol = x;
|
||||
timeMult = 1000;
|
||||
}
|
||||
if (headers[x].contains(COBB_ATR_TIME)) {
|
||||
timeCol = x;
|
||||
timeMult = 1000;
|
||||
atrTime = true;
|
||||
}
|
||||
if (headers[x].toUpperCase().contains(LOG_RPM) || headers[x].contains(LOG_ES)) rpmCol = x;
|
||||
if (headers[x].contains(LOG_VS)) vsCol = x;
|
||||
if (headers[x].contains(LOG_TA)) taCol = x;
|
||||
}
|
||||
while ((line = inputStream.readLine()) != null) {
|
||||
String[] values = line.split(delimiter);
|
||||
if (Double.parseDouble(values[taCol]) > 98) {
|
||||
double logTime = 0;
|
||||
if (atrTime) {
|
||||
String[] timeStamp = values[timeCol].split(COLON);
|
||||
if (timeStamp.length == 3) {
|
||||
logTime = ((Double.parseDouble(timeStamp[0]) * 3600) +
|
||||
(Double.parseDouble(timeStamp[1]) * 60) +
|
||||
Double.parseDouble(timeStamp[2])) * timeMult;
|
||||
}
|
||||
else {
|
||||
logTime = ((Double.parseDouble(timeStamp[0]) * 60) +
|
||||
Double.parseDouble(timeStamp[1])) * timeMult;
|
||||
}
|
||||
}
|
||||
else {
|
||||
logTime = Double.parseDouble(values[timeCol]) * timeMult;
|
||||
}
|
||||
if (startTime == -999999999) startTime = logTime;
|
||||
logTime = logTime - startTime;
|
||||
double speed = 0;
|
||||
if (isManual()){
|
||||
speed = Double.parseDouble(values[rpmCol]);
|
||||
minSpeed = Math.min(minSpeed, speed);
|
||||
maxSpeed = Math.max(maxSpeed, speed);
|
||||
}
|
||||
else {
|
||||
speed = Double.parseDouble(values[vsCol]);
|
||||
minSpeed = Math.min(minSpeed, (speed * rpm2mph));
|
||||
maxSpeed = Math.max(maxSpeed, (speed * rpm2mph));
|
||||
}
|
||||
chartPanel.addRawData(sample, logTime, speed);
|
||||
// LOGGER.trace(sample + "," + logTime + "," + speed);
|
||||
sample++;
|
||||
}
|
||||
}
|
||||
inputStream.close();
|
||||
rpmMin.setText(String.format("%1.0f", minSpeed));
|
||||
rpmMax.setText(String.format("%1.0f", maxSpeed));
|
||||
interpolateButton.doClick();
|
||||
}
|
||||
catch (IOException e) {
|
||||
if (inputStream != null) {
|
||||
try {
|
||||
inputStream.close();
|
||||
} catch (IOException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
LOGGER.info("DYNO: Open log file command cancelled by user.");
|
||||
}
|
||||
}
|
||||
|
||||
private JButton buildOpenReferenceButton() {
|
||||
final JFileChooser openFile = new JFileChooser();
|
||||
final JButton openButton = new JButton("Open");
|
||||
|
||||
openButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
int returnVal = openFile.showOpenDialog(openButton);
|
||||
|
||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||
final File traceFile = openFile.getSelectedFile();
|
||||
BufferedReader inputStream = null;
|
||||
|
||||
try {
|
||||
inputStream = new BufferedReader(new FileReader(traceFile));
|
||||
LOGGER.info("DYNO: Opening trace file: " + traceFile.getName());
|
||||
|
||||
String line = inputStream.readLine();
|
||||
String[] refStats = line.split(COMMA);
|
||||
chartPanel.setRefResults(refStats[2]);
|
||||
while ((line = inputStream.readLine()) != null) {
|
||||
String[] values = line.split(COMMA);
|
||||
if (Double.parseDouble(values[0]) >= 0 ) {
|
||||
chartPanel.setRefTrace(Double.parseDouble(values[0]), Double.parseDouble(values[1]), Double.parseDouble(values[2]));
|
||||
}
|
||||
}
|
||||
inputStream.close();
|
||||
if (refStats[0].equalsIgnoreCase(IMPERIAL)) {
|
||||
iButton.setSelected(true);
|
||||
buttonAction(iButton);
|
||||
}
|
||||
if (refStats[0].equalsIgnoreCase(METRIC)) {
|
||||
mButton.setSelected(true);
|
||||
buttonAction(mButton);
|
||||
}
|
||||
chartPanel.updateRefTrace(Integer.parseInt(refStats[1]));
|
||||
}
|
||||
catch (IOException e) {
|
||||
if (inputStream != null) {
|
||||
try {
|
||||
inputStream.close();
|
||||
} catch (IOException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
LOGGER.info("DYNO: Open trace file command cancelled by user.");
|
||||
}
|
||||
}
|
||||
});
|
||||
return openButton;
|
||||
}
|
||||
|
||||
private JButton buildSaveReferenceButton() {
|
||||
final JFileChooser openFile = new JFileChooser();
|
||||
final JButton saveButton = new JButton("Save");
|
||||
|
||||
saveButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
int returnVal = openFile.showSaveDialog(saveButton);
|
||||
|
||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||
final File traceFile = openFile.getSelectedFile();
|
||||
BufferedWriter outputStream = null;
|
||||
|
||||
try {
|
||||
outputStream = new BufferedWriter(new FileWriter(traceFile));
|
||||
LOGGER.info("DYNO: Saving trace to file: " + traceFile.getName());
|
||||
String line = units + COMMA + orderComboBox.getSelectedItem() + COMMA + currentResult;
|
||||
outputStream.write(line, 0, line.length());
|
||||
outputStream.newLine();
|
||||
|
||||
for (int x = 0; x < chartPanel.getPwrTqCount(); x++) {
|
||||
line = chartPanel.getPwrTq(x);
|
||||
outputStream.write(line, 0, line.length());
|
||||
outputStream.newLine();
|
||||
}
|
||||
outputStream.close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
try {
|
||||
outputStream.close();
|
||||
} catch (IOException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
LOGGER.info("DYNO: Save trace file command cancelled by user.");
|
||||
}
|
||||
}
|
||||
});
|
||||
return saveButton;
|
||||
}
|
||||
|
||||
private JButton buildClearReferenceButton() {
|
||||
final JButton clearButton = new JButton("Clear");
|
||||
clearButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
chartPanel.clearRefTrace();
|
||||
}
|
||||
});
|
||||
return clearButton;
|
||||
}
|
||||
|
||||
private void registerData(String... ids) {
|
||||
for (String id : ids) {
|
||||
LoggerData data = findData(id);
|
||||
EcuDataConvertor convertor = data.getSelectedConvertor();
|
||||
|
@ -689,7 +957,7 @@ public final class DynoControlPanel extends JPanel {
|
|||
}
|
||||
|
||||
private void addComponent(JPanel panel, GridBagLayout gridBagLayout, JComponent component, int y) {
|
||||
add(panel, gridBagLayout, component, 0, y, 3, HORIZONTAL);
|
||||
add(panel, gridBagLayout, component, 0, y, 3, NONE);
|
||||
}
|
||||
|
||||
private void addMinMaxFilter(JPanel panel, GridBagLayout gridBagLayout, String name, JTextField min, JTextField max, int y) {
|
||||
|
@ -718,7 +986,6 @@ public final class DynoControlPanel extends JPanel {
|
|||
}
|
||||
|
||||
private JButton buildInterpolateButton( final JComboBox orderComboBox) {
|
||||
JButton interpolateButton = new JButton("Recalculate");
|
||||
interpolateButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
if (isValidRange(rpmMin, rpmMax)) {
|
||||
|
|
|
@ -23,7 +23,7 @@ version.minor=5
|
|||
version.patch=3
|
||||
version.buildnumber=${buildnumber}
|
||||
version.extra=Beta
|
||||
version.extra1=RC5-rd-v8
|
||||
version.extra1=RC5-rd-v9
|
||||
|
||||
# the starting class for the application
|
||||
class.start=com.romraider.ECUExec
|
||||
|
|
Loading…
Reference in New Issue