Skip to content

Commit

Permalink
Simplified first example
Browse files Browse the repository at this point in the history
  • Loading branch information
galenseilis committed May 27, 2024
1 parent f6daacc commit 42192a7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 30 deletions.
19 changes: 4 additions & 15 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,9 @@ class CustomEvent(core.Event):
"""Execution logic of the custom event."""
print(f"Custom event executed at time {env.now}")

class Simulation:
"""Simple simulation example."""

def __init__(self) -> None:
"""Initialize the simulation environment."""
self.env = core.Environment()

def run_simulation(self) -> None:
"""Run the simulation."""
event = CustomEvent(5) # Schedule the custom event at time 5
self.env.schedule_event(event)
self.env.run(10) # Run the simulation for 10 time units

if __name__ == "__main__":
sim = Simulation()
sim.run_simulation()
env = core.Environment() # Initialize the simulation environment
event = CustomEvent(5) # Schedule the custom event at time 5
env.schedule_event(event)
env.run(10) # Run the simulation for 10 time units
```
19 changes: 4 additions & 15 deletions examples/example_0.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,9 @@ def execute(self, env) -> None:
"""Execution logic of the custom event."""
print(f"Custom event executed at time {env.now}")

class Simulation:
"""Simple simulation example."""

def __init__(self) -> None:
"""Initialize the simulation environment."""
self.env = core.Environment()

def run_simulation(self) -> None:
"""Run the simulation."""
event = CustomEvent(5) # Schedule the custom event at time 5
self.env.schedule_event(event)
self.env.run(10) # Run the simulation for 10 time units

if __name__ == "__main__":
sim = Simulation()
sim.run_simulation()
env = core.Environment() # Initialize the simulation environment
event = CustomEvent(5) # Schedule the custom event at time 5
env.schedule_event(event)
env.run(10) # Run the simulation for 10 time units

0 comments on commit 42192a7

Please sign in to comment.