Environment
Simulation environment.
Environment
Simulation environment.
Source code in src/asimpy/environment.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | |
__init__(logging=False)
Construct a new simulation environment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
logging
|
bool
|
print log messages while executing. |
False
|
Source code in src/asimpy/environment.py
12 13 14 15 16 17 18 19 20 21 | |
__str__()
Format environment as printable string.
Returns: string representation of environment time and queue.
Source code in src/asimpy/environment.py
84 85 86 87 88 89 90 | |
immediate(proc)
Start a new process immediately.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
proc
|
Process
|
|
required |
Source code in src/asimpy/environment.py
23 24 25 26 27 28 29 30 | |
run(until=None)
Run the whole simulation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
until
|
float | int | None
|
when to stop (run forever if not provided). |
None
|
Source code in src/asimpy/environment.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | |
schedule(time, proc)
Schedule a process to run at a specified time (not after a delay).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
time
|
float | int
|
when the process should be scheduled to run. |
required |
proc
|
Process
|
|
required |
Source code in src/asimpy/environment.py
32 33 34 35 36 37 38 39 40 | |
sleep(delay)
Suspend the caller for a specified length of time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
delay
|
float | int
|
how long to sleep. |
required |
Returns: awaitable representing delay.
Source code in src/asimpy/environment.py
42 43 44 45 46 47 48 49 50 51 | |