This FMU was generated by Dymola 2019 FD01

Dymola 2019 FD01 is © 1998-2018 Dassault Systèmes

## Open-source components

The FMU may include open-source software components. Source code for these components is available on request.

The original licensors of said open-source software components provide them on an “as is” basis and without any liability whatsoever to customer (or licensee).

See this page for a list of open-source components used by FMUs exported from Dymola 2019 FD01.

## Source code distribution

If the FMU is exported to include sources, the source code is provided in the directory "sources". Except for a file containing the C main function, the files listed below needs to be compiled as separate compilation units. The remaining C files distributed are included from those in one way or another. Some header files from SUNDIALS are located in sub directories, e.g. "cvode" to match the original SUNDIALS code structure. This is necessary since some #include statements rely on this structure.

The files below are sufficent to create a DLL or shared object file. For a complete executable, also a main program is needed of course.

cvode.c
cvode_dense.c
cvode_direct.c
cvode_io.c
dsmodel.c
fmiCommonFunctions_int.c
fmiCoSimFunctions_int.c
fmiFunctions.c
fmiMEFunctions_int.c
integration.c
jac.c
mmap.c
nvector_serial.c
sundials_dense.c
sundials_direct.c
sundials_math.c
sundials_nvector.c
tpl.c
util.c

If you set the MODEL_IDENTIFIER (FMI 1) or FMI2_FUNCTION_PREFIX (FMI 2) explicitly in your source code, e.g.:

    #define FMI2_FUNCTION_PREFIX MyModel_
    #include "fmiFunctions.h"

you must also update fmiModelIdentifier.h accordingly.

If your target platform does not have a file system you have to define NO_FILE in conf.h:

    #define NO_FILE

### Handling multiple FMUs

In order to be able to combine several source code FMUs, the internal functions and symbols need to be static. This in turn requires that the whole source code is compiled in a single compilation unit. To facilitate this, an extra source code file

    all.c

is provided, that includes all other C files. The only disadvantage of compiling this instead, is that any modification in the source code requires re-compilation of everything.

## Enabling sparse solver

Additional source files are needed to enable sparse solution of linear systems during simulation. The required CVode and SUNDIALS files are located in the "source" subdirectory of the Dymola installation directory. If the flag

    Advanced.SparseActivate = true

is enabled during FMU source code export these files are copied to the "sources" subdirectory of the FMU. To enable the code for the sparse solver define the preprocessor macro

    #define FMU_SOURCE_CODE_EXPORT_SPARSE

Furthermore, the following three files must be compiled in addition to those listed above

cvode_sparse.c
cvode_superlumt.c
sundials_sparse.c

For all.c these are incporporated automatically when setting FMU_SOURCE_CODE_EXPORT_SPARSE.
These files implement the interface between CVode and the default sparse linear algebra library: SuperLU_MT Version 2.4. You must link with this library when building the excecutable. The source code can be found at crd-legacy.lbl.gov/~xiaoye/SuperLU/.

(Note: You must also define `DYNSparseJacobian_` if it is not already defined in dsmodel.c. Its value affects the number of cores that are used during sparse matrix factorization.)