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:
-
- the independent variable (a double-precision floating point value)
-
- the maximum value of the hyperbolic function (a double-precision
floating point value)
-
- the value of for which the function value is (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:
-
- the independent variable (a double-precision floating point value)
-
- the maximum value of the hyperbolic function (a double-precision
floating point value)
-
- the value of for which the function value is (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:
-
- the independent variable (a double-precision floating point value)
-
- the maximum value of the sigmoidal function (a double-precision
floating point value)
-
- the value of for which the function value is (a
double-precision floating point value)
-
- parameter controlling the steepness of the sigmoid curve (a
double-precision floating point value); it is the power to which and
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:
-
- the independent variable (a double-precision floating point value)
-
- the maximum value of the sigmoidal function (a double-precision
floating point value)
-
- the value of for which the function value is (a
double-precision floating point value)
-
- parameter controlling the steepness of the sigmoid curve (a
double-precision floating point value); it is the power to which and
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, and , where is the current value of the monotonically increasing independent variable of the model (usually time) and is a pointer to an independent variable whose value at is desired. lag() is currently able to handle up to 50 lagged model variables.
Inputs:
-
- pointer to the independent variable whose value at
is desired (a pointer to a double-precision floating point value)
-
- current value of the monotonically increasing independent variable of the model [usually time] (a double-precision floating point value)
-
- difference between and the previous value of for
which we desire the value of (a double-precision floating point value)
-
- the dimension of if is a vector; otherwise
(an integer value)
Return Value:
- lag() returns a pointer to the double-precision floating point value of the variable at if ,
or the NULL pointer if .
Forcing Functions
- threshold(x, limit, mode) – threshold function
- :
This function provides a switch between active and inactive state, based on a threshold value.
Inputs:
-
- the variable to be tested (a double-precision floating point value)
-
- the threshold switch point (a double-precision floating point
value)
-
- a string containing either "min" or "max", indicating whether 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 is "min", threshold() returns 0 (inactive state) if
, and returns 1 (active state) if .
If is "max", threshold() returns 0 (inactive state) if
, and returns 1 (active state) if .
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:
-
- the independent variable [usually time] (a double-precision floating point value)
-
- the length of each cycle (a double-precision floating point value)
-
- the positive amplitude of the waveform (a double-precision floating point value)
-
- 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:
-
- the independent variable [usually time] (a double-precision floating point value)
-
- the length of each cycle, including positive and negative phases (a double-precision floating point value)
-
- 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 for the
first half of the cycle and negative 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:
-
- the independent variable [usually time] (a double-precision floating point value)
-
- the duration of the ramp incline for each cycle (a double-precision floating point value)
-
- 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:
-
- the independent variable [usually time] (a double-precision floating point value)
-
- the duration of the ramp decline for each cycle (a double-precision floating point value)
-
- 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:
-
- the independent variable [usually time] (a double-precision floating point value)
-
- value of at which ramp begins (a double-precision floating point value)
-
- the ramp height (a double-precision floating point value)
-
- 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:
-
- the independent variable [usually time] (a double-precision floating point value)
-
- the value of at which pulse begins (a double-precision floating point value)
-
- the pulse height (a double-precision floating point value)
-
- the duration of the pulse (a double-precision floating point value)
Return Value:
- pulse() returns 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:
-
- the independent variable [usually time] (a double-precision floating point value)
-
- the value of at which first pulse begins (a double-precision
floating point value)
-
- the pulse height (a double-precision floating point value)
-
- the duration of the pulse (a double-precision floating point value)
-
- the delay between pulses (a double-precision floating point value)
Return Value:
- perpulse() returns 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:
-
- the independent variable [usually time] (a double-precision floating point value)
-
- the value of at which the step occurs (a double-precision floating point value)
-
- the step height (a double-precision floating point value)
Return Value:
- step() returns zero before the step is taken () and it
returns after the step is taken (). 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:
-
- the independent variable [usually time] (a double-precision floating point value)
-
- the value of at which stepping starts (a double-precision floating point value)
-
- the duration of each step (a double-precision floating point value)
-
- the step height (a double-precision floating point value)
Return Value:
- perstep() returns zero before the first step is taken () 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
- 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:
-
- the number whose factorial is desired (an integer value)
Return Value:
- factorial() returns the value of the factorial () (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 value, given the and standard deviation
().
Inputs:
-
- the value of an independent variable (a double-precision floating point value)
-
- the mean of the Gaussian distribution (a double-precision floating point value)
-
- 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 and standard deviation ().
Inputs:
-
- the mean of the distribution (a double-precision floating point value)
-
- 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 .
Inputs:
-
- 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 value, given the .
Inputs:
-
- the value of an independent variable (an integer value)
-
- 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:
-
- the value of the seed (an integer value)
Return Value: None
|