Data-Driven Lag
What Is Lag?
Lag between various sensors and pieces of equipment is common.
There are a number of reasons why lag exists, but they are usually caused by needing to overcome either distance or inertia, such as…
- A machine taking a while to reach top speed,
- A heating element taking time to reach full temperature,
- A product taking time to reach the next component across a conveyor system.
What Is Data-Driven or Variable Lag
Data-Driven Lag or Variable Lag appears when the time-lag between two elements of your system isn't constant.
This is very common in conveyor-belt systems, where the line might be slowed, sped up or stopped entirely.
For example, let's look at Cupcake #1, working its way down a production line from the oven to the frosting machine.
If we wanted to report on an individual cupcake, we have to contend with the lag in the system. In this case, the lag comes from the time it takes to travel between parts of the production line.
The time it takes depends on both the distance between the two points, and the speed of the conveyor.
Since point A and point B are 50m apart, it will take 300 seconds for our cupcake to get from start to finish if the conveyor is running at 10 meters-per-minute.
But conveyor speed changes - stopping, slowing and speeding up from time-to-time. Our lag-compensation needs to be smarter.
Calculating Real-World Lag
You can use the LagCorrection class if you'd like to calculate the real lag. It takes a measurement - either a counter or a rate - and searches backwards until a specified amount has been seen.
In our example, we'd look at the conveyor speed and look for 50m of conveyor to have passed.
You can also use the LagCorrectedQuery class to build up a single data-frame that provides lag-synchronised data across several different queries and locations.