Package net.simplace.sim.components.util
Class FSTFunctions
java.lang.Object
net.simplace.sim.components.util.FSTFunctions
Defines some helper functions similar to some FST functions (FortranSimulationTranslator)
WIKI_START
Defines some of the FST-Functions (sometimes with different signatures than the original
FST ones).
== References: ==
(FST) [https://www.wageningenur.nl/en/Publication-details.htm?publicationId=publication-way-333137323735 The Fortran simulation translator], Kraalingen, D.W.G. van; Rappoldt, C.; Laar, H.H. van, European Journal of Agronomy 18 (2003)
WIKI_END
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic doubleComputes a linear interpolation for t from a table.static doubleComputes a linear interpolation for t from a table.static doubleComputes a linear interpolation for t from a table.static doubleAFGEN(InterpolationTable xy, double t) Computes a linear interpolation for t from a table.static doubleComputes a linear interpolation for t from a table.static doubleAFGEN(net.simplace.sim.util.FWSimVariable<Double[]> x, net.simplace.sim.util.FWSimVariable<Double[]> y, double t) Computes a linear interpolation for t from a table.static doubleINSW(boolean testvalue, double X2, double X3) Returns one value, if the test value is false and another value, if the test value ist nonnegativestatic doubleINSW(double testvalue, double X2, double X3) Returns one value, if the test value is negative and another value, if the test value ist nonnegativestatic voidIntegrates a state by adding a ratestatic voidIntegrates a state by adding a ratestatic voidINTGRL(net.simplace.sim.util.FWSimVariable<Double> state, net.simplace.sim.util.FWSimVariable<Double> rate) Integrates a state by adding a ratestatic voidINTGRL(net.simplace.sim.util.FWSimVariable<Double> state, net.simplace.sim.util.FWSimVariable<Double> rate, double delta) Integrates a state by adding a ratestatic voidIntegrates a state array by adding a rate arraystatic voidIntegrates a state array by adding a rate arraystatic voidINTGRLA(net.simplace.sim.util.FWSimVariable<Double[]> state, net.simplace.sim.util.FWSimVariable<Double[]> rate) Integrates a state array by adding a rate arraystatic voidINTGRLA(net.simplace.sim.util.FWSimVariable<Double[]> state, net.simplace.sim.util.FWSimVariable<Double[]> rate, double delta) Integrates a state array by adding a rate arraystatic doubleLIMIT(double XL, double XH, double X) Limits a value to a lower and upper boundstatic doubleNOTNUL(double x) Returns 1 instead of 0 if the value is 0.static intREAAND(double x1, double x2) Tests whether two values are positivestatic doubleREANOR(double a, double b) Returns 1 if two values are both zero or negative, returns 0 otherwise
-
Constructor Details
-
FSTFunctions
public FSTFunctions()
-
-
Method Details
-
AFGEN
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- Parameters:
xy- interpolation table as double array with x and y values interleavedt- point at which the value is computed- Returns:
- the interpolated value
-
AFGEN
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.- Parameters:
x- array with x values of the tabley- array with y values of the tablet- point at which the value is computed- Returns:
- the interpolated value
-
AFGEN
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- Parameters:
xy- data sett- point at which the value is computed- Returns:
- the interpolated value
-
AFGEN
public static double AFGEN(net.simplace.sim.util.FWSimVariable<Double[]> x, net.simplace.sim.util.FWSimVariable<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 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- Parameters:
x-y- data sett- point at which the value is computed- Returns:
- the interpolated value
-
AFGEN
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.- Parameters:
xy- data sett- point at which the value is computed- Returns:
- the interpolated value
-
AFGEN
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.- Parameters:
xy- data sett- point at which the value is computed- Returns:
- the interpolated value
-
INSW
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- Parameters:
testvalue-X2- value returned if test value is negativeX3- value returned if test value is positive or zero- Returns:
- resulting value
-
INSW
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- Parameters:
testvalue-X2- value returned if test value is negativeX3- value returned if test value is positive or zero- Returns:
- resulting value
-
REAAND
public static int REAAND(double x1, double x2) Tests whether two values are positive- Parameters:
x1- first valuex2- second value- Returns:
- 1 if both are positive, 0 otherwise
-
LIMIT
public static double LIMIT(double XL, double XH, double X) Limits a value to a lower and upper bound- Parameters:
XL- lower boundXH- upper boundX- value- Returns:
- the value or it's lower/upper bound if it exceeds the bounds
-
NOTNUL
public static double NOTNUL(double x) Returns 1 instead of 0 if the value is 0. Used to avoid division by 0- Parameters:
x- value- Returns:
- value or 1
-
REANOR
public static double REANOR(double a, double b) Returns 1 if two values are both zero or negative, returns 0 otherwise- Parameters:
a- first valueb- second value- Returns:
- 1 or 0
-
INTGRL
public static void INTGRL(net.simplace.sim.util.FWSimVariable<Double> state, net.simplace.sim.util.FWSimVariable<Double> rate) Integrates a state by adding a rate- Parameters:
state-rate-
-
INTGRL
public static void INTGRL(net.simplace.sim.util.FWSimVariable<Double> state, net.simplace.sim.util.FWSimVariable<Double> rate, double delta) Integrates a state by adding a rate- Parameters:
state-rate-delta-
-
INTGRL
Integrates a state by adding a rate- Parameters:
state-rate-
-
INTGRL
public static void INTGRL(net.simplace.sim.util.FWSimVariable<Double> state, double rate, double delta) Integrates a state by adding a rate- Parameters:
state-rate-delta-
-
INTGRLA
public static void INTGRLA(net.simplace.sim.util.FWSimVariable<Double[]> state, net.simplace.sim.util.FWSimVariable<Double[]> rate) Integrates a state array by adding a rate array- Parameters:
state-rate-
-
INTGRLA
public static void INTGRLA(net.simplace.sim.util.FWSimVariable<Double[]> state, net.simplace.sim.util.FWSimVariable<Double[]> rate, double delta) Integrates a state array by adding a rate array- Parameters:
state-rate-delta-
-
INTGRLA
Integrates a state array by adding a rate array- Parameters:
state-rate-
-
INTGRLA
public static void INTGRLA(net.simplace.sim.util.FWSimVariable<Double[]> state, double[] rate, double delta) Integrates a state array by adding a rate array- Parameters:
state-rate-delta-
-