Simulation Collection: Reference Manual

Simulation Collection
Reference Manual
Edition 4.0

November 2011

M. Douglas Williams <[email protected]>

The Simulation Collection implements a hybrid discrete and continuous event simulation engine for developing simulation models in Racket (formerly known as PLT Scheme). The Simulation Collection:

The source code is distributed with the Simulation Collection and is licensed under the GNU Lesser General Public License, Version 3.0 [LGPL].

All of the functionality defined in this manual is exported by the Simulation Collection and accessed using one of the following forms, depending on whether or not the graphics routines are needed:

 (require (planet williams/simulation/simulation-with-graphics))
 (require (planet williams/simulation/simulation))

© 2003-2011, M. Douglas Williams

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".

    1 Introduction

      1.1 Routines Available in the Simulation Collection

      1.2 The Simulation Collection is Free Software

      1.3 Obtaining the Simulation Collection

      1.4 No Warranty

    2 Using the Simulation Collection

      2.1 An Example

      2.2 Loading the Simulation Collection

      2.3 Graphics Modules

    3 Simulation Environments (Basic)

      3.1 The simulation-environment Structure

      3.2 Current Simulation Environment

      3.3 Current Simulation Environment Fields

    4 Simulation Control (Basic)

      4.1 Scheduling Events and Processes

      4.2 Controlling the Simulation Main Loop

      4.3 Simulating Waiting and Working

    5 Events

      5.1 The event Structure

      5.2 Event Lists

      5.3 Example—Functions as Events

    6 Processes

      6.1 Defining a Process Type

      6.2 Defining a Process

      6.3 Process Types

      6.4 Creating and Accessing Processes

        6.4.1 The process-info Structure

        6.4.2 The process Structure

        6.4.3 Creating Processes

        6.4.4 Process States

      6.5 Example—Processes

    7 Resources

      7.1 The resource Structure

        7.1.1 Shortcuts to Resource Set Variables

      7.2 Requesting and Relinquishing Resources

        7.2.1 Requesting Resources

        7.2.2 Relinquishing Resources

        7.2.3 The with-resource Macro

      7.3 Example—Resources

    8 Data Collection

      8.1 Variables

        8.1.1 The variable Structure

        8.1.2 Tally and Accumulate

        8.1.3 Variable Statistics

        8.1.4 Variable History

        8.1.5 History Graphics

        8.1.6 Variable Monitors

      8.2 Example—Tally and Accumulate Example

      8.3 Example—Data Collection

      8.4 Data Collection Across Multiple Simulation Runs

        8.4.1 Open Loop Processing

        8.4.2 Example—Open Loop Processing

        8.4.3 Closed Loop Processing

        8.4.4 Example—Closed Loop Processing

    9 Monitors

    10 Sets

      10.1 The set-cell Structure

      10.2 The set Structure

      10.3 Set Operations

      10.4 Generic Set Routines

      10.5 Example - Furnace Model 1

    11 Continuous Simulation Models

      11.1 Continuous Variables

      11.2 Simulation Control (Continuous)

      11.3 Example—Furnace Model 2

      11.4 Simulation Environment (Continuous)

      11.5 Example—Fixed Step Size—Furnace Model 2a

      11.6 Example—Limiting Step Size—Furnace Model 2b

      11.7 Example—Furnace Model 3

    12 Simulation Classes

      12.1 Process Classes

      12.2 Resource Classes

      12.3 Example—Simulation Classes

    13 Simulation Control (Advanced)

      13.1 Example—Harbor Model

    14 Simulation Environments (Hierarchical)

    15 Simulation Components

    16 SimPy and Simulation Collection Example Comparisons

      16.1 Cellphone

        16.1.1 Simpy Example—Cellphone

        16.1.2 Simulation Collection Example—Cellphone

      16.2 Jackson

        16.2.1 Simpy Example—Jackson

        16.2.2 Simulation Collection Example—Jackson

    17 GNU Free Documentation License

    Bibliography

    Index