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, 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 or 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 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 importing models that support the Functional Mockup Interface for Model Exchange standard (models built with most Modelica based tools support this standard). If you want to experiment with this feature you can 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. You will also need to get the FMI header files from https://www.fmi-standard.org/downloads and include adevs_fmi.h in your program files.

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 then you will need to build them; to test the FMI support you will need the OpenModelica compiler. 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 FMI 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 FMI test cases, put the omc compiler into your PATH and run 'make check_fmi'. 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
jim 2018-01-10