Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 32

Thread: V8 Scan - Calculated Pids

  1. #11
    Joe (Moderator) joecar's Avatar
    Join Date
    Apr 2003
    Posts
    27,752

    Default

    Paul, also see post #139 in this thread: AEM-X-Series-OBDII-Wideband-UEGO-AFR-Sensor-Controller-Gauge

  2. #12
    Lifetime Member Ninety8C5's Avatar
    Join Date
    Sep 2003
    Posts
    433

    Default

    I don't know if this is what you are trying to accomplish, but I just built this in V8.

    If not totally disregard.
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	EFILive Calc PID.jpg 
Views:	54 
Size:	51.2 KB 
ID:	20558  

  3. #13
    Joe (Moderator) joecar's Avatar
    Join Date
    Apr 2003
    Posts
    27,752

    Default

    Quote Originally Posted by Ninety8C5 View Post
    I don't know if this is what you are trying to accomplish, but I just built this in V8.

    If not totally disregard.
    Yes, it is what I want (see mine attached), but I wanted to avoid using an if-then/if-else, I wanted Paul to include a builtin iff() function or operator

    (hmmm, operator would be nicer than a function)




    Click image for larger version. 

Name:	Function Editor~000013.png 
Views:	43 
Size:	43.9 KB 
ID:	20560
    Last edited by joecar; December 15th, 2016 at 01:15 PM.

  4. #14
    EFILive Developer Site Admin Blacky's Avatar
    Join Date
    Mar 2003
    Posts
    9,119

    Default

    Quote Originally Posted by Tre-Cool View Post
    Can we get an official break down or explanation on creating calculated pids for V8 or let me know if your happy with my explanation?

    I've created a few Ben's tonight so i can start playing with the AEM CAN Wideband so thought i'd let everyone else know what i did.

    1) Just like adding calculated pids for V7.5, get your self a good text editor. I recommend Notepad++
    2) Browse to your My Documents\EFILive\V8\Config folder and open up the UserCalculatedPids.ini file
    3) Copy in the sample data below

    EFi Guys?
    You don't need to (nor should you) be editing that text file directly. You should use the built in calc PID editor for V8.

    [F2: Scan]->[Config]:Calculate PIDs (hotkey Ctrl_K)

    Regards
    Paul
    Before asking for help, please read this.

  5. #15
    Joe (Moderator) joecar's Avatar
    Join Date
    Apr 2003
    Posts
    27,752

    Default

    Paul, how do you comment (as in commenting out)...?

  6. #16
    Joe (Moderator) joecar's Avatar
    Join Date
    Apr 2003
    Posts
    27,752

    Default

    It's Pascal/Algol-like:

    Click image for larger version. 

Name:	Function Editor~000015.png 
Views:	45 
Size:	56.3 KB 
ID:	20562

  7. #17
    Lifetime Member Tre-Cool's Avatar
    Join Date
    Feb 2006
    Posts
    827

    Default

    So did what i have for a single wideband be all i need to have for a functioning BEN factor to populate a map?

    Until i connect to an ecu, i can't tell if it's actually going to populate a map. Seems you need to manually type in the data pid. How come we can't just select a pid like we can for the row/column tables?

  8. #18
    EFILive Developer Site Admin Blacky's Avatar
    Join Date
    Mar 2003
    Posts
    9,119

    Default

    Quote Originally Posted by joecar View Post
    Yes, it is what I want (see mine attached), but I wanted to avoid using an if-then/if-else, I wanted Paul to include a builtin iff() function or operator
    The language is Lua, so whatever is available in that language is what you can use. I'm not able to modify the Lua language - sorry :(
    https://www.lua.org/manual/5.2/#index

    You could try this: http://hisham.hm/2011/05/04/luas-and...nary-operator/ (although there's issues with nil values).

    I think it would look something like this:
    Code:
    return pid("EQIVRATIO") * ((pid("WO2LAM1")>pid("WO2LAM2")) and pid("WO2LAM1") or pid("WO2LAM2"))
    Or you could just write a function to do it, like this:

    Code:
    function iff(cond, a, b) 
      if cond then 
        return a 
      else
        return b 
      end 
    end
    
    return pid("EQIVRATIO") * iff(pid("WO2LAM1")>pid("WO2LAM2"),pid("WO2LAM1"),pid("WO2LAM2"))


    Regards
    Paul
    Before asking for help, please read this.

  9. #19
    Joe (Moderator) joecar's Avatar
    Join Date
    Apr 2003
    Posts
    27,752

    Default

    Quote Originally Posted by Blacky View Post
    The language is Lua, so whatever is available in that language is what you can use. I'm not able to modify the Lua language - sorry :(
    https://www.lua.org/manual/5.2/#index

    You could try this: http://hisham.hm/2011/05/04/luas-and...nary-operator/ (although there's issues with nil values).

    I think it would look something like this:
    Code:
    return pid("EQIVRATIO") * ((pid("WO2LAM1")>pid("WO2LAM2")) and pid("WO2LAM1") or pid("WO2LAM2"))
    Or you could just write a function to do it, like this:

    Code:
    function iff(cond, a, b) 
      if cond then 
        return a 
      else
        return b 
      end 
    end
    
    return pid("EQIVRATIO") * iff(pid("WO2LAM1")>pid("WO2LAM2"),pid("WO2LAM1"),pid("WO2LAM2"))
    Regards
    Paul
    Thanks Paul...

    that's what programming is about, working with what is available;


    I ended up defining my own, the .ini looks like this now:
    [Groups]
    FUNCTION=Function definitions
    WO2SER=Wide Band O2 Sensors (Serial-Comms)
    WO2CAN=Wide Band O2 Sensors (CAN-bus)

    [FUNCTION]
    IFF=IFF,factor,0

    [FUNCTION.IFF]
    0=|-- FUNCTION.IFF
    1=|function iff(x,y,z)
    2=|if (x) then return y else return z end
    3=|end

    [WO2SER]
    WO2BEN="Base Efficiency Numerator (Serial-Comms)(Dynamically-Leanest)",factor,3

    [WO2SER.WO2BEN]
    0=|-- WO2SER.WO2BEN
    1=|return iff(pid("WO2LAM1")>pid("WO2LAM2"),pid("WO2LAM1"),p id("WO2LAM2"))*pid("EQIVRATIO")

    [WO2CAN]
    WO2BEN="Base Efficiency Numerator (CAN-bus)(Dynamically-Leanest)",factor,3

    [WO2CAN.WO2BEN]
    0=|-- WO2CAN.WO2BEN
    1=|return iff(pid("WO2S11")>pid("WO2S21"),pid("WO2S11"),pid( "WO2S21"))/pid("EQ_RAT")

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

    Default

    Quote Originally Posted by joecar View Post
    Paul, how do you comment (as in commenting out)...?
    Click image for larger version. 

Name:	lua_comments.png 
Views:	35 
Size:	54.5 KB 
ID:	20564

    It seems like a pretty arbitrary and strange pair of tokens to use for block comments but it makes including/excluding blocks of code much easier:

    --[[ I want to exclude the next two lines
    a = b+c
    d = e+f
    --]]

    ---[[ I want to include the next two lines
    a = b+c
    d = e+f
    --]]

    Notice that by just adding another minus sign to the --[[ start comment token, it is no longer a valid start comment block, it is just a single line comment, so the two lines of code are now included again.
    The end comment token is also ignored because it is now just a single line comment.

    Regards
    Paul
    Before asking for help, please read this.

Page 2 of 4 FirstFirst 1234 LastLast

Similar Threads

  1. Calculated pids
    By x MadMAX DIESEL in forum Black Box Logging
    Replies: 37
    Last Post: June 22nd, 2018, 08:26 AM
  2. Calculated PIDS?
    By beav in forum Diesel
    Replies: 0
    Last Post: December 3rd, 2013, 03:19 AM
  3. Calculated pids not displayed on V2
    By ttls1 in forum Black Box Logging
    Replies: 3
    Last Post: October 7th, 2013, 07:47 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
  •