Torque

Forums

Forums

Comprehensive list ...
 
Notifications
Clear all

Comprehensive list of PID operators and functions

120 Posts
46 Users
0 Reactions
18.2 K Views
 bjt
(@bjt)
Posts: 6
Active Member
 

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)?

 
Posted : 22/08/2017 3:04 am
(@capp777)
Posts: 2999
Famed Member
 

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)

 
Posted : 22/08/2017 7:36 am
(@alawadhi3000)
Posts: 41
Eminent Member
 

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.

 
Posted : 23/12/2017 3:04 pm
(@alawadhi3000)
Posts: 41
Eminent Member
 

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

 
Posted : 23/12/2017 3:07 pm
(@crabber)
Posts: 19
Eminent Member
 

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?

 
Posted : 25/01/2018 3:31 am
(@cintakc)
Posts: 1667
Noble Member
 

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

00000010 - {A:1}

 
Posted : 25/01/2018 6:39 am
(@capp777)
Posts: 2999
Famed Member
 

How to handle signed HEX values...

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

 
Posted : 09/02/2018 12:16 am
(@andriy_)
Posts: 1
New Member
 

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?

 
Posted : 10/02/2018 6:20 am
(@vl_vic)
Posts: 11
Active Member
 

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(

 
Posted : 10/04/2018 7:47 am
(@capp777)
Posts: 2999
Famed Member
 

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.

 
Posted : 10/04/2018 6:18 pm
(@vl_vic)
Posts: 11
Active Member
 

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

 
Posted : 10/04/2018 6:37 pm
 FntX
(@fntx)
Posts: 63
Trusted Member
 

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?

 
Posted : 12/04/2018 1:55 pm
(@capp777)
Posts: 2999
Famed Member
 

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

 
Posted : 12/04/2018 6:34 pm
(@cintakc)
Posts: 1667
Noble Member
 

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

 
Posted : 12/04/2018 7:12 pm
(@vl_vic)
Posts: 11
Active Member
 

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

 
Posted : 12/04/2018 10:14 pm
(@vl_vic)
Posts: 11
Active Member
 

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

 
Posted : 13/04/2018 7:23 am
(@capp777)
Posts: 2999
Famed Member
 

Could you post a sample raw hex bytes
and expected value for your LTFT equation?

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

would have been my guess.

00 00 yields -100.0
FF FF yields 99.997
80 00 yields 0.0

(65535/2.56)-100 = 25499.61

Trying to understand as my son drives
a Crown Vic so these pids/equations would
be useful to us as well.

 
Posted : 14/04/2018 5:01 pm
(@vl_vic)
Posts: 11
Active Member
 

LONGFT1 for ford focus 2:
request:7E0 03 22 11 56 00 00 00 00
response:7E8 05 62 11 56 00 EF 00 00 (-6.64)
response:7E8 05 62 11 56 00 F7 00 00 (-3.52)

 
Posted : 15/04/2018 8:52 am
(@capp777)
Posts: 2999
Famed Member
 

Signed(B)*(100/256) ?

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

 
Posted : 15/04/2018 10:09 am
(@vl_vic)
Posts: 11
Active Member
 

((A*256)+B)*(100/256)-100 it is for LONGFT1

 
Posted : 16/04/2018 7:14 am
Page 4 / 6
Share:

  Follow me on twitter