PDA

View Full Version : How to create calculated PIDs (non linear WB02 example)



Blacky
January 12th, 2005, 08:12 PM
Calculated PIDs should be created by editing the calc_pids.txt file in the My documents\EFILive\V7\User Configuration folder.


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://efilive.com/forum/viewtopic.php?t=1145
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 non-linear voltage. A non-linear voltage means that the voltage output by the WBO2 controller does not vary proportionally with the detected AFR.

Assume that the relationship between the AFR and the Voltage is this:

AFR=5*(V^2)+3*V+14.7 (this is just an example formula and has no real application)

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:

# ================================================== ============================
# Units
# -------------------
# See sae_generic.txt for more information on the *UNITS section

*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: 5*V^2+3*V+14.7 we need to replace V with {EXT.AD1} like this: (5*{EXT.AD1}*{EXT.AD1})+(3*{EXT.AD1})+14.7


# ================================================== ============================
# Add slot definitions here
# --------------------------------
# See sae_generic.txt for more information on "SLOT" formats
#
#Units Low High Fmt Expression
#------------ ------------- ------------- ---- --------------------------------------------------------------
*CLC-00-001
AFR 10.0 20.0 .1 "(5*{EXT.AD1}*{EXT.AD1})+(3*{EXT.AD1})+14.7"


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


# ================================================== ============================
*PRN - Parameter Reference Numbers
# --------------------------------
# See sae_generic.txt for more information on the *PRN section
#
#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

Anonymous
January 13th, 2005, 06:22 AM
Paul,

This is extremely helpful!

All my best,

Steve

Earl H
January 13th, 2005, 06:30 AM
I created a PID (External-Air/Fuel Ratio), using the instructions listed above. The PID is showing in the PID list (scanning software), however the units aren't showing the ":1" value that I have set up for it. In addition, the new PID isn't showing up on the data tab (F9), therefore I can't set up a guage for the PID. Any suggestions as to what may be the cause of this?

Btw, here are the values found in my calc_pid.txt file:


# ================================================== ============================
# Units
# -------------------
# See sae_generic.txt for more information on the *UNITS section

*UNITS

#Code System Abbr Description
#-------- ---------- -------- -------------------------------------------------------------
AFR-Ext None AFR "Air Fuel Ratio"



# ================================================== ============================
# Add slot definitions here
# --------------------------------
# See sae_generic.txt for more information on "SLOT" formats
#
#Units Low High Fmt Expression
#------------ ------------- ------------- ---- --------------------------------------------------------------
*CLC-00-5
AFR-Ext 8.41 19.44 .1 "({EXT.AD1}*{EXT.AD1}*{EXT.AD1}*{EXT.AD1}*{EXT.AD1} )/700 + ({EXT.AD1}*{EXT.AD1}*{EXT.AD1}*{EXT.AD1})/650 + ({EXT.AD1}*{EXT.AD1}*{EXT.AD1})/650 + ({EXT.AD1}*{EXT.AD1})/50 + {EXT.AD1}/1.06 + 8.41"




# ================================================== ============================
*PRN - Parameter Reference Numbers
# --------------------------------
# See sae_generic.txt for more information on the *PRN section
#
#Code PRN SLOT Units System Description
#------------------------- ---- ------------ ---------------- ---------------- ------------------------------------------
CALC.ELH_AFR F100 CLC-00-5 " :1 " Fuel "Ext Wideband AFR"

Blacky
January 13th, 2005, 07:22 AM
Hi Earl,

You have created a new unit called AFR-Ext. I presume that is the units you want to use. I also presume you want the units to display as :1

So change the units you have defined to this:

#Code System Abbr Description
#-------- ---------- -------- -------------------------------------------------------------
AFR-Ext None :1 "Air Fuel Ratio"


Then you MUST use the unit code (AFR-Ext) in the SLOT definition like this:

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

*CLC-00-005
AFR-Ext 8.0 20.0 .1 "({EXT.AD1}*{EXT.AD1}*{EXT.AD1}*{EXT.AD1}*{EXT.AD1} )/700 + ({EXT.AD1}*{EXT.AD1}*{EXT.AD1}*{EXT.AD1})/650 + ({EXT.AD1}*{EXT.AD1}*{EXT.AD1})/650 + ({EXT.AD1}*{EXT.AD1})/50 + {EXT.AD1}/1.06 + 8.41"


Make sure the SLOT name is always of the form CLC-00-xxx. It MUST ALWAYS be 3 letters, a dash, 2 digits, another dash and 3 more digits.

Correction: the sequence number can be 1, 2, 3 or 4 digits long and does not require leading zeros. So we could have used *CLC-00-5
Also the min max values should be "nice" values since they define the default values that you will see on the chart axis and gauge labels.

Then lastly you must specify the unit code again in the PID definition like this:

#Code PRN SLOT Units System Description
#------------------------- ---- ------------ ---------------- ---------------- ------------------------------------------
CALC.ELH_AFR F100 CLC-00-005 AFR-Ext Fuel "Ext Wideband AFR"

Blacky
January 13th, 2005, 07:26 AM
Hint:
If you right click on your calculated PID in the [PIDs (F8)] tab page and select more info, it will explain why the PID may not be valid.
Usually it is invalid because:
1. The expression is wrong
or
2. The PIDs used to create the expression are not selected.

Warning: The {EXT.AD1}, {EXT.AD2} and {EXT.EGT} PIDs will not be valid until a connection to a FlashSCan cable is made.
That means youwill get warning messages in your wide band PID about {EXT.AD1} not being valid.
Once you connect to FlashScan, those PIDs will automatically become valid.

Regards
Paul

Earl H
January 13th, 2005, 08:21 AM
Worked like a charm!!!! Thanks.

parish8
February 27th, 2005, 10:12 AM
i am trying to create my own calc pids. i think i have it mostly figured out but still need to work on my expresions a little. here is my problem.

in version 7 there was no calc_pids.txt file, i copied the file from version 6 and filled in the info. then restarted everything and nothing new came up on efilive7.

just to see if i was doing it right i put that edited file back in the version 6 folder and the stuff came right up when i started efilive6.

how do i get version 7 to see the calc_pids.txt file?

Blacky
February 27th, 2005, 10:33 AM
i am trying to create my own calc pids. i think i have it mostly figured out but still need to work on my expresions a little. here is my problem.

in version 7 there was no calc_pids.txt file, i copied the file from version 6 and filled in the info. then restarted everything and nothing new came up on efilive7.

just to see if i was doing it right i put that edited file back in the version 6 folder and the stuff came right up when i started efilive6.

how do i get version 7 to see the calc_pids.txt file?

V7 stores the calc_pids.txt file in
My Documents\EFILive\V7\User Configuration

Regards
Paul

parish8
February 27th, 2005, 01:24 PM
woohoo, thanks. working good.