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

Thread: Trouble using inline-if function (iff) in calc_pids.txt

  1. #1
    Lifetime Member Mr. P.'s Avatar
    Join Date
    May 2007
    Posts
    259

    Default Trouble using inline-if function (iff) in calc_pids.txt

    I tried to make a custom PID to display boost pressure on a gauge control; the slot definition I used is:

    *CLC-00-162 PSI 0 29.0 .1 "iff({SAE.MAP.kPa} > 100, ({SAE.MAP.kPa} - 100) / 100 * 14.696, 0)"

    My Parameter Reference Number definition looks like this:
    CALC.BOOST F008 CLC-00-162 "PSI" Air "Intake Manifold Boost Pressure"

    And this doesn't work; when I use it on a log that has SAE.MAP > 100, I still get "zero" on my CALC.BOOST PID even in those areas where MAP was 150+.

    Can anyone spot the error in my use of the iff function?

    Mr. P.
    2003 Silverado SS, with Novi-1500 "CAI mod"
    EFILive V 7.5 COS-3 (OLSD, for now!)

  2. #2
    R.I.P Shawn, 1956-2011 WeathermanShawn's Avatar
    Join Date
    Jul 2008
    Posts
    1,807

    Default

    Mr. P.

    I'm no expert on coding calculated pids, but I believe the "iff" function need a Yes or No logic applied to it:

    "iff({CALC.PE}, {CALC.WO2BEN}, {CALC.LTFTBEN})"

    For example, iff CALC.PE is true, then ..., if CALC.PE not true, then...

    They are very tricky to set-up. Best bet is to PM JC..hope he is not busy and if your calc pid applies to a lot of users, then it might get done quicker.

    Good luck..
    2002 Black Camaro Z-28 M6 Hardtop 11.0:1CR 425HP/410TQ SAE (400TQ@3500RPM)
    200cc Heads, 228/232 110+2 Cam, 1 3/4" LT's w/catts, GMMG, Koni Shocks, Hotchkis Springs, 35/21 Sways, 17" ZR1's, 3.90 Gears Roadrunner PCM LM-2 Serial Wideband
    EFILive Closed-Loop MAF/SD Hybrid Tune..


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

    Default

    Quote Originally Posted by Mr. P. View Post
    *CLC-00-162 PSI 0 29.0 .1 "iff({SAE.MAP.kPa} > 100, ({SAE.MAP.kPa} - 100) / 100 * 14.696, 0)"
    That should read like this:
    *CLC-00-162
    psi 0 29.0 .1 "iff({SAE.MAP.kPa} > 100, ({SAE.MAP.kPa} - 100) / 100 * 14.696, 0)"

    i.e. note the line split after the CLC-00-162.

    BTW: psi is already defined, so you don't have to define PSI, but this isn't the problem.
    BTW: note the 0 and 29 are min/max display limits on the chart/gauge (30 looks nicer).
    BTW: make sure there are two blank lines at the end of the calc_pids.txt file.
    BTW: boost should be referenced to BARO (e.g. Shawn lives at 5300 ft elevation).
    BTW: are you trying to make a boost pid...? if so then simply need to define this:
    *CLC-00-162
    psi 0 30 .1 "{SAE.MAP.psi}-{SAE.BARO.psi}"
    kPa 0 200 .1 "{SAE.MAP.kPa}-{SAE.BARO.kPa}"

    and then:
    CALC.BOOST F008 CLC-00-162 "psi,kPa" Air "Intake Manifold Boost Pressure"

    CALC.BOOST will show boost as a positive value, and vacuum as a negative value (i.e. vacuum is negative boost)...
    if you really and truly did not want to see vacuum, then define this:

    *CLC-00-162
    psi 0 30 .1 "
    iff({SAE.MAP.psi}>{SAE.BARO.psi}, {SAE.MAP.psi}-{SAE.BARO.psi}, 0)"
    kPa 0 200 .1 "iff({SAE.MAP.kPa}>{SAE.BARO.kPa}, {SAE.MAP.kPa}-{SAE.BARO.kPa}, 0)"

    and of course you still need this:
    CALC.BOOST F008 CLC-00-162 "psi,kPa" Air "Intake Manifold Boost Pressure"




    Last edited by joecar; June 3rd, 2011 at 03:57 AM.

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

    Default

    I like to make my Fxxx numbers the same as the CLC-00-xxx numbers wherever I can, but it is not required.

  5. #5
    Lifetime Member Mr. P.'s Avatar
    Join Date
    May 2007
    Posts
    259

    Default

    Quote Originally Posted by WeathermanShawn View Post
    ...I believe the "iff" function need a Yes or No logic applied to it...
    Nope; according to the EFILive manual, the conditional [first] parameter is either Zero, or non-Zero; depending on the implicit type conversion used in the underlying software that EFILive is developed with, I am assuming from their literature that False = Zero (0), and True to be "anything not False" i.e. anything non-Zero (including negative numbers, decimals, etc). USUALLY. This is not always the case across all programming languages and platforms.

    Mr. P.
    2003 Silverado SS, with Novi-1500 "CAI mod"
    EFILive V 7.5 COS-3 (OLSD, for now!)

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

    Default

    Yes, zero is false, non-zero is true (same sematics as the C programming language)... this means that negative values are true (since they are non-zero).

  7. #7
    Lifetime Member Mr. P.'s Avatar
    Join Date
    May 2007
    Posts
    259

    Default

    Quote Originally Posted by joecar View Post
    That should read like this: ...
    Thanks joecar, I appreciate it; I've experiemented for a half-hour and still cannot make the iff function work. :(

    I even tried abstracting the sub-formulas out of the function, i.e. I made a PID called CALC.IN_BOOST, and it works returning either 1 or 0 when Kpa > 100; I made CALC.MANVAC which returns the mathematical PSI, and it works correctly; but when I try to make a PID called CALC.BOOST = "iff({CALC.IN_BOOST}, {CALC.MANVAC}, 0)" that just returns a value of zero at all times. I am wondering if the functions in EFILive do not support expressions or constants... ??? and have run out of time to debug through experimentation exactly how they tick.

    So frustrating.

    Mr. P.

    PS - there may be something else at fault, because I select/enable the PIDs, but they do not appear in the Data folder tab (?) but can be bound to my chart/dashpage (??) and draw a flatline at zero. I suspect there is a "mis-binding" somewhere. Maybe it would help to know what the PRN exactly is. I dunno.
    Last edited by Mr. P.; June 3rd, 2011 at 04:57 AM.
    2003 Silverado SS, with Novi-1500 "CAI mod"
    EFILive V 7.5 COS-3 (OLSD, for now!)

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

    Default

    Mr.P post your calc_pids.txt file here, I'll take a closer look at it...

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

    Default

    Have you tried removing some commas?
    "iff({SAE.MAP.kPa}>100,{SAE.MAP.kPa}-100/100*14.696, 0)"
    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

    _________________________________________________

  10. #10
    EFILive Developer Site Admin Blacky's Avatar
    Join Date
    Mar 2003
    Posts
    9,503

    Default

    Quote Originally Posted by Mr. P. View Post
    I tried to make a custom PID to display boost pressure on a gauge control; the slot definition I used is:

    *CLC-00-162 PSI 0 29.0 .1 "iff({SAE.MAP.kPa} > 100, ({SAE.MAP.kPa} - 100) / 100 * 14.696, 0)"

    My Parameter Reference Number definition looks like this:
    CALC.BOOST F008 CLC-00-162 "PSI" Air "Intake Manifold Boost Pressure"

    And this doesn't work; when I use it on a log that has SAE.MAP > 100, I still get "zero" on my CALC.BOOST PID even in those areas where MAP was 150+.

    Can anyone spot the error in my use of the iff function?

    Mr. P.
    I've been testing the expression you posted and it appears that the parenthesis in the expression: ({SAE.MAP.kPa} - 100) / 100 * 14.696 are causing the expression to evaluate to 0.
    If that is the case, then its obviously a bug and needs to be fixed. I'm still working on figuring out if that is really the case.

    Regards
    Paul
    Before asking for help, please read this.

Page 1 of 2 12 LastLast

Similar Threads

  1. Help with calc_pids.txt file...willing to paypal money
    By exploder in forum General (Petrol, Gas, Ethanol)
    Replies: 13
    Last Post: October 5th, 2010, 02:59 PM
  2. downloading software problem "calc_pids.txt"
    By lilbigun in forum FlashScan V2
    Replies: 11
    Last Post: November 19th, 2009, 08:08 AM
  3. Install help please...vista...run as administrator..cant open calc_pids.txt
    By skippy in forum General (Petrol, Gas, Ethanol)
    Replies: 2
    Last Post: February 4th, 2009, 10:12 AM
  4. Inline-6 Conversion ??
    By Lennart in forum General (Petrol, Gas, Ethanol)
    Replies: 2
    Last Post: January 17th, 2009, 10:48 PM
  5. calc_pids.txt?????
    By the4wheeler in forum General
    Replies: 2
    Last Post: October 23rd, 2008, 04:23 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
  •