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
frodus
Member
Posts: 518
Post Comprehensive list of PID operators and functions
on: March 7, 2014 (GMT)

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.

Vasilich
Member
Posts: 218
Post Re: Comprehensive list of PID operators and functions
on: April 5, 2014 (GMT)

The custom PID edit window mentions A<8 in its example string, and after testing it I confirm that Torque supports shift operators x<n and x>n in equations.

fatih.koz
Member
Posts: 11
Post Re: Comprehensive list of PID operators and functions
on: September 30, 2014 (GMT)

Hi,

Does Custom PID’s support “if” and “else” statements like in asp/php/vb ?

if ([0xff1208] < 7.0) A="ON" else A="OFF"

I'm trying to build a Custom PID which will display a static text as output value.

Any help will be great ...

frodus
Member
Posts: 518
Post Re: Comprehensive list of PID operators and functions
on: September 30, 2014 (GMT)

These are all the ones that Ian has ever announced. Might search the change-logs for more, but this is the most comprehensive list of operators that I could come up with after nearly a week of searching through forum topics.

fatih.koz
Member
Posts: 11
Post Re: Comprehensive list of PID operators and functions
on: September 30, 2014 (GMT)

Hi,

I’ll monitor the changelogs for future implemantations but for now as far as searched and understood “if” statements are not possible :)

I’ll try my chance for a simple “0” / “1” result with below equation ;

[0xff1208] < 7.0

So if above code returns 1 then at least I can use the simple on/off display and this will be a good start.

I tested this custom pid without connecting to ecu, the result was 0 and it did not gave an error.

I will post my test results earliest tomorrow at my Fuel Economy Display topic.

Thanks for the reply and detailed list post.

Best wishes

frodus
Member
Posts: 518
Post Re: Comprehensive list of PID operators and functions
on: September 30, 2014 (GMT)

For the ON/OFF display to work, all you need is to be above 0 for ON and 0 or less for OFF.

The “

Hiej
Member
Posts: 173
Post Re: Comprehensive list of PID operators and functions
on: November 4, 2014 (GMT)

Is there someone that could explain what < and > do to a value?

I mean what is the effect to put A < 16 or B < 8 to an equation? What is the difference to use X < 16 or X < 8 ?

– – – – – – – – – – – – – – – – – – – – – – –
2010 Mazda 2.2d – 185
OBDLink MX – SGS7
– – – – – – – – – – – – – – – – – – – – – – –

moreause
Member
Posts: 637
Post Re: Comprehensive list of PID operators and functions
on: November 5, 2014 (GMT)

Normally < and > are smaller than and bigger than

they are normally use with the if command they don’t change the value it’s a check

if value A is > than 16 response is 1 (or on) other wise response is 0 (off)

Vasilich
Member
Posts: 218
Post Re: Comprehensive list of PID operators and functions
on: November 5, 2014 (GMT)

http://en.wikipedia.org/wiki/Logical_shift

moreause, you are wrong – Torque use those as shift operators, not compare operators

Hiej
Member
Posts: 173
Post Re: Comprehensive list of PID operators and functions
on: November 5, 2014 (GMT)

so if i put in the equation “A < 16” the binary value of “A” is shifted to left by 16 bits, if “A < 8” the binary value of “A” is shifted to left by 8 bits “A < 4” the binary value of “A” is shifted to left by 4 bits and so on… it’s correct?

– – – – – – – – – – – – – – – – – – – – – – –
2010 Mazda 2.2d – 185
OBDLink MX – SGS7
– – – – – – – – – – – – – – – – – – – – – – –

moreause
Member
Posts: 637
Post Re: Comprehensive list of PID operators and functions
on: November 5, 2014 (GMT)

a that make more sens

but if i understand correctly since A is a 8 bit value
shifting it by 16 would be equal to set it to 0
unless the end bit become the first bit…

Vasilich
Member
Posts: 218
Post Re: Comprehensive list of PID operators and functions
on: November 6, 2014 (GMT)

Quote from Hiej on November 5, 2014

it’s correct?

yes, that is correct. Though that time moreause is also correct – that makes no sense to shift to more than 7 bits to the right, as all variables A,B,C,D,E,F are byte values (thus having only 8 bits), so shifting to 8 or more bits to the right is equal to setting those to 0. When shifting to the left, byte values will be expanded to words or dwords, as internal calculations are made in 32 bit.

cintakc
Member
Posts: 1661
Post Re: Comprehensive list of PID operators and functions
on: August 16, 2015 (GMT)

Quote from frodus on March 7, 2014

{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

error example A = 00001010b = 09h
must be A = 00001010b = 0Ah

Capp777
Member
Posts: 2993
Post Re: Comprehensive list of PID operators and functions
on: October 1, 2015 (GMT)

If bit logic is reversed…

ABS({A:b}-1)

Expect parser is not accepting as written.

or

1-{A:b}

Suggested by Cintakc.

Edited.

MPD56
Member
Posts: 276
Post Re: Comprehensive list of PID operators and functions
on: October 1, 2015 (GMT)

Thanks Capp777

Good for us old members with poor memory also.

Capp777
Member
Posts: 2993
Post Re: Comprehensive list of PID operators and functions
on: April 22, 2016 (GMT)

Quote from admin on April 21, 2016
Hi! Right! – in the 1.8.92 update you’re going to get a new set of variables that you can use in the equation parser…

Torque traditionally takes some of the hard work away when dealing with responses (which is why you don’t immediately need to start of with variable D in a lot of cases). The variables starts from A, B, C, for mode 21, 22, 01, etc where the data headers and response status have already been removed for you. (these are also mirrored by variables N0, N1, N2 (etc) for simplicity)

However, with some awkward manufacturers, they may reply with no header at all (with useful information at the start of the packet that you’ll want to get at).

To get the variables for the *whole* raw data reply, you can now use the following variables:

R0, R1, R2, R3 (etc) where in most cases R3/4 would equate to ‘A’ in normal mode21/22/01 messages (depending if you’re using canbus or an iso protocol like 9141)

So, R0 (‘Raw 0’) will get you the absolute start of the message, which should give you access to the bytes you want

So the equation would now look like:

R0 * 5

For the first value in the reply

End Quote.

Automate
Member
Posts: 19
Post Re: Comprehensive list of PID operators and functions
on: April 23, 2016 (GMT)

What about the length (number of bytes) of the received data? Is it available in a variable to be used in a formula?

DANGER1979
Member
Posts: 2
Post Re: Comprehensive list of PID operators and functions
on: April 28, 2016 (GMT)

1. VAL{sensor name}
Where can I see a full list of sensor name?

2. can I know the name of the variable “tank capacity” from the profile

Capp777
Member
Posts: 2993
Post Re: Comprehensive list of PID operators and functions
on: April 28, 2016 (GMT)

Quote from DANGER1979 on April 28, 2016
1. VAL{sensor name}
Where can I see a full list of sensor name?

2. can I know the name of the variable “tank capacity” from the profile

End Quote.

The easiest way is to use Torquescan which
will display the long names of all the pids
known to Torque.

DANGER1979
Member
Posts: 2
Post Re: Comprehensive list of PID operators and functions
on: April 29, 2016 (GMT)

The variable “tank Volume” – in TorqueScan not available.
I want to use this variable in the formula customs PIDs.

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

  Follow me on twitter