-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7fac203
commit 0f749be
Showing
4 changed files
with
112 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,35 @@ | ||
# Overview | ||
|
||
DESimpy is a library that provides a minimalist set of components for implementing discrete event simulations. | ||
|
||
# Quickstart | ||
|
||
Install using pip: | ||
|
||
```bash | ||
pip install desimpy | ||
``` | ||
|
||
Now you can prepare a short example like this one: | ||
|
||
```python | ||
from desimpy import EventScheduler | ||
|
||
def clock(env: EventScheduler, name: str, tick: int | float) -> 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) | ||
|
||
event_log = env.run_until_max_time(2) | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters