Loader.LoadProfile.Curves (loader v0.3.1)

Convenience functions for defining typical "curves" (i.e. "functions") for the request distribution in a LoadProfile.

Some function families, like exponentiation and logarithms, are varied enough or complex enough that i believe they are better expressed as "plain" callback functions, e.g. fn x -> -1 * :math.pow(2, (x + 3)) + 4. These function families have thus been excluded from this module.

In the context of a LoadProfile, the unit for x is always seconds.

Link to this section Summary

Functions

A sinusoidal function with a modification such that the result is always >= 0. Accepts options to modify the oscillation of the wave.

Link to this section Functions

Link to this function

linear(x, slope, y_intercept)

@spec linear(integer(), number(), number()) :: number()
Link to this function

quadratic(x, quadratic_coefficient, linear_coefficient \\ 1, constant \\ 0)

@spec quadratic(integer(), number(), number(), number()) :: number()
Link to this function

sine_wave(x, opts \\ [])

@spec sine_wave(
  integer(),
  keyword()
) :: number()

A sinusoidal function with a modification such that the result is always >= 0. Accepts options to modify the oscillation of the wave.

options

Options

  • :amplitude: a measure of the peak deviation of the wave from it's center. To keep all values of the wave >= 0, the vertical center of the wave will also be equal to its amplitude. Should be a positive number, and will be forced as such via Kernel.abs/1. Defaults to 1.
  • :frequency: the number of oscillations (cycles) that occur each second. Defaults to 1.
  • :angular_frequency: the rate-of-change of the function, in units of radians/second. Mutually exclusive with :frequency, with :angular_frequency taking precedence. Defaults to nil.
  • :phase: specifies, in radians, where in the wave's cycle the oscillation will begin, when x = 0. Defaults to 0.

See https://en.wikipedia.org/wiki/Sine_wave for more info on sine waves

Link to this function

uniform(x, y_intercept)

@spec uniform(integer(), number()) :: number()