lslog: Logistic Method for Matching Peak and Load Factor

View source: R/shaper_log.R

lslogR Documentation

Logistic Method for Matching Peak and Load Factor

Description

Logistic Method for Matching Peak and Load Factor

Usage

lslog(
  x,
  target_max = 10000,
  target_lf = 0.7,
  k = 1,
  inf_pos = 0.5,
  iter = 500,
  def_l = 1
)

Arguments

x

A numeric array, representing reference load shape. All values must be strictly positive containing no NA(s). The length of x must be > 167.

target_max

Target peak value of resultant load shape, must be > 0.

target_lf

Target load factor of resultant load shape, must be numeric in between 0 and 1 (exclusive).

k

Steepness parameter, must be a positive number. See "Details".

inf_pos

Inflection point parameter. See "Details".

iter

Number of iterations for solving certain parameter. Must be >= 30. See "Details".

def_l

Start parameter for solving l, must be a positive numeric.

Details

The algorithm first evaluates the load factor of the reference load shape x, which is defined by the ratio of average to peak value. If the target load factor is greater than reference level, then all base values are multiplied by a number > 1. If the target load factor is less than reference level, then all base values are multiplied by a number < 1. The multipliers increase or decrease with a sigmoid pattern.

The sigmoid function is a transformed version of

f(x)=\frac{L}{1 - exp(-k(x-x_0))}

Parameter k is shape parameter, shaping the "sigmoidness" of the function. Larger value of k indicates more steepness in the function and lower value results in changes in multipliers in more linear fashion.

Location parameter x_0 controls the inflection point of the function and derived from inf_pos. inf_pos = 0.5 indicates the inflection point of the sigmoid multipliers is halfway.

The L parameter in the sigmoid is numerically solved. The number of iterations is equal to the iter argument, optimized based on the minimum difference between the derived and target load factor.

The return object contains a data frame df, having the following columns:

  • x_index: An index given to the original load shape x, starting from 1 to length(x).

  • x: The original array x, unaltered.

  • x_rank: The rank of the data points of the given array x, from 1 for the peak to length(x) for the lowest value.

  • x_ordered: Sorted x (largest to smallest).

  • x_pu: Per unit x, derived by diving x by max(x).

  • x_ordered_pu: Per unit x, sorted from largest to smallest.

  • mult: Derived multipliers, would be applied to sorted per unit x.

  • y_ordered_pu: Product of per unit sorted x and mult.

  • y_ordered_pu2: y_ordered_pu, sorted again, in case y_ordered_pu does not become decreasing.

  • y_pu: Resultant load shape in per unit. This is derived by re-ordering y_ordered_pu2 with respect to their original rank.

  • y: Resultant load shape. This is derived by multiplying y_pu by taget_max / base_max

Value

A list of class "lslog", having following elements:

  • df: A data frame. See "Details".

  • k: Steepness parameter. See "Details".

  • inf_pos: Inflection point parameter. See "Details".

  • L: Numerically solved optimized L parameter. See "Details".

  • max_mult: Maximum of the multipliers.

  • min_mult: Minimum of the multipliers.

  • base_load_factor: Load factor of the reference load shape x.

  • target_load_factor: Target load factor.

  • derived_load_factor: Load factor of the derived load shape (object$df$y).

  • base_max: Peak value of the base load shape, x

  • target_max: Target peak value of the new load shape.

  • derived_max: Peak value of the derived load shape (object$df$y)

  • base_min: Minimum value of the base load shape, x

  • derived_min: Minimum value of the derived load shape (object$df$y)

  • dec_flag: A logical flag stating whether the multipliers resulted in strictly decreasing values. TRUE indicates the order was not preserved. Only applicable for target_max > base_max. See "Details".

  • lf_flag: A logical flag indicating if the load factor of the derived shape differs from the target by more than 1%.

  • min_pu_flag: A logical flag indicating existence of negative values in the derived load shape. TRUE indicates the existence of negative values. Only applicable for target_max < base_max. See "Details".

See Also

lslin, print.lslog, summary.lslog, plot.lslog, lscore

Examples

loads <- ercot[ercot$Year == 2019, ]$COAST
plot(loads, type = "l")
logistic_loadshape <- lslog(loads, target_lf = 0.50, k = 0.5)
summary(logistic_loadshape)
#---------------------------------------------------
loads2 <- ercot[ercot$Year == 2020, ]$ERCOT
plot(loads2, type = "l")
logistic_loadshape2 <- lslog(loads2, target_lf = 0.6,
                            k = 0.5, inf_pos = 0.4)
summary(logistic_loadshape2)
#---------------------------------------------------
loads3 <- ercot[ercot$Year == 2020, ]$ERCOT
plot(loads3, type = "l")
logistic_loadshape3 <- lslog(loads3, target_lf = 0.9)
summary(logistic_loadshape3)







loadshaper documentation built on May 17, 2022, 5:07 p.m.