EVAL Field (Math And Scripting)

Advanced Feature: Eval Math/Logic expression or formula


IMPORTANT
:
Do not read this page if you just start using VDASH-EMU. Information here are dedicated to the EVAL FIELD , a very advanced and powerful feature and you do NOT need it to get started with VDASH-EMU.

Eval Math Expression with telemetry Data:
you can enter a Math expression in a specific field named Eval in the properties of the object to be evaluated with the targeted telemetry data, to change the result or do some calculation with telemetry or to simply display a value.

EVAL FIELD: Enter the Math formula or logic (boolean) formula in this field

Eval Visibility: Hide the object if the telemetry value equal to zero or the result of the formula equal to zero

Here is an example of calculation with ERS or KERS value to get a percentage and not a Kj (see the screenshot below):

DATA / 4000

or

DATA / (400000 / 100)

or using the Math fonction ABS()

ABS(DATA)

Notes: DATA in the formula is automatically replaced by the targeted telemetry value (i.e. the current telemetry data object, KERS or ERS value in the screenshot example)

another example using Logic this time which stay at zero and do not accept negative value:

IF(DATA<0,0,DATA)

 

see below all variables and functions available.

 

Mathematical Operators
+ Additive operator
– Subtraction operator
* Multiplication operator
/ Division operator
% Remainder operator (Modulo)
^ Power operator

Boolean Operators*
== Equals
!= Not equals
<> Not equals
< Less than
<= Less than or equal to
> Greater than
>= Greater than or equal to
&& Boolean AND
|| Boolean OR

Bitwise Operators:
& AND
| OR

*Boolean operators result always in a value of 1 or 0 (zero).

Supported Functions
ABS(expression) Returns the absolute (non-negative) value of the expression
ACOS(expression) Returns the angle of acos (in degrees)
ASIN(expression) Returns the angle of asin (in degrees)
ATAN(expression) Returns the angle of atan (in degrees)
CEIL(expression) Rounds the value up to the nearest integer
COS(expression) Returns the trigonometric cosine of an angle (in degrees)
COSH(expression) Returns the hyperbolic cosine of a value
DEG(expression) Converts an angle measured in radians to an approximately equivalent angle measured in degrees
FLOOR(expression) Rounds the value down to the nearest integer
IF(condition,value_if_true,value_if_false) Returns one value if the condition evaluates to true or the other if it evaluates to false
LOG(expression) Returns the natural logarithm (base e) of an expression
LOG10(expression) Returns the common logarithm (base 10) of an expression
MAX(e1,e2, …) Returns the biggest of the given expressions
MIN(e1,e2, …) Returns the smallest of the given expressions
NOT(expression) Boolean negation, 1 (means true) if the expression is not zero
RAD(expression) Converts an angle measured in degrees to an approximately equivalent angle measured in radians
RANDOM() Produces a random number between 0 and 1
ROUND(expression,precision) Rounds a value to a certain number of digits, uses the current rounding mode
SIN(expression) Returns the trigonometric sine of an angle (in degrees)
SINH(expression) Returns the hyperbolic sine of a value
SQRT(expression) Returns the square root of an expression
TAN(expression) Returns the trigonometric tangens of an angle (in degrees)
TANH(expression) Returns the hyperbolic tangens of a value
toDegrees(expression) Return converted value
toRadians(expression) Return converted value

v1.1-32f additions:
buttonState(n) result 0 or 1 – (n is the index of the button from 1 to 32)
ledState(n) result 0 or 1 (n is the index of the LED; Marshal Led from 1 to 6; External Led from 7 to 13)
isChanged() result 1 when the DATA (telemetry) has been changed

*Functions names are case insensitive.

Supported Constants
E
Euler
PHI
PI

Since version 1.07 Android / 0.3.5 Windows some telemetry variables are exposed to be able to use them in the EVAL field, here the list:

DATA VARIABLES:

RAWGEAR
SPEEDKMH
SPEEDMPH
NUMBEROFLAPS
TOTALLAPS
COMPLETEDLAPS
POSITION
ENGINERPM
MAXENGINERPM
CARSPEED
ENGINEOILTEMP
ENGINEWATERTEMP
ENGINEOILPRESSURE
FUELPRESSURE
VOLTAGE
FUELLITERS
FUELCAPACITYLITERS
BRAKEBIAIS
BRAKETEMPFL
BRAKETEMPFR
BRAKETEMPRL
BRAKETEMPRR
TIREPRESSUREFL
TIREPRESSUREFR
TIREPRESSURERL
TIREPRESSURERR
LAPTIMECURRENT
LAPTIMEBEST
LAPTIMELAST
TRACKSIZE
LAPDIST
KERSLEVEL
KERSMAXLEVEL
DRS
SECTOR
LASTSECTOR1
LASTSECTOR2
TIMEELAPSED
TURBOBOOSTPRESSURE
FUELMIX
THROTTLESHAPE
TIRESCOMPOUND
THROTTLEPEDAL
BRAKEPEDAL
CLUTCHPEDAL
FRONTBRAKEBIAS
REARBRAKEBIAS
FRONTANTIROLLBAR
REARANTIROLLBAR
LEFTWEIGHTJACKER
RIGHTWEIGHTJACKER
DIFFENTRY
DIFFMIDDLE
DIFFEXIT
ENGINEBRAKING
ENGINEPOWER
PITSTOPFRONTFLAPADJUSTMENT
TIRETEMPERATUREFLIN
TIRETEMPERATUREFLMID
TIRETEMPERATUREFLOUT
TIRETEMPERATUREFRIN
TIRETEMPERATUREFRMID
TIRETEMPERATUREFROUT
TIRETEMPERATURERLIN
TIRETEMPERATURERLMID
TIRETEMPERATURERLOUT
TIRETEMPERATURERRIN
TIRETEMPERATURERRMID
TIRETEMPERATURERROUT
TIRETEMPERATUREFL
TIRETEMPERATUREFR
TIRETEMPERATURERL
TIRETEMPERATURERR
LOCALACCELERATIONX
LOCALACCELERATIONY
LOCALACCELERATIONZ
GFORCE
TIRELOADFL
TIRELOADFR
TIRELOADRL
TIRELOADRR
TIREWEARFL
TIREWEARFR
TIREWEARRL
TIREWEARRR
TOTALCARS
RAINING
AMBIENTTEMP
TRACKTEMP
WIND
WINDDIRECTION
STARTLIGHTS
STEER
NUMPENALTIES
SESSIONTYPE
SESSIONSTATE
SESSIONFLAGS

v1.1-25 additions:
DELTATIMELAST
DELTATIMEBESTRECORDS
CURRSECTOR1
CURRSECTOR2
TIMEBEHINDLEADER
TIMEBEHINDNEXT

FLAG VARIABLES:

GREENFLAGWARNING
YELLOWFLAGWARNING
BLUEFLAGWARNING
REDFLAGWARNING
REDZONEWARNING
ENGINEWARNING
FUELPRESSUREWARNING
OILWARNING
WATERWARNING
DETACHEDPARTS
ISLASTLAP
ISINPITS
HEADLIGHTS
ENGINESTALL
TCLEVEL
ABSLEVEL
PITLIMITER
DRSLEGALSTATUS
IGNITIONSTARTER
SAFETYCARFLAG
ONPITROAD
BLACKFLAG
ISENGLISHUNIT

v1.1.-31g Addition:
PAGEBLOCKED

v1.1-32 Addition:
CURRENTLAP

SUSPENSIONDEFLECTIONFL << suspension position or max travel
SUSPENSIONDEFLECTIONFR
SUSPENSIONDEFLECTIONRL
SUSPENSIONDEFLECTIONRR
SUSPENSIONVELOCITYFL
SUSPENSIONVELOCITYFR
SUSPENSIONVELOCITYRL
SUSPENSIONVELOCITYRR
PITCHRAW
YAWRAW
ROLLRAW
LAPSREMAININGINTANK << laps remaining based on average of fuel per lap consumption
FUELPERLAP << fuel per lap consumption
PUSHTOPASS << 1=Allowed; 2=Activated
PTPAMOUNTLEFT << Push To Pass left
DELTAVERSUSCARBEHIND << Delta time versus Car behind you
VELOCITYX
VELOCITYY
VELOCITYZ
ANGULARVELOCITYX
ANGULARVELOCITYY
ANGULARVELOCITYZ