STORAGE
Models a warehouse-type exclusive resource where occupancy is defined by the amount contributed by each entity.
It supports multiple occupants up to its capacity, and queues entities if there is not enough free space.
Internally it manages two lists: occupying entities with their load, and waiting entities.
It supports several entry-selection logics through the optional METHOD parameter.
Associated blocks:
- ENTER resourceName, amount ; Tries to occupy the resource if capacity is available. Otherwise, the entity is queued.
- LEAVE resourceName; Releases the resource by the amount contributed and allows another entity to enter.
Available events: ON_ATTEMPT, ON_QUEUE, ON_ENTER, ON_LEAVE
It supports multiple selection methods for choosing the next entity to enter via the METHOD parameter:
- "FIFO" First in, first out. Takes the first item in the list (arrival order).
- "LIFO" Last in, first out. Traverses to the last node in the list.
- "MIN_SPACE" Chooses the entity that needs the least space (and fits in what is available).
- "MAX_SPACE" Chooses the entity that needs the most space (within the available space).
- default Equivalent to "FIFO" if no method is specified.
Additional statistics: EQ_BIN_* and RQ_BIN_* tabulate by used capacity.
Storage {NAME:Sto1, CAPACITY:3, X:100, Y:100,METHOD:MIN_SPACE}
Storage {NAME:Sto2, CAPACITY:3, X:100, Y:100, ON_ATTEMPT:Fac1_attempt, E_BIN_START:0,E_BIN_SIZE:1,E_BIN_COUNT:40 }
;------------------------
Enter Sto2,6
ADVANCE 10
RELEASE Sto2
Example
/*
Resources. Storage
*/
POSITION {NAME:Exit,X:615,Y:388}
initial posY,500
Graphic {NAME:Text1,Type:TEXT,X:324,Y:X$posY - 0}
Graphic {NAME:Text2,Type:TEXT,X:324,Y:X$posY - 20}
Graphic {NAME:Text3,Type:TEXT,X:324,Y:X$posY - 40}
Graphic {NAME:Text4,Type:TEXT,X:324,Y:X$posY - 60}
Graphic {NAME:Text5,Type:TEXT,X:324,Y:X$posY - 140}
Graphic {NAME:Text6,Type:TEXT,X:324,Y:X$posY - 160}
Graphic {NAME:Text7,Type:TEXT,X:324,Y:X$posY - 180}
Graphic {NAME:Text8,Type:TEXT,X:324,Y:X$posY - 200}
Storage {NAME:Storage1,X:324,Y:235
,capacity:30
,ON_ATTEMPT:STORAGE1_attempt
,ON_ENTER:STORAGE1_enter
,ON_LEAVE:STORAGE1_leave
,ON_QUEUE:STORAGE1_queue
,E_BIN_START:34,E_BIN_SIZE:1,E_BIN_COUNT:12
,R_BIN_SIZE:1,R_BIN_COUNT:10
,EQ_BIN_START:34,EQ_BIN_SIZE:1,EQ_BIN_COUNT:12
,RQ_BIN_START:0,RQ_BIN_SIZE:1,RQ_BIN_COUNT:32
}
START 1000
;-------------------------------
GENERATE 10,0 {NAME:GEN1,X:62,Y:396}
advance 10 {to:Storage1}
enter Storage1,random * 25 + 1
advance 35,10
leave Storage1
advance 10 {to:Exit}
ENDGENERATE 1
;-------------------------------
PROCEDURE STORAGE1_leave
move {name:Text5,text:"AC1$ I am the VE [D$N] of ON_LEAVE for entity P$ENTITYNUMBER"}
TERMINATE_VE
endprocedure
PROCEDURE STORAGE1_queue
move {name:Text6,text:"AC1$ I am the VE [D$N] of ON_QUEUE for entity P$ENTITYNUMBER"}
TERMINATE_VE
endprocedure
PROCEDURE STORAGE1_enter
move {name:Text7,text:"AC1$ I am the VE [D$N] of ON_ENTER for entity P$ENTITYNUMBER"}
TERMINATE_VE
endprocedure
PROCEDURE STORAGE1_attempt
move {name:Text8,text:"AC1$ I am the VE [D$N] of ON_ATTEMPT for entity P$ENTITYNUMBER"}
TERMINATE_VE
endprocedure