net.simplace.sim.components.util.FSTFunctions
Defines some helper functions similar to some FST functions (FortranSimulationTranslator)
Defines some of the FST-Functions (sometimes with different signatures than the original
FST ones).
References:
(FST) The Fortran simulation translator, Kraalingen, D.W.G. van; Rappoldt, C.; Laar, H.H. van, European Journal of Agronomy 18 (2003)
public class FSTFunctions {
// Public Constructors
public FSTFunctions();
// Class Methods public static double
AFGEN(Double[] xy, double t);
Computes a linear interpolation for t from a table. The method returns the leftmost or rightmost value if t is out of range.
Takes the table as a double array with x-values in the even and y-values in the odd entries
- xy interpolation table as double array with x and y values interleaved
- t point at which the value is computed
returns the interpolated value
public static double
AFGEN(Double[] x, Double[] y, double t);
Computes a linear interpolation for t from a table. The method returns the leftmost or rightmost value if t is out of range.
Takes the table as two double array, first one with x-values, second one with y-values.
- x array with x values of the table
- y array with y values of the table
- t point at which the value is computed
returns the interpolated value
public static double
AFGEN(FWSimVariable xy, double t);
Computes a linear interpolation for t from a table. The method returns the leftmost or rightmost value if t is out of range.
Takes the table as a SimVariable of type double array with x-values in the even and y-values in the odd entries and calls AFGEN for double array
- xy data set
- t point at which the value is computed
returns the interpolated value
public static double
AFGEN(FWSimVariable x, FWSimVariable y, double t);
Computes a linear interpolation for t from a table. The method returns the leftmost or rightmost value if t is out of range.
Takes the table as two SimVariable of type double array with x-values in the even and y-values in the odd entries and calls AFGEN for two double array
- xy data set
- t point at which the value is computed
returns the interpolated value
public static double
AFGEN(TreeMap xy, double t);
Computes a linear interpolation for t from a table. The method returns the leftmost or rightmost value if t is out of range.
Takes the table as a TreeMap with x-values as keys and y-values as entries and calls AFGEN for two double arrays.
- xy data set
- t point at which the value is computed
returns the interpolated value
public static double
INSW(double testvalue, double X2, double X3);
Returns one value, if the test value is negative and another value, if the test value ist nonnegative
- testvalue
- X2 value returned if test value is negative
- X3 value returned if test value is positive or zero
returns resulting value
public static double
INSW(boolean testvalue, double X2, double X3);
Returns one value, if the test value is false and another value, if the test value ist nonnegative
- testvalue
- X2 value returned if test value is negative
- X3 value returned if test value is positive or zero
returns resulting value
public static int
REAAND(double x1, double x2);
Tests whether two values are positive
- x1 first value
- x2 second value
returns 1 if both are positive, 0 otherwise
public static double
LIMIT(double XL, double XH, double X);
Limits a value to a lower and upper bound
- XL lower bound
- XH upper bound
- X value
returns the value or it's lower/upper bound if it exceeds the bounds
public static double
NOTNUL(double x);
Returns 1 instead of 0 if the value is 0. Used to avoid division by 0
returns value or 1
public static double
REANOR(double a, double b);
Returns 1 if two values are both zero or negative, returns 0 otherwise
- a first value
- b second value
returns 1 or 0
public static void
INTGRL(FWSimVariable state, FWSimVariable rate);
Integrates a state by adding a rate
public static void
INTGRL(FWSimVariable state, FWSimVariable rate, double
delta);
Integrates a state by adding a rate
public static void
INTGRL(FWSimVariable state, double rate);
Integrates a state by adding a rate
public static void
INTGRL(FWSimVariable state, double rate, double delta);
Integrates a state by adding a rate
public static void
INTGRLA(FWSimVariable state, FWSimVariable rate);
Integrates a state array by adding a rate array
public static void
INTGRLA(FWSimVariable state, FWSimVariable rate, double
delta);
Integrates a state array by adding a rate array
public static void
INTGRLA(FWSimVariable state, double[] rate);
Integrates a state array by adding a rate array
public static void
INTGRLA(FWSimVariable state, double[] rate, double delta);
Integrates a state array by adding a rate array
}