Processors#
Processors are compiled pre-defined routines.
They provide functionality that would be hard or slow to implement in FDL.
Trigonometric#
Calculated in radians:
acos(x)
asin(x)
atan(x)
atan2(x,y)
(arc tan ofy/x
)cos(x)
cosh(x)
sin(x)
sinh(x)
tan(x)
tanh(x)
Mathematical#
Simple scalar calculations:
abs(x)
ceil(x)
exp(x)
floor(x)
ln(x)
(natural logarithm)log(x)
(base 10 logarithm)sqrt(x)
Calulated against parameters with respect to time (even in distance-mode):
derivative(param)
integral(param)
Logical#
not(x)
or!x
- Returns
TRUE
ifx
is 0, otherwiseFALSE
. IsInRange(a, b, epsilon)
- Returns
1
ifa
is in range ofb
. IsGT(a, b)
- Returns
1
ifa
is greater thanb
, otherwise returns0
. IsGE(a, b)
- Returns
1
ifa
is greater than or equal tob
, otherwise returns0
. IsLT(a, b)
- Returns
1
ifa
if less thanb
, otherwise returns0
. IsLE(a, b)
- Returns
1
isa
is less than or equal tob
, otherwise returns0
.
Interpolation#
BiLinearInterpolate(file, x, y)
-
Returns a bi-linearly interpolated result corresponding to
x
,y
fromfile
.x
andy
are parameter names (e.g.$vCar
) or expressionsfile
is the path to a.3d
file in the format specified below.
Data file format
The filename must have the extension
.3d
The content is ASCII text, representing the values of data points in a grid. Comment lines are prefixed with
#
.Grid rules:
- The grid must be fully populated and rectilinear but need not be regular
i.e. there may be irregular intervals between ordinates but each intersection of an ordinate must have a data value; - There must be at least 4 data points in the grid;
- Entries must be ordered within a row such that column range values increase to the right
and within a column such that row range values increase to the bottom; - Entries on the same line must be separated with tabs or commas;
- Both input values must lie within the grid.
If any of these rules are broken,
BiLinearInterpolate(...)
returns a result of0
and a warning is displayed when ATLAS first attempts to use the processor.Line Entry Description 1 blank , X1, X2, …, Xi Xi = value of column i ordinate 2 Y1, Z1,1, Z2,1, … , Zi,1 1st row of table (i columns Γ j rows),
Yi = value of row j ordinate
Zi,j = data value at intersection of column i and row j3 Y2, Z1,2, Z2,2, … , Zi,2 2nd row of table … … 3rd and successive rows of table n Yj, Z1,j, Z2,j,... , Zi,j last row of table Example
This file…
# Example 3d grid ,5,7.5,10 0,1,2,3 10,4,5,6 25,7,8,9 30,10,11,12
… creates this table:
Input X Range 5 7.5 10 Input Y Range 0 1 2 3 10 4 5 6 25 7 8 9 30 10 11 12 Formulae
If Xi <=
x
<= Xi+1 and Yj <=y
<= Yj+1 thenZa = Zi,j + ( (
x
- Xj) * (Zi+1,j - Zi,j) / (Xi+1 - Xi) )
Zb = Zi,j+1 + ( (x
- Xj) * (Zi+1,j+1 - Zi,j+1) / (Xi+1 - Xi) )
result = Za + ( (y
- Yj) * (Zb - Za) / (Yj+1 - Yj) ) LinearInterpolate(file, x)
-
Returns a linearly-interpolated result corresponding to
x
fromfile
.x
is a parameter name (e.g.$vCar
) or expressionfile
is the path to a.3d
file in the format specified below.
If
x
under or over the limits of the data set then a result extrapolated from the lowest or highest two data points is returned.Data file format
The filename must have the extension
.2d
The content is ASCII text, representing the values of data points in a grid. Comment lines are prefixed with
#
.Grid rules:
- There must be at least two pairs of data but there can be as many as required;
- Entries must be ordered with lowest input, first;
- Entries on the same line must be separated with tabs or commas;
- No consecutive pair of inputs may be the same (to prevent divide by zero errors when calculating m).
If any of these rules are broken,
LinearInterpolate(...)
returns a result of0
and a warning is displayed when ATLAS first attempts to use the processor.Line Entry Description 1 Y1, Z1 1st pair (Y = input value, Z = resulting data value); required 2 Y2, Z2 2nd pair; required … … 3rd and successive pairs; optional n Yn, Zn last pair Example
This file…
# Example 2d grid 0,1 10,4 25,7 30,10
… creates this table:
Input range Data values 0 1 10 4 25 7 30 10 Formulae
- If
x
is between Yi and Yi+1 then result = mi*(x
β Yi) + Zi - If
x
is below Y1 then result = m1*(x
- Yi) + Z1 - If
x
is above Yn then result = mn-1*(x
- Yn) + Zn
Where mi = (Zi+1 - Zi)/(Yi+1 - Yi)
Filtering#
Note
param
must be a parameter from a data channel or another function, not the result of a calculation:
Filter(param,freq)
- Calculates the smoothed value of the parameter.
This is a low-pass filter with a cut-off frequency offreq
. HighPassFilter(param,freq)
- Calculates the smoothed value of the parameter.
This is a high-pass Filter with a cut-off frequency offreq
. DigitalFilter1(param, B1, B2, A1, A2)
- Implements a 1st order digital filter using the difference equation
A1
y(n) =B1
x(n) +B2
x(n-1) -A2
y(n-1) DigitalFilter2(param, B1, B2, B3, A1, A2, A3)
- Implements a 2nd order digital filter using the difference equation
A1
y(n) =B1
x(n) +B2
x(n-1) +B3
x(n-2) βA2
y(n-1) -A3
y(n-2) DigitalFilter3(param, B1, B2, B3, B4, A1, A2, A3, A4)
- Implements a 3rd order digital filter using the difference equation
A1
y(n) =B1
x(n) +B2
x(n-1) +B3
x(n-2) +B4
x(n-3) -A2
y(n-1) -A3
y(n-2) -A4
y(n-3)
Caution
For all 3 types of digital filter, it is your responsibility to ensure the function is evaluated at the appropriate frequency for the filter coefficients.
The Fixed Frequency calculation mode is recommended to ensure that changes to the parameters sampling rates do not affect filter results.
MedianFilter(param,n)
- Calculates the median filter value in a data window of n/2 samples either side of the current data point.
MedianFilter9(param)
- Calculates the median filter value of a data window 4 points either side of the current data point.
The effect is to remove spikes from the data, where their width is less than 4 data-points. MedianFilter17(param)
- As above, but the data window is 17 points wide, enabling spikes to be filtered out up to 8 data-points wide.
MedianFilter25(param)
- As above, but the data window is 25 points wide, enabling spikes to be filtered out up to 12 data-points wide.
PhaseCompFilter(param, freq)
-
Calculates a phase-compensated filter which does not lag behind its input parameter.
The filter has a cut-off frequency offreq
.The phase-compensated filter does not respond well at very low cut-off frequencies, especially for pre-calculated functions.
In this case, the data is filtered at a higher cut-off frequency.
Special#
These perform special operations on data — such as returning information about a recorded parameter — or special actions — such as writing log output.
Note
param
must be a parameter from a data channel (i.e. not the result of a calculation).
BitOfWord(param, bit)
- Returns
1
if bit number bit in the parameterparam
is1
, otherwise returns0
.
Bits count from0
and from least significant to most significant. ClearLog(logname)
- Clears the contents of the file path
logname
. CurrentLapNumber()
- Returns the current Lap number.
IsFirstPass()
- Returns
TRUE
the first time that the function is used to evaluate a term and returnsFALSE
for successive passes.
Reset when the function is completed. IsInError(param)
- Returns
TRUE
if the parameter value is in error for that parameter (iIndicates that the sensor may be out of range). IndexBySample(param, n)
- Returns the value of parameter
param
,n
samples forward or backward (n
βve). IndexByTime(param, t)
- Returns the value of parameter
param
,t
seconds forward or backward (t
βve). LapBestFit(x, y, Or, Os)
- Returns the best fit line of parameters
x
andy
with nth order ofOr
and coefficient index ofOs
(i.e.0
= offset,1
= slope etc.)
Returns coefficients during current lap. LapMax(param)
- Returns the maximum value of parameter
param
during the current lap. LapMean(param)
- Returns the mean value of parameter
param
during the current lap. LapMin(param)
- Returns the minimum value of parameter
param
during the current lap. LapStdDev(param)
- Returns the standard deviation of parameter
param
during the current lap. LapTime(lap)
- Returns the lap time in seconds of the given lap
lap
. LinearRegressionOffset(x, y)
- Returns Linear Regression Offset for parameters
x
andy
during current lap. LinearRegressionR2(x, y)
- Returns Linear Regression R2 for parameters
x
andy
during current lap. LinearRegressionSlope(x, y)
- Returns Linear Regression Slope for parameters
x
andy
during current lap. SamplesMax(param, n)
- Returns the rolling maximum value of parameter
param
over the previous n samples. SamplesMin(param, n)
- Returns the rolling minimum value of parameter
param
over the previous n samples. SessionMax(param)
- Returns the maximum value of parameter
param
during the whole session. SessionMean(param)
- Returns the mean value of parameter
param
during the whole session. SessionMin(param)
- Returns the minimum value of parameter
param
during the whole session. SessionStdDev(param)
- Returns the standard deviation of parameter
param
during the whole session. SetEvent(n, d, g, p, v)
-
Sets an Event at a given time.
n
— Named
— Descriptiong
— Groupp
— Priority (0 -2)v
— Volatility (0,1)
SamplesPerSec(param)
- Returns the sample rate in Hz being used to sample the parameter.
TimeIntoLap()
- Returns the time in seconds from the start of the current lap in the Active Layer.
TimeIntoSession()
- Returns the time in seconds from the start of the current session in the Active Layer.
TimeOfDay()
- Returns the time in seconds from midnight for the Active Layer Time Position.
UwLapMean(param)
- Returns the unweighted Mean value of parameter
param
during the current Lap. UwLapStdDev(param)
- Returns the unweighted Standard Deviation value of parameter
param
during the current Lap. UwSessionMean(param)
- Returns the unweighted Mean value of parameter
param
during the Session. UwSessionStdDev(param)
- Returns the unweighted Standard Deviation value of parameter
param
during the Session. WriteToLog (βlognameβ, entry)
-
Appends a line to the file
logname
with the text:FunctionName
& Tab &entry
FunctionName
= the name of the function in which the processor was executed.entry
= a string enclosed in quotes or an expression which can be evaluated to a numeric value which is converted to a string representing the value to 8 or more digits.