Expression Filtering

Entering an expression in the Function field of the Graph Display Layout Editor sets a condition which must be met for the data to be included in the graph you are configuring.

NOTE: Expression filtering, does increase processing overhead, and may not perform well on slower devices.

Defining the function for a filter follows the same procedure as the expressions for math parameters:

1. Insert variables that represent that output of the sensors and/or PIDs that will be included in the calculation.
2. Add supported math operations to complete the desired calculation.

The completed function must evaluate to TRUE or FALSE (1 or 0). Each frame of data received will be checked against this function:

If the function evaluates as TRUE (1) for the frame, the data in the frame will be added to the graph.
If the function evaluates as FALSE (0), the data from the frame will NOT be added to the graph.

Example

Suppose we want to create a filter that filters out throttle values < or = to 50% as well as the transitions before and after. To accomplish this, we need a filter expression that will return TRUE if ALL of the following conditions are true:

Throttle % > 50
Throttle % has been > 50 for 500 milliseconds
Throttle % will be > 50 for 500 milliseconds

Part 1 - Throttle % > 50

1. Click New Variable. The Variable Wizard appears.

2. Click the Parameter link. The Parameter Selector window appears.

3. Search for throttle position and select (double-click on) the Throttle Position sensor in the Generic Sensors group.
4. In the Unit dropdown of the Variable Wizard window, select %.
5. Click OK. The filter expression should now show a text representation of the Throttle % variable you just created:

[50090.156]

6. For this first part of our expression, we simply need to make sure Throttle % is > 50. So, we just need to add > 50 after our throttle position variable:

[50090.156] > 50

Part 2 - Throttle % has been > 50 for 500 milliseconds

Now, we need to filter out the transitions before this period. To do that, we can use the average function to verify that the average throttle % has been over 50 for at least 500 ms.

1. This second condition has to ALSO be true. So, we add AND to our expression.

[50090.156] > 50 AND

2. Click New Variable to open the Variable Wizard again.
3. Select the same Parameter and Unit that was selected in Part 1.

4. In the Special Function box, select Average and enter a Period of 500 ms.
5. Click OK. Our expression should now look like this:

[50090.156] > 50 AND [50090.156.avg(500)]

6. For this period, the throttle position needs to be over 50%. So, we add > 50 to this part of the expression as well:

[50090.156] > 50 AND [50090.156.avg(500)] > 50.

Part 3 - Throttle % has been > 50 for 500 milliseconds

Now, we need to filter out the transitions after this period. This requires exactly the same procedure that we used for Part 2. However, we will use -500 ms for the period.

NOTE: Using a negative value for the Period tells VCM Scanner to look at the period AFTER the current time index. This works only during playback of recorded data streams. When Iive scanning, VCM Scanner can't obtain the specified information (it can't look into the future).

So, we add the following to the end of our expression:

AND [50090.156.avg(-500)] > 50

So, the final expression would look like the following:

([50090.156] > 50) AND ([ 50090.156.avg(500)] > 50) AND ([50090.156.avg(-500)] > 50)

NOTE: We've added parentheses to make the expression more readable. But, this is optional. The expression will work without them.