Home Manuals Supported inc file formats.
Supported inc file formats. PDF Print E-mail
Written by Phil Tobin   
Wednesday, 27 May 2015 16:17

Most calculations are linear and can be implemented using a basic mathematical expression in an ini file. However, in cases where the transformation is not easily fit to a basic mathematical expression, look up tables can be defined in an "inc" file.

A common example of this in TunerStudio is non-linear sensor outputs.

 

There are 2 primary formats of inc files.

In either format, Rows that start with #, ' or : are considered commented out.

Anything in a row after a semicolon is considered a comment.


Format 1

Format 2

Usage

Example

 

Format 1:

This format contains rows made of of a key value and the lookup value separated by a tab. It should not be a space between the values, it should always be a tab.

It can contain any number of rows of data starting from the lowest key value to the highest. Any key values between will be interpolated from the lookup value. Finally the row should be ended with a line feed. Windows or Unix style linefeed/Carriage returns will work.

Example:

; My inc File

; Volts Pressure

0    [TAB] 0.0

0.5 [TAB] 10.6

...

...

4.5 [TAB] 120

5.0 [TAB]  160

 

Format 2:

A file that contains a row for each possible value with the data type for that entry. In a case where you have a 10bit ADC, the file would be expected to have 1024 entries, for an 8 bit ADC 255 entries are needed.

Valid Data types are: DB, DW and for TunerStudio, it does not matter which you use, they are treated the same. When using this format, spaces are commonly used instead of tabs, but tabs will work also.

In this case the lookup value is generally an ADC value that equates to a row Index, this is why an entry for each ADC is required, there is no interpolation.

Example 8 bit ADC temperature look up.

 

; Known Steinhart-Hart coefficients: A=0.00149032  B=0.00022746  C=1.1639e-007
; ADC - Temp (dF)
    DB    210T    ;   0 - sensor failure.
    DB    475T    ;   1 -  435.4
    DB    409T    ;   2 -  369.4
    DB    375T    ;   3 -  334.8
    DB    351T    ;   4 -  311.7

....

....

....

....

    DB      0T    ; 249 - -40.6
    DB      0T    ; 250 - -45.6
    DB      0T    ; 251 - -51.5
    DB      0T    ; 252 - -58.9
    DB      0T    ; 253 - -68.9
    DB      0T    ; 254 - -85.1
    DB    210T    ; 255 - sensor failure.

 

Usage:

    To use these inc files with TunerStudio or Shadow Dash, they should be placed in the inc directory of your project,

[YourTunerStudioProjectFolder]/inc/

Then use the table() function in the [OutputChannels] section of an ini file.

Table Function:

table( lookupValue, "YourFile.inc")

lookupValue - will be the key value to be used in the lookup. It will typically be another OutputChannel representing the ADC value or Key value.

YourFile.inc - is the name of the file that is in the Project inc folder. It should be surrounded by  quotes "

 

If you are working in a custom.inc file the lookupValue channel can be any OutputChannel defined in your custom.ini or in the main firmware ini file.

 

Example custom.ini this example will use the adc7 as found with MS2Extra to perform a lookup in your inc file:

 

[OutputChannels]

        ; adc7 is defined in the main firmware ini for this esample

      myTemperature = { table( adc7, 'myTemperatureSensor.inc')  }, "°F"

 

 

 

Last Updated on Thursday, 28 May 2015 13:20
 
 

Polls

What would you like to see in TunerStudio 3.0