scopman3

SCoP Language Summary

A text-based language to define a simulation model
General Modeling Functions

    hyperbol(x, max, K) – compute an hyperbolic function
    : This function computes the value of an hyperbolic function, given the values of two constant parameters.

    Inputs:

      x
      the independent variable (a double-precision floating point value)
      max
      the maximum value of the hyperbolic function (a double-precision floating point value)
      K
      the value of x for which the function value is max/2 (a double-precision floating point value)

    Return Value:

    • hyperbol() returns the value of the hyperbolic function (a double-precision floating point value).

    revhyperbol(x, max, K) – compute a reverse hyperbolic function
    : This function computes the value of a reverse hyperbolic function, given the values of two constant parameters.

    Inputs:

      x
      the independent variable (a double-precision floating point value)
      max
      the maximum value of the hyperbolic function (a double-precision floating point value)
      K
      the value of x for which the function value is max/2 (a double-precision floating point value)

    Return Value:

    • revhyperbol() returns the value of the reverse hyperbolic function (a double-precision floating point value).

    sigmoid(x, max, K, n) – compute a sigmoidal function
    : This function computes the value of a sigmoidal function of one variable, given the values of three constants in the function.

    Inputs:

      x
      the independent variable (a double-precision floating point value)
      max
      the maximum value of the sigmoidal function (a double-precision floating point value)
      K
      the value of x for which the function value is max/2 (a double-precision floating point value)
      n
      parameter controlling the steepness of the sigmoid curve (a double-precision floating point value); it is the power to which x and K are raised

    Return Value:

    • sigmoid() returns the value of the sigmoidal function (a double-precision floating point value).

    revsigmoid(x, max, K, n) – compute a reverse sigmoidal function
    : This function computes the value of a reverse sigmoidal function of one variable, given the values of three constants in the function.

    Inputs:

      x
      the independent variable (a double-precision floating point value)
      max
      the maximum value of the sigmoidal function (a double-precision floating point value)
      K
      the value of x for which the function value is max/2 (a double-precision floating point value)
      n
      parameter controlling the steepness of the sigmoid curve (a double-precision floating point value); it is the power to which x and K are raised

    Return Value:

    • revsigmoid() returns the value of the reverse sigmoidal function (a double-precision floating point value).

    lag(var, curt, lagt, vsize) – generalized lag function
    : This function provides a generalized lag facility for the SCoP modeler, but use of it requires more than a passing knowledge of C language syntax (this `limitation’ will be addressed in a future version of SCoP). The lag() function has two independent variables, var and curt, where curt is the current value of the monotonically increasing independent variable of the model (usually time) and var is a pointer to an independent variable whose value at curt – lagt is desired. lag() is currently able to handle up to 50 lagged model variables.

    Inputs:

      var
      pointer to the independent variable whose value at curt – lagt is desired (a pointer to a double-precision floating point value)
      curt
      current value of the monotonically increasing independent variable of the model [usually time] (a double-precision floating point value)
      lagt
      difference between curt and the previous value of curt for which we desire the value of var (a double-precision floating point value)
      vsize
      the dimension of var if var is a vector; otherwise ≤1 (an integer value)

    Return Value:

    • lag() returns a pointer to the double-precision floating point value of the variable var at curt-lagt if curt ≥lagt, or the NULL pointer if curt < lagt.
Forcing Functions

    threshold(x, limit, mode) – threshold function
    : This function provides a switch between active and inactive state, based on a threshold value.

    Inputs:

      x
      the variable to be tested (a double-precision floating point value)
      limit
      the threshold switch point (a double-precision floating point value)
      mode
      a string containing either "min" or "max", indicating whether limit is to be treated as a minimum or a maximum value for switching to the active state

    Return Value:

      The return from threshold() is an integer value. If mode is "min", threshold() returns 0 (inactive state) if x < limit, and returns 1 (active state) if x ≥limit. If mode is "max", threshold() returns 0 (inactive state) if x > limit, and returns 1 (active state) if x ≤limit. threshold() returns -1 if there is an error in its arguments.

    harmonic(t, period, amplitude, phase) – harmonic function
    : This function generates a sine wave of specified period, amplitude, and phase.

    Inputs:

      t
      the independent variable [usually time] (a double-precision floating point value)
      period
      the length of each cycle (a double-precision floating point value)
      amplitude
      the positive amplitude of the waveform (a double-precision floating point value)
      phase
      the phase shift of the waveform, in periods (a period is 360 degrees or radians; a double-precision floating point value)

    Return Value:

    • harmonic() returns the value of the harmonic function (a double-precision floating point value).

    squarewave(t, period, amplitude) – square wave function
    : This function generates a square wave of specified period and amplitude.

    Inputs:

      t
      the independent variable [usually time] (a double-precision floating point value)
      period
      the length of each cycle, including positive and negative phases (a double-precision floating point value)
      amplitude
      the positive amplitude of the waveform (a double-precision floating point value)

    Return Value:

    • squarewave() returns the value of the squarewave function (a double-precision floating point value), which is positive amplitude for the first half of the cycle and negative amplitude for the second half of the cycle.

    sawtooth(t, period, amplitude) – sawtooth function
    : This function generates a sawtooth wave (periodic ramp) of specified period and amplitude.

    Inputs:

      t
      the independent variable [usually time] (a double-precision floating point value)
      period
      the duration of the ramp incline for each cycle (a double-precision floating point value)
      amplitude
      the ramp height for each cycle (a double-precision floating point value)

    Return Value:

    • sawtooth() returns the value of the sawtooth function (a double-precision floating point value).

    revsawtooth(t, period, amplitude) – revsawtooth function
    : This function generates a reverse sawtooth wave (periodic declining ramp) of specified period and amplitude.

    Inputs:

      t
      the independent variable [usually time] (a double-precision floating point value)
      period
      the duration of the ramp decline for each cycle (a double-precision floating point value)
      amplitude
      the ramp height for each cycle (a double-precision floating point value)

    Return Value:

    • revsawtooth() returns the value of the reverse sawtooth function (a double-precision floating point value).

    ramp(t, lag, height, duration) – ramp function
    : This function generates a ramp function of specified height and duration.

    Inputs:

      t
      the independent variable [usually time] (a double-precision floating point value)
      lag
      value of t at which ramp begins (a double-precision floating point value)
      height
      the ramp height (a double-precision floating point value)
      duration
      the duration of the ramp incline (a double-precision floating point value)

    Return Value:

    • ramp() returns the value of the ramp function (a double-precision floating point value).

    pulse(t, lag, height, duration) – pulse function
    : This function generates a single pulse of specified height and duration.

    Inputs:

      t
      the independent variable [usually time] (a double-precision floating point value)
      lag
      the value of t at which pulse begins (a double-precision floating point value)
      height
      the pulse height (a double-precision floating point value)
      duration
      the duration of the pulse (a double-precision floating point value)

    Return Value:

    • pulse() returns height during the pulse interval and zero otherwise (a double-precision floating point value).

    perpulse(t, lag, height, duration, delay) – periodic pulse function
    : This function generates periodic pulses of specified height, duration, and delay between pulses.

    Inputs:

      t
      the independent variable [usually time] (a double-precision floating point value)
      lag
      the value of t at which first pulse begins (a double-precision floating point value)
      height
      the pulse height (a double-precision floating point value)
      duration
      the duration of the pulse (a double-precision floating point value)
      delay
      the delay between pulses (a double-precision floating point value)

    Return Value:

    • perpulse() returns height during the pulse interval and zero otherwise (a double-precision floating point value).

    step(t, jumpt, jump) – step function
    : This function generates a single jump of specified height in a constant function.

    Inputs:

      t
      the independent variable [usually time] (a double-precision floating point value)
      jumpt
      the value of t at which the step occurs (a double-precision floating point value)
      jump
      the step height (a double-precision floating point value)

    Return Value:

    • step() returns zero before the step is taken (t < jumpt) and it returns jump after the step is taken (t ≥jumpt). The return from step() is a double-precision floating point value.

    perstep(t, lag, period, jump) – periodic step function
    : This function generates periodic jumps of specified height and duration in a constant function.

    Inputs:

      t
      the independent variable [usually time] (a double-precision floating point value)
      lag
      the value of t at which stepping starts (a double-precision floating point value)
      period
      the duration of each step (a double-precision floating point value)
      jump
      the step height (a double-precision floating point value)

    Return Value:

    • perstep() returns zero before the first step is taken (t < lag) and thereafter it returns the cumulative sum of the heights of the steps already taken. The return from perstep() is a double-precision floating point value.
Probability Functions

    erf(z) – normalized error function
    : This function computes the normalized error function.

    erf(z) = {2π} ∫0z exp(-t2)&sp; dt

    Inputs:
      z
      the value of an independent variable (a double-precision floating point value)

    Return Value:

    • erf() returns the value of the normalized error function. This will lie in the interval between -1.0 and 1.0 and is a double-precision floating point value.

    exprand() – random number from exponential distribution
    : This function computes a random sample from the exponential distribution.

    Return Value:

    • exprand() returns a random number from the exponential distribution (a double-precision floating point value).

    factorial(n) – factorial function
    : This function computes the factorial of an integer argument.

    Inputs:

      n
      the number whose factorial is desired (an integer value)

    Return Value:

    • factorial() returns the value of the factorial (n!) (a double-precision floating point value).

    gauss(x, mean, std_dev) – Gaussian probability density function
    : This function computes the value of a Gaussian probability density function at a particular x value, given the mean and standard deviation (std_dev).

    Inputs:

      x
      the value of an independent variable (a double-precision floating point value)
      mean
      the mean of the Gaussian distribution (a double-precision floating point value)
      std_dev
      the standard deviation of the distribution (a double-precision floating point value)

    Return Value:

    • gauss() returns the value of the probability (a double-precision floating point value).

    normrand(mean, std_dev) – random number from normal distribution
    : This function selects a random number from the normal distribution with the specified mean and standard deviation (std_dev).

    Inputs:

      mean
      the mean of the distribution (a double-precision floating point value)
      std_dev
      the standard deviation of the distribution (a double-precision floating point value)

    Return Value:

    • normrand() returns a random number from the normal distribution (a double-precision floating point value).

    poisrand(mean) – random number from Poisson distribution
    : This function computes a random number from the Poisson distribution with the specified mean.

    Inputs:

      mean
      the mean of the distribution (a double-precision floating point value)

    Return Value:

    • poisrand() returns an integer from the Poisson distribution (an integer value).

    poisson(x, mean) – Poisson probability density function
    : This function computes the value of a Poisson probability density function at a particular x value, given the mean. Inputs:
      x
      the value of an independent variable (an integer value)
      mean
      the mean of the Poisson distribution (a double-precision floating point value)

    Return Value:

    • poisson() returns the value of the probability (a double-precision floating point value).

    scop_random() – random number generator
    : This function selects a random number from the uniform distribution on the interval between 0 and 1. A seed can be specified for the function (see set_seed() below); otherwise a seed of 1 will be used.

    Return Value:

    • scop_random() returns the random number (a double-precision floating point value). Note: this function is used by the other distribution generators such as poisrand.

    set_seed(n) – seed the random number function (random())
    : This function sets the seed of the SCoP Library random number generator (see scop_random() above).

    Inputs:

      n
      the value of the seed (an integer value)

    Return Value: None