ON THIS PAGE:
Format
Integral_Sampled(Expr ,StartTime [,EndTime])
Returns
Returns the integral of an expression over a range of time.
Inputs
Expr: The expression to be integrated.
Behaviour: Required
Dimension: Collection
Valid data types: Boolean, Decimal, Integer
StartTime: The start time over which to produce the integral.
Behaviour: Required
Dimension: Collection, SingleValue
Valid data types: DateTime, Decimal, Integer, String
EndTime: The end time over which to produce the integral. If not specified, it assumes the current time.
Behaviour: Optional
Dimension: Collection, SingleValue
Valid data types: DateTime, Decimal, Integer, String
When to Use
Integral_Sampled() operates in SI units of time, that is, seconds. If you are integrating a rate to produce a total, ensure that the rate is a per-second quantity so that you produce a meaningful result.
Examples
Expression: Integral_Sampled(Expr, Time() - 60, Time())
Result: Integral over the last minute (60 seconds).
Expression: Integral_Sampled(Expr, Time() - 60)
Result: Integral over the last minute (60 seconds).
Expression: Integral_Sampled(Expr, Midnight(Time()))
Result: Integral since midnight (the start of the day).
Expression: Integral_Sampled({tag, sampleMethod = "Raw"}, Time() – 60)
Result: Integral of the raw values over the last minute.
Expression: Integral_Sampled(Sampling(Expr, "raw"), Time() - 60)
Result: Integral of the raw values over the last minute.
Expression: Integral_Sampled({HourlyFlowRate}/3600, Midnight(Time()))
Result: Integral of the hourly flow rate since midnight, ie total production for the day (3600 is the number of seconds in an hour).
Expression: Integral_Sampled({ABC} > 10, Midnight(Time()))
Result: The total number of seconds during which the tag ABC has been greater than 10, since midnight. Equality operators (ie =, ==, !=, <, <=, >, >=) evaluate to 1 or 0, so integrating them produces the total time that the expression is true.