====Rate==== This is a function of the [[class_LagCorrection|LagCorrection]] class. ===Description=== This function is used to calculate a [[lagged time]] based on a //rate//. Use this if the source of your lag is counting the **speed** or **rate** that your target is moving, instead of being measured with a **counter**. Note that in many industrial applications, field-based counters or totalisers are more accurate that performing calculations than rates are. For example, you might have a conveyor system that has a speed measurement. If Sensor X is 50m away from Sensor Y, you can calculate the //time lag// between Y and X by going backwards and finding out how long it took for 50m of conveyor to pass. ===Parameters=== ^Parameter^Type^Meaning^ |server|ARDI API Server|The ARDI server to query| |query|string|The AQL Query to send| |amount|float|The amount to lag the time by| |origin|datetime|The ending/reference time (default=now)| |seconds|int|The maximum number of seconds to search (default=1 day)| |expected|int|The average amount of time in normal operation (default=10 minutes)| ===Returns=== The number of seconds of lag between the **origin** time and when **amount** has passed/flowed/been seen. ===Notes and Behaviour=== The **expected** time should be the maximum amount of lag you'd //expect// to have during normal operation (ie. if your machines didn't stop in the mean-time). The **seconds** time should be the maximum amount of lag you're willing to search for. ===Example=== srv = ardiapi.Server('demo.optrix.com.au/s/pl') query = "'Paint Line' ASSET 'Distance' PROPERTY VALUES" lc = samplestream.LagCorrection() diff = lc.Amount(srv,query,25) print("Roller 2 Lag Correction - " + str(dt))