Skip to main content

Discrete event simulation in using synchronous Python.

Project description

DESimpy

A synchronous discrete event simulation (DES) framework in Python (DESimpy).

Overview

DESimPy provides the core components of DES.

Processes in DESimPy are defined by methods owned by Python objects inherited from the Event abstract base class. These processes can be used to model system-level or component level changes in a modelled system. Such systems might include customers or patients flowing through services, vehicles in traffic, or agents competing in games.

DESimPy implements time-to-event simulation where the next event in a schedule is processed next regardless of the amount of time in the simulated present to that event. This constrasts with "time sweeping" in which a step size is used to increment foreward in time. It is possible to combine time-to-event with time sweeping (see Palmer & Tian 2021), however this package does not provide any explicit support for that.

Installation

pip install desimpy

Quickstart

Here is a small example to show the basic logic. This example is the simple clock process presented in the SimPy documentation.

from desimpy.des import EventScheduler

def clock(env, name, tick) -> None:
    """Clock simulation process."""

    def action() -> None:
        """Schedule next tick of the clock."""
        print(name, env.current_time)
        env.timeout(tick, action)

    env.timeout(0, action=action)

env = EventScheduler()

clock(env, "fast", 0.5)
clock(env, "slow", 1)

env.run_until_max_time(2, logging=False)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

desimpy-0.1.1.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

desimpy-0.1.1-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file desimpy-0.1.1.tar.gz.

File metadata

  • Download URL: desimpy-0.1.1.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.19.3 CPython/3.12.3 Linux/6.8.0-47-generic

File hashes

Hashes for desimpy-0.1.1.tar.gz
Algorithm Hash digest
SHA256 bc2b52d16a56a57a2e14124c98c14de9f428a124907f0d1b4e56edbe7cac5a74
MD5 3f8efcec8e977b8880aea040b89788b4
BLAKE2b-256 fd52eb55981815d1d5aa4930b23d18495aaddeb0f3bb4bd8438d20a624caccd6

See more details on using hashes here.

File details

Details for the file desimpy-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: desimpy-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.19.3 CPython/3.12.3 Linux/6.8.0-47-generic

File hashes

Hashes for desimpy-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9f07a05eae616c9b6054625e3d142265ca19637e78c2b4d88bdeb5cba79308d3
MD5 e4811cde477fe4d4143f1acc0ecb921a
BLAKE2b-256 b3515a8b0662a58f9f3adcd5222d735b1bab4647ddf18c40cadcd3f49b9d3aad

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page