DEVS-C++ Reference Guide
Hyup J. Cho and Young K. Cho
Artificial Intelligence and Simulation Research Group
Department of Electrical and Computer Engineering
The University of Arizona
Copyright (C) The University of Arizona
Table of Contents
1 Introduction
2 Discrete Event
Simulation
2.1 Modeling and Simulation
2.2 The Types of Mathematical
Models
2.3 Discrete Event
System
3 Formalism: Formal
System Description
3.1 Parallel DEVS
Formalism for Basic Models
3.2 DEVS Formalism
for Coupled (Multi-component) Models
4 DEVS Environment
4.1 Container Library
4.2 Devs Library
5 Basic Models
5.1 Devs Model
5.2 Atomicbase and
Atomic Models
5.3 Cellbase and Cell
Models
5.4 Coupled Models
5.4.1 Instance
Variables
5.4.2 Convert_input()
6 Derived Classes of
coupled class
6.1 Digraph Models
6.1.1 Instance
Variables
6.1.2 wrap_deltfunc
Function
6.1.3 Output (compute_input_output)
Function
6.2 Block Models
6.2.1 Instance
Variables
6.2.2 Coupling method
of the Block
6.3 Digcell models
6.4 Comparison of digraph,
block, and Digraphcell models
7 Hierarchical Dynamic
Structure
8 Test Operations
8.1 Control Flow of
DEVS
8.2 Initialize Operation
8.3 Inject Operation
9 Installation of DEVS-C++
in UNIX
9.1 Structure of Directories
9.2 How to run test
models
Appendix
A1. Source code for
Basic (atomic) model example
A2. Source code for
GPT Test Programs
A3. Source code for
Hierarchical Block Model Test Programs
A4. Source code for
digraph cell (digcell) model
1. Introduction
Simulation is one of the most powerful tools for the planning, design,
and control of complex processes or systems. Commercial simulators allow
users to find solutions by simulating their models representing the real
system or entity being modeled. In such commercial simulators, numerous
variables and functions are pre-defined to support the users’ requirements,
providing the advantage of easy access and fast design for pre-defined
types of models. However, most commercial simulators have severe limitations
in modeling and running complex real world systems. From the dynamic structural
point of view, the methods of adding or deleting a variable or a component
during simulation run-time, are not provided because no command in the
commercial simulators is supported for such a specific behavior. Were they
to provide such a detailed behavior, the number of commands including different
parameter formats would become too large and complex for users to easily
seek appropriate commands. For example, the current number of the commands
in the SIMAN simulator, which does not support a dynamic structural scheme,
is too large for users to look up --64 pages to describe commands and variables.
Therefore, limitation on the practical number of commands and parameter
formats of the commercial simulators constrains the expression of complex
behaviors. Most commercial simulators are incapable of extending the problem
space or describing models deeper than some fixed level.
To overcome these limitations requires a methodology that provides the
flexibility to design, and expandability to explore, the problem space.
As a possible solution, DEVS (Discrete Event System Specification) environment
is a system-theory based simulation tool that provides expandability with
modular and hierarchical features. It offers flexibility with object-oriented
messages as user-defined data structures. Based on a system theory called
the DEVS formalism [1,2], the DEVS environment offers a library with which
users can easily build models in a hierarchical modular way. In fact, the
coupled model in the DEVS library is the major class to construct models
hierarchically, while atomic models are the most basic classes. Due to
the hierarchical property, users can quickly expand their models. Since
a message in the DEVS environment carries an object--the data structure
defined by the user, information as a message type can be delivered from
one model to another. In other words, the size or scope of the object can
be determined by the user, and can be different from one application to
another, while the DEVS environment delivers the message containing the
object from a source model to a destination. (However, in DEVS-C++, the
user is responsible for creating and deleting the data structure in the
message). The DEVS environment helps overcome the complexity of the users
problem. Because models in the problem space can be developed to the depth
and scope needed to meet the modeling objectives.
The DEVS formalism is theoretically well-defined means of expressing
hierarchical, modular models in discrete event simulation. A DEVS model
works as a timed state machine so that the state of the system is changed
by external or internal events with elapsed time. DEVS-C++, based on the
parallel DEVS formalism [4], is a modular hierarchical discrete event simulation
environment implemented in the object-oriented C++ language.