Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: Exressions question?

  1. #1
    Lifetime Member 67SS509's Avatar
    Join Date
    Dec 2005
    Posts
    230

    Default Exressions question?

    When entering your expression in the calc.pid which is correct....

    "({EXT.AD1}*2.5)+8.75"
    or
    "{EXT.AD1}*2.5+8.75"

    or does it matter?

    This is for a FJO wideband with a .5v-4.5v analog output= 10-20AFR
    2002 Chevy truck, SCSB 2WD, Stroked LS3 w/Big Mutha Thumper cam
    2002SS Camaro LS7/427 with stock suspension setup
    2012 Chevy truck, SCSB 2WD, Magnaflow exhaust + K&N

  2. #2
    Joe (Moderator) joecar's Avatar
    Join Date
    Apr 2003
    Posts
    28,403

    Default

    The operator * has higher precedence than the operator + so both expressions are the same.

    See the scantool user manual, page 92.

  3. #3
    Lifetime Member mr.prick's Avatar
    Join Date
    Nov 2006
    Posts
    3,195

    Default

    It should have the brackets. IMO
    Some of the WBO2 PIDs are missing them.

    calc_pids will have improper data
    if the equation is not strung together properly.
    512k RoadRunner Firmware 12.14R
    FlashScan V2 Bootblock V2.07.04 Firmware V2.07.22 EFILive V7.5.7 (Build 191) V8.2.1 (Build 181)
    LC-1 WBO2

    _________________________________________________

  4. #4
    Joe (Moderator) joecar's Avatar
    Join Date
    Apr 2003
    Posts
    28,403

    Default

    Show me an example of "a*b + c" that does not mean "(a*b) + c"...?

  5. #5
    Lifetime Member mr.prick's Avatar
    Join Date
    Nov 2006
    Posts
    3,195

    Default

    Quote Originally Posted by joecar View Post
    Show me an example of "a*b + c" that does not mean "(a*b) + c"...?
    "({SAE.LONGFT1}+{SAE.LONGFT2})/2"
    "({SAE.LONGFT1}+{SAE.LONGFT2}/2)"
    Click image for larger version. 

Name:	math.jpg 
Views:	239 
Size:	444.2 KB 
ID:	6591

    How about "(a+b)/c"?
    It might not make a difference with "a*b+c" but (a+b)/c" does.
    IMO it's better to get into the habit of using them.
    A PID like this:
    "({SAE.MAP.kPa})-value({SAE.MAP.kPa},frame()-1)"
    would not work without brackets.
    I'm no fan of syntax errors
    Some of the predefined WBO2 PIDs have them and some don't.
    512k RoadRunner Firmware 12.14R
    FlashScan V2 Bootblock V2.07.04 Firmware V2.07.22 EFILive V7.5.7 (Build 191) V8.2.1 (Build 181)
    LC-1 WBO2

    _________________________________________________

  6. #6
    Joe (Moderator) joecar's Avatar
    Join Date
    Apr 2003
    Posts
    28,403

    Default

    Quote Originally Posted by mr.prick View Post
    ...
    A PID like this:
    "({SAE.MAP.kPa})-value({SAE.MAP.kPa},frame()-1)"
    would not work without brackets.
    This works (the one and only bracket pair removed):
    "{SAE.MAP.kPa}-value({SAE.MAP.kPa},frame()-1)"

    value() and frame() are functions and so ( ) are in their syntax.

  7. #7
    Lifetime Member mr.prick's Avatar
    Join Date
    Nov 2006
    Posts
    3,195

    Default

    Quote Originally Posted by joecar View Post
    This works (the one and only bracket pair removed):
    "{SAE.MAP.kPa}-value({SAE.MAP.kPa},frame()-1)"
    value() and frame() are functions and so ( ) are in their syntax.
    Not syntax but improper data, as far as this PID is concerned.
    I tried a few different combos with this one until I got it to work right.
    It originally was this:
    "Value({TP},frame()-1)-{TP}"
    (I got it from Paul)

    The syntax error reference is not relevant here,
    just pointing out that it's annoying when it happens.
    Just because it "works" doesn't mean it will be right.


    Like I said some of the predefined WBO2 PIDs have them and some do not,
    even though the expressions are the same.
    Example:
    Wide Band AFR 1 - LC-1 {CALC.AFR_LC11}
    Expression:
    AFR = ({EXT.AD1}*3)+7.35

    Wide Band AFR 2 - NGK AFX {CALC.AFR_NGK2}
    Expression:
    AFR = {EXT.AD2}*1.4+9
    is VALID

    I showed (a+b)/c can result in differing data but (a*b)+c may not.
    Whether or not this results in the data being wrong/right
    you will need to try both ways to see.
    My 2¢
    512k RoadRunner Firmware 12.14R
    FlashScan V2 Bootblock V2.07.04 Firmware V2.07.22 EFILive V7.5.7 (Build 191) V8.2.1 (Build 181)
    LC-1 WBO2

    _________________________________________________

  8. #8
    Joe (Moderator) joecar's Avatar
    Join Date
    Apr 2003
    Posts
    28,403

    Default

    Quote Originally Posted by mr.prick View Post
    Not syntax but improper data, as far as this PID is concerned.
    I tried a few different combos with this one until I got it to work right.
    It originally was this:
    "Value({TP},frame()-1)-{TP}"
    (I got it from Paul)
    ...
    Hmmmm... What was going wrong...? Which {TP} occurance was giving the wrong value, the first or the last...?

    If {X} gives a wrong value that is corrected by ({X}) then that is a bug.

    Can you post a log file and a calc_pids.txt for me to look at.

    That expression is finding the delta in TP from the previous frame to the current frame, right...?

  9. #9
    Joe (Moderator) joecar's Avatar
    Join Date
    Apr 2003
    Posts
    28,403

    Default

    Quote Originally Posted by joecar View Post
    ...
    Like I said some of the predefined WBO2 PIDs have them and some do not,
    even though the expressions are the same.
    Example:
    Wide Band AFR 1 - LC-1 {CALC.AFR_LC11}
    Expression:
    AFR = ({EXT.AD1}*3)+7.35

    Wide Band AFR 2 - NGK AFX {CALC.AFR_NGK2}
    Expression:
    AFR = {EXT.AD2}*1.4+9
    is VALID
    Both of those work correctly.

    I showed (a+b)/c can result in differing data but (a*b)+c may not.
    a*b+c takes advantage of default precedence, whereas (a+b)/c requires parentheses.

    Whether or not this results in the data being wrong/right
    you will need to try both ways to see.
    My 2¢
    I value your 2¢... I'm trying to see this for myself, I'll run a few experiments, I just need to know how to duplicate this and what to look for.

    I work with programming languages and compilers everyday, and when the default precedence is not honoured then this is a MAJOR show stopper.

    Oh, please do assume smilies in all my posts... ...I'm pretty easy to discuss things with.

  10. #10
    Joe (Moderator) joecar's Avatar
    Join Date
    Apr 2003
    Posts
    28,403

    Default

    Quote Originally Posted by joecar View Post
    This works (the one and only bracket pair removed):
    "{SAE.MAP.kPa}-value({SAE.MAP.kPa},frame()-1)"

    value() and frame() are functions and so ( ) are in their syntax.
    Quote Originally Posted by mr.prick View Post
    Not syntax but improper data, as far as this PID is concerned.

    It originally was this:
    "Value({TP},frame()-1)-{TP}"
    (I got it from Paul)

    ...
    value() needs ( ) since that's how it groups its parameter list...

    frame() same thing, the parameter list is empty.

Page 1 of 2 12 LastLast

Similar Threads

  1. Desired Airflow Question, not your normal question
    By Dale in forum General (Petrol, Gas, Ethanol)
    Replies: 25
    Last Post: October 1st, 2010, 11:10 AM
  2. Locked out timing question for boost setup question??
    By nitrorocket in forum General (Petrol, Gas, Ethanol)
    Replies: 13
    Last Post: September 13th, 2005, 03:22 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •