R. den Ouden
Simulatie met Java®.
Report 97.3.LT.4902, Transport Technology, Logistic Engineering.
Java is a computer language which importance is increasing by its use for
internet. Several simulation tools for Java are available, such as
SimJava or JavaSim, but none of these tools make Java a programming language
suitable for discrete-event simulation. My computer assignment
was to develop a simulation-tool for Java which includes the
event scheduler. Subsequently a standard simulation problem, the
'lock model' had to be programmed which makes use of the simulation unit
developed. De simulation methods of the simulation unit have to
correspond to the terminology and principles of Must.
After getting acquainted to and gaining programming experience with Java I
started programming the lock model. While programming, for each
simulation method like 'start', '(re)activate', 'passivate', 'hold' and 'stop',
a separate method (Java-term for procedure) was developed. In the end a
collection of simulation methods was formed, so only these simulation methods
had to be saved in a new package (Java-term for unit).
This package makes it possible to use these simulation methods in every
Java-program by initializing the package in the class-definition (the
syntax of the class). While developing the simulation program is decided to
use a class of the thread-type for each component. The usage of the
threads makes it possible to stop each component temporarily while running
the simulation, which is essential for the discrete-event simulation.
Since Java supports the usage of multi-threading (running several threads
simultanious), it was of great importance to take care of the fact that while
running the simulation, only one thread is active at a time, because of
the discrete-event principle.
Conclusions with regard to the development of the simulation unit and the
usage of Java are:
Although the developed simulation-unit makes it possible to program and
simulate the lock model in Java, the simulation-unit is far from
complete, reliable and user-friendly like simulation tools as Must or
Prosim. Therefore the following recommendations are made:
- It is possible to simulate with Java by the discrete-event principle;
- Java is not user-friendly in using the file-project-structure. The user must
be very careful changing an existing file, since when a file is changed,
the original one isn't available anymore;
- The usage of threads for each process description offers the advantage of
using the available thread-methods as stop en resume. This makes it easy to
stop the components temporarily (event-based-principle);
- Often the situation occurs that more than one events with the same
eventtime are created. This can cause problems i.e. the event-order.
The user of the simulation package must be sure that the events are created
in the right order and are executed in the right order;
- Java can only process 1677 threads. When more threads are created and
activated the program causes a program failure. At first sight it seems that
1677 thread is extremely much, but with simulation with a long runtime
and/or many objects this fact will cause problems very quickly.
- Test and develop the simulation-package into a 'full' simulation tool (like
Must or Prosim);
- Examine if it is possible to use the facility of multi-threading, i.e.
running the components simultanious. This is more in keeping with the
reality and simplifies the event-scheduling principle or makes it even
- Examine the developments of simulation tools which make simulation with Java
possible, critically. It is useless developing a 'new' simulation tool for
Java, when a functioning simulation tool for Java is available.
Reports on Logistic Engineering (in Dutch)
, TU Delft