API Reference¶
factorysimpy
¶
base
¶
belt_store
¶
BeltStore(env, capacity=float('inf'), speed=1, accumulation_mode_indicator=True)
¶
Bases: Store
This is a class that is derived from SimPy's Store class and has extra capabilities that makes it a reservable store for processes to reserve space for storing and retrieving items.
Processes can use reserve_put() and reserve_get() methods to get notified when a space becomes available in the store or when an item gets available in the ReservableReqStore. These methods returns a unique event (SimPy.Event) to the process for every reserve requests it makes.
get and put are two methods that can be used for item storing and retrieval from ReservableReqStore.
Process has to make a prior reservation and pass the associated reservation event as argument in the get and
put requests. ReservableReqStore maintains separate queues for reserve_put
and reserve_get
operations
to ensures that only processes with valid reservations can store or retrieve items.
ReservableReqStore preserves item order by associating an unreserved item in the store with a reservation event by index when a reserve_get() request is made. As a result, it maintains a list of reserved events to preserve item order.
It also allows users to cancel an already placed reserve_get or reserve_put request even if it is yielded. It also handles the dissociation of the event and item done at the time of reservation when an already yielded event is canceled.
When an item is added into the BeltStore using put(), it is associated with a delay representing the time it takes for the item to move through the belt. The item is not immediately available for retrieval after being put into the store. Instead, it becomes available only after the specified delay has elapsed, simulating the movement of items on a conveyor belt.
Attributes: |
|
---|
Initializes a reservable store with reservations.
Args:
capacity (int, optional): The maximum number of items the store can hold. Defaults to infinity. mode (str, optional): The mode of the store ('FIFO' or 'LIFO'). Defaults to 'FIFO'. speed (float, optional): The speed of the conveyor belt. Defaults to 1. accumulation_mode_indicator (bool, optional): Indicates if the belt is in accumulation mode. Defaults to True. capacity (int, optional): The maximum number of items the store can hold. Defaults to infinity.
Source code in src/factorysimpy/base/belt_store.py
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 |
|
get(get_event)
¶
Retrieve an item from the store after a successful reservation.
This method attempts to retrieve an item associated with a reserve_get
event. If the reservation exists, it triggers _trigger_get
to retrieve
the item. If successful, _trigger_reserve_put
is called to process any
pending reserve_put
requests. If the item retrieval fails, an error
message is raised.
Parameters: |
|
---|
Returns: |
|
---|
Raises: |
|
---|
Source code in src/factorysimpy/base/belt_store.py
410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 |
|
handle_new_item_during_interruption(item)
¶
Handle new item added during STALLED_ACCUMULATING_STATE with accumulation=1.
Computes delay using same logic as for existing items.
Source code in src/factorysimpy/base/belt_store.py
1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 |
|
interrupt_all_move_processes(reason='External interrupt')
¶
Interrupt all active move_to_ready_items processes.
Parameters: |
|
---|
Source code in src/factorysimpy/base/belt_store.py
755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 |
|
interrupt_and_resume_all_delayed_interrupt_processes(reason='State change interrupt')
¶
Interrupt all active delayed interrupt processes and clear them.
Parameters: |
|
---|
Source code in src/factorysimpy/base/belt_store.py
1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 |
|
move_to_ready_items(item)
¶
Move items from the store to the ready_items list after a put operation. This method is called as a process to ensure that items are moved asynchronously. Handles interrupts when state changes to stalled and resumes when state changes back. Movement is split into two phases: 1. First phase: item[0].length/self.speed time (time for item to fully enter belt) 2. Second phase: remaining time (time for item to reach exit)
Source code in src/factorysimpy/base/belt_store.py
629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 |
|
put(put_event, item)
¶
Perform a put
operation on the store and trigger any pending reserve_get
requests.
Ensures that only processes with a valid reservation can put items into the store.
If the put operation succeeds, it triggers _trigger_reserve_get
to process pending get requests.
Parameters: |
|
---|
Returns: |
|
---|
Raises: |
|
---|
Source code in src/factorysimpy/base/belt_store.py
509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 |
|
reserve_get()
¶
Create a reservation request to retrieve an item from the store.
This method generates a SimPy event representing a request to reserve an item
for retrieval (get
). The event is assigned attributes such as
the resource it belongs to, and the process making the request.
The event is then added to reserve_get_queue
, which is maintained in
the order in which the requests are made, and _trigger_reserve_get()
is called to process pending
reservations if items are available.
Returns: |
|
---|
Source code in src/factorysimpy/base/belt_store.py
305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 |
|
reserve_get_cancel(get_event_to_cancel)
¶
Cancel a previously made reserve_get
request.
Source code in src/factorysimpy/base/belt_store.py
260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 |
|
reserve_put()
¶
Create a reservation request to put an item into the store.
This function generates a SimPy event representing a reservation request. The event is
assigned attributes such as resource name, and the process making the request.
The event is then added to reserve_put_queue
, which is maintained in the order in which the
request is made.
After adding the event to the queue, _trigger_reserve_put
is called to process
any pending reservations.
Returns: |
|
---|
Source code in src/factorysimpy/base/belt_store.py
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
|
reserve_put_cancel(put_event_to_cancel)
¶
Cancel a previously made reserve_put
request.
This method allows a process to cancel its reservation for putting an item
into the store. If the reservation exists in the reserve_put_queue
, it is
removed before triggering _trigger_reserve_put
to process any pending reservations.
If the reservation is already in reservations_put
, it is also removed and
_trigger_reserve_put
is triggered.
Parameters: |
|
---|
Returns: |
|
---|
Raises: |
|
---|
Source code in src/factorysimpy/base/belt_store.py
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
|
resume_all_move_processes()
¶
Resume all interrupted move_to_ready_items processes.
Source code in src/factorysimpy/base/belt_store.py
774 775 776 777 778 779 780 781 782 783 |
|
selective_interrupt(reason='Selective interrupt')
¶
Perform selective interruption based on belt occupancy patterns and mode.
When noaccumulation_mode_on=True (STALLED_NONACCUMULATING_STATE): - Interrupt all items immediately
When noaccumulation_mode_on=False (STALLED_ACCUMULATING_STATE): - Use pattern-based interruption with delays based on item positions
Pattern-based rules for accumulating mode: - For patterns like '_*', interrupt all items. - For patterns like '___', interrupt item in second last position after 1 delay, and second item after 2 delays. - For patterns like '___*', interrupt first item and second item after 3 delays. - For patterns like '__*', interrupt first item, second after 2 delays, and third after 2 delays.
Parameters: |
|
---|
Source code in src/factorysimpy/base/belt_store.py
920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 |
|
buffer_store
¶
BufferStore(env, capacity=float('inf'), mode='FIFO')
¶
Bases: Store
This is a class that is derived from SimPy's Store class and has extra capabilities that makes it a reservable store for processes to reserve space for storing and retrieving items.
Processes can use reserve_put() and reserve_get() methods to get notified when a space becomes available in the store or when an item gets available in the ReservableReqStore. These methods returns a unique event (SimPy.Event) to the process for every reserve requests it makes.
get and put are two methods that can be used for item storing and retrieval from ReservableReqStore.
Process has to make a prior reservation and pass the associated reservation event as argument in the get and
put requests. ReservableReqStore maintains separate queues for reserve_put
and reserve_get
operations
to ensures that only processes with valid reservations can store or retrieve items.
ReservableReqStore preserves item order by associating an unreserved item in the store with a reservation event by index when a reserve_get() request is made. As a result, it maintains a list of reserved events to preserve item order.
It also allows users to cancel an already placed reserve_get or reserve_put request even if it is yielded. It also handles the dissociation of the event and item done at the time of reservation when an already yielded event is canceled.
An item that is added into the BufferStore using put(), it is associated with a delay representing the time it takes for the item to be available for retrieval. The delay can also be 0. The items can be retrieved in FIFO or LIFO manner based on the mode of operation of the BufferStore.
Attributes: |
|
---|
Args:
capacity (int, optional): The maximum number of items the store can hold.
Defaults to infinity.
mode (str, optional): The mode of the store ('FIFO' or 'LIFO'). Defaults to 'FIFO'.
Source code in src/factorysimpy/base/buffer_store.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
|
get(get_event)
¶
Retrieve an item from the store after a successful reservation.
This method attempts to retrieve an item associated with a reserve_get
event. If the reservation exists, it triggers _trigger_get
to retrieve
the item. If successful, _trigger_reserve_put
is called to process any
pending reserve_put
requests. If the item retrieval fails, an error
message is raised.
Parameters: |
|
---|
Returns: |
|
---|
Raises: |
|
---|
Source code in src/factorysimpy/base/buffer_store.py
355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 |
|
move_to_ready_items(item)
¶
Move items from the store to the ready_items list after a put operation. This method is called as a process to ensure that items are moved asynchronously.
Source code in src/factorysimpy/base/buffer_store.py
553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 |
|
put(put_event, item)
¶
Perform a put
operation on the store and trigger any pending reserve_get
requests.
Ensures that only processes with a valid reservation can put items into the store.
If the put operation succeeds, it triggers _trigger_reserve_get
to process pending get requests.
Parameters: |
|
---|
Returns: |
|
---|
Raises: |
|
---|
Source code in src/factorysimpy/base/buffer_store.py
449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 |
|
reserve_get()
¶
Create a reservation request to retrieve an item from the store.
This method generates a SimPy event representing a request to reserve an item
for retrieval (get
). The event is assigned attributes such as the resource
it belongs to, and the process making the request.
The event is then added to reserve_get_queue
, which is maintained in
the order in which the requests are made, and _trigger_reserve_get()
is called to process pending
reservations if items are available.
Returns: |
|
---|
Source code in src/factorysimpy/base/buffer_store.py
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 |
|
reserve_get_cancel(get_event_to_cancel)
¶
Cancel a previously made reserve_get
request.
Source code in src/factorysimpy/base/buffer_store.py
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 |
|
reserve_put()
¶
Create a reservation request to put an item into the store.
This function generates a SimPy event representing a reservation request. The event is
assigned attributes such as resource name, and the process making the request.
The event is then added to reserve_put_queue
, which is maintained in the order in which the requests are made.
After adding the event to the queue, _trigger_reserve_put
is called to process
any pending reservations.
Returns: |
|
---|
Source code in src/factorysimpy/base/buffer_store.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
|
reserve_put_cancel(put_event_to_cancel)
¶
Cancel a previously made reserve_put
request.
This method allows a process to cancel its reservation for putting an item
into the store. If the reservation exists in the reserve_put_queue
, it is
removed before triggering _trigger_reserve_put
to process any pending reservations.
If the reservation is already in reservations_put
, it is also removed and
_trigger_reserve_put
is triggered.
Parameters: |
|
---|
Returns: |
|
---|
Raises: |
|
---|
Source code in src/factorysimpy/base/buffer_store.py
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
|
fleet_store
¶
FleetStore(env, capacity=float('inf'), delay=1, transit_delay=0)
¶
Bases: Store
This is a class that is derived from SimPy's Store class and has extra capabilities that makes it a priority-based reservable store for processes to reserve space for storing and retrieving items with priority-based access.
Processes can use reserve_put() and reserve_get() methods to get notified when a space becomes available in the store or when an item gets available in the ReservablePriorityReqStore. These methods returns a unique event (SimPy.Event) to the process for every reserve requests it makes. Processes can also pass a priority as argument in the request. Lower values indicate higher priority.
get and put are two methods that can be used for item storing and retrieval from ReservablePriorityReqStore.
Process has to make a prior reservation and pass the associated reservation event as argument in the get and
put requests. ReservablePriorityReqStore maintains separate queues for reserve_put
and reserve_get
operations
to ensures that only processes with valid reservations can store or retrieve items.
ReservablePriorityReqStore preserves item order by associating an unreserved item in the store with a reservation event by index when a reserve_get() request is made. As a result, it maintains a list of reserved events to preserve item order.
It also allows users to cancel an already placed reserve_get or reserve_put request even if it is yielded. It also handles the dissociation of the event and item done at the time of reservation when an already yielded event is canceled.
Attributes: |
|
---|
Initializes a reservable store with priority-based reservations.
Parameters: |
|
---|
Source code in src/factorysimpy/base/fleet_store.py
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 |
|
fleet_activation_process()
¶
Process to activate the fleet when items are available but not equivalent to self.capacity(level not achieved). This process waits for the activate_fleet event to be triggered.
Source code in src/factorysimpy/base/fleet_store.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
|
get(get_event)
¶
Retrieve an item from the store after a successful reservation.
This method attempts to retrieve an item associated with a reserve_get
event. If the reservation exists, it triggers _trigger_get
to retrieve
the item. If successful, _trigger_reserve_put
is called to process any
pending reserve_put
requests. If the item retrieval fails, an error
message is raised.
Parameters: |
|
---|
Returns: |
|
---|
Raises: |
|
---|
Source code in src/factorysimpy/base/fleet_store.py
442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 |
|
move_to_ready_items(items)
¶
Move items from the store to the ready_items list after a put operation. This method is called as a process to ensure that items are moved asynchronously.
Source code in src/factorysimpy/base/fleet_store.py
696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 |
|
put(put_event, item)
¶
Perform a put
operation on the store and trigger any pending reserve_get
requests.
Ensures that only processes with a valid reservation can put items into the store.
If the put operation succeeds, it triggers _trigger_reserve_get
to process pending get requests.
Parameters: |
|
---|
Returns: |
|
---|
Raises: |
|
---|
Source code in src/factorysimpy/base/fleet_store.py
586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 |
|
reserve_get(priority=0)
¶
Create a reservation request to retrieve an item from the store.
This method generates a SimPy event representing a request to reserve an item
for retrieval (get
). The event is assigned attributes such as priority,
the resource it belongs to, and the process making the request.
The event is then added to reserve_get_queue
, which is maintained in
priority order, and _trigger_reserve_get()
is called to process pending
reservations if items are available.
Parameters: |
|
---|
Returns: |
|
---|
Source code in src/factorysimpy/base/fleet_store.py
338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 |
|
reserve_get_cancel(get_event_to_cancel)
¶
Cancel a previously made reserve_get
request.
Source code in src/factorysimpy/base/fleet_store.py
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 |
|
reserve_get_cancel1(get_event_to_cancel)
¶
Cancel a previously made reserve_get
request.
This method allows a process to cancel its reservation for retrieving an item
from the store. If the reservation exists in the reserve_get_queue
, it is removed,
and _trigger_reserve_get()
is called to process any remaining reservations.
If the reservation is already in reservations_get
, it is removed, and the corresponding
item is repositioned in the store to maintain order. _trigger_reserve_get()
is then
triggered to handle pending reservations.
Parameters: |
|
---|
Returns: |
|
---|
Raises: |
|
---|
Source code in src/factorysimpy/base/fleet_store.py
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 |
|
reserve_put(priority=0)
¶
Create a reservation request to put an item into the store.
This function generates a SimPy event representing a reservation request. The event is
assigned attributes such as priority, resource name, and the process making the request.
The event is then added to reserve_put_queue
, which is maintained in priority order.
After adding the event to the queue, _trigger_reserve_put
is called to process
any pending reservations.
Parameters: |
|
---|
Returns: |
|
---|
Source code in src/factorysimpy/base/fleet_store.py
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
|
reserve_put_cancel(put_event_to_cancel)
¶
Cancel a previously made reserve_put
request.
This method allows a process to cancel its reservation for putting an item
into the store. If the reservation exists in the reserve_put_queue
, it is
removed before triggering _trigger_reserve_put
to process any pending reservations.
If the reservation is already in reservations_put
, it is also removed and
_trigger_reserve_put
is triggered.
Parameters: |
|
---|
Returns: |
|
---|
Raises: |
|
---|
Source code in src/factorysimpy/base/fleet_store.py
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 |
|
priority_req_store
¶
PriorityGet(resource, priority=0)
¶
Bases: Get
Source code in src/factorysimpy/base/priority_req_store.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
|
PriorityPut(resource, item, priority=0)
¶
Bases: Put
Source code in src/factorysimpy/base/priority_req_store.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
|
PriorityReqStore(env, capacity=1)
¶
Bases: Store
This is a class derived from SimPy's Store class and has extra capabilities that makes it a priority-based store for put and get.
Processes can pass a priority as argument in the put and get request. Request with lower values of priority yields first among all get(or put) requests. If two requests with same priority are placed from two processes then FIFO order is followed to yield the requests.
Source code in src/factorysimpy/base/priority_req_store.py
87 88 |
|
SortedQueue(maxlen=None)
¶
Bases: list
Queue for sorting events by their :attr:~PriorityRequest.key
attribute.
Source code in src/factorysimpy/base/priority_req_store.py
15 16 17 18 |
|
maxlen = maxlen
instance-attribute
¶
Maximum length of the queue.
append(item)
¶
Sort item into the queue.
Raise a :exc:RuntimeError
if the queue is full.
Source code in src/factorysimpy/base/priority_req_store.py
20 21 22 23 24 25 26 27 28 29 30 |
|
reservable_priority_req_filter_store
¶
ReservablePriorityReqFilterStore(env, capacity=float('inf'), trigger_delay=0)
¶
Bases: FilterStore
This is a class that is derived from SimPy's Store class and has extra capabilities that makes it a priority-based reservable store for processes to reserve space for storing and retrieving items with priority-based access. It supports user tp only get items that match a user criteria
Processes can use reserve_put() and reserve_get() methods to get notified when a space becomes available in the store or when an item gets available in the ReservablePriorityReqStore. These methods returns a unique event (SimPy.Event) to the process for every reserve requests it makes. Processes can also pass a priority as argument in the request. Lower values indicate higher priority. Filter to be used while using "get" can be passed in the reserve_get request.
get and put are two methods that can be used for item storing and retrieval from ReservablePriorityReqStore.
Process has to make a prior reservation and pass the associated reservation event as argument in the get and
put requests. ReservablePriorityReqStore maintains separate queues for reserve_put
and reserve_get
operations
to ensures that only processes with valid reservations can store or retrieve items.
ReservablePriorityReqStore preserves item order by associating an unreserved item in the store with a reservation event by index when a reserve_get() request is made. As a result, it maintains a list of reserved events to preserve item order.
It also allows users to cancel an already placed reserve_get or reserve_put request even if it is yielded. It also handles the dissociation of the event and item done at the time of reservation when an already yielded event is canceled.
Attributes: |
|
---|
Initializes a reservable store with priority-based reservations.
Args:
capacity (int, optional): The maximum number of items the store can hold.
Defaults to infinity.
Source code in src/factorysimpy/base/reservable_priority_req_filter_store.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
|
get(get_event)
¶
Retrieve an item from the store after a successful reservation.
This method attempts to retrieve an item associated with a reserve_get
event. If the reservation exists, it triggers _trigger_get
to retrieve
the item. If successful, _trigger_reserve_put
is called to process any
pending reserve_put
requests. If the item retrieval fails, an error
message is raised.
Parameters: |
|
---|
Returns: |
|
---|
Raises: |
|
---|
Source code in src/factorysimpy/base/reservable_priority_req_filter_store.py
355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 |
|
put(put_event, item)
¶
Perform a put
operation on the store and trigger any pending reserve_get
requests.
Ensures that only processes with a valid reservation can put items into the store.
If the put operation succeeds, it triggers _trigger_reserve_get
to process pending get requests.
Parameters: |
|
---|
Returns: |
|
---|
Raises: |
|
---|
Source code in src/factorysimpy/base/reservable_priority_req_filter_store.py
462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 |
|
reserve_get(priority=0, filter=None)
¶
Create a reservation request to retrieve an item from the store.
This method generates a SimPy event representing a request to reserve an item
for retrieval (get
). The event is assigned attributes such as priority,
the resource it belongs to, and the process making the request.
The event is then added to reserve_get_queue
, which is maintained in
priority order, and _trigger_reserve_get()
is called to process pending
reservations if items are available.
Parameters: |
|
---|
Returns: |
|
---|
Source code in src/factorysimpy/base/reservable_priority_req_filter_store.py
246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 |
|
reserve_get_cancel(get_event_to_cancel)
¶
Cancel a previously made reserve_get
request.
This method allows a process to cancel its reservation for retrieving an item
from the store. If the reservation exists in the reserve_get_queue
, it is removed,
and _trigger_reserve_get()
is called to process any remaining reservations.
If the reservation is already in reservations_get
, it is removed, and the corresponding
item is repositioned in the store to maintain order. _trigger_reserve_get()
is then
triggered to handle pending reservations.
Parameters: |
|
---|
Returns: |
|
---|
Raises: |
|
---|
Source code in src/factorysimpy/base/reservable_priority_req_filter_store.py
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 |
|
reserve_put(priority=0)
¶
Create a reservation request to put an item into the store.
This function generates a SimPy event representing a reservation request. The event is
assigned attributes such as priority, resource name, and the process making the request.
The event is then added to reserve_put_queue
, which is maintained in priority order.
After adding the event to the queue, _trigger_reserve_put
is called to process
any pending reservations.
Parameters: |
|
---|
Returns: |
|
---|
Source code in src/factorysimpy/base/reservable_priority_req_filter_store.py
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 |
|
reserve_put_cancel(put_event_to_cancel)
¶
Cancel a previously made reserve_put
request.
This method allows a process to cancel its reservation for putting an item
into the store. If the reservation exists in the reserve_put_queue
, it is
removed before triggering _trigger_reserve_put
to process any pending reservations.
If the reservation is already in reservations_put
, it is also removed and
_trigger_reserve_put
is triggered.
Parameters: |
|
---|
Returns: |
|
---|
Raises: |
|
---|
Source code in src/factorysimpy/base/reservable_priority_req_filter_store.py
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 |
|
reservable_priority_req_store
¶
ReservablePriorityReqStore(env, capacity=float('inf'))
¶
Bases: Store
This is a class that is derived from SimPy's Store class and has extra capabilities that makes it a priority-based reservable store for processes to reserve space for storing and retrieving items with priority-based access.
Processes can use reserve_put() and reserve_get() methods to get notified when a space becomes available in the store or when an item gets available in the ReservablePriorityReqStore. These methods returns a unique event (SimPy.Event) to the process for every reserve requests it makes. Processes can also pass a priority as argument in the request. Lower values indicate higher priority.
get and put are two methods that can be used for item storing and retrieval from ReservablePriorityReqStore.
Process has to make a prior reservation and pass the associated reservation event as argument in the get and
put requests. ReservablePriorityReqStore maintains separate queues for reserve_put
and reserve_get
operations
to ensures that only processes with valid reservations can store or retrieve items.
ReservablePriorityReqStore preserves item order by associating an unreserved item in the store with a reservation event by index when a reserve_get() request is made. As a result, it maintains a list of reserved events to preserve item order.
It also allows users to cancel an already placed reserve_get or reserve_put request even if it is yielded. It also handles the dissociation of the event and item done at the time of reservation when an already yielded event is canceled.
Attributes: |
|
---|
Initializes a reservable store with priority-based reservations.
Args:
capacity (int, optional): The maximum number of items the store can hold.
Defaults to infinity.
Source code in src/factorysimpy/base/reservable_priority_req_store.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
|
get(get_event)
¶
Retrieve an item from the store after a successful reservation.
This method attempts to retrieve an item associated with a reserve_get
event. If the reservation exists, it triggers _trigger_get
to retrieve
the item. If successful, _trigger_reserve_put
is called to process any
pending reserve_put
requests. If the item retrieval fails, an error
message is raised.
Parameters: |
|
---|
Returns: |
|
---|
Raises: |
|
---|
Source code in src/factorysimpy/base/reservable_priority_req_store.py
350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 |
|
put(put_event, item)
¶
Perform a put
operation on the store and trigger any pending reserve_get
requests.
Ensures that only processes with a valid reservation can put items into the store.
If the put operation succeeds, it triggers _trigger_reserve_get
to process pending get requests.
Parameters: |
|
---|
Returns: |
|
---|
Raises: |
|
---|
Source code in src/factorysimpy/base/reservable_priority_req_store.py
458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 |
|
reserve_get(priority=0)
¶
Create a reservation request to retrieve an item from the store.
This method generates a SimPy event representing a request to reserve an item
for retrieval (get
). The event is assigned attributes such as priority,
the resource it belongs to, and the process making the request.
The event is then added to reserve_get_queue
, which is maintained in
priority order, and _trigger_reserve_get()
is called to process pending
reservations if items are available.
Parameters: |
|
---|
Returns: |
|
---|
Source code in src/factorysimpy/base/reservable_priority_req_store.py
261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 |
|
reserve_get_cancel(get_event_to_cancel)
¶
Cancel a previously made reserve_get
request.
This method allows a process to cancel its reservation for retrieving an item
from the store. If the reservation exists in the reserve_get_queue
, it is removed,
and _trigger_reserve_get()
is called to process any remaining reservations.
If the reservation is already in reservations_get
, it is removed, and the corresponding
item is repositioned in the store to maintain order. _trigger_reserve_get()
is then
triggered to handle pending reservations.
Parameters: |
|
---|
Returns: |
|
---|
Raises: |
|
---|
Source code in src/factorysimpy/base/reservable_priority_req_store.py
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 |
|
reserve_put(priority=0)
¶
Create a reservation request to put an item into the store.
This function generates a SimPy event representing a reservation request. The event is
assigned attributes such as priority, resource name, and the process making the request.
The event is then added to reserve_put_queue
, which is maintained in priority order.
After adding the event to the queue, _trigger_reserve_put
is called to process
any pending reservations.
Parameters: |
|
---|
Returns: |
|
---|
Source code in src/factorysimpy/base/reservable_priority_req_store.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
|
reserve_put_cancel(put_event_to_cancel)
¶
Cancel a previously made reserve_put
request.
This method allows a process to cancel its reservation for putting an item
into the store. If the reservation exists in the reserve_put_queue
, it is
removed before triggering _trigger_reserve_put
to process any pending reservations.
If the reservation is already in reservations_put
, it is also removed and
_trigger_reserve_put
is triggered.
Parameters: |
|
---|
Returns: |
|
---|
Raises: |
|
---|
Source code in src/factorysimpy/base/reservable_priority_req_store.py
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
|
reservable_req_store
¶
ReservableReqStore(env, capacity=float('inf'))
¶
Bases: Store
This is a class that is derived from SimPy's Store class and has extra capabilities that makes it a reservable store for processes to reserve space for storing and retrieving items.
Processes can use reserve_put() and reserve_get() methods to get notified when a space becomes available in the store or when an item gets available in the ReservableReqStore. These methods returns a unique event (SimPy.Event) to the process for every reserve requests it makes.
get and put are two methods that can be used for item storing and retrieval from ReservableReqStore.
Process has to make a prior reservation and pass the associated reservation event as argument in the get and
put requests. ReservableReqStore maintains separate queues for reserve_put
and reserve_get
operations
to ensures that only processes with valid reservations can store or retrieve items.
ReservableReqStore preserves item order by associating an unreserved item in the store with a reservation event by index when a reserve_get() request is made. As a result, it maintains a list of reserved events to preserve item order.
It also allows users to cancel an already placed reserve_get or reserve_put request even if it is yielded. It also handles the dissociation of the event and item done at the time of reservation when an already yielded event is canceled.
Attributes: |
|
---|
Initializes a reservable store with reservations.
Args:
capacity (int, optional): The maximum number of items the store can hold.
Defaults to infinity.
Source code in src/factorysimpy/base/reservable_req_store.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
|
get(get_event)
¶
Retrieve an item from the store after a successful reservation.
This method attempts to retrieve an item associated with a reserve_get
event. If the reservation exists, it triggers _trigger_get
to retrieve
the item. If successful, _trigger_reserve_put
is called to process any
pending reserve_put
requests. If the item retrieval fails, an error
message is raised.
Parameters: |
|
---|
Returns: |
|
---|
Raises: |
|
---|
Source code in src/factorysimpy/base/reservable_req_store.py
342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 |
|
put(put_event, item)
¶
Perform a put
operation on the store and trigger any pending reserve_get
requests.
Ensures that only processes with a valid reservation can put items into the store.
If the put operation succeeds, it triggers _trigger_reserve_get
to process pending get requests.
Parameters: |
|
---|
Returns: |
|
---|
Raises: |
|
---|
Source code in src/factorysimpy/base/reservable_req_store.py
450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 |
|
reserve_get()
¶
Create a reservation request to retrieve an item from the store.
This method generates a SimPy event representing a request to reserve an item
for retrieval (get
). The event is assigned attributes such as the resource it belongs to, and the process making the request.
The event is then added to reserve_get_queue
, which is maintained in
the order in which it has added, and _trigger_reserve_get()
is called to process pending
reservations if items are available.
Returns: |
|
---|
Source code in src/factorysimpy/base/reservable_req_store.py
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 |
|
reserve_get_cancel(get_event_to_cancel)
¶
Cancel a previously made reserve_get
request.
This method allows a process to cancel its reservation for retrieving an item
from the store. If the reservation exists in the reserve_get_queue
, it is removed,
and _trigger_reserve_get()
is called to process any remaining reservations.
If the reservation is already in reservations_get
, it is removed, and the corresponding
item is repositioned in the store to maintain order. _trigger_reserve_get()
is then
triggered to handle pending reservations.
Parameters: |
|
---|
Returns: |
|
---|
Raises: |
|
---|
Source code in src/factorysimpy/base/reservable_req_store.py
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 |
|
reserve_put()
¶
Create a reservation request to put an item into the store.
This function generates a SimPy event representing a reservation request. The event is
assigned attributes such as the resource name, and the process making the request.
The event is then added to reserve_put_queue
, which is maintained in the order in which the request has come.
After adding the event to the queue, _trigger_reserve_put
is called to process
any pending reservations.
Returns: |
|
---|
Source code in src/factorysimpy/base/reservable_req_store.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
|
reserve_put_cancel(put_event_to_cancel)
¶
Cancel a previously made reserve_put
request.
This method allows a process to cancel its reservation for putting an item
into the store. If the reservation exists in the reserve_put_queue
, it is
removed before triggering _trigger_reserve_put
to process any pending reservations.
If the reservation is already in reservations_put
, it is also removed and
_trigger_reserve_put
is triggered.
Parameters: |
|
---|
Returns: |
|
---|
Raises: |
|
---|
Source code in src/factorysimpy/base/reservable_req_store.py
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
|
slotted_belt_store
¶
BeltStore(env, capacity=float('inf'), mode='FIFO', delay=1)
¶
Bases: Store
This is a class that is derived from SimPy's Store class and has extra capabilities that makes it a priority-based reservable store for processes to reserve space for storing and retrieving items with priority-based access.
Processes can use reserve_put() and reserve_get() methods to get notified when a space becomes available in the store or when an item gets available in the ReservablePriorityReqStore. These methods returns a unique event (SimPy.Event) to the process for every reserve requests it makes. Processes can also pass a priority as argument in the request. Lower values indicate higher priority.
get and put are two methods that can be used for item storing and retrieval from ReservablePriorityReqStore.
Process has to make a prior reservation and pass the associated reservation event as argument in the get and
put requests. ReservablePriorityReqStore maintains separate queues for reserve_put
and reserve_get
operations
to ensures that only processes with valid reservations can store or retrieve items.
ReservablePriorityReqStore preserves item order by associating an unreserved item in the store with a reservation event by index when a reserve_get() request is made. As a result, it maintains a list of reserved events to preserve item order.
It also allows users to cancel an already placed reserve_get or reserve_put request even if it is yielded. It also handles the dissociation of the event and item done at the time of reservation when an already yielded event is canceled.
Attributes: |
|
---|
Initializes a reservable store with priority-based reservations.
Args:
capacity (int, optional): The maximum number of items the store can hold.
Defaults to infinity.
Source code in src/factorysimpy/base/slotted_belt_store.py
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 |
|
get(get_event)
¶
Retrieve an item from the store after a successful reservation.
This method attempts to retrieve an item associated with a reserve_get
event. If the reservation exists, it triggers _trigger_get
to retrieve
the item. If successful, _trigger_reserve_put
is called to process any
pending reserve_put
requests. If the item retrieval fails, an error
message is raised.
Parameters: |
|
---|
Returns: |
|
---|
Raises: |
|
---|
Source code in src/factorysimpy/base/slotted_belt_store.py
394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 |
|
handle_new_item_during_interruption(item)
¶
Handle new items arriving during selective interruption.
For new items, the delay before interruption is: capacity - num_items
Parameters: |
|
---|
Source code in src/factorysimpy/base/slotted_belt_store.py
963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 |
|
interrupt_all_move_processes(reason='External interrupt')
¶
Interrupt all active move_to_ready_items processes.
Parameters: |
|
---|
Source code in src/factorysimpy/base/slotted_belt_store.py
712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 |
|
move_to_ready_items(item)
¶
Move items from the store to the ready_items list after a put operation. This method is called as a process to ensure that items are moved asynchronously. Handles interrupts when state changes to stalled and resumes when state changes back. Movement is split into two phases: 1. First phase: item[0].length/self.speed time (time for item to fully enter belt) 2. Second phase: remaining time (time for item to reach exit)
Source code in src/factorysimpy/base/slotted_belt_store.py
609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 |
|
put(put_event, item)
¶
Perform a put
operation on the store and trigger any pending reserve_get
requests.
Ensures that only processes with a valid reservation can put items into the store.
If the put operation succeeds, it triggers _trigger_reserve_get
to process pending get requests.
Parameters: |
|
---|
Returns: |
|
---|
Raises: |
|
---|
Source code in src/factorysimpy/base/slotted_belt_store.py
490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 |
|
reserve_get(priority=0)
¶
Create a reservation request to retrieve an item from the store.
This method generates a SimPy event representing a request to reserve an item
for retrieval (get
). The event is assigned attributes such as priority,
the resource it belongs to, and the process making the request.
The event is then added to reserve_get_queue
, which is maintained in
priority order, and _trigger_reserve_get()
is called to process pending
reservations if items are available.
Parameters: |
|
---|
Returns: |
|
---|
Source code in src/factorysimpy/base/slotted_belt_store.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 |
|
reserve_get_cancel(get_event_to_cancel)
¶
Cancel a previously made reserve_get
request.
Source code in src/factorysimpy/base/slotted_belt_store.py
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 |
|
reserve_put(priority=0)
¶
Create a reservation request to put an item into the store.
This function generates a SimPy event representing a reservation request. The event is
assigned attributes such as priority, resource name, and the process making the request.
The event is then added to reserve_put_queue
, which is maintained in priority order.
After adding the event to the queue, _trigger_reserve_put
is called to process
any pending reservations.
Parameters: |
|
---|
Returns: |
|
---|
Source code in src/factorysimpy/base/slotted_belt_store.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
|
reserve_put_cancel(put_event_to_cancel)
¶
Cancel a previously made reserve_put
request.
This method allows a process to cancel its reservation for putting an item
into the store. If the reservation exists in the reserve_put_queue
, it is
removed before triggering _trigger_reserve_put
to process any pending reservations.
If the reservation is already in reservations_put
, it is also removed and
_trigger_reserve_put
is triggered.
Parameters: |
|
---|
Returns: |
|
---|
Raises: |
|
---|
Source code in src/factorysimpy/base/slotted_belt_store.py
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 |
|
resume_all_move_processes()
¶
Resume all interrupted move_to_ready_items processes.
Source code in src/factorysimpy/base/slotted_belt_store.py
731 732 733 734 735 736 737 738 739 740 |
|
selective_interrupt(reason='Selective interrupt')
¶
Perform selective interruption based on belt occupancy patterns and mode.
When noaccumulation_mode_on=True (STALLED_NONACCUMULATING_STATE): - Interrupt all items immediately
When noaccumulation_mode_on=False (STALLED_ACCUMULATING_STATE): - Use pattern-based interruption with delays based on item positions
Pattern-based rules for accumulating mode: - For patterns like '_*', interrupt all items. - For patterns like '___', interrupt item in second last position after 1 delay, and second item after 2 delays. - For patterns like '___*', interrupt first item and second item after 3 delays. - For patterns like '__*', interrupt first item, second after 2 delays, and third after 2 delays.
Parameters: |
|
---|
Source code in src/factorysimpy/base/slotted_belt_store.py
776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 |
|
constructs
¶
chain
¶
connect_nodes_with_buffers(machines, buffers, src, sink)
¶
Connects source, machines, buffers, and optionally a sink in the following order: src -> buffer1 -> machine1 -> buffer2 -> machine2 -> ... -> bufferN -> sink
Parameters: |
|
---|
Returns: |
|
---|
Source code in src/factorysimpy/constructs/chain.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
|
mesh
¶
connect_mesh(env, rows, cols, node_cls, edge_cls, node_kwargs=None, edge_kwargs=None, node_kwargs_grid=None, edge_kwargs_grid=None, prefix='M', edge_prefix='B', source_cls=None, sink_cls=None, source_kwargs=None, sink_kwargs=None)
¶
Builds a mesh/grid of nodes connected with buffers. Each node is connected to its right and down neighbor.
Returns: |
|
---|
Source code in src/factorysimpy/constructs/mesh.py
3 4 5 6 7 8 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 |
|
connect_mesh_with_source_sink(env, rows, cols, node_cls, edge_cls, node_kwargs=None, edge_kwargs=None, node_kwargs_grid=None, edge_kwargs_grid=None, prefix='M', edge_prefix='B', source_cls=None, sink_cls=None, source_kwargs=None, sink_kwargs=None)
¶
Builds a mesh/grid of nodes connected with buffers. Source sends to first row, Sink collects from last row.
Returns: |
|
---|
Source code in src/factorysimpy/constructs/mesh.py
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 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
|
edges
¶
buffer
¶
Buffer(env, id, capacity=1, delay=0, mode='FIFO')
¶
Bases: Edge
Buffer class representing a FIFO queue. Inherits from the Edge class. This buffer can have a single input edge and a single output edge.
Attributes: |
|
---|
Behavior:
The Buffer is a type of edge represents components that holds the items that are waiting to be accepted by the destination node. Items that are added in buffer becomes available
for use after delay
amount of time. It operates in two modes-
1. FIFO
: It prioritizes items in the order they were added, with the oldest items being available for the destination node first.
2. LIFO
: It prioritizes items in the reverse order of their arrival, items that newly added are available to use by the destination node first
Incoming edges can use reserve_get and reserve_put calls on the store in the buffer to reserve an item or space and after yielding
the requests, an item can be put and obtained by using put and get methods.
Raises: |
|
---|
Output performance metrics
The key performance metrics of the buffer edge are captured in the stats
attribute (dict) during a simulation run.
last_state_change_time : Time when the state was last changed.
time_averaged_num_of_items_in_buffer : Time-averaged number of items available in the buffer.
total_time_spent_in_states : Dictionary with total time spent in each state.
Source code in src/factorysimpy/edges/buffer.py
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 |
|
can_get()
¶
Check if the buffer can accept an item.
Returns¶
bool True if the buffer can give an item, False otherwise.
Source code in src/factorysimpy/edges/buffer.py
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
|
can_put()
¶
Check if the buffer can accept an item.
Returns¶
bool True if the buffer can accept an item, False otherwise.
Source code in src/factorysimpy/edges/buffer.py
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
|
get(event)
¶
Get an item from the buffer.
Parameters¶
event : simpy.Event The event that was reserved for getting an item.
Returns¶
item : object The item retrieved from the buffer.
Source code in src/factorysimpy/edges/buffer.py
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 |
|
reserve_get_cancel(event)
¶
Cancel a reserved get event.
Parameters¶
event : simpy.Event The event that was reserved for getting an item.
Source code in src/factorysimpy/edges/buffer.py
182 183 184 185 186 187 188 189 190 191 |
|
reserve_put_cancel(event)
¶
Cancel a reserved put event.
Parameters¶
event : simpy.Event The event that was reserved for putting an item.
Source code in src/factorysimpy/edges/buffer.py
193 194 195 196 197 198 199 200 201 202 |
|
continuous_conveyor
¶
ConveyorBelt(env, id, conveyor_length, speed, item_length, accumulating)
¶
Bases: Edge
A conveyor belt system with optional accumulation.
Attributes:
capacity (int): Maximum capacity of the belt.
state (str): state of the conveyor belt.
length (float): Length of the item.
speed (float): Speed of the conveyor belt.
accumulating (bool): Whether the belt supports accumulation (1 for yes, 0 for no).
belt (BeltStore): The belt store object.
Source code in src/factorysimpy/edges/continuous_conveyor.py
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 |
|
can_get()
¶
Check if an item can be retrieved from the belt.
Source code in src/factorysimpy/edges/continuous_conveyor.py
123 124 125 126 127 128 129 |
|
can_put()
¶
Check if an item can be added to the belt.
Source code in src/factorysimpy/edges/continuous_conveyor.py
138 139 140 141 142 143 |
|
get(event)
¶
Get an item from the belt.
Parameters¶
event : simpy.Event The event that was reserved for getting an item.
Returns¶
Item The item retrieved from the belt.
Source code in src/factorysimpy/edges/continuous_conveyor.py
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 |
|
is_empty()
¶
Check if the belt is completely empty.
Source code in src/factorysimpy/edges/continuous_conveyor.py
105 106 107 108 |
|
is_full()
¶
Check if the belt is full.
Source code in src/factorysimpy/edges/continuous_conveyor.py
119 120 121 |
|
is_stalled()
¶
Check if the belt is stalled due to time constraints.
Source code in src/factorysimpy/edges/continuous_conveyor.py
131 132 133 134 135 136 |
|
put(event, item)
¶
Put an item into the belt.
Parameters¶
event : simpy.Event The event that was reserved for putting an item. item : Item The item to be put on the belt.
Returns¶
simpy.Event An event that will be triggered when the item is successfully put on the belt.
Source code in src/factorysimpy/edges/continuous_conveyor.py
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
|
set_conveyor_state(new_state)
¶
Set the conveyor state and manage belt store interrupts/resumes.
Parameters: |
|
---|
Source code in src/factorysimpy/edges/continuous_conveyor.py
320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 |
|
edge
¶
Edge(env, id, capacity)
¶
Edge represents the passive components. It used to connect two nodes and helps to move items between them. It is the base class used to model buffers, conveyors, fleets, etc in manufacturing system.
Parameters: |
---|
Raises: |
|
---|
Source code in src/factorysimpy/edges/edge.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
|
connect(src, dest, reconnect=False)
¶
Connects this edge to a source node and a destination node.
This method checks that both src
and dest
are valid Node objects and that the edge is not already connected,
unless reconnect
is set to True. It also registers this edge in the out_edges
of the source node and the
in_edges
of the destination node.
Parameters: |
---|
Raises: |
|
---|
Source code in src/factorysimpy/edges/edge.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
|
get_delay(delay)
¶
Returns value based on the type of parameter delay
provided.
Parameters: |
|
---|
Returns: |
|
---|
Source code in src/factorysimpy/edges/edge.py
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
|
update_state(new_state, current_time)
¶
Update node state and track the time spent in the previous state.
Parameters: |
|
---|
Source code in src/factorysimpy/edges/edge.py
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
|
fleet
¶
Fleet(env, id, capacity=1, delay=1, transit_delay=0)
¶
Bases: Edge
Fleet class representing an AGV (Automated Guided Vehicle) or a group of transporters. Inherits from the Edge class. This fleet can have a single input edge and a single output edge.
Attributes: |
|
---|
Behavior:
The Fleet is a type of edge represents components that moves multiple items simulataneaously between nodes.
User can specify a parameter capacity
to specify how many items can be moved at once.
Incoming edges can use reserve_get and reserve_put calls on the store in the fleet to reserve an item or space and after yielding
the requests, an item can be put and obtained by using put and get methods.
Raises: |
|
---|
Output performance metrics
The key performance metrics of the fleet edge are captured in the stats
attribute (dict) during a simulation run.
last_state_change_time : Time when the state was last changed.
time_averaged_num_of_items_in_fleet : Time-averaged number of items available in the fleet.
total_time_spent_in_states : Dictionary with total time spent in each state.
Source code in src/factorysimpy/edges/fleet.py
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 |
|
can_get()
¶
Check if the fleet can accept an item.
Returns¶
bool True if the fleet can give an item, False otherwise.
Source code in src/factorysimpy/edges/fleet.py
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
|
can_put()
¶
Check if the fleet can accept an item.
Returns¶
bool True if the fleet can accept an item, False otherwise.
Source code in src/factorysimpy/edges/fleet.py
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
|
get(event)
¶
Get an item from the fleet.
Parameters¶
event : simpy.Event The event that was reserved for getting an item.
Returns¶
item : object The item retrieved from the fleet.
Source code in src/factorysimpy/edges/fleet.py
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 |
|
reserve_get_cancel(event)
¶
Cancel a reserved get event.
Parameters¶
event : simpy.Event The event that was reserved for getting an item.
Source code in src/factorysimpy/edges/fleet.py
173 174 175 176 177 178 179 180 181 182 |
|
reserve_put_cancel(event)
¶
Cancel a reserved put event.
Parameters¶
event : simpy.Event The event that was reserved for putting an item.
Source code in src/factorysimpy/edges/fleet.py
184 185 186 187 188 189 190 191 192 193 |
|
slotted_conveyor
¶
ConveyorBelt(env, id, capacity, delay, accumulating)
¶
Bases: Edge
A conveyor belt system with optional accumulation.
Attributes:
capacity (int): Maximum capacity of the belt.
state (str): state of the conveyor belt.
delay (float): Time interval between two successive movements on the belt.
accumulation (bool): Whether the belt supports accumulation (1 for yes, 0 for no).
Source code in src/factorysimpy/edges/slotted_conveyor.py
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 91 92 93 94 95 96 |
|
can_get()
¶
Check if an item can be retrieved from the belt.
Source code in src/factorysimpy/edges/slotted_conveyor.py
138 139 140 141 142 143 144 |
|
can_put()
¶
Check if an item can be added to the belt.
Source code in src/factorysimpy/edges/slotted_conveyor.py
153 154 155 156 157 158 |
|
get(event)
¶
Get an item from the belt.
Parameters¶
event : simpy.Event The event that was reserved for getting an item.
Returns¶
Item The item retrieved from the belt.
Source code in src/factorysimpy/edges/slotted_conveyor.py
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
|
is_empty()
¶
Check if the belt is completely empty.
Source code in src/factorysimpy/edges/slotted_conveyor.py
127 128 129 |
|
is_full()
¶
Check if the belt is full.
Source code in src/factorysimpy/edges/slotted_conveyor.py
134 135 136 |
|
is_stalled()
¶
Check if the belt is stalled due to time constraints.
Source code in src/factorysimpy/edges/slotted_conveyor.py
146 147 148 149 150 151 |
|
put(event, item)
¶
Put an item into the belt.
Parameters¶
event : simpy.Event The event that was reserved for putting an item. item : Item The item to be put on the belt.
Returns¶
simpy.Event An event that will be triggered when the item is successfully put on the belt.
Source code in src/factorysimpy/edges/slotted_conveyor.py
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 |
|
set_conveyor_state(new_state)
¶
Set the conveyor state and manage belt store interrupts/resumes.
Parameters: |
|
---|
Source code in src/factorysimpy/edges/slotted_conveyor.py
275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 |
|
helper
¶
baseflowitem
¶
BaseFlowItem(id)
¶
A class representing an item .
Source code in src/factorysimpy/helper/baseflowitem.py
3 4 5 6 7 8 9 10 11 12 13 |
|
set_creation(source_id, env)
¶
Set creation time and source node ID.
Source code in src/factorysimpy/helper/baseflowitem.py
15 16 17 18 |
|
set_destruction(node_id, env)
¶
set the destruction time and node of the item.
Source code in src/factorysimpy/helper/baseflowitem.py
20 21 22 23 |
|
update_node_event(node_id, env, event_type='entry')
¶
Update item details and stats when entering or exiting a node.
Parameters: |
|
---|
Source code in src/factorysimpy/helper/baseflowitem.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
|
item
¶
Item(id)
¶
Bases: BaseFlowItem
A class representing a pallet, which can hold multiple items.
Source code in src/factorysimpy/helper/item.py
5 6 7 |
|
pallet
¶
Pallet(id)
¶
Bases: BaseFlowItem
A class representing a pallet, which can hold multiple items.
Source code in src/factorysimpy/helper/pallet.py
5 6 7 8 |
|
add_item(item)
¶
Add an item to the pallet.
Source code in src/factorysimpy/helper/pallet.py
10 11 12 |
|
remove_item()
¶
Remove an item from the pallet if present.
Source code in src/factorysimpy/helper/pallet.py
14 15 16 17 18 19 |
|
nodes
¶
combiner
¶
Combiner(env, id, in_edges=None, out_edges=None, node_setup_time=0, target_quantity_of_each_item=[1], processing_delay=0, blocking=True, out_edge_selection='FIRST_AVAILABLE')
¶
Bases: Node
Combiner class representing a processing node in a factory simulation. Inherits from the Node class.The combiner can have multiple input edges and a multiple output edges. It gets items from the input edges and packs them into a pallet or box and pushes it to the output edge.
Parameters: |
|
---|
Behavior
The combiner node represents components that process or modify the items that flow in the simulation model. It can have multiple incoming edges
and multiple outgoing edge. Edge to which processed item is pushed is decided using the method specified
in the parameter out_edge_selection
. Combiner will transition through the states- SETUP_STATE
, PROCESSING_STATE
, IDLE_STATE
and
BLOCKED_STATE
. The combiner has a blocking behavior if blocking
=True
and gets blocked when all its worker threads have processed items and the out edge is full and
cannot accept the item that is being pushed by the combiner and waits until the out edge can accept the item. If blocking
=False
, the combiner will
discard the item if the out edge is full and cannot accept the item that is being pushed by the combiner.
Raises: |
|
---|
Output performance metrics:
The key performance metrics of the combiner node is captured in stats
attribute (dict) during a simulation run.
last_state_change_time : Time when the state was last changed.
num_item_processed : Total number of items generated.
num_item_discarded : Total number of items discarded.
total_time_spent_in_states: Dictionary with total time spent in each state.
Source code in src/factorysimpy/nodes/combiner.py
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 91 92 93 94 95 96 97 98 99 100 101 |
|
add_in_edges(edge)
¶
Adds an in_edge to the node. Raises an error if the edge already exists in the in_edges list.
Parameters: |
|
---|
Source code in src/factorysimpy/nodes/combiner.py
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
|
add_out_edges(edge)
¶
Adds an out_edge to the node. Raises an error if the edge already exists in the out_edges list.
Parameters: |
|
---|
Source code in src/factorysimpy/nodes/combiner.py
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 |
|
update_state(new_state, current_time)
¶
Update node state and track the time spent in the previous state.
Parameters: |
|
---|
Source code in src/factorysimpy/nodes/combiner.py
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
|
machine
¶
Machine(env, id, in_edges=None, out_edges=None, node_setup_time=0, work_capacity=1, processing_delay=0, blocking=True, in_edge_selection='FIRST_AVAILABLE', out_edge_selection='FIRST_AVAILABLE')
¶
Bases: Node
Machine represents a processing node in a factory simulation. This Machine can have multiple input edges and output edges.
Parameters: |
|
---|
Behavior
The machine node represents components that process or modify the items that flow in the simulation model. It can have multiple incoming edges
and multiple outgoing edge. Edge from which the item comes in and the edge to which processed item is pushed is decided using the method specified
in the parameter in_edge_selection
and out_edge_selection
. Machine will transition through the states- SETUP_STATE
, PROCESSING_STATE
, IDLE_STATE
and
BLOCKED_STATE
. The machine has a blocking behavior if blocking
=True
and gets blocked when all its worker threads have processed items and the out edge is full and
cannot accept the item that is being pushed by the machine and waits until the out edge can accept the item. If blocking
=False
, the machine will
discard the item if the out edge is full and cannot accept the item that is being pushed by the machine.
Raises: |
|
---|
Output performance metrics:
The key performance metrics of the Machine node is captured in stats
attribute (dict) during a simulation run.
last_state_change_time : Time when the state was last changed.
num_item_processed : Total number of items generated.
num_item_discarded : Total number of items discarded.
total_time_spent_in_states: Dictionary with total time spent in each state.
Source code in src/factorysimpy/nodes/machine.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
|
add_in_edges(edge)
¶
Adds an in_edge to the node. Raises an error if the edge already exists in the in_edges list.
Parameters: |
|
---|
Source code in src/factorysimpy/nodes/machine.py
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
|
add_out_edges(edge)
¶
Adds an out_edge to the node. Raises an error if the edge already exists in the out_edges list.
Parameters: |
|
---|
Source code in src/factorysimpy/nodes/machine.py
278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 |
|
update_state_rep(current_time)
¶
Update the state representation tuple based on the current state of worker threads.
Parameters: |
|
---|
Source code in src/factorysimpy/nodes/machine.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
|
node
¶
Node(env, id, in_edges=None, out_edges=None, node_setup_time=0)
¶
Base class to represent an active entity in a manufacturing system, such as machines, splits, or joints.
Parameters: |
|
---|
Raises: |
|
---|
Source code in src/factorysimpy/nodes/node.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
|
get_delay(delay)
¶
Returns value based on the type of parameter delay
provided.
Parameters: |
|
---|
Returns: |
|
---|
Source code in src/factorysimpy/nodes/node.py
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 |
|
update_state(new_state, current_time)
¶
Update node state and track the time spent in the previous state.
Parameters: |
|
---|
Source code in src/factorysimpy/nodes/node.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
|
sink
¶
Sink(env, id, in_edges=None, node_setup_time=0)
¶
Bases: Node
A Sink is a terminal node that collects flow items at the end. Once an item enters the Sink, it is considered to have exited the system and cannot be retrieved or processed further This sink can have multiple input edges and no output edges.
Raises
AssertionError: If the sink does not have at least 1 input edge or has an output edge.
Source code in src/factorysimpy/nodes/sink.py
23 24 25 26 27 28 29 30 31 32 33 |
|
source
¶
Source(env, id, in_edges=None, out_edges=None, item_length=1, flow_item_type='item', inter_arrival_time=0, blocking=False, out_edge_selection='FIRST_AVAILABLE')
¶
Bases: Node
Parameters: |
|
---|
Behavior:
The Source node is responsible for generating items that flow in the simulation model. It operates in two modes: blocking and non-blocking.
when blocking=True
:
- After each inter_arrival_time
, the source generates an item.
- If the selected out edge is full, the source waits until space is available.
- Once space is available, the item is transferred to the selected edge.
- inter_arrival_time
must not be None
.
when blocking=False
:
- After each inter_arrival_time
, the source generates an item.
- If the selected out edge is full, the item is discarded immediately.
- If space is available, the item is transferred without waiting.
- inter_arrival_time
must not be 0.
Raises: |
|
---|
Output performance metrics:
The key performance metrics of the Source node is captured in stats
attribute (dict) during a simulation run.
last_state_change_time : Time when the state was last changed.
num_item_generated : Total number of items generated.
num_item_discarded : Total number of items discarded due to lack of space in out edge.
total_time_spent_in_states: Dictionary with total time spent in each state.
Source code in src/factorysimpy/nodes/source.py
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
|
add_out_edges(edge)
¶
Adds an out_edge to the source node. Raises an error if the source already has an out_edge or if the edge already exists in the out_edges list.
Parameters: |
|
---|
Source code in src/factorysimpy/nodes/source.py
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 |
|
update_state(new_state, current_time)
¶
Update node state and track the time spent in the previous state.
Parameters: |
|
---|
Source code in src/factorysimpy/nodes/source.py
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 |
|
splitter
¶
Splitter(env, id, in_edges=None, out_edges=None, node_setup_time=0, processing_delay=0, blocking=True, mode='UNPACK', split_quantity=None, in_edge_selection='FIRST_AVAILABLE', out_edge_selection='FIRST_AVAILABLE')
¶
Bases: Node
Splitter class representing a processing node that can unpack an incoming item and send it to multiple outgoing edges in a factory simulation.
Parameters: |
|
---|
Behavior
The Splitter node represents components that process or modify the items that flow in the simulation model. It can have multiple incoming edges
and multiple outgoing edge. Edge from which the item comes in and the edge to which processed item is pushed is decided using the method specified
in the parameter in_edge_selection
and out_edge_selection
. Splitter will transition through the states- SETUP_STATE
, PROCESSING_STATE
, IDLE_STATE
and
BLOCKED_STATE
. The Splitter has a blocking behavior if blocking
=True
and gets blocked when all its worker threads have processed items and the out edge is full and
cannot accept the item that is being pushed by the Splitter and waits until the out edge can accept the item. If blocking
=False
, the Splitter will
discard the item if the out edge is full and cannot accept the item that is being pushed by the Splitter.
Raises: |
|
---|
Output performance metrics:
The key performance metrics of the Splitter node is captured in stats
attribute (dict) during a simulation run.
last_state_change_time : Time when the state was last changed.
num_item_processed : Total number of items generated.
num_item_discarded : Total number of items discarded.
total_time_spent_in_states: Dictionary with total time spent in each state.
Source code in src/factorysimpy/nodes/splitter.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
|
add_in_edges(edge)
¶
Adds an in_edge to the node. Raises an error if the edge already exists in the in_edges list.
Parameters: |
|
---|
Source code in src/factorysimpy/nodes/splitter.py
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 |
|
add_out_edges(edge)
¶
Adds an out_edge to the node. Raises an error if the edge already exists in the out_edges list.
Parameters: |
|
---|
Source code in src/factorysimpy/nodes/splitter.py
247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 |
|
update_state(new_state, current_time)
¶
Update node state and track the time spent in the previous state.
Parameters: |
|
---|
Source code in src/factorysimpy/nodes/splitter.py
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
|
utils
¶
stats_summary
¶
compute_performance_metrics(stats, sim_time)
¶
Compute cycle time, resource utilization, throughput, and % time spent in each state for each worker.
Parameters: |
|
---|
Returns: |
|
---|
Source code in src/factorysimpy/utils/stats_summary.py
1 2 3 4 5 6 7 8 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 |
|
utils
¶
get_edge_selector(sel_type, node, env, edge_type=None)
¶
Returns a generator that yields selected indices from the node's edge list.
Args:
sel_type (str): The selection strategy. One of: 'RANDOM', 'ROUND_ROBIN'.
node (object): The node object containing in_edges or out_edges.
env (simpy.Environment): The simulation environment.
edge_type (str, optional): Whether to select from 'out_edges' or 'in_edges'. Default is 'OUT'.
Returns:
generator: A generator yielding selected indices from the specified edge list.
Raises:
ValueError: If sel_type is not a valid selection strategy.
Source code in src/factorysimpy/utils/utils.py
3 4 5 6 7 8 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 |
|