Not all resources must serve every entity for the same duration. In some scenarios—such as customer service, healthcare triage, or processing stations—it can be reasonable to adapt the service time based on the system load.
In this example, three counters (Facility_1, Facility_2, Facility_3) receive entity flows of different intensities. Each one is paired with a Queuer, which lets you measure and record the current queue size.
Before being served, each entity calls a procedure that dynamically computes its service time, based on the current queue size of the resource.
The logic used here is one of the following:
assign queueSize,R$(P$counter,QUEUE) + 1
ASSIGN serviceTime, round(max(2, 120 / P$queueSize))
ASSIGN serviceTime, round(max(2, 120 / sqrt(P$queueSize)))
ASSIGN serviceTime, round(120 / log(P$queueSize + 1))
This means:
-
With a larger queue, service time becomes shorter, prioritizing throughput.
-
With a smaller queue, more time is spent per entity, improving service quality.
It is an automatic balancing strategy between quality and performance.
This technique demonstrates:
-
How to couple a resource with its
Queuerto measure load. -
How to use mathematical functions to adapt
ADVANCEdurations. -
How to keep queue size under control without sacrificing attention.
The example can easily be extended to:
-
More complex service-time functions.
-
Decision-making about which counter to choose.
-
Global system performance optimization.
Example
/*
Managing service time
*/
Facility {NAME:Facility_1,X:400,Y:84,capacity:3,E_BIN_SIZE:1,E_BIN_COUNT:200}
Facility {NAME:Facility_2,X:400,Y:282,capacity:3,E_BIN_SIZE:1,E_BIN_COUNT:200}
Facility {NAME:Facility_3,X:400,Y:471,capacity:3,E_BIN_SIZE:1,E_BIN_COUNT:200}
Queuer {NAME:Queuer_1,X:400,Y:174,R_BIN_SIZE:1,R_BIN_COUNT:30}
Queuer {NAME:Queuer_2,X:400,Y:363,R_BIN_SIZE:1,R_BIN_COUNT:30}
Queuer {NAME:Queuer_3,X:400,Y:557,R_BIN_SIZE:1,R_BIN_COUNT:30}
Graphic {NAME:Text_1,Type:TEXT,X:400,Y:132}
Graphic {NAME:Text_2,Type:TEXT,X:400,Y:323}
Graphic {NAME:Text_3,Type:TEXT,X:400,Y:512}
POSITION {NAME:POS_1,X:700,Y:137}
POSITION {NAME:POS_2,X:700,Y:328}
POSITION {NAME:POS_3,X:700,Y:506}
START 1000
;*********************************************************
GENERATE 10,0 {NAME:GEN1,X:100,Y:126}
CALL counterPath,1
ENDGENERATE 1
GENERATE 15,0 {NAME:GEN2,X:100,Y:319}
CALL counterPath,2
ENDGENERATE 1
GENERATE 20,0 {NAME:GEN3,X:100,Y:492}
CALL counterPath,3
ENDGENERATE 1
;----------------------------------
PROCEDURE counterPath
assign counter,"Facility_P$PARAM_A"
assign queue,"Queuer_P$PARAM_A" {debug:1}
assign counterId,"P$PARAM_A"
ADVANCE 20 {TO:"P$counter"}
CALL computeTime , "P$counter",P$counterId
QUEUE P$queue
SEIZE P$counter
DEPART P$queue
ADVANCE P$computeTime
RELEASE P$counter
ADVANCE 20 {TO:"POS_P$counterId"}
ENDPROCEDURE
;----------------------------------
PROCEDURE computeTime
assign counter,"P$PARAM_A"
assign counterId,P$PARAM_B
assign queueSize,R$(P$counter,QUEUE) + 1
;ASSIGN serviceTime, round(max(2, 120 / P$queueSize))
;ASSIGN serviceTime, round(max(2, 120 / sqrt(P$queueSize)))
ASSIGN serviceTime, round(120 / log(P$queueSize + 1))
move {name:"Text_P$counterId",text:"service time: P$serviceTime"}
RETURN P$serviceTime
ENDPROCEDURE