Kostas Oikonomou <[EMAIL PROTECTED]> writes:

> I'm trying to see if I can use the DE domain of Ptolemy II to
> simulate a simple semi- Markov process.  The main obstacle I've run
> into is that I can't see any way of generating random numbers from
> distributions other than the exponential and normal.
> Is there some relatively easy way of doing this? (i.e. no Java code,
> because I don't know enough Java).  I remember from a while ago that
> Ptolemy Classic had such facilities.

I'm not sure.  I don't know that much about random numbers.

In Ptolemy II 3.0, there are the following actors that generate
random numbers under actor library->random 

Bernoulli - An actor that outputs a random sequence of booleans.
DiscreteRandomSource - An actor that produces tokens with a given
       probability mass function.
Gaussian - An actor that outputs a random sequence with a Gaussian
       distribution.
Rician - An actor that outputs a random sequence with a Rician distribution.
Uniform - An actor that outputs a random sequence with a uniform distribution.


Under actor library -> sources -> timed sources, there is
PoissonClock - A Poisson process clock source.

The expression language has random() and gaussian() functions:


> The functions random() and gaussian() shown in Table 5 on page
> 96 return one or more random numbers. With the minimum number of
> arguments (zero or two, respectively), they return a single
> number. With one additional argument, they return an array of the
> specified length. With a second additional argument, they return a
> matrix with the specified number of rows and columns.

> There is a key subtlety when using these functions in Ptolemy II. In
> particular, they are evaluated only when the expression within which
> they appear is evaluated. The result of the expression may be used
> repeatedly without re-evaluating the expression. Thus, for example, if
> the <i>value</i> parameter of the <i>Const</i> actor is set to
> "random()</font>", then its output will be a random constant, i.e., it
> will not change on each firing. The output will change, however, on
> successive runs of the model. In contrast, if this is used in an
> Expression actor, then each firing triggers an evaluation of the
> expression, and consequently will result in a new random number.

random() and gaussian() are declared in
ptolemy/data/expr/UtilityFunctions.java.
You could add other functions to that file.

You could also use the interface to Matlab, see
http://ptolemy.eecs.berkeley.edu/ptolemyII/ptII3.0/ptII3.0.2/ptolemy/matlab/matlab.htm

Someone else on the list might have other suggestions.

-Christopher

----------------------------------------------------------------------------
Posted to the ptolemy-hackers mailing list.  Please send administrative
mail for this list to: [EMAIL PROTECTED]

Reply via email to