How to intersect calculators? Merging trips and stops.

Injecting intervals from one calculator into another calculator.

Sometimes, you have related or complementary data in different calculators and might want to join it in a single place. For instance, you have a “route” calculator and a “stops” calculator. Let’s see how to inject “stops” into “route”.

Note: we assume that you already have the above two calculators created as per your logic.

Now you need to create a new counter of the type "calculator" that should say where to look for intervals for injection (in our case these are the intervals for the “stops” calculator).

adding calculator counter

For the “calculator” counter to work correctly, the same device(s) should be assigned to both calculators. Once the intervals for the referenced calculator (“stops” in our case) change, they will be automatically added to the master calculator interval (“route”):

interval with injected data toolbox

You can also limit the fields to include from the calculator, like begin and duration fields on the screenshot above.

allow_start_before and allow_finish_after configuration parameters for the counter define the period for the selection of sourced intervals. By default, they are set to “false” which means that only the intervals falling within the bounds of our interval will be retrieved.

***

Explore more capabilities of the flespi analytics engine filtering the KB by “analytics” tag.


See also
Article explains how to configure a calculator to detect trips between geofences.
How to configure a calculator to detect when a device enters or exits any geofence.