Package com.anylogic.engine
- java.lang.Object
- com.anylogic.engine.SDUtilities
public class SDUtilities extends Object
This class contains functions commonly used in System Dynamic modeling.
- Author:
- AnyLogic North America, LLC https://anylogic.com
Modifier and Type | Method | Description |
---|---|---|
static double | getTableFunctionArea |
Returns the area under a
tableFunction (with linear
interpolation and Nearest out-of-range action)
between start and end . |
static double | lookupBackward |
For a
tableFunction (with linear
interpolation and Nearest out-of-range action)
returns the value of the left point of interval for x
value. |
static double | lookupExtrapolate |
For a
tableFunction (with linear
interpolation and Nearest out-of-range action)
returns the value for the given x using extrapolation if
needed.This function may be replaced with a call of .get(x) method
for a table function with Extrapolate out-of-range
action. |
static double | lookupForward |
For a
tableFunction (with linear
interpolation and Nearest out-of-range action)
returns the next value between arguments. |
static double | lookupInvert |
Finds the input that, when used in the
tableFunction (with
linear interpolation and Nearest
out-of-range action) would return y .This function will find the first (smallest) value that satisfies this inverse relationship. |
static double | lookupSlope |
Finds the slope at
x in the tableFunction
according to the given mode . |
public static double getTableFunctionArea(TableFunction tableFunction, double start, double end)
Returns the area under a
tableFunction
(with linear
interpolation and Nearest out-of-range action)
between start
and end
.- Parameters:
tableFunction
-start
-end
-- Returns:
- the area under a
tableFunction
public static double lookupExtrapolate(TableFunction tableFunction, double x)
For a
This function may be replaced with a call of
tableFunction
(with linear
interpolation and Nearest out-of-range action)
returns the value for the given x
using extrapolation if
needed.This function may be replaced with a call of
.get(x)
method
for a table function with Extrapolate out-of-range
action.- Parameters:
tableFunction
-x
-- Returns:
- the value for the given
x
using extrapolation if needed
public static double lookupSlope(TableFunction tableFunction, double x, double mode)
Finds the slope at
Between arguments of a table function the slope is just the change in y divided by the change in
If the value for
x
in the tableFunction
according to the given mode
. for a
tableFunction
(with linear interpolation
and Nearest out-of-range action).Between arguments of a table function the slope is just the change in y divided by the change in
x
from one point to the next. If
x
is the same as a point in table function then the average
of the slope before and after x
is returned.If the value for
x
is out of range of table function (bigger
than the biggest x
point or smaller than the smallest
x
point) what is returned depends on mode
, If
mode
is 0 then 0 is returned, this is analogous to a
Nearest out-of-range action. If mode
is
positive, then the slope of the closes segment is used
(Extrapolate out-of-range action). If mode
is negative then Double.NaN
is returned.- Parameters:
tableFunction
-x
-mode
-- Returns:
- the slope at
x
in thetableFunction
public static double lookupBackward(TableFunction tableFunction, double x)
For a
tableFunction
(with linear
interpolation and Nearest out-of-range action)
returns the value of the left point of interval for x
value.- Parameters:
tableFunction
-x
-- Returns:
- the value of the left point of interval for
x
value
public static double lookupForward(TableFunction tableFunction, double x)
For a
tableFunction
(with linear
interpolation and Nearest out-of-range action)
returns the next value between arguments.- Parameters:
tableFunction
-x
-- Returns:
- the next value between arguments
public static double lookupInvert(TableFunction tableFunction, double y)
Finds the input that, when used in the
This function will find the first (smallest) value that satisfies this inverse relationship. If
tableFunction
(with
linear interpolation and Nearest
out-of-range action) would return y
.This function will find the first (smallest) value that satisfies this inverse relationship. If
y
is outside the range of table
function (bigger than the biggest y value or smaller than the smallest y
value) the function will return Double.NaN
.- Parameters:
tableFunction
-y
-- Returns:
- the argument of tableFunction which provides the given result
y