Container Example
pydes.Container(sim, capacity=inf)
Containers have the capability to acumulate and provide continuous amounts of what contains. It is particularly useful to model non discrete accumulators like Tanks.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sim
|
Simulator
|
The simulator instance. |
required |
capacity
|
int | float
|
The capacity of the container, default is 1. |
inf
|
Methods:
| Name | Description |
|---|---|
get |
decrease the level of the container by some amount. |
put |
increase the level of the container by some amount. |
get(amount=1)
Get some amount from the container.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
amount
|
int | float
|
The amount to get from the container, default is 1. |
1
|
put(amount=1)
Put some amount into the container.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
amount
|
int | float
|
The amount to put into the container, default is 1. |
1
|
level()
Get the current level of the container.
capacity()
Get the capacity of the container.
Imports
Define Model
Run Simulation
sim = Simulator()
container = Container(sim)
p1 = Process1(sim, container)
p2 = Process2(sim, container)
sim.schedule(p1.main)
sim.schedule(p2.main)
sim.run(until=10)
| ------------------------------ | --------------- | ---------------------------------------- | ------------------------------ |
| time | component | value | description |
| ------------------------------ | --------------- | ---------------------------------------- | ------------------------------ |
| | | | |
| 0 | Process1.0 | begin put 5 into container | None |
| 0 | Process2.0 | begin get 15 from container | None |
| 0 | Process1.0 | end put 5 into container | None |
| 0 | Process1.0 | container level: 5 | None |
| 1 | Process1.0 | begin put 5 into container | None |
| 1 | Process1.0 | end put 5 into container | None |
| 1 | Process1.0 | container level: 10 | None |
| 2 | Process1.0 | begin put 5 into container | None |
| 2 | Process1.0 | end put 5 into container | None |
| 2 | Process1.0 | container level: 15 | None |
| 2 | Process2.0 | end get 15 from container | None |
| 2 | Process2.0 | container level: 0 | None |
| 2 | Process2.0 | begin get 15 from container | None |
| 3 | Process1.0 | begin put 5 into container | None |
| 3 | Process1.0 | end put 5 into container | None |
| 3 | Process1.0 | container level: 5 | None |
| 4 | Process1.0 | begin put 5 into container | None |
| 4 | Process1.0 | end put 5 into container | None |
| 4 | Process1.0 | container level: 10 | None |
| 5 | Process1.0 | begin put 5 into container | None |
| 5 | Process1.0 | end put 5 into container | None |
| 5 | Process1.0 | container level: 15 | None |
| 5 | Process2.0 | end get 15 from container | None |
| 5 | Process2.0 | container level: 0 | None |
| 5 | Process2.0 | begin get 15 from container | None |
| 6 | Process1.0 | begin put 5 into container | None |
| 6 | Process1.0 | end put 5 into container | None |
| 6 | Process1.0 | container level: 5 | None |
| 7 | Process1.0 | begin put 5 into container | None |
| 7 | Process1.0 | end put 5 into container | None |
| 7 | Process1.0 | container level: 10 | None |
| 8 | Process1.0 | begin put 5 into container | None |
| 8 | Process1.0 | end put 5 into container | None |
| 8 | Process1.0 | container level: 15 | None |
| 8 | Process2.0 | end get 15 from container | None |
| 8 | Process2.0 | container level: 0 | None |
| 8 | Process2.0 | begin get 15 from container | None |
| 9 | Process1.0 | begin put 5 into container | None |
| 9 | Process1.0 | end put 5 into container | None |
| 9 | Process1.0 | container level: 5 | None |
| 10 | Process1.0 | begin put 5 into container | None |
| 10 | Process1.0 | end put 5 into container | None |
| 10 | Process1.0 | container level: 10 | None |