Newsletter Contents
Introduction
CSIM for Java Now Available
Focus on CSIM for Java Users
Going to a Conference?
Technical Note: Accuracy of Results
Your Feedback is important
Hello, CSIM users!
Summer is almost upon us here in Austin, along family vacations, long sunny days,
and lakeside fun. A time to go new places and try new things…such as CSIM for
Java!
For more than 20 years, CSIM has been helping C and C++ programmers around the
world build fast, efficient discrete-event simulations. As the Java programming
language continues to grow in popularity, Mesquite is pleased to offer CSIM for
Java, a fully featured simulation toolkit. CSIM for Java allows Java programmers
to write and rapidly execute simulation models in their preferred programming
environment, on any Java-supported platform.
This issue of the Mesquite newsletter highlights CSIM for Java, including a
technical note with a Java example and a feature story from a user of the Beta
software. Keep reading to learn more about this useful, long-awaited new tool!
CSIM for Java has been released! This new software allows Java programmers to
quickly and easily create process-oriented, discrete-event simulation models of
complex systems. CSIM for Java is comprised of a library of Java classes and
routines that give Java programmers the functionality of the CSIM library, while
mimicking the style of CSIM models.
Written in Java, a CSIM for Java model offers the unparalleled flexibility and time
savings of working with a standard programming language. Standard IDEs such as
Eclipse and NetBeans can be used to create CSIM for Java models. CSIM users can
now enjoy the benefits of the CSIM toolkit together with Java's platform
independence, object-oriented approach, threading, and networking capabilities.
CSIM for Java delivers the same features that have established the original CSIM
package as the premier programmer's tool for C/C++-based discrete event simulations.
Multiple simulation objects are pre-built, including facilities, storages, events,
and mailboxes; and each object automatically collects usage and queuing data.
In addition, the software contains extensive random number functions and numerous
structures for collecting and summarizing data, such as tables, qtables, meters,
and boxes. CSIM for Java capitalizes on Java's platform independence; the package
can run on any system with a Java Virtual Machine (JVM).
After a five-month Beta period, the software has been fully tested by users and
Mesquite staff alike, and has received excellent reviews! Said one Beta user,
"I was pleased with the features and documentation. CSIM for Java was a great
discrete time/event simulation toolkit for my project. The statistics gathering and
reporting features were very good as well."
-- Thomas Hogarty, George Mason University
Visit us online to learn more about CSIM for Java.
You will also find a complete set of
CSIM for Java documentation online.
At Systemflow Simulations, Inc. we have extensive experience modeling material
handling systems using diverse simulation modeling tools. After beta-testing
CSIM for Java, we would like to add the product to our modeling toolkit.
Our first CSIM for Java model consists of a tilt-tray sorter system used in
order-fulfillment operations for small-sized product. The sorting system consists
of an oval containing the path around which the trays travel. At one or both ends
of the oval there are induction chutes containing product to be placed on trays.
Aligned at each side of the oval are arrays of delivery chutes onto which product
is dropped. In a tilt-tray sorting system, product generally conveys to the sorting
area where human operators place the product on induction chutes. The product rests
on the induction chutes until an empty tray arrives. Upon arrival the chute releases
the product and the tray tilts to accept the oncoming item. Once the item is fully
onboard, the tray returns to its normal upright position and begins travel around
the sorter. When the tray arrives at its designated delivery point, the tray tilts
once again to drop the product down a chute to waiting packing operators below who
assemble orders to prepare them for delivery.
Model Logic
We constructed this model by using processes to represent the incoming product from
the conveyor system, the induction and conveyance of product at the induction
chutes, the product item itself, and the tilt-tray. When the model starts, a tray
generator process creates trays and dispatches them to begin traveling the sorting
loop. At the same time an induction manager is creating project items and placing
them at the end of the induction chutes. When an empty tray passes an induction
chute with product, the tray activates the item's process so that the item can begin
conveying along the sorter loop while riding on the tray. The item then travels to
its designated delivery point, at which it signals the tray to tilt toward the
correct delivery side dumping the item onto the delivery chute. At this point, the
item conveys down the delivery chute to order packers waiting below. Once the tray
has delivered the item, it returns to its upright position and continues empty
around the sorter loop to repeat this process. In this model we used the
untimed_wait method of the Event class for inter-process signaling. This model
uses inter-process signaling to signal to the induction process when items arrive
to the sorting area on conveyors, and for trays to signal to the induction process
that an empty tray has arrived so that it can place the item on the tray.
Animation
We animated this model in 3D using the Systemflow 3D Animator software from
Systemflow Simulations, Inc. This software package provides for post-process 3D
animation of simulation models using a time-stamped event file created by the
simulation model. To create this animation, we created a layout file consisting
of an oval track that represents the sorting loop conveyor. We also defined the 3D
shapes that make up the tilt-trays, induction and delivery chutes, product cartons,
packing boxes, and order packers. Inside our CSIM for Java model code, we placed
animation command statements to create all of the induction and delivery chutes
along with the packing stations, tilt-trays and product cartons. We also included
animation commands to convey the trays around the sorter loop, to convey the cartons
down the delivery chute, and to perform the tilting operation of the trays. The
simulation model produced a completed time-stamped event file for this animation.
To view this animation, we opened the time-stamped event file and the layout file
in Systemflow 3D Animator. Using this tool we were able to have 360-degree
navigation through the sorting area, along with the ability to view the animation
at different speeds. Using this software's AVI capture feature, we captured AVI
movies to place on our web site.
Conclusion
The productivity and quality of the CSIM for Java modeling environment, combined
with the smooth 3D animation of Systemflow 3D Animator software, make an ideal
toolkit for modeling material handling applications. Using these tools we can
offer our clients cost-effective, high-fidelity simulations with compelling 3D
animations.
If you're going to a conference and presenting a project that uses CSIM, we'd love to
hear about it! Send your conference proceedings referencing CSIM to us, and we'll send
you a CSIM anniversary t-shirt.
So let's say we're modeling a system of some kind. We create a model of our system; we run it for 5000 simulated seconds; and we publish the results: the mean job completion time is 21.8 seconds. We make a recommendation to management based on this result. But how do we know that the result (21.8 seconds) is correct?
Two major issues affect a simulation model's accuracy of results:
- The correctness of the model (structure, process behavior, etc.)
- The statistical accuracy
In this note, we address the second issue. We assume that the conscientious
modeler has already verified that the model is structurally correct and that the
processes in the model correctly mimic the behavior of the active entities in the
real system.
So how much of an issue is statistical accuracy? Just how inaccurate can a
correctly-built model be?
In a model of the simplest kind of system (an M/M/1 queue), the parameters of our
example are selected so that average service per job is 1.8 seconds and the server
utilization is 0.90. From queuing theory, we know that average job response time
for this model should be 18.0 seconds. The elapsed time for a run is 5000
simulated seconds, and this model was rerun for a total of 10 runs. The results
are as shown in the following chart:
These results could be viewed as alarming, since in only 5 or the 10 runs, the mean
response time from the model is within 10% of the computed (known correct)
value (18.0); the average of these 10 runs is 19.5.
A topic in the field of statistics called confidence intervals deals with
this issue of statistical accuracy. A confidence interval is a statistical range with
a specified probability that a given parameter lies within the range. Or, to
apply this definition to our model, a confidence interval for the mean value
(of our set of values) is an interval that could contain the mean with a specified
probability.
Obviously, the narrower the interval and the higher the confidence level
(the probability), the more sure we are that the estimates of the mean of the
values are valid. If we have a 95% confidence interval for a mean response time
and this interval is specified as [17.205, 19.785], then we can say that the true
(unknown) mean response time is in this interval with probability 0.95. For more
information, the interested reader is referred to any standard statistics
textbook to learn more about confidence intervals. A well-known book on simulation
(Simulation Modeling and Analysis, by Law and Kelton, McGraw-Hill)
shows how to apply confidence intervals to the estimate the accuracy of the
outputs of simulation models.
With response times, the samples are known to be auto-correlated - the successive
response times are not independent. If one response time is "long", then it is
highly likely that the next response time will also be long. The standard
techniques for creating confidence intervals assume that the values used to
create the interval are independent. Thus, the usual technique for estimating
confidence intervals does not give valid results for confidence intervals and
other techniques must be applied.
CSIM for Java and CSIM19 uses the Method of Batched Means to compute accurate
estimates of the confidence intervals for response times. The run-length
feature in CSIM uses these confidence intervals to automatically control the number
of samples required to achieve a pre-specified relative error for the response time
at a pre-specified confidence level.
To continue with our example, the M/M/1 model used in the above example is modified
to use the run-length feature. In this model, the relative error is specified to
0.075 and the confidence level is 95% (0.95). The results for these runs are
summarized in the following chart:
It can be seen that the response times for each run is much closer to the known correct value (18.0); the average response time for the 10 runs is 18.09 seconds. It is fair to say that the results in the run-length version are closer to the known correct value than the results obtained with the fixed elapsed time.
The CSIM for Java program I used to run these two sets of tests is as follows (the CSIM19 program is similar):
// Accuracy.java
import com.mesquite.csim.*;
import com.mesquite.csim.Process;
import com.mesquite.csim.file.Files;
import java.io.*;
public class Accuracy extends Model {
public static void main(String Args[]) {
model = new Accuracy();
m_s = Files.Setfile("Accuracy.out");
m_txt = Files.Setfile("Accuracy.txt");
model.setOutputStream(m_s);
for(int nr = 0; nr < m_numRuns; nr++) {
model.run();
model.report();
m_txt.println("run " + nr + " respTime " +
m_respTime.mean() + "etime " + model.clock());
}
}
private static Accuracy model;
private static PrintStream m_s;
private static PrintStream m_txt;
private static int m_numRuns = 10;
private static double m_iarTime = 2.0;
private static double m_srvTime = 1.8;
private static double m_simTime = 5000.0;
private static Table m_respTime;
private static FCFSFacility m_fac;
public Accuracy() {
super("Accuracy");
}
public void run() {
start(new Sim());
}
private class Sim extends Process {
public Sim() {
super("Sim");
}
public void run() {
m_fac = new FCFSFacility();
m_respTime = new Table("response time");
m_respTime.run_length(0.075, 0.95, 90.0);
add(new Gen());
// hold(m_simTime); // static elapsed time
model.converged().untimed_wait(); // run-length
}
}
private class Gen extends Process {
public Gen() {
super("Gen");
}
public void run() {
while(true) {
add(new Job());
hold(rand.exponential(m_iarTime));
}
}
}
private class Job extends Process {
public Job() {
super("Job");
}
public void run() {
double m_startTime = model.clock();
m_fac.use(rand.exponential(m_srvTime));
m_respTime.record(model.clock() - m_startTime);
}
}
}
Note: The accuracy of the estimate of the mean response time is affected by the
utilization of the server at the facility. When a server is heavily utilized, a
long response interval has an enduring impact on the subsequent response times.
With a less heavily utilized server, the impact of a long interval is less enduring.
So, with a heavily utilized server, we need more estimates of the response time to
obtain an accurate estimate of the mean response time. The run-length control feature
uses confidence intervals and the pre-specified accuracy (relative error) and confidence
level to run the model until the estimated confidence has converged to the desired
accuracy. Since it is possible that the response times are not from a stable process
and the confidence interval will never converge, the run-length control feature will
stop when the specified cpu time limit is exceeded; in this case, the user is notified
that the desired interval was not achieved.
We are currently designing CSIM 20 and would like to be able to incorporate your
suggestions. If you have comments on CSIM 19 or CSIM for Java, or suggestions for
CSIM 20, do let us know!
Check out CSIM for Java and other site updates at
www.mesquite.com! And drop
us a note or give us a call if you have ideas, comments, or questions. We look forward
to hearing from you!
Warm wishes,

Nan Schwetman, President
Mesquite Software, Inc.
8500 North MOPAC, Suite 825
Austin, TX 78759, USA
Tel: (800) 538-9153 (US) or +1 (512) 338-9153
Fax: +1 (512) 338-4966
E-mail:
www: www.mesquite.com