lslin | R Documentation |
lslin
applies linear method to a reference load
shape to match the peak and load factor to target values. See "Details"
for the algorithm.
lslin(x, target_max = 10000, target_lf = 0.7)
x |
A numeric array, representing reference load shape.
All values must be strictly positive containing no |
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). |
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/decrease
linearly and are applied to the based values after ordered.
If x' is the ordered version of x, then x'_{i} will be multiplied by 1-(i-1)*β, where β is a constant calculated as:
β = \frac{∑_{i=1}^n x'_{i} - target\ load\ factor } {∑_{i=1}^n x'_{i}(i-1)}
The load factor of the derived series matches the target. For target < base, β is positive and vice-versa.
The algorithm attempts hard to match the load factor of the derived load shape to the base load factor. β becomes large in magnitude for large difference of base and target load factor. In case β > 1, it is possible to get negative multipliers which force the values to be negative. This particular situation can occur when target load factor is significantly smaller than the base load factor.
If the target load factor is much bigger than the base load factor, one/both of the followings can occur:
As a linearly increasing function is multiplied by a decreasing function (x'), it is possible that the maximum of the product can exceed the maximum value of the base (x'), resulting in a different load factor.
As a linearly increasing function is multiplied by a decreasing function (x'), it is possible that the product is not strictly decreasing. The product array is re-ordered to produce the final values.
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
A list of class "lslin"
, having following elements:
df
: A data frame. See "Details".
beta
: Slope of the linearly increasing/decreasing multipliers.
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".
lslog
,
print.lslin
,
summary.lslin
,
plot.lslin
,
lscore
loads <- ercot[ercot$Year == 2019, ]$COAST plot(loads, type = "l") linear_loadshape <- lslin(loads, target_lf = 0.50) summary(linear_loadshape) #------------------------------------- loads2 <- ercot[ercot$Year == 2020, ]$ERCOT plot(loads2, type = "l") linear_loadshape2 <- lslin(loads2, target_lf = 0.7) summary(linear_loadshape2)#' #------------------------------------- loads3 <- ercot[ercot$Year == 2020, ]$ERCOT plot(loads3, type = "l") linear_loadshape3 <- lslin(loads3, target_lf = 0.95) summary(linear_loadshape3) #------------------------------------- loads4 <- ercot[ercot$Year == 2020, ]$SCENT plot(loads3, type = "l") linear_loadshape4 <- lslin(loads4, target_lf = 0.3) summary(linear_loadshape4)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.