Mathematical Expressions

The following sections list all operators and functions supported in WinDarab. WinDarab follows conventional mathematical rules for evaluating expressions.

Constants

e (Eulers’s number)

e = (1/0!) + (1/1!) + (1/2!) + (1/3!) + ... = 2.7182...

NoValue

Allows you to 'filter out' data, no Value is returned and creates a discontinuity in the signal

HOLD

Returns the value of the latest calculation result.
HOLD can be used to eliminate/replace invalid measurement values.
the use of HOLD can slow down math function calculation because the function must be recalculated from the beginning of a file.

pi

pi = 3.1415…

Arithmetic Operators

*

Multiplication

+

Addition

-

Subtraction

/

Division

^

, Calculates the result of <x> raised to the power of <y>

<X> BitAnd <y>

Calculate the result of the bitwise AND-combination of <x> and <y>

<X> BitOr <y>

Calculate the result of the bitwise OR-combination of <x> and <y>

<X> BitXor <y>

Calculate the result of the bitwise XOR-combination of <x> and <y>

Comparisons

<

Less Than

<=

Less Than or Equal to

=

Equal to

<>

Not equal to

>

Greater than

>=

Greater than or Equal to

Logical operators

AND

Logical AND Operator

NOT

Logical NOT Operator

OR

Logical OR Operator

General functions

average(<Channel>;<Samples>)

Calculates the average value of a channel for x(n) within the range n-<Samples> to n+<Samples>

If (<Condition> ; <IfTrue> ; <IfFalse>)

If the first expression is true, the result of the second expression is returned. Otherwise, the result of third expression is returned.

IsSegment

Returns 1, if the car is in one of the given racetrack segments, otherwise 0.
The segments can be selected by their number or by name

Segment(<Segmentation Name>

Returns the number of the racetrack segment

SegmentIndex(<SegmentName>

Returns the index of the segment in the selected Segmentation

TakeAve(<channel1>;...;<channeln>)

Returns the average value of all input channels at the current sample

TakeMax(<channel1>;...;<channeln>)

Returns the max value of all input channels at the current sample

TakeMin(<channel1>;...;<channeln>)

Returns the min value of all input channels at the current sample

Math Functions

Abs(<x>)

Returns the positive absolute value of <x>.

arccos(<x>)

Calculates the radiant angle, the cosine of which equals the parameter <x>.

ArcCosH(<x>)

Calculates the radiant angle, the hyperbolic cosine of which equals the parameter <x>.

ArcSin(<x>)

Calculates the radiant angle, the sine of which equals the parameter <x>.

ArcTan(<x>)

Calculates the radiant angle, the tangent of which equals the parameter <x>.

ArcSinH(<x>)

Calculates the radiant angle, the hyperbolic sine of which equals the parameter <x>.

ArcTanH(<x>)

Calculates the radiant angle, the hyperbolic tangent of which equals the parameter <x>.

ceil(<x>)

Calculates the smallest integer greater than or equal to to <x>.

Cos(<x>)

Calculates the cosine of the radiant <x>.

CosH(<x>)

Calculates the hyperbolic cosine of the radiant <x>.

Exp(<x>)

Calculates the exponential value 

floor(<x>)

Calculates the biggest integer smaller-equal to <x>.

frac(<x>)

Returns only the decimals from <x>.

HasValue(<value>)

True if the value is valid and False if the value is 'NoValue'

int(<x>)

Cuts all decimals from <x>.

lb(<x>)

Calculates the base-2 log of <x>.

lg(<x>)

Calculates the base-10 log of <x>.

ln(<x>)

Calculates the natural log of <x>.

round(<x>)

Rounds <x> to the nearest integer value.

sign(<x>)

Returns the sign of <x> (-1 or 1).

Sin(<x>)

Calculates the sinus of the radiant <x>.

SinH(<x>)

Calculates the hyperbolic sine of the radiant<x>.

sqr(<x>)

Calculates .

sqrt(<x>)

Calculates .

Tan(<x>)

Calculates the tangent of the radiant.

TanH(<x>)

Calculates the hyperbolic tangent of the radiant <x>.

BitInvert(<x>)

Calculates the bitwise Inversion of <x>.

Important

Due to limitations in precision of math results (because WinDarab is using 32-Bit IEEE-float values) there are problems, if the resulting value is too big. E.g. the result of BitInvert(128) is wrong, while the result of BitInvert(255) is correct.
The precision problem occurs only, when saving the math result in memory. While evaluation the expression, there won’t be any precision issues.
This means that the expression can evaluate a maximum of 32-Bit values, but the final result should be smaller.

Scripting

:=

Assignment operator for Local or Var variables

begin

Keyword to define the start of a script inside a math function

end

Keyword to define the end of a script inside a math function

Local

Keyword to define a Local variable, which is a variable that resets to 0 at each new timestamp (doesn't retain its previous value)

Var

Keyword to define a script variable that remembers its previous value

Trace functions

Ave(<channel>)

Calculates the average value of a channel over the file

DetectEvent([Rising|Active|Falling|Inactive]; <BeingCondition>;<MinTrueDuration>;<BeginDelay>;<EndCondition>;<MinFalseDuration>;<EndDelay>)

Returns a code from the event detected, if after the begin-condition for the given time (in milliseconds) the end-condition isn't found.
Without phase: 1: Begin Event (Rising Edge); 2: Inside Event; -1: End of Event(Falling Edge); 0:Outside Event
With phase: True(1) or False(0)

delta(<Channel>)

Calculates the difference between Channel(x(n)) and Channel(x(n-1))

dn

Calculates the difference Samples(x(n)) and Samples(x(n-1)).

ds

Calculates the difference between xDist(x(n)) and xDist(x(n-1)).

dt

Calculates the difference between xTime(x(n)) and xTime(x(n-1)).

IsLap([OutLap|RunningLap|InLap|FastestLap|NormalizedLap];...)

Returns true, if the current lap has one of the listed attributes. You can check for multiple attributes in a single call
e.g.:
IsLap(InLap;OutLap) returns true, if the lap is an In or Out lap.

LapAve(<Channel>)

Calculates the average value for a channel within the current lap

LapIndex

Returns the index of a lap, its a continuous counter starting at 1

LapMax(<Channel>)

Calculates the maximum value of a channel within the current lap

LapMin(<Channel>)

Calculates the minimum value of a channel within the current lap.

LapNo

Returns the lap number as shown in the File Explorer pane

LapSigma(<Channel>)

Same as Sigma but with a lap change set as the reset condition.

LapStdDev(<channel>)

Calculates the standard deviation for the channel within the current lap.

Lookup(<TableName>;<param1>;<param2>;…)

The lookup table is called with the given parameters which specify the dimensional values.

Max(<Channel>)

Calculates the maximum value of a channel.

Min(<Channel>)

Calculates the minimum value of a channel.

OutingNo

Returns the outing number shown in the File Explorer Pane

SampleRate(<channel>)

Returns the average sample rate in milliseconds of the channel

SegmentAve(<Channel>)

Calculates the average value for a channel within the current lap

SegmentIndex(<SegmentName>

Returns the index of the segment in the selected Segmentation

SegmentMax(<Channel>)

Calculates the maximum value of a channel within the current lap

SegmentMin(<Channel>)

Calculates the minimum value of a channel within the current lap.

SegmentStdDev(<channel>)

Calculates the standard deviation of a channel within the current lap.

sigma(<Channel>; <reset>)

Calculates the sum of Channel(x(0)) to Channel(x(n)). The optional second parameter defines a reset condition that - when occurring - resets the sum and starts from zero again.

ValueAtDist(<channel>; <dist> [; <LapIndex>])

Returns the value of the channel at the given distance. See New Math Functions

ValueAtTime(<channel>; <time> [; <LapIndex>])

Returns the value of the channel at the given time. See New Math Functions

IIR Filter Functions

WinDarab provides seven filter functions:

  • bandpass
  • bandpassFIR
  • lowpass
  • lowpassFIR
  • highpass
  • highpassFIR
  • stopband

WinDarab supports a number of different approximation techniques and frequencies for each of these filters.

  • Tip: Using the WinDarab Filter Assistant simplifies the assembly of filter functions considerably

bandpass

Syntax:

  • bandpass (<Technique>;<Order>;<Frequency Range>;<Expression>)

Parameters:

Technique

Order

Frequency Range>

Butterworth

1 / 2 / 3 / 4 / 5 / 6 / 7 / 8 / 9 / 10 / 11 / 12

50:100 / 50:200 /100:200 / 150:200

bandpassFIR

Syntax:

  • bandpassFIR(<Order>, <lowerCutoff>, <upperCutoff>, <Channel>)

The channel is filtered using a FIR-bandpass-filter of the given order (>=4th order) and a cutoff frequency [Hz].

lowpass

Syntax

  • lowpass (<Technique>;<Order>;<Frequency>;<Expression>)

Parameters:

Technique

Order

Frequency

Chebyshev-I

4 / 8 / 10 / 12

5 / 10 / 20 / 50 / 100 / 150 / 200

Chebyshev-II

4 / 8 / 10 / 12

5 / 10 / 20 / 50 / 100 / 150 / 200

Elliptic

4 / 8 / 10 / 12

5 / 10 / 20 / 50 / 100 / 150 / 200

Butterworth

1 / 2 / 3 / 4 / 5 / 6 / 7 / 8 / 9 / 10 / 11 / 12

5 / 10 / 20 / 50 / 100 / 150 / 200

FIR-Hamming

40 / 50 / 60

5 / 10 / 20 / 50 / 100

FIR-Remez

60

5 / 10 / 20 / 50 / 100

lowpassFIR

Syntax:

  • lowpassFIR(Order, CutoffFreq, Channel)

The channel is filtered using a FIR-lowpass-filter of the given order (>=4th order) and cutoff frequency [Hz].

highpass

Syntax:

  • highpass (<Technique>;<Order>;<Frequency>;<Expression>)

Parameters:

Technique

Order

Frequency

Chebyshev-

4 / 8 / 10 / 12

5 / 10 / 20 / 50 / 100 / 150 / 200

Chebyshev-II

4 / 8 / 10 / 12

5 / 10 / 20 / 50 / 100 / 150 / 200

Elliptic

4 / 8 / 10 / 12

5 / 10 / 20 / 50 / 100 / 150 / 200

Butterworth

1 / 2 / 3 / 4 / 5 / 6 / 7 / 8 / 9 / 10 / 11 / 12

5 / 10 / 20 / 50 / 100 / 150 / 200

FIR-Hamming

40 / 50 / 60

5 / 10 / 20 / 50 / 100

highpassFIR

Syntax:

  • highpassFIR (<Order>, <CutoffFreq>, <Channel>)

The channel is filtered using a FIR-highpass-filter of the given order (>=4th order) and cutoff frequency [Hz].

stopband

Syntax:

  • stopband (<Technique>;<Order>;<Frequency Range>;<Expression>)

Parameters:

Technique

Order

Frequency Range

Chebyshev-I

4 / 8 / 10 / 12

50100 / 50200 / 100200 / 150200

Chebyshev-II

4 / 8 / 10 / 12

50100 / 50200 / 100200 / 150200

Elliptic

4 / 8 / 10 / 12

50100 / 50200 / 100200 / 150200

Butterworth

1 / 2 / 3 / 4 / 5 / 6 / 7 / 8 / 9 / 10 / 11 / 12

50100 / 50200 / 100200 / 150200

The use of the diacritic mark "~" (tilde) between the upper and the lower frequency is mandatory.

Lookup Function

Syntax:

  • Lookup(<LookupTable>;<param1>[;<param2>…])

Parameters:

  • LookupTable: The base table for the lookup-value.
    • For more information on lookup tables see LookupTables.
  • param1-x: The input parameters for the first (x) dimension of the lookup table
  • param2-y: The input parameters for the second (y) dimension of the lookup table

Note: The number of the dimensional-parameters has to match the dimension of the lookup table.