# Thread: How to create an extra external PID (linear WBO2 example)

1. ## How to create an extra external PID (linear WBO2 example)

Calculated PIDs should be created by editing the calc_pids.txt file in the My documents\EFILive\V7\User Configuration folder.

Code:
`WARNING: You should NEVER modify the sae_generic.txt file unless instructed to by EFILive. The sae_generic.txt file WILL be overwritten each time you re-install or upgrade the software.`
This explanation is the same as the non-linear example given here:
http://www.efilive.com/forum/viewtopic.php?t=1142
The only difference is in the expression used to calculate the AFR

Suppose we had an ACME Wide band O2 controller (a fictitous controller) that outputs a linear voltage. A linear voltage means that the voltage output by the WBO2 controller varies proportionally with the detected AFR.

Assume that the relationship between the AFR and the Voltage is this:
Code:
`AFR=V*2+9`
Creating a calculated PID is a three step process.
1. You need to define the units (both metric and imperial) that your PID will display.
2. You need to define the min, max, precision and equation that determines the value of your calculated PID.
3. You need to define the Parameter Reference Number (PRN) so that EFILive can uniquely identify the PID.

Step 1 - Define the units.

We want to see our wide band output as AFR, so we need to create the AFR units. Units are defined in the *UNITS section of the calc_pids.txt file. like this:
Code:
```# ==============================================================================
# Units
# -------------------

*UNITS

#Code     System     Abbr     Description
#-------- ---------- -------- -------------------------------------------------------------
AFR       None       AFR      "Air Fuel Ratio"```
Code must be unique.
System can be one of None, Metric or Imperial. Since AFR is neither metric nor imperial, we set it's system to None.
Abbr (Abbreviation) is the text that is displayed in the EFILive Scan Tool.
Description is not used in EFILive - it is just for clarity in the configuration file.

HINT: Check in the sae_generic.txt file to see if the units you want to use have already been defined. In this case, AFR is already defined in sae_generic.txt so there is no need to add it to the calc_pids.txt file.

Step 2 - Define min, max, precision and expression.

The min, max, precision and expression information is stored in SLOTs in the calc_pids.txt file. SLOT is an SAE OBDII acronym that stands for: Scaling, Limits, Offset and Transfer function. It is a way to define the conversion of raw digitial data into engineering units.

Calculated PID SLOT names MUST be of the form: CLC-00-xxx where xxx is a unique sequence number. The calculated PIDs defined by EFILive range from 900 to 999. So you are free to use any sequence number in the range 000..899

Each SLOT entry consists of the slot identifier, in our case *CLC-00-001, followed by a list of entries defining the units, min, max, precision and expression for each "view" of the PID that you require. We only want to see 1 view of our PID: AFR, so we only need one entry.
(Multiple views are usually used for defining metric and imperial versions of the same value).

EFILive supplies the voltage data from the 2 A/D pins via the PIDs: {EXT.AD1} and {EXT.AD2}. Looking directly into the connectors on the side of the FlashScan interface, with the EFILive logo facing upwards, AD1 is on the right and AD2 is on the left of the 3 pin connector.

To display the AFR using the expression: V*2+9 we need to replace V with {EXT.AD1} like this: {EXT.AD1}*2+9

Code:
```# ==============================================================================
# --------------------------------
#
#Units             Low          High      Fmt  Expression
#------------ ------------- ------------- ---- --------------------------------------------------------------
*CLC-00-001
Units MUST match one of the previously defined Unit Codes.
Low is the default low value that is applied to gauges and charts when the PID is used in a dashboard item. That value can be changed in the dashboard configuration.
High is the default high value that is applied to gauges and charts when the PID is used in a dashboard item. That value can be changed in the dashboard configuration.
Fmt is the default format of the value in the form .x where x defines the number of decimal places to be displayed. That value can be changed in the dashboard configuration.
Expression is the mathematical expression that defines the value of the calculated PID. See the EFILive Scan Tool User Manual for more information on creating expressions and using built in formulas.

Step 3 - Define the PID reference number

PIDs are defined in the *PRN section of the calc_pids.txt file.
Calculated PIDs' names MUST begin with "CALC." and their PRN (Parameter Reference Number) must be in the range \$F000..\$F6FF which is reserved for scan tools. Additionally, EFILive defined external PIDs and calculated PIDs will be in the range \$F400..\$F5FF. So you are free to use any value in the range: \$F000..\$F3FF

Code:
```# ==============================================================================
*PRN - Parameter Reference Numbers
# --------------------------------
#
#Code                      PRN  SLOT         Units            System           Description
#------------------------- ---- ------------ ---------------- ---------------- ------------------------------------------
CALC.ACME_AFR              F001 CLC-00-001   AFR              Fuel             "Wide band AFR"```
Code is the PID name
PRN is the Parameter Reference Number
SLOT is the SLOT name defined earlier
Units MUST be one or more of the unit codes defined for the specified SLOT only. If you specify more than one unit, separate them with a comma and enclose both in a single set of double quotes (i.e. "V,AFR")
System is the system to which the PID belongs. The system is available in the "System" drop down list box in the [PIDs (F8)] tab page in the Scan Tool. For Wide Band O2 the system should be O2 but you are free to enter anything you like. If you enter a system that does not exist, EFILive will create it.

Note: If any (non-comment) entry in calc_pids.txt contains a space or a comma then it must be enclosed in double quotes.

Once you have completed these steps, restart EFILive Scan Tool and you should be able to see your PID in the [PIDs (F8)] tab page.

Happy PID creating....
Paul

2. Thanks Paul, as simple as it looks it's not for some of us.
Joe

================================================== ============================
# File details
# ------------
#
# This section defines various details about the file format.

*FILE

#Parameter Value Description
#---------- ---------------- ---------------------------------------------------
VERSION 7.1.1 File version
DECSEP . Decimal separator used in this file

# ================================================== ============================
# Units
# -------------------

*UNITS

#Code System Abbr Description
#-------- ---------- -------- -------------------------------------------------------------

# ================================================== ============================
# --------------------------------
#
#Units Low High Fmt Expression
#------------ ------------- ------------- ---- --------------------------------------------------------------

*UNM-16-9000
AFR 10.0 20.0 .1 * 2.0 9.0

# ================================================== ============================
*PRN - Parameter Reference Numbers
# --------------------------------
#
#Code PRN SLOT Units System Description
#------------------------- ---- ------------ ---------------- ---------------- ------------------------------------------

EXT.AFR F400 UNM-16-9000 AFR O2 "w My Wide band AFR"

3. Originally Posted by jfpilla
Thanks Paul, as simple as it looks it's not for some of us.
Joe

AFR None :1 "Air Fuel Ratio" # ================================================== ============================
# File details
# ------------
#
Is that first line like that in your file or is that just a type in the post?
If it is in the file it could really confuse EFILive
Paul

4. Originally Posted by Blacky
Originally Posted by jfpilla
Thanks Paul, as simple as it looks it's not for some of us.
Joe

AFR None :1 "Air Fuel Ratio" # ================================================== ============================
# File details
# ------------
#
Is that first line like that in your file or is that just a type in the post?
If it is in the file it could really confuse EFILive
Paul
Have no clue how that got there. Here's what I have.
Did an edit. Hope no one used it.

================================================== ============================
# File details
# ------------
#
# This section defines various details about the file format.

*FILE

#Parameter Value Description
#---------- ---------------- ---------------------------------------------------
VERSION 7.1.1 File version
DECSEP . Decimal separator used in this file

# ================================================== ============================
# Units
# -------------------

*UNITS

#Code System Abbr Description
#-------- ---------- -------- -------------------------------------------------------------

# ================================================== ============================
# --------------------------------
#
#Units Low High Fmt Expression
#------------ ------------- ------------- ---- --------------------------------------------------------------

*UNM-16-9000
AFR 10.0 20.0 .1 * 2.0 9.0

# ================================================== ============================
*PRN - Parameter Reference Numbers
# --------------------------------
#
#Code PRN SLOT Units System Description
#------------------------- ---- ------------ ---------------- ---------------- ------------------------------------------

EXT.AFR F400 UNM-16-9000 AFR O2 "w My Wide band AFR"

5. The PID will initially be unsupported until you connect to the FlashScan Cable.
To see unsupported PIDs, uncheck the "Supported" checkbox.

Also the value is wrong - I may have messed up in my explanation, I'll go check it in a moment.

The raw value (let's call it "N") from the \$F400 pin on the side of flashscan is 0..1023, that represents a voltage of 0..5. So you have to convert it like this:

V = N/204.6
AFR = V*2+9
so
AFR = (N/204.6)*2+9
or
AFR = N/102.3+9

like this:

AFR 10.0 20.0 .1 / 102.9 9.0

Hope that helps
Paul

6. Originally Posted by Blacky
Also the value is wrong - I may have messed up in my explanation, I'll go check it in a moment.
Yes, I did mess up, I'll go back and correct it soon.
Paul

7. Originally Posted by Blacky
The PID will initially be unsupported until you connect to the FlashScan Cable.
To see unsupported PIDs, uncheck the "Supported" checkbox.

Also the value is wrong - I may have messed up in my explanation, I'll go check it in a moment.

The raw value (let's call it "N") from the \$F400 pin on the side of flashscan is 0..1023, that represents a voltage of 0..5. So you have to convert it like this:

V = N/204.6
AFR = V*2+9
so
AFR = (N/204.6)*2+9
or
AFR = N/102.3+9

like this:

AFR 10.0 20.0 .1 / 102.9 9.0

Hope that helps
Paul
102.3 correct?

It shows up in f8,9,10,11. Shows in f8 with a red x through it. No problem setting up a Map.

8. Originally Posted by jfpilla
102.3 correct?
It shows up in f8,9,10,11. Shows in f8 with a red x through it. No problem setting up a Map.
The rred cross indicated the PID is "not supported". It will not be supported until you make a connection to FlashScan. That is because it is not supported on AutoTap interfaces.

The red cross should be removed once a connection is made.

Regards
Paul

9. Originally Posted by Blacky
Originally Posted by jfpilla
102.3 correct?
It shows up in f8,9,10,11. Shows in f8 with a red x through it. No problem setting up a Map.
The rred cross indicated the PID is "not supported". It will not be supported until you make a connection to FlashScan. That is because it is not supported on AutoTap interfaces.

The red cross should be removed once a connection is made.

Regards
Paul
This is the current. Any other result I should check?

================================================== ============================
# File details
# ------------
#
# This section defines various details about the file format.

*FILE

#Parameter Value Description
#---------- ---------------- ---------------------------------------------------
VERSION 7.1.1 File version
DECSEP . Decimal separator used in this file

# ================================================== ============================
# Units
# -------------------

*UNITS

#Code System Abbr Description
#-------- ---------- -------- -------------------------------------------------------------

# ================================================== ============================
# --------------------------------
#
#Units Low High Fmt Expression
#------------ ------------- ------------- ---- --------------------------------------------------------------

*UNM-16-9000
AFR 10.0 20.0 .1 / 102.3 9.0

# ================================================== ============================
*PRN - Parameter Reference Numbers
# --------------------------------
#
#Code PRN SLOT Units System Description
#------------------------- ---- ------------ ---------------- ---------------- ------------------------------------------

EXT.AFR F400 UNM-16-9000 AFR O2 "w My Wide band AFR"

10. Originally Posted by jfpilla
This is the current. Any other result I should check?
That looks ok to me.
What do you mean by "Any other result I should check?"
Paul

Page 1 of 5 123 ... Last

#### Posting Permissions

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