|
Loading
|
||||
Queue System Miscellaneous MonitorsThis page describes a number of additional monitors for the Queue System net. Count_trans_occur_Arrivals'Arrive_1
This monitor is a Count Transition Occurrences monitor. It calculates the number of times the Processed_A_Jobs
This is a data collector monitor that counts how many jobs of job type
The monitor is associated with the This monitor does not need to collect data either before a simulation starts or when stop criteria are fulfilled. Therefore, the initialization and stop functions both return the value NONE.
The predicate function returns true when the
fun pred (bindelem) =
let
fun predBindElem (Server'Stop (1, {job})) = (#jobType job)=A
| predBindElem _ = false
in
predBindElem bindelem
end
The observation function returns the value 1 whenever the predicate function returns true, i.e. whenever the server finishes processing a job of type
fun obs (bindelem) =
let
fun obsBindElem (Server'Stop (1, {job})) = 1
| obsBindElem _ = ~1
in
obsBindElem bindelem
end
Both the count and sum statistics for this monitor will indicate how many jobs of type OneHundred_QueueDelays
This is a breakpoint monitor that is used to stop a simulation when 100 jobs have passed through the queue of jobs. The monitor is associated with the
The predicate function accesses the count statistic for the “Queue Delay” monitor each time the
fun pred (bindelem) =
let
fun predBindElem (Server'Start (1, {jobs, job,proctime})) =
Queue_Delay.count()=100
| predBindElem _ = false
in
predBindElem bindelem
end
Place_content_bp_Server'Completed_1
This is a Place Contents breakpoint monitor. It can be used to stop a simulation when the The index entry for this monitor is dimmed, indicating that the monitor has been disabled. When the monitor is disabled, it will not be able to stop a simulation. If the monitor is enabled again, then it will stop a simulation when the appropriate conditions are fulfilled. For more about disabling and enabling monitors, see the help page about how to Edit a monitor. Save arrival info
This is a write-in-file monitor that is used to save information about the jobs that arrive during a simulation. The monitor is associated with the Here is an example of a file that was generated by this monitor. Initialization functionThe initialization function adds some header-like information to the file before a simulation starts. fun init () = "Job arrivals \n============\n" Predicate function
The predicate function returns true each time the
fun pred (bindelem) =
let
fun predBindElem (Arrivals'Arrive (1, {jobs, job})) = true
| predBindElem _ = false
in
predBindElem bindelem
end
Observation function
The observation function returns a string each time the predicate function returns true, i.e. each time the
The first part of the string is a counter indicating how many jobs have arrived. This number is accessed via the count function for the “Count_trans_occur_Arrivals'Arrive_1” monitor. The second part of the string is a string representation of the job that just arrived, i.e. the job that is bound to the variable
fun obs (bindelem) =
let
fun obsBindElem (Arrivals'Arrive (1, {jobs, job})) =
Int.toString(Count_trans_occur_Arrivals'Arrive_1.count())^
" "^
(Job.mkstr job)^"\n"
| obsBindElem _ = ""
in
obsBindElem bindelem
end
Stop function
The stop function returns a string that is added to the file when simulation stop criteria are fulfilled. The string contains information about how many jobs arrived during the simulation and the number of steps that were executed during the simulation. The fun stop () = "\n\nA total of "^ Int.toString(Count_trans_occur_Arrivals'Arrive_1.count())^ " jobs arrived during the "^(IntInf.toString(step()))^ " steps of this simulation.\n" User defined log fileThis is a user-defined monitor that creates and updates a file. Normally a write-in-file monitor would be used for this purpose, but this monitor is included just to show an example of how a user-defined monitor can be used.
The monitor is associated with almost all of the transitions in the net. The monitor is not associated with the Here is an example of a file that was generated by this monitor Initialization function
The initialization function creates a file and adds a string to the head of the file. The function uses the fun init () = (initfile(); TextIO.output(getfid(), "Occurring transitions\n")) Predicate functionThe predicate function returns true each time one of the three transitions that are associated with the monitor occurs. This means that the file associated with the monitor will be updated when these three transitions occur.
fun pred (bindelem) =
let
fun predBindElem (Arrivals'Arrive (1, {jobs, job})) = true
| predBindElem (Server'Start (1, {jobs, job,proctime})) = true
| predBindElem (Server'Stop (1, {job})) = true
| predBindElem _ = false
in
predBindElem bindelem
end
Observation function
The observation function returns a string that will be added to the file by the action function. The first part of the string indicates the step number at which the transition occurred. The remaining part of the string indicates which transition occurred and some information about the binding of the variables of the transitions. The
fun obs (bindelem) =
let
fun obsBindElem (Arrivals'Arrive (1, {jobs, job})) =
"Arrive occurred: job="^Job.mkstr(job)^"\n"
| obsBindElem (Server'Start (1, {jobs, job,proctime})) =
"Start occurred: job="^Job.mkstr(job)^
", length jobs="^Int.toString(length jobs)^"\n"
| obsBindElem (Server'Stop (1, {job})) =
"Stop occurred: job="^Job.mkstr(job)^"\n"
| obsBindElem _ = "This should never be in the file\n"
in
Int.toString(step())^" "^(obsBindElem bindelem)
end
Action function
The action function will add the string that is returned by the observation function (
fun action (observedval) =
TextIO.output(getfid(), observedval)
handle Option => (initfile();
TextIO.output(getfid(), observedval))
Usually the file will have been opened by the initialization function. However if the monitor is modified, e.g. one of the monitoring functions is edited, after some simulation steps have been executed and the simulation is continued, then the file will no longer be open, and an error would occur if the file were not reopened. Stop function
The stop function adds a string to the end of the file, closes the file, and sets the reference variable
fun stop () =
(TextIO.output(getfid(), "\n\n"^"Simulation stopped after "
^Int.toString(step())^" steps\n");
TextIO.closeOut(getfid());
fileid := NONE)
Related pagesQueue system example, Queue system queue delay, Queue system queue length, Queue System Server Utilization |
||||