next up previous contents
Next: Modeling and simulation with Up: A Discrete EVent system Previous: About this manual   Contents

Building and Installing

The Adevs package is organized into the following directory structure:
adevs-x.y.z
           +->docs
           +->examples
           +->include
           +->src
           +->test
           +->util
The Adevs simulation engine is comprised almost entirely of template classes, and these are implemented in the header files located in the include directory. The exceptions are the random number generators, the Java language bindings, the OpenModelica support, and some aspects of the parallel simulation engine. If you do not want to use these features then its sufficient for your program to include adevs.h and to be sure your compiler can find the include directory that adevs.h is in.

If you want to use the random number generators and parallel simulation engine, then you must build the adevs static library. To do this, enter the src directory and execute the command 'make' if you are using a Linux system or 'build' if you are using Windows. On Windows, the batch file creates a static library called adevs.lib. For Linux systems, the makefile creates a static library called libadevs.a.

If you are using a Windows system, the batch file must be executed from the Visual C++ command prompt. This will ensure the batch file can find the compiler, linker, and necessary system header files. For Linux systems, make sure you have a recent version of the GNU C++ compiler and GNU make. You may need to edit the makefile (i.e., the file Makefile) to set compiler flags, etc. but the defaults should work in most cases.

To build the Java language bindings, you need to have the Sun (now Oracle) JDK or something that is compatible with it (such as the OpenJDK). On a Windows system, from the src directory enter the adevs_jni directory and then execute the command 'build'. This creates three files: adevs.jar, java_adevs.dll, and java_adevs.lib. To build and run your Java programs, you will need to put adevs.jar into your classpath and java_adevs.dll into your java.library.path (or make sure it is in your regular PATH for finding executables and dynamic link libraries).

On a Linux system, stay in the src directory and execute the command 'make java_adevs'. This creates two files: adevs.jar and libjava_adevs.so. As before, you need to put adevs.jar into your classpath and libjava_adevs.so into your java.library.path or make sure it is in your LD_LIBRARY_PATH for locating dynamic link libraries.

Adevs includes some support for simulating Modelica models that are compiled with the OpenModelica compiler. If you want to enable this support, you must get and build the OpenModelica compiler. For this purpose, the shell script build-omc.sh is provided in the util directory. This shell script does the following: 1) creates the directory openmodelica at the location where the script is run, 2) fetches the minimal set of packages that are needed to compile the OpenModelica compiler, and 3) fetches and builds a bare-bones OpenModelica compiler. The compiler is called omc and it is located in the directory openmodelica/trunk/build/bin.

After running the build-omc script, go to the Adevs src directory. Edit the makefile so that MODELICA_HOME points to the openmodelica/trunk directory that was created by the build-omc script. Now run 'make adevs_with_modelica'. This creates the static library libadevs.a with the Adevs random number generators, parallel simulator, and all parts of the OpenModelica runtime system that are needed to simulate Modelica models.

To run the test suite (which is not required to use the software), you must build the static library file and install Tcl (the test scripts need Tcl to run; if you can run `tclsh' then you already have a working copy of Tcl). If you want to test the Java bindings or OpenModelica support then you will need to build those too. There are four sets of tests that can be executed: one for the serial simulation engine, one for the parallel simulation engine, one for the Java language bindings, and one for the OpenModelica support.

To run the tests for the serial simulation engine, use 'make check_cpp'. To run the tests for the parallel simulation engines use 'make check_par' (note: the environment variable OMP_NUM_THREADS must be set to at least four). To run the Java test cases, use 'make java_test'. To run the OpenModelica test cases, put the omc compiler into your PATH and run 'make check_modelica'. To run all of the test cases, use 'make'. The test script will abort when any test fails. If the test script run to completion, then all of the tests passed.

The test cases can be a bit of a bear to run on a Windows computer. If you need to edit compiler settings, executable directives, etc. to make it work, then modify the file make.common. For Linux systems using the GNU tools the test cases should work out of the box. Otherwise, edit make.common to fix things to fit your development environment.


next up previous contents
Next: Modeling and simulation with Up: A Discrete EVent system Previous: About this manual   Contents
2017-05-15