Difference between revisions of "Equations"

From Torque OBD2 Wiki
Jump to navigationJump to search
Line 7: Line 7:
 
* EWMAF(weight:value)
 
* EWMAF(weight:value)
 
:Exponentially weighted moving average filter - filter noisy signals here. 'weight' should be between 0(more smoothing) and 1(less smoothing)
 
:Exponentially weighted moving average filter - filter noisy signals here. 'weight' should be between 0(more smoothing) and 1(less smoothing)
 +
  
 
* TDLY(seconds:value)  
 
* TDLY(seconds:value)  
 
:Time based delay -  causes data to be delayed by 'seconds' amount before being returned.  Returns 0 until data buffer is full
 
:Time based delay -  causes data to be delayed by 'seconds' amount before being returned.  Returns 0 until data buffer is full
 +
  
 
* RDLY(polls:value)  
 
* RDLY(polls:value)  
 
:Read based delay - data is delayed by X polling loops before being returned
 
:Read based delay - data is delayed by X polling loops before being returned
 +
  
 
* TOT(seconds:value)
 
* TOT(seconds:value)
 
:Totalizer function based upon difference from time/value
 
:Totalizer function based upon difference from time/value
 +
  
 
* TAVG(seconds:value)
 
* TAVG(seconds:value)
 
:Timed average.  This averages the incoming data for the configured amount of time (in seconds). Data older than the configured time is removed from being averaged
 
:Timed average.  This averages the incoming data for the configured amount of time (in seconds). Data older than the configured time is removed from being averaged
 +
  
 
* RAVG(value)
 
* RAVG(value)
 
:Rolling average. This averages incoming values until it is reset. No values are removed from the average until it is reset.
 
:Rolling average. This averages incoming values until it is reset. No values are removed from the average until it is reset.
 +
  
 
* AVG(bucketSize:value)
 
* AVG(bucketSize:value)
 
:Point average. This averages incoming values from a bucket of s set size.  The bucket can be configured to average a set amount of values, so AVG(10,value) would average the last 10 values
 
:Point average. This averages incoming values from a bucket of s set size.  The bucket can be configured to average a set amount of values, so AVG(10,value) would average the last 10 values
 +
  
 
* SIN(value), COS(value) ,TAN(value).
 
* SIN(value), COS(value) ,TAN(value).
 
:Trigonometric functions are supported
 
:Trigonometric functions are supported
 +
  
 
* LOG(value)
 
* LOG(value)
 
:Returns the natural logarithm (base e) of a value
 
:Returns the natural logarithm (base e) of a value
 +
  
 
* LOG10(value)
 
* LOG10(value)
 
:Returns the base 10 logarithm of a value
 
:Returns the base 10 logarithm of a value
 +
  
 
* LOG1P(value)
 
* LOG1P(value)
 
:Returns the natural logarithm of the sum of the value and 1
 
:Returns the natural logarithm of the sum of the value and 1
 +
  
 
* INT(value)
 
* INT(value)
 
:Converts the incoming number to an integer
 
:Converts the incoming number to an integer
 +
  
 
* SQRT(value)
 
* SQRT(value)
 
:Returns the correctly rounded positive square root of a value.
 
:Returns the correctly rounded positive square root of a value.
 +
  
 
* ABS(value)
 
* ABS(value)
 
:Returns the absolute value of the number given  
 
:Returns the absolute value of the number given  
 +
  
 
* SIGNED(value)
 
* SIGNED(value)
 
:Treats the incoming value as 8bit signed
 
:Treats the incoming value as 8bit signed
 +
  
  

Revision as of 12:45, 7 October 2016

The PID Editor contains a reasonably powerful equation editor that allows you to manipulate the incoming data from an OBD device, Sensor, or other data input to the app

Functions

The equation editor supports the following functions

  • EWMAF(weight:value)
Exponentially weighted moving average filter - filter noisy signals here. 'weight' should be between 0(more smoothing) and 1(less smoothing)


  • TDLY(seconds:value)
Time based delay - causes data to be delayed by 'seconds' amount before being returned. Returns 0 until data buffer is full


  • RDLY(polls:value)
Read based delay - data is delayed by X polling loops before being returned


  • TOT(seconds:value)
Totalizer function based upon difference from time/value


  • TAVG(seconds:value)
Timed average. This averages the incoming data for the configured amount of time (in seconds). Data older than the configured time is removed from being averaged


  • RAVG(value)
Rolling average. This averages incoming values until it is reset. No values are removed from the average until it is reset.


  • AVG(bucketSize:value)
Point average. This averages incoming values from a bucket of s set size. The bucket can be configured to average a set amount of values, so AVG(10,value) would average the last 10 values


  • SIN(value), COS(value) ,TAN(value).
Trigonometric functions are supported


  • LOG(value)
Returns the natural logarithm (base e) of a value


  • LOG10(value)
Returns the base 10 logarithm of a value


  • LOG1P(value)
Returns the natural logarithm of the sum of the value and 1


  • INT(value)
Converts the incoming number to an integer


  • SQRT(value)
Returns the correctly rounded positive square root of a value.


  • ABS(value)
Returns the absolute value of the number given


  • SIGNED(value)
Treats the incoming value as 8bit signed


  • RANDOM()
Returns a random number between 0 and 1
  • BARO()
Returns the barometric pressure from the android device or measured from the vehicle ECU if it supports it in psi