REXGEN 1REXGEN 2REXGEN 2 IMU GNSSREXGEN AirREXGEN ProDeveloper

REXGEN XML reference: triggers, conditions and logic blocks

Updated

Make the logger react to what it measures. Compare values, do arithmetic, filter signals and fire triggers that start or stop recording or send a message.

About this guide

The schema, ReXConfig.xsd revision 1.1, defines the logic blocks in this guide. One published example uses ARITHMETIC and CONSTANT.

The quickest way to get a working trigger is to build it in REXDESK. Its Save Project command writes the project as XML that you can compare with this guide. See REXDESK: start and stop logging with triggers.

Every block here takes a UID attribute (required and unique in the file) and the optional Version, X and Y. It sits inside BLOCKS in a list named after it, for example TRIGGER_LIST. Blocks connect by UID. See REXGEN XML configuration: how it fits together.

Triggers and comparisons

TRIGGER

A trigger compares inputs and fires when the condition is met. To start or stop recording, name its UID in a recorder's EnableUID or DisableUID. To send an event message, name it in a message's TriggeringMessageUniqueID. This one fires when the value from block 30 stays above a constant of 3,000 for 500 ms.

<CONSTANT UID="31">
  <Value>3000</Value>
</CONSTANT>
<TRIGGER UID="40">
  <Name>Engine above 3000 rpm</Name>
  <InputUID1>30</InputUID1>
  <InputUID2>31</InputUID2>
  <OperatorCondition>GREATER</OperatorCondition>
  <ConditionAcceptanceTime>500</ConditionAcceptanceTime>
  <KeepActiveTime>0</KeepActiveTime>
  <DoNotActivateTimeout>0</DoNotActivateTimeout>
</TRIGGER>
Name
A name for the trigger. Required. String.
InputUID1, InputUID2
The two values compared, usually a signal and a constant. Required. Unsigned short.
InputUID3
A third value for range checks. Optional. Unsigned short.
OperatorCondition
The test: EQUAL, NOT_EQUAL, GREATER, LESS, EQUAL_GREATER, EQUAL_LESS, IN_RANGE, IN_RANGE_INCLUSIVE, NOT_IN_RANGE, NOT_IN_RANGE_INCLUSIVE, NEW, INCREMENT, DECREMENT, CHANGE or SAME. Required.
ConditionAcceptanceTime
Time in milliseconds the condition must stay true before the trigger fires. Optional. Unsigned int. Default 0.
KeepActiveTime
Time the trigger stays active after it fires. Required. Unsigned int.
DoNotActivateTimeout
Time during which the trigger cannot fire again. Required. Unsigned int.
ImpulseOnTrue
Optional. String. Default 0.
MaximumTriggeringCount
Maximum number of times the trigger can fire. 0 means no limit. Optional. Unsigned short. Default 0.
TriggerCountResetUID
UID of the signal that resets the trigger's count. Optional. Unsigned short. Default 0.

CONDITION

A condition takes two inputs, two further condition inputs and an operator from the same list as TRIGGER.

<CONDITION UID="41">
  <Input1UID>30</Input1UID>
  <Input2UID>31</Input2UID>
  <InputConditionUID1>0</InputConditionUID1>
  <InputConditionUID2>0</InputConditionUID2>
  <OperatorCondition>EQUAL_GREATER</OperatorCondition>
</CONDITION>
Input1UID, Input2UID
The values compared. Required. Unsigned short.
InputConditionUID1, InputConditionUID2
Two further inputs whose role is not described. Required. Unsigned short.
OperatorCondition
The test, as for TRIGGER. Required.

RELATIONAL_OPERATOR

This block compares two values and outputs the result.

<RELATIONAL_OPERATOR UID="42">
  <InputUID1>30</InputUID1>
  <InputUID2>31</InputUID2>
  <RelationalOperator>GREATER</RelationalOperator>
</RELATIONAL_OPERATOR>
InputUID1, InputUID2
The values compared. Required. Unsigned short.
RelationalOperator
EQUAL, NOT_EQUAL, GREATER, LESS, EQUAL_GREATER or EQUAL_LESS. Required.

Constants and arithmetic

CONSTANT

This block holds a fixed value that other blocks can use.

<CONSTANT UID="200">
  <Value>4</Value>
</CONSTANT>
Value
The value. Required. Float.

ARITHMETIC

This block combines two inputs as Input1 operator Input2. The published averaging example sums four thermocouple signals with three SUM blocks. This block then divides the total by a CONSTANT of 4.

<ARITHMETIC UID="1009">
  <Input1UID>1007</Input1UID>
  <Input2UID>200</Input2UID>
  <ArithmeticAction>DIV</ArithmeticAction>
</ARITHMETIC>
Input1UID, Input2UID
The two operands. Required. Unsigned short.
ArithmeticAction
SUM, SUB, MUL, DIV or the bitwise AND, OR, XOR and NOT. Required.

RATIONAL_FORMULA

This block applies the ASAM rational function (A·x² + B·x + C) / (D·x² + E·x + F) to one input, with six parameters.

<RATIONAL_FORMULA UID="43">
  <InputUID>30</InputUID>
  <ParA>0</ParA>
  <ParB>1</ParB>
  <ParC>0</ParC>
  <ParD>0</ParD>
  <ParE>0</ParE>
  <ParF>1</ParF>
</RATIONAL_FORMULA>
InputUID
The input value. Required. Unsigned short.
ParA to ParF
The six parameters. The values in the example pass the input through unchanged. Required. Float.

Signal processing

SIGNAL_FILTER

This block smooths an input. The example takes a moving average over four samples.

<SIGNAL_FILTER UID="44">
  <InputUID>30</InputUID>
  <Filter_Type>MOVING_AVERAGE</Filter_Type>
  <WindowSize>4</WindowSize>
  <Alpha>0</Alpha>
  <InitialValue>0</InitialValue>
  <Name>Speed smoothed</Name>
</SIGNAL_FILTER>
InputUID
The input value. Required. Unsigned short.
Filter_Type
MOVING_AVERAGE, MEDIAN, LOW_PASS or HIGH_PASS. Required. Default MOVING_AVERAGE.
WindowSize
Number of samples for the moving average or median. Required. Unsigned short. Default 4.
Alpha
Smoothing factor for the low-pass and high-pass filters. Required. Float.
InitialValue
Starting value of the output. Required. Float. Default 0.
Name
Optional. String.

SIGNAL_OPERATOR

This block works on successive samples of one input. The schema gives the formulas, where Ts is the sample period:

  • DIFFERENCE: y[k] = x[k] − x[k−1]
  • DERIVATIVE: y[k] = (x[k] − x[k−1]) / Ts
  • INTEGRATOR: y[k] = y[k−1] + x[k] × Ts
  • ACCUMULATOR: y[k] = y[k−1] + x[k]
<SIGNAL_OPERATOR UID="45">
  <InputUID>30</InputUID>
  <Operator_Type>DERIVATIVE</Operator_Type>
  <InitialValue>0</InitialValue>
  <Name>Speed rate of change</Name>
</SIGNAL_OPERATOR>
InputUID
The input value. Required. Unsigned short.
Operator_Type
One of the four operations in the list. Required. Default DIFFERENCE.
InitialValue
Starting value of the output. Required. Float. Default 0.
Name
Optional. String.

Counters and switches

COUNTER

This block generates a counting value, for example a rolling counter in a transmitted message.

<COUNTER UID="46">
  <CounterType>LOOP</CounterType>
  <Cycle>100</Cycle>
  <InitialValue>0</InitialValue>
  <MaxValue>15</MaxValue>
  <Seed>1</Seed>
</COUNTER>
CounterType
LOOP (start again after the maximum) or SINGLE (stop at it). Optional.
Cycle
Counting period in milliseconds. Required. Unsigned short.
InitialValue, MaxValue
First and maximum value. Required. Unsigned int.
Seed
The step added each cycle. Required. Unsigned short.
Delay
Optional. Unsigned int.

SWITCH

This block chooses one of several inputs by the value of a selector input, like a multiplexer.

<SWITCH UID="47">
  <InputSwitchUID>48</InputSwitchUID>
  <InputCount>2</InputCount>
  <InputDefaultUID>31</InputDefaultUID>
  <CASE_LIST>
    <CASE>
      <CaseValue>1</CaseValue>
      <InputUID>30</InputUID>
    </CASE>
    <CASE>
      <CaseValue>2</CaseValue>
      <InputUID>44</InputUID>
    </CASE>
  </CASE_LIST>
</SWITCH>
InputSwitchUID
The selector. Required. Unsigned short.
InputCount
Number of cases. Required. Unsigned int.
InputDefaultUID
The input used when no case matches. Required. Unsigned short.
CASE_LIST
One CASE for each choice. When the selector equals CaseValue, the output is InputUID. Required.

Start recording with a trigger

  1. Build the trigger. Add the TRIGGER and the blocks it compares, as in the first example.
  2. Hold recording until it fires. In the SDINTERFACE, set InitialEnableState to false and EnableUID to the trigger's UID.
  3. Keep the lead-up. Set PreLogTime and PostLogTime for the data before and after the event. See REXGEN XML reference: recording (SD) and USB outputs.
  4. Validate and load. Check the file against the schema, then load it. See REXGEN XML configuration: how it fits together.

Each product page lists the trigger sources that model offers: CAN identifier, signal, digital input, J1939 DM1 and internal channel.

Products in this guide

REXGEN 1

Vehicle black box

View REXGEN 1 Ask an engineer

REXGEN 2

Evidence data logger

View REXGEN 2 Ask an engineer

REXGEN 2 IMU GNSS

Motion & location data logging

View REXGEN 2 IMU GNSS Ask an engineer

REXGEN Air

CAN to cloud

View REXGEN Air Ask an engineer

REXGEN Pro

Edge data platform

View REXGEN Pro Ask an engineer

Still stuck?

Our engineers answer support questions on every Influx Technology product.