AnyLogic
Expand
Font size
  • java.lang.Object
    • com.anylogic.engine.SDUtilities

public class SDUtilities
extends java.lang.Object
This class contains functions commonly used in System Dynamic modeling.
Author:
AnyLogic North America, LLC https://anylogic.com

Method Summary

All Methods Static Methods Concrete Methods 
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.
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.
static double lookupExtrapolate​(TableFunction tableFunction, double x)
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​(TableFunction tableFunction, double x)
For a tableFunction (with linear interpolation and Nearest out-of-range action) returns the next value between arguments.
static double lookupInvert​(TableFunction tableFunction, double y)
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​(TableFunction tableFunction, double x, double mode)
Finds the slope at x in the tableFunction according to the given mode.
Modifier and Type Method Description

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Method Detail

getTableFunctionArea

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

lookupExtrapolate

public static double lookupExtrapolate​(TableFunction tableFunction,
                                       double x)
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.
Parameters:
tableFunction -
x -
Returns:
the value for the given x using extrapolation if needed

lookupSlope

public static double lookupSlope​(TableFunction tableFunction,
                                 double x,
                                 double mode)
Finds the slope at 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 the tableFunction

lookupBackward

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

lookupForward

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

lookupInvert

public static double lookupInvert​(TableFunction tableFunction,
                                  double y)
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. 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
How can we improve this article?