Class FSTFunctions

java.lang.Object
net.simplace.sim.components.util.FSTFunctions

public class FSTFunctions extends Object
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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static double
    AFGEN(Double[] xy, double t)
    Computes a linear interpolation for t from a table.
    static double
    AFGEN(Double[] x, Double[] y, double t)
    Computes a linear interpolation for t from a table.
    static double
    AFGEN(TreeMap<Double,Double> xy, double t)
    Computes a linear interpolation for t from a table.
    static double
    AFGEN(InterpolationTable xy, double t)
    Computes a linear interpolation for t from a table.
    static double
    AFGEN(net.simplace.sim.util.FWSimVariable<Double[]> xy, double t)
    Computes a linear interpolation for t from a table.
    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.
    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
    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
    static void
    INTGRL(net.simplace.sim.util.FWSimVariable<Double> state, double rate)
    Integrates a state by adding a rate
    static void
    INTGRL(net.simplace.sim.util.FWSimVariable<Double> state, double rate, double delta)
    Integrates a state by adding a rate
    static void
    INTGRL(net.simplace.sim.util.FWSimVariable<Double> state, net.simplace.sim.util.FWSimVariable<Double> rate)
    Integrates a state by adding a rate
    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
    static void
    INTGRLA(net.simplace.sim.util.FWSimVariable<Double[]> state, double[] rate)
    Integrates a state array by adding a rate array
    static void
    INTGRLA(net.simplace.sim.util.FWSimVariable<Double[]> state, double[] rate, double delta)
    Integrates a state array by adding a rate array
    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
    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
    static double
    LIMIT(double XL, double XH, double X)
    Limits a value to a lower and upper bound
    static double
    NOTNUL(double x)
    Returns 1 instead of 0 if the value is 0.
    static int
    REAAND(double x1, double x2)
    Tests whether two values are positive
    static double
    REANOR(double a, double b)
    Returns 1 if two values are both zero or negative, returns 0 otherwise

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • FSTFunctions

      public FSTFunctions()
  • Method Details

    • AFGEN

      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
      Parameters:
      xy - interpolation table as double array with x and y values interleaved
      t - point at which the value is computed
      Returns:
      the interpolated value
    • AFGEN

      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.
      Parameters:
      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
    • AFGEN

      public static double AFGEN(net.simplace.sim.util.FWSimVariable<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 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 set
      t - 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 set
      t - point at which the value is computed
      Returns:
      the interpolated value
    • AFGEN

      public static double AFGEN(TreeMap<Double,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 TreeMap with x-values as keys and y-values as entries and calls AFGEN for two double arrays.
      Parameters:
      xy - data set
      t - point at which the value is computed
      Returns:
      the interpolated value
    • AFGEN

      public static double AFGEN(InterpolationTable 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.
      Parameters:
      xy - data set
      t - 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 negative
      X3 - 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 negative
      X3 - 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 value
      x2 - 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 bound
      XH - upper bound
      X - 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 value
      b - 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

      public static void INTGRL(net.simplace.sim.util.FWSimVariable<Double> state, double rate)
      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

      public static void INTGRLA(net.simplace.sim.util.FWSimVariable<Double[]> state, 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, double[] rate, double delta)
      Integrates a state array by adding a rate array
      Parameters:
      state -
      rate -
      delta -