Torque

Forums

Forums

Guest  

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




Torque » Torque OBD ECU Scanner » Torque Discussion / Ideas » Comprehensive list of PID operators and functions

Pages: 1 2 3 [4] 5 6
Author Topic: Comprehensive list of PID operators and functions
Capp777
Member
Posts: 2554
Post Re: Comprehensive list of PID operators and functions
on: July 14, 2017 (GMT)

Quote from bjt on July 13, 2017
I have an issue with my fuel level constantly flickering when I’m driving and the fuel is sloshing around in the tank, I need some kind of

delay(1000);

or something to stop it constantly updating and flickering, any ideas?

End Quote.

There are available functions which should
help…

Quote from Capp777 on October 2, 2016

Wiki equation page…

https://torque-bhp.com/wiki/Equations

End Quote.

bjt
Member
Posts: 6
Post Re: Comprehensive list of PID operators and functions
on: July 15, 2017 (GMT)

Nice one, thank you!

bjt
Member
Posts: 6
Post Re: Comprehensive list of PID operators and functions
on: August 22, 2017 (GMT)

Haven’t been able to get this to work correctly and only seem to get back garbage. My formula for fuel level is ((A*50)/100) how do you take the result of that and use TAVG(seconds:value)?

Capp777
Member
Posts: 2554
Post Re: Comprehensive list of PID operators and functions
on: August 22, 2017 (GMT)

Quote from bjt on August 22, 2017
Haven’t been able to get this to work correctly and only seem to get back garbage. My formula for fuel level is ((A*50)/100) how do you take the result of that and use TAVG(seconds:value)?

End Quote.

I would try…

TAVG(5:A*0.5)

Jays auto
Member
Posts: 2
Post Re: Comprehensive list of PID operators and functions
on: August 22, 2017 (GMT)

Quote from frodus on March 7, 2014
I’ve compiled a comprehensive list of PID operators and functions from various posts into one thread. If you know of any additional, post below and I will edit this post and try to keep near the top,or if Ian can STICKY, that’d be awesome.

I’ve found these:

* — multiply, example 256*A
/ — Divide, example A/10
+ — Add, example 256*A+B
— Subtract, example B-10
& – Logical AND, example A&4
() — precedence operator, example (256*A+B)*0.1
{A:b} — returns the bth bit of the byte A. Least significant bit is 0, example A = 00001010b = 09h, {A:0} = 0; {A:1} = 1
[XX] – returns the value of a PID, where XX is the ID of the OBD2 sensor. i.e. [0d] (speed) or [ff1001] (gps speed)
Baro() returns barometer psia from [33] – Vehicle or [ff1270] – Phone.
A^B – returns A to the power of b
Log10(A) – returns the Log(base 10) of A
SIGNED(A) returns decimal value of A assuming highest bit is a sign bit
ABS(A) returns absolute value of A
VAL{sensor name} returns the value of the sensor, make sure this matches exactly. Sensor names are their untranslated names.

Piemmm,

Do you have a full list of all the math that is available? Even if you email it to me, I can write it up and document it here. I just don’t know if there are any more available.

Also, suggest having a MIN() and MAX() that returns a running minimum or maximum of a particular PID.

15 years being a tuner from dsm to jdm

alawadhi3000
Member
Posts: 41
Post Re: Comprehensive list of PID operators and functions
on: December 23, 2017 (GMT)

I’m trying to make a custom PID that translate the response into text

If I’m using the example in the equations FAQ
LOOKUP(A::1=’moo’:2=’boo’)

To my understanding that means if the value of A=1 then display “moo” instead, else if the value of A=2 then display “boo” instead.

Whenever I put that equation in the custom PID it gives me the below error:-

Variable ‘:1=’moo’:2=’boo” does not exist.

alawadhi3000
Member
Posts: 41
Post Re: Comprehensive list of PID operators and functions
on: December 23, 2017 (GMT)

Okay I got it, it doesn’t work on the latest public version, I tried the BETA and it works.

crabber
Member
Posts: 19
Post Re: Comprehensive list of PID operators and functions
on: January 25, 2018 (GMT)

Could someone explain in simple terms for me this line from the first post please:

{A:b} — returns the bth bit of the byte A. Least significant bit is 0, example A = 00001010b = 09h, {A:0} = 0; {A:1} = 1

I notice that cintakc has pointed out that the example is wrong

A = 00001010 should be 0A in hex but what does the “bth” bit mean?

In the example {A:0} = 0 does the 0 mean the first bit then 1 the second etc? I just cant get my head around individual bits or am I looking at this in completely the wrong way?

cintakc
Member
Posts: 1105
Post Re: Comprehensive list of PID operators and functions
on: January 25, 2018 (GMT)

bit count in byte starts right from zero
00001000 – Bit(A:3) or {A:3}
76543210

00000010 – {A:1}

Capp777
Member
Posts: 2554
Post Re: Comprehensive list of PID operators and functions
on: February 9, 2018 (GMT)

How to handle signed HEX values…

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

andriy_
Member
Posts: 1
Post Re: Comprehensive list of PID operators and functions
on: February 10, 2018 (GMT)

Need to convert run time (PID 011F) in seconds to hours.minutes format. Smth like this:
Round(A%3600+(A-A%60)/100, 2). But I see no round or modulus functions…

Any ideas?

vl_vic
Member
Posts: 11
Post Re: Comprehensive list of PID operators and functions
on: April 10, 2018 (GMT)

Hi,
Who can help determine the equation for 1158 – short term fuel trim percent (ford focus 2)?
Here is the response: 7E8 05 62 11 58 87 AE 00 00 (should be -5.4 %) A=87 B=AE
1158 – short term fuel trim percent – 2 bytes – subtract 32768 then divide by -327.68 -not work(

Capp777
Member
Posts: 2554
Post Re: Comprehensive list of PID operators and functions
on: April 10, 2018 (GMT)

Quote from vl_vic on April 10, 2018
Hi,
Who can help determine the equation for 1158 – short term fuel trim percent (ford focus 2)?
Here is the response: 7E8 05 62 11 58 87 AE 00 00 (should be -5.4 %) A=87 B=AE
1158 – short term fuel trim percent – 2 bytes – subtract 32768 then divide by -327.68 -not work(

End Quote.

A*(100/128)-100 ?

((A*256)+B)*(100/32768)-100 ?

Positive result though?

Might try multiplying by -1.0 to
invert results…

(A*(100/128)-100)*-1.0 ?

(((A*256)+B)*(100/32768)-100)*-1.0 ?

Edited.

vl_vic
Member
Posts: 11
Post Re: Comprehensive list of PID operators and functions
on: April 10, 2018 (GMT)

no,value is considered 2 bytes.
A=87 B=AE.
((A*256)+B)-32768/-327,68 -not work(

FntX
Member
Posts: 49
Post Re: Comprehensive list of PID operators and functions
on: April 12, 2018 (GMT)

Your view on the variables is slightly wrong. I was wrong too.

7E 80 56 21 15 88 7A E0 00 0
R0 = 7E
R1 = 80
R2 = 56
R3 or A = 21
R4 or B = 15
R5 or C = 88
R6 or D = 7A
R7 = E0

This looks odd. Are you sure this is the right response?

If so you need to split the bits up:
{R5:1}*256+{R6:0} ***first byte
{R6:1}*256+{R7:0} ***second byte

Which, in theory, translates into the formula:
((({R5:1}*256+{R6:0})+({R6:1}*256+{R7:0}))-32768)/-327,68

Right?

Capp777
Member
Posts: 2554
Post Re: Comprehensive list of PID operators and functions
on: April 12, 2018 (GMT)

His response looks like typical CAN. Torque
would parse the data following 62 11 58 as
A, B, etc.

Note that internally the adapter treats 7E8
as 07 E8 whereas Torque’s Rx addressing
may not and may require a nibble shift for
proper alignment.

My two cents anyway.

Discussed here where ATD1 was used to achieve
shift…

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

cintakc
Member
Posts: 1105
Post Re: Comprehensive list of PID operators and functions
on: April 12, 2018 (GMT)

is not BMW – this ford focus 2 so there is no nibble shift

vl_vic
Member
Posts: 11
Post Re: Comprehensive list of PID operators and functions
on: April 12, 2018 (GMT)

yes, I did not meet nibble shift in any formula of focus

vl_vic
Member
Posts: 11
Post Re: Comprehensive list of PID operators and functions
on: April 13, 2018 (GMT)

By the way, it is a working formula for Long Trim (LONGFT1)
(A*256+B)/2.56-100. But SHRTFT1 calculates something differently:(

Pages: 1 2 3 [4] 5 6
WP-Forum by: Fredrik Fahlstad, Version: 2.4
Page loaded in: 0.197 seconds.

  Follow me on twitter