...
Code Block | ||
---|---|---|
| ||
/// Energy consumption per household per minute in the next 15 minutes derivative = MAP({ expressions = [ ['derivative(temp_wh, PredictionTimes)','whPerMinute'], ['id','id'] ] },predTime) /// Energy consumption per household per minute in the next 15 minutes watts = MAP({ expressions = [ ['whPerMinute * 60','watt'], ['id','id'] ] },derivative) |
Select
The select operator works a little different when a temporal attribute is involved in the predicate (i.e., an expression with Boolean return value). It does not tell if, but when a stream element fulfills the predictate. It does this by reducing the prediction time interval(s) to the intervals in which the predicate return true
. If the prediction times are empty, i.e., if the predictate is not true at any point in time in the incoming prediction time interval(s), the stream element is removed completely.
But why are there multiple prediction time intervals, i.e., a list of time intervals, in the metadata of a steam element? That is because the predicate can be for some intervals true and for some false. The select needs to remove the intervals in which the result is false. Hence, it needs to create multiple non-intersecting time intervals. An example can be seen in the following figure. If the predicate is is_inside(tpoint, region)
, the result are two time intervals: [[12:00,13:00),[14:00,15:00)].
Having a list is a design decision. An alternative would have been, that the select could create multiple stream elements. Nevertheless, a select is considered to reduce the stream elements, not increasing their number. Hence, this solution was choosen.
The trimTemporal function
Text
Code Block |
---|
testSelect = SELECT({
predicate = 'tdistance > 15000'
},calcDistance)
testTrim = MAP({
expressions = ['TrimTemporal(tdistance, ValidTimes)']
},testSelect) |
Join
Text
Aggregate
Text
Examples
...