Torque

Forums

Forums

Guest  

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




Torque » Torque OBD ECU Scanner » Torque Discussion / Ideas » Custom Pid Help

Pages: 1 [2]
Author Topic: Custom Pid Help
F-150Torqued
Member
Posts: 437
Post Re: Custom Pid Help
on: April 21, 2017 (GMT)

Thanks Capp777. I think @userM’s vehicle is a BMW and if it supports [0C] I would be willing to bet it would support [0D] (or Vehicle speed – in kph). If it does not – seems we would be faced with TWO unknowns – Gear Ratio & Speed. So other than ‘math is fun’, were sunk.

But MY ‘OLD’ 2004 F150 5.4l Has GEAR at PID # 11B3, Formula: A/2. If I am correct about @userM’s being a BMW, my bet is that it has both VSS, _AND_ GEAR somewhere if it could just be found.

But working out cleaver new PID’s & Displays is COOL & FUN – Like the one I created that “ALTERNATES” between Volts display & Temperature display for Cylinder Head Temp on my vehicle – using the CHT_V volts sensor. The concept can be used for ANY gauge.

I found PID for a constant counter. Ie: PIDs on MY vehicle for “Acceleration UP Counter” (# 1617) and “Deceleration Counter” (# 1618) that run as continuous counters depending on whether the engine is under “positive” or “negative” Torque.

I created a ‘Virtual PID’ named ‘TRQ-acc 1617’ out of the UP Counter (MODE/PID 221617) with formula ((A*256+B)&8)/8. This Virtual PID just masks off bit3 of the constant UP counter and creates a ZERO or ONE out of it – which gives me alternating Zero/One at the desired rate – about every few (5-6) seconds.

Then I changed the Short Name of CHT_V (PID 1685) to “CHT_V/ºF” and used the Formula:

(val{TRQ-acc 1617})*((65535-(A*256+B)/13107)+((val{TRQ-acc 1617})*-1)+1)*((65535-(A*256+B))/94.875)

Both halves of the Formula are multiplied by the Value of ‘TRQ-acc 1617’, then added together and displayed on a ‘Digital Gauge with Units specified as ‘Volts/Deg F’. Since ‘TRQ-acc 1617 can never be anything other than ZERO or ONE, either the left half or right half of the formula is multiplied by ZERO when the OTHER half is multiplied by ONE. Thus, adding them together results in simply displaying either Volts – or Deg F alternately.

What’s really COOL is, since letting off the accelerator stops the ‘Acceleration UP Counter’ (and starts the Deceleration counter), you can STOP the display’s alternation at any time by simply letting off the gas!!!

I have the standard CHT (PID 1624) – which is ‘Normalized’ CHT displayed right next to it, and the gauge based on voltage/Degrees will swing above and below the normalized Cylinder Head Temp when under load or coasting for a distance.

————
54371019

Capp777
Member
Posts: 2993
Post Re: Custom Pid Help
on: April 21, 2017 (GMT)

Both [0C] and [0D] are standard OBDII so
hopefully the BMW supports them.

Your custom pid for gear is Ford specific
so I doubt it will work on the BMW.

Its amazing what can be done with a little
thought behind the equations. Torque definitely
stands out from the pack for sure.

While I can’t use Torque Pro on my car which is
OBDI, it’s still fun to see how others use it like
your examples.

userM
Member
Posts: 96
Post Re: Custom Pid Help
on: April 22, 2017 (GMT)

OD + OC working in my car

I tested the pid with ((([OC]/(0.83*2.813))*1.83)*60)/1000
and I do get a respond but I don’t know what the numbers saying..

userM
Member
Posts: 96
Post Re: Custom Pid Help
on: April 22, 2017 (GMT)

I like this concept ( I have to studied in order to understand it)

If your vehicle supports …
[0C] Engine rpm
[0D] Vehicle Speed in kph
TireCir Tire Circumference in meters
GearRatio = ([0C]*60*TireCir)/([0D]*2813)
0.83 = (1600*60*1.83)/(75.244*2813)
To my knowledge there is no way to look
up a ratio to gear.

Can we make a pid to check 6 other pids? with if statements (something like in excel)?

meaning
if number = 0.83 then 6
if 1 = 5
if 1.23 = 4
etc?

edit:
(1600*60)*(1/0.83)*(1/2.813)*(1.83/1000) = 75.244 kph
however like I said if od=6500

then
(6500*60)*(1/0.83)*(1/2.813)*(1.83/1000) = 305,680 kph
which is not true..

(I have to check again the TireCir Tire Circumference
it should be less..)

Capp777
Member
Posts: 2993
Post Re: Custom Pid Help
on: April 22, 2017 (GMT)

Since engine rpms determines the speed…

1600 rpm = ~75
3200 rpm = ~150
6400 rpm = ~300

seems reasonable?

userM
Member
Posts: 96
Post Re: Custom Pid Help
on: April 22, 2017 (GMT)

It is reasonable but not real. max speed is 240

F-150Torqued
Member
Posts: 437
Post Re: Custom Pid Help
on: April 22, 2017 (GMT)

Sorry – we’re not going to be able to come up with ANY formula that will actually make your car go faster! LOL

————

54371019

Capp777
Member
Posts: 2993
Post Re: Custom Pid Help
on: April 22, 2017 (GMT)

Maybe doing something similar to what
F-150Torqued did? (to display gear).

Torque does not have a lookup function or
IF…THEN capability.

F-150Torqued
Member
Posts: 437
Post Re: Custom Pid Help
on: April 22, 2017 (GMT)

Quote from Capp777 on April 22, 2017

Torque does not have a lookup function or
IF…THEN capability.

This is a perfect example of why I’ve been pleading for @piemmm to implement Boolean arithmetic capability. It would be a breeze if you could simply stick (4.552*(Gear=1)+2.548*(Gear=2)+1.659*(Gear=3)…etc) in the formula in place of OD. @userM could create a virtual PID with your example to determin Gear if it can’t be located from OBDII and do this type thing if Torque would let us use the processor’s actual numeric result (zero / one /or minus 1) from logical tests.

Another method that I believe could be made to work within current Torque math would be to develop a curve fitting formula against which the “INT” function would result in accurate numeric GEAR number. Similar to (but simpler than) that which I was working on to get accurate Engine Oil Temperature from the Oil Temp sensor Voltage out put.

————–

54371019

userM
Member
Posts: 96
Post Re: Custom Pid Help
on: April 22, 2017 (GMT)

Well, I am not a mathematician or physicist and in general I don’t know much about cars given the fact that my interest began a few months ago.

However after a few tries with [0D]/[0C] I can say that I have the gear indication with almost 100% success

I had to add to the formula (([0D]/[0C])+0.0045)*100 and in a digital dial I turned the decimals to 1 and I am getting the correct gear indicator.

I would prefer a more scientific and elegant solution but until then I think I am getting what I need!

F-150Torqued
Member
Posts: 437
Post Re: Custom Pid Help
on: April 22, 2017 (GMT)

What do you mean you’re “not a mathematician”. I wouldn’t expect your ordinary ‘chimney sweep’ to come up with that. Lol

You might be able to put brackets around your formula and add “INT” (without the quotes) in front. Then you might be able to use any gauge type – or specify digital gauge decimals as zero. OR use a histogram gauge and see which gear you spend the most time driving in!! Lol

I’ve been guilty of sticking similar things in an Excel spreadsheet and just playing with it till I get something that produces the correct answer for a PID from the PID SCAN on my vehicle. WISH LAN WOULD GET TORQUE SCAN WORKING AGAIN.

—————–

54371019

Capp777
Member
Posts: 2993
Post Re: Custom Pid Help
on: April 23, 2017 (GMT)

I would create a gear pid using the
following equation:

((Val{GearRatio}^-1.039)*5.0149)+0.12

then use a digital display set to zero
decimal places.

This assumes you have created a custom pid
named GearRatio from our previous postings.

GearRatio -> Predicted Gear -> Displayed Gear

4.552 -> 1.15846 -> 1
2.548 -> 2.01767 -> 2
1.659 -> 3.08375 -> 3
1.230 -> 4.16437 -> 4
1.000 -> 5.13490 -> 5
0.830 -> 6.20611 -> 6

user_M
Member
Posts: 20
Post Re: Custom Pid Help
on: April 23, 2017 (GMT)

If it outta not much trouble please give me more specific because i don’t see what I should do

Capp777
Member
Posts: 2993
Post Re: Custom Pid Help
on: April 23, 2017 (GMT)

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.

userM
Member
Posts: 96
Post Re: Custom Pid Help
on: April 24, 2017 (GMT)

I don’t much have time to test it but for a few minutes it is working ok. Only 2 problems I noticed

1. in low speeds with 6th Gear it returns 7
2 again in low speed 5th Gear returns 4 (if i remember correct)

Capp777
Member
Posts: 2993
Post Re: Custom Pid Help
on: April 24, 2017 (GMT)

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.

userM
Member
Posts: 96
Post Re: Custom Pid Help
on: April 24, 2017 (GMT)

ok,I we calculate, adjust and let you know. Thanks!

bjmsam
Member
Posts: 12
Post Re: Custom Pid Help
on: January 4, 2019 (GMT)

Thank you! The Imperial units equation works for me as long as [0D] is scaled by 0.621371, since despite Torque being configured for MPH, values for speed (both OBD and GPS) used in PID calculations are in KPH. For my car:

Column “GearRatio” is computed in Torque as:

([0C]*60*6.98)/((([0D]*.621371)+0.1)*3.42*5280)
   or
([0C]*60*2.12)/(([0D]+0.1)*3.42*1000)
   or
0.037*([0C]/([0D]+0.1))

.
.
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’)

.
.
More discussion (and a simpler / computationally cheaper alternative) here.

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

  Follow me on twitter