If we generalize a finite state automaton by letting the time between two events be stochastic, and possibly also letting the choice of the next state be stochastic, we obtain a model for event based stochastic processes. Such models have many applications, of which one is queuing systems.
As a simple example of discrete-time stochastic process simulation we can consider a simple server model with a queue.
The CustomerGenerator model contains an output connector outCustomer that transmits the customer arrival events to the rest of the system. We first start by defining a model which generates customers at random points in time. The time delay until the next customer arrival is assumed to be a normally distributed stochastic variable T, here computed by calling the random number function normalvariate, see above, where the negative part is folded back on the positive side using abs(T) to avoid unrealistic negative service times. Since this function is side-effect free as all Modelica functions, it returns a randomSeed value to be used at the next call to normalvariate, see the help functions above.