Discrete Event System Specification (DEVS)

1 The Random Package

2 DEVS Model

We will now describe a fairly comprehensive example on how DEVS models can be represented in Modelica. One difference in Modelica is that we have a built-in time variable for absolute time rather than a local timer tlocal that is reset at the most recent event. This local timer is not really needed for modeling purposes since time is available, but is included to show the relation to traditional DEVS models. The facilities for model structuring and reuse are in general much greater in Modelica due to its object-oriented properties compared to traditional DEVS. In order to simplify comparisons this example connects model components such as servers or generators in a way that is analogous to traditional DEVS.

A simple job shop model illustrates DEVS based modeling. A generator for arriving jobs is connected to a simple DEVS based server.

The testDEVSServer model connects a job generator to a simple DEVS-based server.

2.1 testDEVSServer Model

The testDEVSServer model contains two main items: a generateJobEvents generator component that generates arriving jobs at regular intervals, and a simpleDEVSServer server component being a very simple model of a job shop system that services arriving jobs with a normally distributed service time. The SignalView class instances are needed to widen sharp peaks for plotting.

2.2 SimpleDEVSServer

The SimpleDEVSServer class is a fairly straightforward extension of the basic DEVS class BasicDEVSTwoPort. A randomly distributed service time variable servTime has been added with a normal distribution determined by parameters mean and stdev. The discrete randomSeed variable is needed to store the seed between calls to normalvariate, which as all Modelica functions is a mathematical function whose value is completely determined by its inputs. The absolute value of servTime is used to guarantee positive service times.

Remember the following two connect equations from the testDEVSServer model. When using the currently available Modelica tools it is necessary to employ some kind of
SignalView peak widening facility in order to plot sharp peaks that have zero width, i.e. have no time duration. Otherwise these peaks would not be visible in the diagram.

2.3 Simulation of testDEVSServer

We simulate the testDEVSServer model to be able to view some of the input and output signals. The plot agrees with the specification of the generateJobEvents instance, where the first event is generated at time = 3 and subsequent events are generated with a periodicity 1.5 seconds.

2.3.1 Plot

Diagram 1: viewSignal1.outp.signal, viewSignal2.outp.signal and DEVSactive

2.3.2 Plot

Diagram 2: - viewSignal1.outp.signal and viewSignal2.outp.signal

2.3.3 Plot

Diagram 3: - The output signal outp of the generateJobEvents generator component in testDEVSServer.

2.3.4 Plot

Diagram 4: - The output signal simpleDEVSServer.tNextEvent.

2.3.5 Plot

Diagram 5: - A signal is emitted through simpleDEVSServer.outp when completing \\ service of a job, here Job 1 and Job 3.

2.3.6 Plot

Diagram 6: - The variable simpleDEVSServer.DEVSactive is true while a job is being serviced.

2.3.7 Plot

Diagram 7: - The service time variable simpleDEVSServer.servTime obtains new values at events.

2.3.8 Plot

Diagram 8: - The output signal simpleDEVSServer.internalEvent.

3 A Coupled Pipelined DEVS Model

Several basic DEVS model components can be connected together to form a coupled model, which itself is

a DEVS model. This is illustrated by the Modelica realization of a simple DEVS coupled model by placing

three simple servers in series to form a three-server pipeline.

The three-server coupled DEVS pipeline model can be tested using the following model