![]() |
MegaLogViewer Formulas |
Custom Fields:
MegaLogViewer supports custom fields, that is fields calculated using a formula
defined by the user. The formula can be as complex as you wish, following the
guidelines on this page.
It is recommended that this is used for adding your own fields as opposed to
editing the properties files. I discourage editing of the properties files as
your changes will be over written on the next update. If you come up with formulas you feel many
would beefit from or find a need to edit the properties file(s), please contact
EFI Analytics. We can incorporate it in the next release for all.
To create a custom field:
From the Menu bar select:
"Calculated Fields" -> "Custom Fields" -> "Add Custom Field"
Simple calculations:
deltaRPM=[RPM]-[RPM-1]
interpreted as:
deltaRPM = (Current RPM)-(RPM 1 record back)
You can reference previous records by incuding the -x inside the []. As seen above
[RPM] references the current RPM, where [RPM-1] now references the RPM 1 record previous.
You can reference back further, i.e [RPM-2] will reference 2 records back,
[RPM-3] is 3 back, and so on. All references are relative.
Operators:
Advanced Math functions:
Supported Advanced Math functions are:
Function |
Definition |
Usage |
Smoothing | Smooths a field by averaging over the smoothingFactor number of records. | smoothBasic( field, smoothingFactor) |
sine | Standard Sine of a value. | sin(val) |
cosine | Standard Cosine of a value. | cos(val) |
arcsine | Standard arcsine of a value. | asin(val) |
arccosine | Standard arccosine of a value. | acos(val) |
tangent | Standard Tangent of a value. | tan(val) |
arc tangent | Standard Arc Tangent of a value. | atan(val) |
square root | Standard Square Root, same as pow(val, 0.5) of a value. | sqrt(val) |
absolute | Changes any negative values to the same magnitude in the positive direction. | abs(val) |
log | Natural log of a value. | log(val) |
log base 10 | Base 10 log of a value of a value. | log10(val) |
recipricol | The recipricol of a value, or 1/val | recip(val) |
exponent | Exponent of a value. | pow(val, exponent) |
round | Rounds the value of a value to the nearest integer value. | round(val) |
floor | Returns the largest (closest to positive infinity) integer value that is greater than or equal to the argument. | floor(val) |
ceiling | Returns the smallest (closest to negative infinity) integer value that is greater than or equal to the argument. |
ceil(val) |
exponent | Returns Euler's number e raised to the power of a double value. | exp(val) |
isNaN |
Checks the output of an expression to result in a invalid number |
isNaN(val) |
smoothFiltered |
Smooth a field using a matrix filter for less lag |
smoothFiltered(val) |
accelHp |
Calculates HP based on Acceleration rate. |
accelHp( velocity (MPH), deltaVelocity(MPH), deltaTime(s), weight(lb) ) |
Aero Drag |
Calculates the Aerodynamic Drag |
aerodynamicDragHp( velocity (m/s), airDensity (kg/m^-3), dragCoefficent, frontalArea (m^2) ) |
Rolling Drag |
Calculates estimated rolling resistence |
rollingDragHp( speed (MPH), tirePressure (psi), weight (lbs) ) |
Logical Conditions
Conditions will result in a true or false state. These can be used in several places including
Custom Filters in VE Analyze.
[RPM]>2000
interpreted as:
true when RPM is greater than 2000, false if 2000 RPM or below
Any form of complex math expresion can be used on each side of the operator.
Supported comparators:
In-line evaluation
In some instances you may want different calculations performed based on a condition.
this can be performed with an in-line evaluation
output = {condition} ? {true expression} : {false expression}
Example:
calcVal = [RPM] > 1000 ? [RPM] : 0
this will provide RPM for anything over 1000, anything under will be 0
Naturally You can get as fancy as needed in the condition, true expression and false expression.
some good examples of rather complex calculations can be found in the MSGraph.properties file
for MegaLogViewer. Checkout the calculations for "Instant MPG" or HP