Skip to main content

python-drs

A PyTorch-inspired, event-driven Discrete Rate Simulation (DRS) framework for modeling systems where material flows continuously over time.

Instead of ticking through time at fixed intervals, DRS calculates exactly when the next limit (threshold) will be hit, jumps the simulation clock to that precise moment, and triggers the matching state transition. The result is a simulation that runs in a fraction of the time of fixed-step models — and never misses a limit.

Features

  • Event-driven time stepping — simulate years of operation in seconds
  • PyTorch-style architectureModule, Variable, and Level compose into hierarchies with automatic dependency tracking
  • Built-in telemetry — every state change is logged and plotted without custom tracking code
  • Fail-fast guardrails — the engine stops you from breaking the physics of your model (e.g. draining an empty tank)
  • Applicable to any continuous-flow system — water networks, chemical processing, electrical grids, traffic, and more

Installation

pip install python-drs

Optional extras:

pip install python-drs[progress]   # Rich progress bar

Quickstart

from drs import DRSEngine, Module, Level

class Tank(Module):
    def forward(self):
        # Fill at 50 units per time step
        self.volume.rate = 50.0

model = Tank()
model.volume = Level("Volume", initial_value=100.0)

engine = DRSEngine(model)
result = engine.run(max_time=20.0)
print(result.summary())

Documentation

Full guides, tutorials, and API reference live in the docs/ directory.

License

MIT — see LICENSE.

Download files

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

Source Distribution

python_drs-0.1.1.tar.gz (27.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_drs-0.1.1-py3-none-any.whl (30.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: python_drs-0.1.1.tar.gz
  • Upload date:
  • Size: 27.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for python_drs-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b3ac7ca66868d6b12d1b45bc43ed20c692114adb35b3fb04c63ac8781223eee0
MD5 d7eada61f67972cb60266f7dd8bbd5c0
BLAKE2b-256 0abcaa9c122cf7f0c3ffdb0efe13c23c7045f791531c98fc08f1ce485d1bfedb

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_drs-0.1.1.tar.gz:

Publisher: publish.yml on epicgamer17/python-drs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: python_drs-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 30.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for python_drs-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 56c279fcfc7b83df787f6b63aebb7f4fd493e49f299c5389af51d056b3f65d5b
MD5 03ed72bfa44c007f0135c2009dee5c45
BLAKE2b-256 cf82b6ae190f61a1bd60269bee9ecec6cafa2458f65fa73a2d435abc6451cb87

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_drs-0.1.1-py3-none-any.whl:

Publisher: publish.yml on epicgamer17/python-drs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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