A number of monitors for the Queue System net illustrate different ways in which the length of the queue of jobs can be measured.

List_length_dc_System’Queue_1

This monitor is a list length monitor, and it is used to calculate the length of the list that represents the queue of jobs.

This monitor was created by applying the Create List Length Monitor tool to the Queue place on the System page. The monitor is associated with this place and the two transitions that change the marking of the place.

List

List length monitor for job queue

Queue Length

This monitor is a generic data collector monitor that is also used to calculate the length of the queue of jobs. The monitor is associated with the place Queue on the page Server and the two transitions that change the marking of this place.

Queue

Queue length monitor

This monitor will measure the length of the list on the place Queue, and it calculates timed statistics.

Predicate function

The predicate function is invoked each time the Arrive transition on page Arrivals or the Start transition on the page Server occurs. It will return true each time it is invoked. This means that the predicate function will return true each time the marking of the place Queue on the page Server changes.

fun pred (bindelem, Server’Queue_1_mark : Jobs ms) =
let
fun predBindElem (Server’Start (1, {jobs, job,proctime})) = true
| predBindElem (Arrivals’Arrive (1, {jobs, job})) = true
| predBindElem _ = false
in
predBindElem bindelem
end

The predicate function can examine the marking of the Queue place when it is invoked, but it ignores this information.

Observation function

The observation function will be invoked whenever one of the transitions surrounding the place Queue occurs, i.e. whenever the marking of the place changes.

fun obs (bindelem, Server’Queue_1_mark : Jobs ms) =
length(ms_to_col(Server’Queue_1_mark))

Whenever it is invoked, this observation function examines the marking of the place Queue, via the argument Server'Queue_1_mark. The marking is a multi-set of values from the colour set Jobs. In this CP-net, there will always be only one token on the Queue place. The ms_to_col function is a function for multi-sets, and it converts a multi-set with one element to the single element in the multi-set. In this observation function, evaluating the expression ms_to_col(Server'Queue_1_mark) will always return a single value of type Jobs, i.e. a single value that is a list of values of type Job. The length function is then used to return the length of this list as an integer.

The observation function can examine the transitions that surround the place Queue, but it ignores this information.

Initialization and stop functions

The initialization and stop functions are similar to the observation function, however they return integer option values. The initialization function will be invoked once before a simulation starts, and it will return the value SOME x where x is the length of the queue of jobs. The stop function will return similar values when it is invoked when simulation stop criteria are fulfilled.

fun init (Server’Queue_1_mark : Jobs ms) =
SOME (length(ms_to_col(Server’Queue_1_mark)))

fun stop (Server’Queue_1_mark : Jobs ms) =
SOME (length(ms_to_col(Server’Queue_1_mark)))

Queue length advanced

This monitor is similar to the Queue Length monitor. The statistics that are calculated for this monitor will be the same as those for the Queue Length monitor. The difference between the two monitors is that fewer data values are collected for this monitor.

The monitor is associated with two places and two transitions. It is associated with the nodes that are associated with the Queue Length monitor as well as the place Idle on page Server.

Advanced

Advanced queue length monitor

When a job is added to the empty queue and the server is idle, the job will be immediately removed from the queue. This means that the length of the queue will change from 0 to 1 to 0 at the same model time. In other words, in these situations, the length of the queue will be 1 for 0 units of time. This monitor avoids measuring the length of the queue when a job is added to the empty queue and the server is idle. The figure below shows the differences in the data values that are collected by this monitor and the Queue Length monitor.

Data

Data for queue length monitors

Predicate function

The predicate function for this monitor is the only monitoring function that is different from the monitoring functions for the Queue Length monitor. Lines 6-7 below ensure that data will not be collected when the Arrive transition occurs, and the length of the list on the place Queue is equal to 1, and the size of the marking of place Idle is 1 (i.e. the server is idle). In other words, it ensures that data will not be collected when the length of the queue of jobs is equal to 1 for 0 units of time.

fun pred (bindelem, Server’Idle_1_mark : Server tms,
Server’Queue_1_mark : Jobs ms) =
let
fun predBindElem (Server’Start (1, {jobs, job,proctime})) = true
| predBindElem (Arrivals’Arrive (1, {jobs, job})) =
not((length(ms_to_col(Server’Queue_1_mark))=1) andalso
(size Server’Idle_1_mark=1))
| predBindElem _ = false
in
predBindElem bindelem
end

Queue length NoInitNoStop

This monitor is similar to the Queue Length monitor. However, it is different in that the initialization and stop functions return the value NONE. In other words, this monitor does not measure the length of the queue of jobs before a simulation starts or when a simulation stops because simulation stop criteria are fulfilled.

The statistics for this monitor will be slightly different from those for the Queue Length monitor because this monitor ignores the fact that the length of the queue is 0 from time 0 until the first time the transition Arrive occurs.

Queue length NoInit

This monitor is similar to the Queue Length monitor. However, it is different in that the initialization function returns the value NONE. In other words, this monitor does not measure the length of the queue of jobs before a simulation starts.

As compared to the Queue Length NoInitNoStop monitor, this monitor may collect at additional data values, namely the values returned by the stop function when simulation stop criteria are fulfilled. The statistics for this monitor will always be exactly the same as those for the Queue Length NoInitNoStop monitor.

Queue length NoStop

This monitor is also similar to the Queue Length monitor. However, it is different in that the stop function returns the value NONE. In other words, this monitor does not measure the length of the queue of jobs when simulation stop criteria are fulfilled.

As compared to the Queue Length monitor, this monitor may collect fewer data values, namely because the stop function does not return a data value when simulation stop criteria are fulfilled. The statistics for this monitor will always be exactly the same as those for the Queue Length monitor. If the stop function for the Queue Length monitor is invoked because simulation stop criteria are fulfilled, then a plot of the data from this monitor will differ slightly from a plot of the data from the Queue Length monitor.

Here is an example of the data that is collected by the two monitors during a simulation that stops as soon as the Stop transition becomes enabled.

Queue

Queue length plotted

Related pages

Queue System, Queue System Queue Delay, Queue System Server Utilization, Queue System Miscellaneous Monitors

Queue system queue delay
Queue system server utilization

You must be logged in to post a comment.