Facility

Updated: 2025-09-13

FACILITY

Models an exclusive resource (such as a machine, an operator, or a booth).
It allows multiple entities depending on its capacity, and queues them if it is busy.
Internally it manages two lists: entities occupying the resource and entities waiting.

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.
  • default    Equivalent to "FIFO" if no method is specified.

Associated blocks:

  • SEIZE resourceName ; Tries to seize the resource if capacity is available. Otherwise, the entity is queued.
  • RELEASE resourceName; Releases the resource and allows another entity to enter.

Available events: ON_ATTEMPT, ON_QUEUE, ON_SEIZE, ON_RELEASE

Facility {NAME:Fac1, CAPACITY:3, X:100, Y:100}
Facility {NAME:Fac2, CAPACITY:3, X:100, Y:100, ON_ATTEMPT:Fac1_attempt, E_BIN_START:0,E_BIN_SIZE:1,E_BIN_COUNT:40 }
;------------------------
SEIZE Fac1
ADVANCE 10
RELEASE Fac1

Example

/*

Resources. Facility


*/

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}

Facility {NAME:Facility1,X:324,Y:160
	,capacity:3
	,ON_ATTEMPT:FACILITY1_ATTEMPT
	,ON_SEIZE:FACILITY1_SEIZE
	,ON_RELEASE:FACILITY1_RELEASE
	,ON_QUEUE:FACILITY1_QUEUE
    ,R_BIN_SIZE:1,R_BIN_COUNT:10
    ,E_BIN_SIZE:1,E_BIN_COUNT:10
    }


START 1000

;-------------------------------

GENERATE 10,0 {NAME:GEN1,X:62,Y:396}

advance 10 {to:Facility1}
seize Facility1
advance 55,10
release Facility1
advance 10 {to:Exit}

ENDGENERATE 1
;-------------------------------

PROCEDURE FACILITY1_RELEASE
	move {name:Text1,text:"AC1$ I am the VE [D$N] of ON_RELEASE for entity P$ENTITYNUMBER"}
    TERMINATE_VE
endprocedure 
PROCEDURE FACILITY1_QUEUE
	move {name:Text2,text:"AC1$ I am the VE [D$N] of ON_QUEUE for entity P$ENTITYNUMBER"}
    TERMINATE_VE
endprocedure 
PROCEDURE FACILITY1_SEIZE
	move {name:Text3,text:"AC1$ I am the VE [D$N] of ON_SEIZE for entity P$ENTITYNUMBER"}
    TERMINATE_VE
endprocedure 
PROCEDURE FACILITY1_ATTEMPT
	move {name:Text4,text:"AC1$ I am the VE [D$N] of ON_ATTEMPT for entity P$ENTITYNUMBER"}
    TERMINATE_VE
endprocedure