logo Sven Pawletta, Thorsten Pawletta, Hochschule Wismar - University of Technology, Business & Design

Diploma Thesis

Development of an Object-Orientated DEVS-Simulator with Matlab


1st Supervisor:
2nd Supervisor:
Prof. Dr.-Ing Sven Pawletta
Prof. Dr.-Ing. Ernst Jonas
Download project's source code
  Christina Deatcu, January 2003  


Problem

Starting with the DEVS theory by Zeigler and an existing MATLAB®-based DEVS-simulator, a new DEVS-simulator was to be designed and implemented, which especially eases the interfaces for modeling and simulation.

Special impact was put on:
  • Gaining acquaintance of the DEVS theory and the abstract simulator algorithms based on it,
  • Familiarization with the object orientated features of MATLAB® and programming of GUIs using MATLAB®,
  • Analysis of the existing simulation runtime system MatlabDEVS,
  • Development of a proposal for a better structure for a MATLAB®-based DEVS runtime system,
  • Implementation of an improved runtime system (MatlabDEVS2),
  • Verification of the implementation using a selected example.

DEVS Theory

To solve problems of real world systems using scientific methods, the model-based approach is an effective and widely used method.

The DEVS formalism offers ways to describe systems which change their state driven by events at discrete times. DEVS (Discrete Event Specified Systems) are systems which have a continuous time base, but events and therefore changes of system's state take place at discrete time intervals.

Zeigler distinguishes between two different kinds of DEVS: the atomic DEVS which is indivisible and the coupled DEVS which is a more complex DEVS consisting of other coupled and/or atomic DEVS. The development of hierarchical models which may be used for computer simulation means is made possible by this strategy.
To make models reusable the implementation with an object-orientated programming language is obvious.

Since the specification for DEVS models just includes the reactions on events but not the timing, the active abstract simulators are employed to simulate the passive DEVS model.
With each atomic DEVS model a simulator, with each coupled DEVS a coordinator is associated.
Simulation then takes place by message-passing among the simulators and coordinators, not among the DEVS models.
To the outermost model, the coupled DEVS on top of the tree, the root coordinator is attached which controls the overall simulation loop.

MatlabDEVS

Several implementations of the DEVS theory using object-orientated programming languages exist. One of those implementations, MatlabDEVS, is an open system embedded into the MATLAB® environment. It takes benefit of MATLAB®'s features for object-orientated programming.
Advantages of the system:
  • Portability,
  • Usability for complex experiments and data analysis.

   
Weak points:
  • User interfaces for modeling and simulation,
  • Poor documentation,
  • Complicated file structure of models.
 

MatlabDEVS2

Class Hierarchy

Within the MatlabDEVS2 system the same base classes are used for modeling and simulation. Caused by the fact that, when using inheritance in MATLAB®, the child object contains a parent object in a property with the name of the parent class, no strictly separated classes have to be defined for simulation and modeling.
Although the same classes are in charge, the simulation engine is separated from the model, because it exclusively uses a few of the class methods.

Additional capabilities of the abstract simulator are programmed without taking benefit of the object-orientated features of MATLAB®.


 
Since the abstract simulator is separated from the implementation of a specific model, the simulation engine may be used for more than just one model.


Modeling and Simulation

Model building takes place by creating new user defined classes. Classes for modeling have to inherit from the two classes atomic_devs and coupled_devs.

Object-orientated programming within the MATLAB® programming environment results in a complicated file structure representing the classes. This fact cannot be influenced. Hence, a GUI for modeling and simulation which creates the source code files for the classes was implemented.
Compared to the old MatlabDEVS, MatlabDEVS2 supports the user with some features during the development and simulation of models:
  • A GUI for defining and viewing classes for atomic and coupled DEVS models (DEVSModeler),
  • A GUI for starting a simulation run (DEVSSimulator),
  • And a user guide for working with the system.
Those features cause the MatlabDEVS2 system to consist of three main parts:
  1. The DEVSModeler,
  2. The DEVSSimulator,
  3. And the simulation engine, already mentioned above.

DEVSModeler

The DEVSModeler offers features to create new atomic and coupled models, display, modify and delete them, as well.

It administers source code files and displays each atomic or coupled model as if it just consisted of one file. All characteristics of a model are available on one screen and are easily changeable.

DEVSSimulator
After the user did successfully define his model, the DEVSSimulator becomes available to support the modeler with a tool for creation of a start file.
The start file contains he call of the root coordinator function whose parameters specify the simulation time and output generated by the system.

The DEVSSimulator then automatically executes this file to cause the simulation run.

Simulation results, i.e. the flow of messages and additional output generated by the model itself, may then be watched at MATLAB® command window.
 

Summary

Discrete-event modeling simulation can be used in many areas of science. It may help to explain, forecast the behavior of, improve and design real world systems.
Since the classical DEVS theory introduced by Zeigler works with a very high level of abstraction, a simulation runtime system implementing this formalistic description will always stay a system to explain the theory.
Hence, the MatlabDEVS2 system should be seen as a system used for teaching tasks and research on the DEVS theory.
MatlabDEVS2 offers the opportunity to view the flow of messages among the simulators/coordinators as simulation output and thereby illustrates the theory.

Screenshots of the DEVSModeler and DEVSSimulator are taken from the verification example.


Christina Deatcu
email: christina.deatcu@hs-wismar.de

Download project's source code (including ARGESIM Comparison 6)