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.


Formal definitions for table below

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

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

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

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 as a red line and a scale interval s as a black line. The intervals 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 < dend <= send then dend - dstart


if dstart<= sstart < send <= dend then send - sstart


otherwise 0







Name in version 7.0

Proposed 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 scale

50% 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 scale

100% of scale interval in data interval

d overlaps 100% of s


-

-

-

Zero, one, or many

dstart <= sstart,send <= dend

New, see FLEX-349

50% 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) / dlength >= 0.5

Possible addition related to FLEX-349

100% of data interval in scale interval

s overlaps 100% of d

-

-


-

Zero or one


Possible addition

Largest 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 scale

Start 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 scale

End 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 only

Start time in scale interval

d starts in s

-

-

Exactly one

sstart <= dstart < send

Count final time only

End time in scale interval

d ends in s

-

-

Exactly one

sstart < dend <= send

Proportional time*value

Value proportional to data in scale

d overlaps s





At least one

overlap(s,d)  > 0

Proportional value

Overlap 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 pattern

Smallest value of allocated data

d overlaps s





At least one

overlap(s,d)  > 0

Largest value in pattern

Largest value of allocated data

d overlaps s





At least one

overlap(s,d)  > 0


(warning) Note for DST* handling supported starting from op-v 8.2

All records that have an invalid start or end date in the transition period at the beginning of dst will be ignored.



Name in version 7.0

Condition for d to be allocated to s

Calculation of sval depending on dval of all allocated d's

Notable error behaviour

50% in scale

If 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.

(warning) Note for DST* adapting:

the values are not adjusted, only for counting, when no value column is specified.


100 % in scale

If 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 scale

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

As in option "50% in scale"


Count start time only

If and only if sstart <= dstart < send

As in option "50% in scale"


Count final time only

If and only if sstart <= dend < send

As in option "50% in scale"


Proportional time*value

If and only if overlap(s,d)  > 0

svali = overlap(s,d)/slength * dvali for all indices i of sval

(warning) Note for DST* adapting: the Slength is adjusted

Error if no value column defined

Proportional value

If and only if overlap(s,d)  > 0

svali = overlap(s,d)/dlength * dvali for all indices i of sval

(warning) Note for DST* adapting: the Slength is adjusted

Error if no value column defined

Distribute value in pattern

If and only if overlap(s,d)  > 0


Like "Proportional value"

no implementation defined (not in 8.0, 8.1 or 8.2)

Error if no value column defined

Smallest value in the pattern

If and only if overlap(s,d)  > 0

Value column is required, otherwise 1 is taken.

(warning) Note for DST* adapting: the values are not adjusted.

If no value column defined, then input table is returned with additional "Result" and "CNT_" columns

Largest value in pattern

If and only if overlap(s,d)  > 0

Value column is required, otherwise 1 is taken.

(warning) Note for DST* adapting: the values are not adjusted.

If no value column defined, then input table is returned with additional "Result" and "CNT_" columns

Hours to staffing


(warning) Note for DST* adapting:

both intervals (d and s) are adapted to DST


Staffing to hours


(warning) Note for DST* adapting:

both intervals (d and s) are adapted to DST


Maximum duration of the data row

If and only if overlap(s,d)  > 0

svali = dvali for all indices i of sval

(warning) Note for DST* adapting: the time is adjusted