Go to start of banner

# Calculation methods

This page explains the calculation methods of the Scaling 8.0 operator. The calculation method for an operation is set by the parameter "Calculation method" of the operator.

A calculation method determines

1. whether a data interval is allocated to a scale interval (incrementing the value of the "Result" or "CNT_" fields of the result table), and
2. the values in the "Value" columns of the result table based on the "Value" columns in the input table.

A data interval and a scale interval can overlap. In particular, the data interval can start or end in, or completely overlap a scale interval (see introduction of Scaling 8.0 for examples). The decision of whether a data interval is allocated to a scale interval depends on this relation. Depending on the calculation method, it can happen that a data interval is allocated to zero, one, or many scale intervals and vice versa.

If a data interval is allocated to a scale interval, then the data interval's values can influence the scale interval's values in different ways. For example, the values of the scale interval can be the sums of the values of the data intervals allocated to the scale interval . Other methods consider the percentage to which one interval overlaps the other.

The calculation methods can be divided in two categories: Methods, that focus on (1.) the allocation condition for a data interval to a scale interval, and methods, that focus on (2.) the calculation of the values. Methods of the former category calculate the values in the same way and methods of the latter category have the same allocation condition (TODO stimmt das?).

The next section gives an intuitive overview on the different calculation methods with respect to the allocation of data intervals and the determination of the values in a scale interval. It is followed by a section defining the methods in a more formal way.

## Intuitive overview

The following table gives an intuitive overview over the currently implemented calculation methods and some possible extensions.

In the table, we abbreviate the data interval by `d` and the scale interval by `s`. The first nine methods differ in their allocation condition. The other methods all allocate a data interval to a scale interval if they overlap. These methods differ in the calculation of the values.

The formal parts of the overview below are based on a set of variables and a function.

In particular, the triple `d = (dstart, dend, dval)` represents an interval defined in a data row of the input table (data interval), where

• `d``start `is the start time of `d `("From" column of the input table),
• `d``end` is the end time of `d `("To" column of the input table), and

• dval is a sequence of decimal numbers (see Data Types) defined for `d `(the values in columns defined in setting "Count"), which defaults to .

Note that the length of dval is the same for all rows as it equals the number of columns defined in column setting "Count".

Further, we use `dlength = dend - ``dstart `to describe the length of `d`.

`The quadruple s = (sstart, send, scnt, sval)` represents an interval of fixed length defined the scale (scale interval), where

• `sstart` is the` `start time of `s`` `("From" column of the result table),
• `send` is the end time of `s`` `("To" column of the result table),

• `scnt` is an integer indicating the number of data intervals allocated to `s`  ("CNT_" or "Result" column of the result table), and
• sval is a sequence of decimal numbers of length equal the number of columns defined in column setting "Count", each number representing the sum over the values computed for each value at the same index of dval for each allocated data interval `d` ("Value" columns of the result table),

Further, we use `slength = send - ``sstart `to describe the length of `s`. This value is the same for rows of the result table. It is defined by the parameter "Scaling" that defines the scaling intervals.

The function `overlap`(s,d) takes as input two intervals. It returns an Integer representing the time the two intervals overlap.

For example, the figure below shows a data interval `d `as a red line and a scale interval `s` as a black line. The intervals `d `and `s` overlap two time units, therefore `overlap(s,d) = 2.` The function `overlap(s,d)` hence is defined as follows.

`overlap`: Intervals x Intervals → Integers >= 0  (`overlap `maps two Intervals to a non-negative Integer)

 `overlap(s,d) =` if `dstart` <= `sstart` < `dend` < `send` then `dend `- `sstart` if `sstart`< `dstart ` < `send` <= `dend` then `send `- `dstart ` if `sstart`<= `dstart ` < `d``end` <= `s``end` then `d``end `- `dstart ` if `dstart`<= `sstart ` < `send` <= `dend` then `send `- `sstart ` otherwise `0`

Name in version 7.0Proposed name for version 8.0`d` is allocated to `s` if...`d` allocated to `s`?`d` can be allocated to how many `s`?

Formal condition for `d` to be allocated to `s`

(if and only if) (`d` covers 100% of `s`) (`d` ends in `s`) (s overlaps 100% of d) (`d` starts in `s`)

50% in scale50% of scale interval in data interval`d` overlaps at least 50% of `s `or` s` overlaps 100% of `d`  (note solid red line) (`s` overlaps 100% of `d`) (note solid red line)

Zero, one, or many`overlap`(`s`,`d`) / `slength` >= 0.5 or `sstart` <= `dstart`,`dend` <= `send`
100% in scale100% of scale interval in data interval `d` overlaps 100% of `s` ---Zero, one, or many`dstart` <= `sstart`,`send` <= `dend`
New, see FLEX-34950% of data interval in scale interval`s` overlaps at least 50% of `d`, allocation to earlier scale interval in case of a tie

n/a

-

(tie, allocation of `d` to earlier scale interval)

n/a

n/a

Zero or one`overlap`(`s`,`d`) / d`length` >= 0.5
Possible addition related to FLEX-349100% of data interval in scale intervals overlaps 100% of d-- -Zero or one

Possible additionLargest part of data interval in scale interval`s` overlaps largest part of `d`, allocation to earliest scale interval in case of a tie -

(tie, allocation of `d` to earlier scale interval)  Exactly one

Start time in scaleStart time in scale interval or overlaps 100% of scale interval`d` starts in `s` or `d` overlaps 100% of `s` -  At least one`sstart` <= `dstart` <` send `or `dstart` <= `sstart`,`send` <= `dend`
End time in scaleEnd time in scale interval or overlaps 100% of scale interval`d` ends in `s` or `d overlaps 100% of ``s`   -At least one`sstart` < `dend` <=` send` or `dstart` <= `sstart`,`send` <= `dend`
Count start time onlyStart time in scale interval`d` starts in `s`-- ` `

Exactly one`sstart` <= `dstart` <` send`
Count final time onlyEnd time in scale interval`d` ends in `s`-  -Exactly one`sstart` < `dend` <=` send`
Proportional time*valueValue proportional to data in scale`d` overlaps `s`    At least one`overlap`(`s`,`d`)  > 0
Proportional valueOverlap in hours
`d` overlaps `s`    At least one`overlap`(`s`,`d`)  > 0
Distribute value in pattern?`d` overlaps `s`    At least one`overlap`(`s`,`d`)  > 0
Smallest value in the patternSmallest value of allocated data`d` overlaps `s`    At least one`overlap`(`s`,`d`)  > 0
Largest value in patternLargest value of allocated data`d` overlaps `s`    At least one`overlap`(`s`,`d`)  > 0

Name in version 7.0Condition for d to be allocated to sCalculation of` sval` depending on `dval` of all allocated `d`'sNotable error behaviour
50% in scaleIf and only if `overlap`(`s`,`d`) / `slength` >= 0.5 or `sstart` <= `dstart`,`dend` <= `send`

svali =`dvali` for all indices `i` of sval`.`

If parameter "Count" is not set, then these columns are omitted.

100 % in scaleIf and only if `dstart` <= `sstart`,`send` <= `dend`As in option "50% in scale"
Start time in scale

If and only if` sstart` <= `dstart` <` send `or `dstart` <= `sstart`,`send` <= `dend`

As in option "50% in scale"
End time in scaleIf and only if` sstart` <= `dend` <` send` or `dstart` <= `sstart`,`send` <= `dend`As in option "50% in scale"
Count start time onlyIf and only if `sstart` <= `dstart` <` send`As in option "50% in scale"
Count final time onlyIf and only if `sstart` <= `dend` <` send`As in option "50% in scale"
Proportional time*valueIf and only if `overlap`(`s`,`d`)  > 0svali = overlap`(s,d)/slength` `* dvali` for all indices `i` of svalError if no value column defined
Proportional valueIf and only if `overlap`(`s`,`d`)  > 0

svali = overlap`(s,d)/dlength` `* dvali` for all indices `i` of svalError if no value column defined
Distribute value in patternIf and only if `overlap`(`s`,`d`)  > 0

Like "Proportional value"??Error if no value column defined
Smallest value in the patternIf and only if `overlap`(`s`,`d`)  > 0
If no value column defined, then input table is returned with additional "Result" and "CNT_" columns
Largest value in patternIf and only if `overlap`(`s`,`d`)  > 0
If no value column defined, then input table is returned with additional "Result" and "CNT_" columns
Hours to staffing

Staffing to hours

Maximum duration of the data rowIf and only if `overlap`(`s`,`d`)  > 0svali = `dvali` for all indices `i` of sval

• No labels