DSOL 3 (Java 7)

DSOL version 3 is both an extension and a simplification of the DSOL simulator family. In the DSOL 3 blog (bottom menu) some of the design choices are explained. A summary of the big changes in DSOL 3 is given below.

 

Packaging

DSOL 1 and DSOL 2 were built using a large number of projects: language, naming, event, logger, gisbeans, introspection, interpreter, jstats, dsol, dsol-devs, dsol-xml, dsol-gui, dsol-hla, dsol-animation, jstats-charts, dsol-examples, and dsol-tutorial. Although Maven takes good care of loading all these separate projects, the scattering of the code over different projects that are rarely used separately, does not make a lot of sense anymore, and makes debugging and using the API web pages a lot harder. Therefore, starting with DSOL 3, the packaging will be as follows:

  • dsol-base: all non-simulation and non-gui classes that are needed for DSOL to work. This combines the classes from the DSOL 2 projects language, naming, event, logger, introspection, and interpreter.
  • dsol-core: all simulation classes that are needed for DSOL to work. This combines the classes from the DSOL-2 projects jstats, dsol, and dsol-devs.
  • dsol-swing: a set of (swing) gui classes that can help to build quick user interfaces for DSOL. This combines the DSOL-2 projects dsol-animation, dsol-gui and jstats-charts classes. Graphs are shown using jfreechart.
  • dsol-fx: a new project with javafx gui classes that can help to build quick user interfaces for DSOL. Graphs are shown using the javafx chart classes. (This project is under development)
  • dsol-web: a new project with web-based gui classes that can help to build quick user interfaces for DSOL on the Web. Charts are shown using the charts4j libraries or offline rendered jfreechart PNGs to have maximum compatibility with the dsol-swing project. (This project is under development)
  • dsol-demo: a number of examples for DSOL, including the tutorial. This combines the classes from the DSOL-2 projects dsol-examples and dsol-tutorial. (This project is under development)
  • dsol-hla: classes to link DSOL models to HLA. The project contains the main ambassadors for HLA and is tested with the CERTI HLA implementation. (This project is under development)

In addition there is a dsol-build-tools project that contains the settings for checkstyle, Eclipse, etc. This project is especially aimed at developers of dsol itself and guarantees consistent code styles and formatting. Thhe parent project of all above projects is the dsol project. It contains the main pages for the site at http://simulation.tudelft.nl/dsol/3.0/index.html and it contains the parent Maven pom-file for all DSOL projects.

 

Time representation

One of the big changes is the extension of the ways time can be represented, e.g. on a Calendar, as Double, Float or as Long, and with or without time units such as MINUTE or DAY. Another one is the differentiation between absolute time and relative time when events are scheduled. A typical piece of code in DSOL3 would be:

  DEVSSimulator.CalendarLong simulator = new DEVSSimulator.CalendarLong();
  ...
  simulator.scheduleEventRel(new UnitTimeLong(120L, TimeUnit.SECOND), this, this, "update", null);
  Calendar calEndOfRun = new GregorianCalendar(2014, Calendar.DECEMBER, 31, 23, 59, 59);
  simulator.scheduleEventAbs(calEndOfRun, this, this, "calcStats", null);

The DEVSSimulator.Double (and DESSSimulator.Double, DEVDESSSimulator.Double, Animator.Double, etc.) look most like the "old" Simulators in DSOL 2. When units are to be used to specify the events, pre-specified wrapper classes such as DEVSSimulator.DoubleUnit (and DESSSimulator.DoubleUnit, DEVDESSSimulator.DoubleUnit, Animator.DoubleUnit, RealTime.DoubleUnit, etc.) are available to specify scheduled events using units such as new UnitTimeDouble(12.0, TimeUnit.HOUR). It is also quite easy to create own time units (e.g., own objects, infinite precision calculus) on which events can be scheduled. In that sense, DSOL 3 is completely extensible.

 

Absolute versus relative scheduling of events

As can be seen in the example above, the unclear scheduleEvent(...) method has been replaced by the scheduleEventAbs(...) and scheduleEventRel(...) methods. The DSOL 2 method had as a big disadvantage that it was always unclear whether it scheduled using relative or absolute time. With the new names, this confusion is gone.

 

Use of the Logger

As DSOL is a library, most of the Logger entries go totally unnoticed. Instead of using a Logger to notify of problems and errors in the code, exceptions are thrown under all circumstances. This enables the "higher" user code to deal with the errors in an appropriate manner. They can be logged there if DSOL runs as a server applications, or shown to a user if DSOL is used in an interactive manner.