Torque

Forums

Forums

Guest  

Show or hide header
Welcome Guest, posting in this forum require registration.




Torque » Torque OBD ECU Scanner » Torque Discussion / Ideas » Gear indication (possible solution)

Pages: [1] 2
Author Topic: Gear indication (possible solution)
dark_1
Member
Posts: 4
Post Gear indication (possible solution)
on: November 2, 2017 (GMT)

Hi all. First post here. This is long sorry, skip to the bold text for the how to.

So I’ve had torque pro for a few years and recently started playing with it again. Always wanted gear indication but could never find a good solution and didn’t want to pay for one as I don’t really use it much and its more just for fun.

Short of writing a plugin I noticed we can use an equation for a PID and wanted to see if I could come up with a working one without conditional statements.

Thanks to some of the other members, there’s another thread where they were doing something similar but I couldn’t figure out how they came up with certain numbers.

This is working for me and I’m sharing with you guys to see if it can work for others. I’ll be keeping my eye on this thread for the next little while for your feedback. Oh and this works for my manual transmission, no idea how it will work for automatics.

How To
For this to work you will need
1. Your gear ratios. This is a must, just google for your transmission and you should be able to find them. You need at least one gear ratio or final drive ratio. The rest we can figure out but I have not included this functionality into the sheet yet, let me know if someone needs.

2. Tire size. The sheet uses metric tire sizes but as long as you can figure out your tire circumference in inches, just enter that into the sheet.

I’ve included instructions in the sheet on what to do. Just basically fill out your ratios and tire dimensions and it will give you the corresponding speeds for your car at a specific rpm. You can change the rpm from 2000 to whatever you want. Write the speeds down and go check how close they are by driving your car and maintaining that rpm in that gear. If they match your ratios are good. They don’t need to be exact, within 5 should be close enough.

Once you know they’re good follow the instructions and create the 2 PIDs. For testing create 2 displays, one for GearRatio and another for Gear. Make sure to format the display for gear to have 0 decimal places and GearRatio to have 2-3. I believe doing this rounds the number which is what we want. I couldn’t find a round function to use in the formula entry for PID.

Drive around and see how close they are. For me 1, 2, 3 were pretty good but higher gears, especially at lower rpms would fluctuate between correct gear and one lower. If the displayed gear is off, start adjusting the equation for Gear in small increments. GearRatio should display a number close to your actual ratio, it will fluctuate a bit but should not be off by a lot.

For me the equation came out to be 3.822x^-1.072. I adjusted the 3.822 until now where it shows correct gear ~90-95% of the time. My final number was 3.97.

Oh and please guys DRIVE SAFE. Don’t stare at your tach trying to maintain 2000 on the dot. Pay attention to the road lol

Here’s the excel sheet
https://nofile.io/f/Qm5DTk2STzo/gear+indicator+torque+pro.xlsx

Capp777
Member
Posts: 2993
Post Re: Gear indication (possible solution)
on: November 2, 2017 (GMT)

Is this the thread you mentioned? (where
certain numbers couldn’t be figured out).

https://torque-bhp.com/forums/?wpforumaction=viewtopic&t=8721.0

dark_1
Member
Posts: 4
Post Re: Gear indication (possible solution)
on: November 3, 2017 (GMT)

Yea it is. I tried to come up with a way to get an equation to predict the current gear for anyone based on their gear ratios. I started the whole process from a spreadsheet I found at https://forum.reveltronics.com/viewtopic.php?t=87

Then I found a formula at https://en.wikipedia.org/wiki/Gear_train which I realized I could use but just needed to come up with a way to get an equation.

So I plotted gear ratios on a graph at x and gear on y. Turned out a power line matches all the points almost exactly. So because we know final ratio, tire circumference, rpm and speed, we can calculate what our current gear ratio is and in turn what gear we are in. I’m not sure if its been done before but I couldn’t find anything through google to give us our gear ratios with just an equation (that anyone can come up with as opposed to one from someone else). If there’s a universal equation for this I’d love to know :).

Capp777
Member
Posts: 2993
Post Re: Gear indication (possible solution)
on: November 3, 2017 (GMT)

F-150Torqued and I developed the equations in
that link specifically using the OP’s gear and
differential data. Since Torque does not have a
lookup capability to get the OP’s correct gear,
a polynomial equation was used.

The GearRatio equation’s “2.813” value would have
to be changed to the correct differential ratio
for others to use and the polynomial equation,
specific to the gear ratios in use, would need to be
recalculated. TireCir value would also have to be
revised to the correct value.

Quote from Capp777 on April 23, 2017
Create two custom pids using the equations
already provided in previous posts.

GearRatio

Gear

Then use a digital display type for Gear
with decimal places set to zero (0) to eliminate
the fractional part of result.

I have tested offline and your Gear ratios
displayed correct Gear (1-6).

Long Name: GearRatio
Short Name: GearRatio
Mode/PID: leave blank
Header: Auto
Min: 0
Max: 5
Units: ratio
Scaling: x1
Equation: ([0C]*60*1.830)/(([0D]+1)*2.813*1000)
Diag. Start/Stop: leave blank
Notes: [0D] is kph and TireCir (1.830) is in meters.

Long Name: GearRatio
Short Name: GearRatio
Mode/PID: leave blank
Header: Auto
Min: 0
Max: 5
Units: ratio
Scaling: x1
Equation: ([0C]*60*6.004)/((([0D]*0.621371192)+1)*2.813*5280)
Diag. Start/Stop: leave blank
Notes: [0D] is kph and TireCir (6.004) is in feet.

Long Name: Gear
Short Name: Gear
Mode/PID: leave blank
Header: Auto
Min: 1
Max: 6
Units: gear
Scaling: x1
Equation: ((Val{GearRatio}^-1.039)*5.0149)+0.12
Diag. Start/Stop: leave blank
Notes: Equation for gear ratios given on page [1].

Edited for BJMSAM corrections.

End Quote.

dark_1
Member
Posts: 4
Post Re: Gear indication (possible solution)
on: November 3, 2017 (GMT)

Check the excel sheet :-)

F-150Torqued
Member
Posts: 437
Post Re: Gear indication (possible solution)
on: November 4, 2017 (GMT)

@dark_1

Thanks for sharing. Nice Spreadsheet. I’m glad you got into ‘virtual’ pids and working out cool formulas. Makes Torque infinitely more fun.

I realize your GEAR methodology is applicable without respect to vehicle make.

And a frustrating fact of OBDII is the proprietary (and seemingly non-standard) nature of OBDII PID assignments.

But for those Torque users who own Ford F150, Automatic, (about 2004 through 2008), I have dug up about thirty some-odd great PIDs relating to the Torque Convertor and Transmission. GEAR, and GEAR RATIO and a bunch of other great readings are among them.

GEAR – Current Transmission Gear – PID# 11B3, Unit: Int. Equation A/2
TSS/ISS – Turbine Shaft Speed/Input Shaft Speed – PID# 11B4, Unit: RPM. Equation (A*256+B)/4
OSS – Output Shaft Speed – PID 11B5, Unit: RPM. Equation (A*256+B)/4
GR – Gear Ratio (Input Shaft – to – Output Shaft speed ratio) – PID 163B, Unit: Integer Ratio, Equation (A*256+B)/16384

Having fun with formulas, I have created one gauge that ‘alternates’ between Volts / CHT Temperature. I located a asynchronous ‘Counter’ out of which I mask out the 4bit (with the ‘&’ operator) and shift it into LSB position in a virtual PID to use for a Boolean multiplier (either 0 or 1), I’ll call it ‘BX’. Then I combined the TWO formulas into one – ie: ((Formula for Volts * BX) + (Formula for Temp * ((BX*-1)+1))) for my alternating gauge. One side or the other of the formula will always come out to ZERO, leaving the other as the sole result (either volts or temp).

—————

54371019

dark_1
Member
Posts: 4
Post Re: Gear indication (possible solution)
on: November 4, 2017 (GMT)

Heh thanks. Wouldn’t it be great if they openly shared this info with us? I mean we’re only dumping tens of thousands to buy their vehicles. Would be great if there was an open protocol. Anyways. I’m glad I found your thread and was able to use it toward this. I really thought I’d have to code a plugin just to get a stupid gear display. I mean the only useful purpose for me were if I were recording a vid and used it as an overlay to show my shifts. But anyways glad someone thinks its useful. I’m hoping others try it out so we can improve it and who knows maybe it can be incorporated into torque.

Cheers

Capp777
Member
Posts: 2993
Post Re: Gear indication (possible solution)
on: December 28, 2018 (GMT)

Quote from Capp777 on April 24, 2017
Since kph reported and TireCir might not be
exact, I would take the time to tweak the 1.83
until you obtain the precise gear ratios you
posted.

The mechanical relationship between
engine rpm, gear ratio and speed is fixed
so its likely the gear ratios not being exact
is the cause (or the update rate of changing
data for [0C] and [0D]).

Like I said before, I tested the exact ratios and
it displayed the correct gear during my tests.

Then there is the Torque Converter slippage
which could be an issue at lower speeds with
Automatic Transmissions?

Edited.

Torque Pro 1.8.190

Any beta testers willing to give this a try…

closest(([0C]*60*1.830)/(([0D]+1)*2.813*1000)::28.000=’P/N’:4.552=’1st’:2.548=’2nd’:1.659=’3rd’:1.230=’4th’:1.000=’5th’:0.830=’6th’:0.0=’OFF’)

closest(([0C]*60*6.004)/((([0D]*0.621371192)+1)*2.813*5280)::28.000=’P/N’:4.552=’1st’:2.548=’2nd’:1.659=’3rd’:1.230=’4th’:1.000=’5th’:0.830=’6th’:0.0=’OFF’)

Edited for BJMSAM corrections.

End Quote.

This gear solution was posted on the thread given
above on page two. Note the ([0D]+1) in the
closest() equations at bottom. (Meters and feet)..

Long Name: Gear
Short Name: Gear
Mode/PID: leave blank
Header: Auto
Min: 1
Max: 6
Units: gear
Scaling: x1
Equation: closest(([0C]*60*1.830)/(([0D]+1)*2.813*1000)::28.000=’P/N’:4.552=’1st’:2.548=’2nd’:1.659=’3rd’:1.230=’4th’:1.000=’5th’:0.830=’6th’:0.0=’OFF’)
Diag. Start/Stop: leave blank

Long Name: Gear
Short Name: Gear
Mode/PID: leave blank
Header: Auto
Min: 1
Max: 6
Units: gear
Scaling: x1
Equation: closest(([0C]*60*6.004)/((([0D]*0.621371192)+1)*2.813*5280)::28.000=’P/N’:4.552=’1st’:2.548=’2nd’:1.659=’3rd’:1.230=’4th’:1.000=’5th’:0.830=’6th’:0.0=’OFF’)
Diag. Start/Stop: leave blank

Edited for BJMSAM corrections.

bjmsam
Member
Posts: 12
Post Re: Gear indication (possible solution)
on: December 30, 2018 (GMT)

Thanks! I tried both with mixed results. The conditional was closest (pun intended), but what was displayed did not reflect what was logged. Here are examples when driving in 2nd (“4” indicated) and 4th (“5” indicated) gears (car specs):

Speed (GPS)(mph)   Engine RPM(rpm)   Gear(gear)   GearRatio(ratio)   ratio
21                 1920              1.00         1.14               2.05
40                 1707              0.74         0.63               0.97

.
.
Column “Gear” is determined as follows:

closest((Val{GearRatio})::28.000=’P/N’:2.66=’1st’:1.78=’2nd’:1.30=’3rd’:1.00=’4th’:0.74=’5th’:0.50=’6th’:0.0=’OFF’)

.
.
Column “GearRatio” is computed in Torque as:

([0C]*60*6.98)/(([0D]+1)*3.42*5280)

.
.
Column “Ratio” is computed in the spreadsheet as:

=(RPM*60*6.98)/((MPH+1)*3.42*5280)

.
.
Perhaps [0C] and [0D] are different values than Engine RPM(rpm) and Speed (GPS)(mph), respectively?

Capp777
Member
Posts: 2993
Post Re: Gear indication (possible solution)
on: December 30, 2018 (GMT)

The equations provided would have to be
edited for your vehicle.

Tire Circumference in meters and feet
(1.830 and 6.004). (Should be adjusted to
yield closest match to target gear ratio in
list. In your example, should be adjusted
to yield 1.78 for known second gear).

Differential Ratio (2.813).

and the gear ratios for your specific
vehicle.

[0C] and [0D] are from the ECU whereas
GPS Speed is from your phone.

bjmsam
Member
Posts: 12
Post Re: Gear indication (possible solution)
on: December 31, 2018 (GMT)

Thanks. My previous post reflects those very adjustments for my vehicle and correct ratios calculated by the spreadsheet (vs. the GearRatios calculated and logged by Torque), so ’tis a mystery.

Converting the GPS speed to KPH in the spreadsheet does not produce the GearRatio values that Torque logged, so that’s not it… any other ideas?

Capp777
Member
Posts: 2993
Post Re: Gear indication (possible solution)
on: December 31, 2018 (GMT)

Did you adjust the tire circumference as
I suggested to increase from 1.14 to the
expected 1.78 in second gear? (GearRatio).

Your table didn’t show values for [0D] mph
which was used to compute GearRatio.

1.14 = (1920*60*6.98)/(([0D]+1)*3.42*5280)

1.14*(([0D]+1)*3.42*5280) = (1920*60*6.98)

([0D]+1) = (1920*60*6.98) / (1.14*3.42*5280)

([0D]+1) = 39.06096981

then solve…

1.78 = (1920*60*X)/(([0D]+1)*3.42*5280)

1.78*(([0D]+1)*3.42*5280) = (1920*60*X)

X = 1.78*(([0D]+1)*3.42*5280)/(1920*60)

X = 10.89859649

Use value of X for Tire Circumference.

bjmsam
Member
Posts: 12
Post Re: Gear indication (possible solution)
on: December 31, 2018 (GMT)

The 6.98 value I used for tire circumference is as computed by the spreadsheet attached earlier and confirmed by this tire size calculator for my rear size of 325/30-19. Again, the ratio values computed within the spreadsheet seem correct, so I still suspect the [0D] values rather than the formulas and will log that PID next time and use GPS MPH for computations within Torque. Thanks!

Capp777
Member
Posts: 2993
Post Re: Gear indication (possible solution)
on: December 31, 2018 (GMT)

Its not unusual that the mph is actually
lower than shown. Big difference between
21 and 39 mph though!

Still hope you test with tire circumference
X.

GPS mph yielded 2.05 which is above ideal
1.78 ratio which still needs minor tweaking.

bjmsam
Member
Posts: 12
Post Re: Gear indication (possible solution)
on: December 31, 2018 (GMT)

True, but consider these rows from the same log also when driving in 2nd and 4th:

Speed (GPS)(mph)   Engine RPM(rpm)   Gear(gear)   GearRatio(ratio)   ratio
15                 1216              1.00         1.08               1.78
34                 1515              0.74         0.63               1.00

.
.
I now have Torque configured to log OBD speed [0D] and GPS speed [ff1001], GearRatio computed with each, and Gear computed for each. Is it possible for Torque to log 4 and 5 for Gear rather than 1.00 and 0.74? The next time I take that car out, I will try to log a range of RPMs in each gear so we have more useful data for this beta test.

Capp777
Member
Posts: 2993
Post Re: Gear indication (possible solution)
on: December 31, 2018 (GMT)

I don’t believe Torque will log the text
values.

Golfer1971
Member
Posts: 6
Post Re: Gear indication (possible solution)
on: January 1, 2019 (GMT)

Hi there!
I‘m new here in and I‘m really curious for a final solution that works smoothly for my Golf 7!

Cheers!
Daniel from Germany

bjmsam
Member
Posts: 12
Post Re: Gear indication (possible solution)
on: January 4, 2019 (GMT)

I cannot explain the discrepancy between values calculated by Torque and values calculated by the spreadsheet.

Engine RPM(rpm)   Speed (OBD)(mph)   Speed (GPS)(mph)   GPS vs OBD Speed   GearRatio(ratio)   RatioOBD      GearRatioGPS(ratio)   RatioGPS      Gear(gear)   GearGPS(gear)   Gear
                                                        Difference(mph)    Torque             Spreadsheet   Torque                Spreadsheet                                Actual
708               0                   0.04               0.04               16.43              16.43         15.48                 15.79         28           28              1
1264              3.73                0.38               3.35                4.19               6.20         18.18                 21.25         28           28              1
1483              12.43               7.56               4.87                1.64               2.56          2.61                  4.02          1.78         2.66           1
2615              19.88              16.46               3.42                1.67               2.91          2                     3.47          1.78         1.78           1
3455              29.2               24.28               4.92                1.67               2.65          1.92                  3.17          1.78         1.78           1
4271              36.04              31.59               4.45                1.68               2.67          1.91                  3.04          1.78         1.78           1
3288              37.28              37.21               0.07                1.25               1.99          1.25                  2.00          1.3          1.3            2
3286              41.63              38.18               3.45                1.12               1.79          1.22                  1.95          1            1.3            2
3825              49.71              43.85               4.61                1.12               1.75          1.24                  1.98          1            1.3            2
4512              57.17              51.8                5.36                1.13               1.80          1.24                  1.98          1            1.3            2
3714              59.65              58.41               1.24                0.89               1.42          0.91                  1.45          1            1              3
3464              60.27              59.02               1.26                0.82               1.31          0.84                  1.34          0.74         0.74           3
3608              62.76              60.96               1.79                0.82               1.31          0.84                  1.35          0.74         0.74           3
3658              63.38              62.78               0.6                 0.82               1.32          0.83                  1.33          0.74         0.74           3
3570              62.14              63.13               0.99                0.82               1.31          0.82                  1.29          0.74         0.74           3
3238              60.89              61.08               0.18                0.76               1.21          0.76                  1.21          0.74         0.74           3
2624              59.65              59.3                0.35                0.63               1.00          0.63                  1.01          0.74         0.74           4
2665              60.27              59.42               0.86                0.63               1.01          0.64                  1.02          0.74         0.74           4
1932              60.27              60.14               0.14                0.51               0.73          0.52                  0.73          0.5          0.5            5
1977              60.27              59.56               0.71                0.47               0.75          0.47                  0.76          0.5          0.5            5
1905              60.27              59.87               0.4                 0.45               0.72          0.45                  0.73          0.5          0.5            5
1290              59.03              59.08               0.05                0.31               0.50          0.31                  0.50          0.5          0.5            6
1282              57.79              58.04               0.25                0.31               0.51          0.32                  0.50          0.5          0.5            6
1261              57.17              57.26               0.09                0.31               0.50          0.31                  0.50          0.5          0.5            6
1244              55.92              56.15               0.23                0.32               0.51          0.32                  0.51          0.5          0.5            6
1225              55.3               55.31               0.01                0.32               0.50          0.32                  0.50          0.5          0.5            6
1199              54.06              54.27               0.21                0.32               0.51          0.32                  0.50          0.5          0.5            6
1154              52.2               53.27               1.08                0.31               0.50          0.31                  0.49          0.5          0.5            6
1012              45.36              49.07               3.71                0.32               0.51          0.29                  0.47          0.5          0.5            6
896               39.77              42.19               2.42                0.32               0.51          0.3                   0.48          0.5          0.5            6
882               39.77              39.52               0.25                0.31               0.50          0.32                  0.50          0.5          0.5            6
868               39.15              38.13               1.01                0.32               0.50          0.32                  0.51          0.5          0.5            6
854               38.53              38.61               0.08                0.31               0.50          0.31                  0.50          0.5          0.5            6
860               38.53              38.17               0.35                0.32               0.50          0.32                  0.51          0.5          0.5            6
1292              39.15              38.87               0.28                0.47               0.75          0.47                  0.75          0.5          0.5            5
1257              38.53              38.73               0.21                0.47               0.74          0.48                  0.73          0.5          0.5            5
1124              38.53              38.7                0.17                0.41               0.66          0.41                  0.66          0.5          0.5            5

.02319245 = (60 * 6.98) / (3.42 * 5280)

In spreadsheets for my car, [0C] / ([0D]+1) ratios fall neatly into the following bins for each gear, so I will try that next time (much simpler without transmission gear ratios, differential ratio, and tire circumference):

gear   RPM/(MPH+1)
1      120
2       80
3       60
4       45
5       23
6       22
bjmsam
Member
Posts: 12
Post Re: Gear indication (possible solution)
on: January 4, 2019 (GMT)

Implementing my simpler approach above helped reveal the problem. Despite Torque being configured for MPH, values for speed (both OBD and GPS) used in PID calculations are in KPH. Multiplying [0D] by 0.621371 corrected all three methods, which now display correctly!

([0C] / ([0D] * 0.621371) + 0.1)

for calculations with Imperial units

I will stick with my approach (RPM/KPH ratios for each gear derived from logged data) since it is computationally cheaper for Torque to maximize sampling rate.

closest(([0C]/([0D]+0.1))::500='N':'200'='1':130='2':95='3':70='4':50='5':35='6':0='Off')

single PID with ratios for my car determined simply by logging a short drive through each gear

Now, if only Torque could log the gear (as a string or number) rather than the ratio to avoid multiple search/replace operations in the spreadsheet when reviewing logs…

Anyway, thanks for the inspiration!

Capp777
Member
Posts: 2993
Post Re: Gear indication (possible solution)
on: January 4, 2019 (GMT)

Thanks for the update! Based upon your
observations does the meter based form
of the equation work as posted without
corrections?

Pages: [1] 2
WP-Forum by: Fredrik Fahlstad, Version: 2.4
Page loaded in: 0.066 seconds.

  Follow me on twitter