FMI Library: part of JModelica.org
Macros | Typedefs | Functions
Library initialization

Macros

#define FMI_IMPORT_NAME_CHECK   1
 If this configuration option is set, the model description will be checked to follow the variable naming conventions. Variables not following the convention will be logged. More...
 

Typedefs

typedef struct fmi_xml_context_t fmi_import_context_t
 FMI version independent library context. Opaque struct returned from fmi_import_allocate_context() More...
 
typedef struct fmi1_import_t fmi1_import_t
 FMU version 1.0 object. More...
 
typedef struct fmi2_import_t fmi2_import_t
 FMU version 2.0 object. More...
 

Functions

FMILIB_EXPORT fmi_import_context_tfmi_import_allocate_context (jm_callbacks *callbacks)
 Create fmi_import_context_t structure. More...
 
FMILIB_EXPORT void fmi_import_free_context (fmi_import_context_t *c)
 Free memory allocated for the library context. More...
 
FMILIB_EXPORT void fmi_import_set_configuration (fmi_import_context_t *c, int conf)
 Sets advanced configuration, if zero is passed default configuration is set. Currently only one non default configuration is available: FMI_IMPORT_XML_NAME_CHECK. More...
 
FMILIB_EXPORT fmi_version_enu_t fmi_import_get_fmi_version (fmi_import_context_t *c, const char *fileName, const char *dirName)
 Unzip an FMU specified by the fileName into directory dirName and parse XML to get FMI standard version. More...
 
FMILIB_EXPORT fmi1_import_tfmi1_import_parse_xml (fmi_import_context_t *c, const char *dirName)
 Parse FMI 1.0 XML file found in the directory dirName. More...
 
FMILIB_EXPORT fmi2_import_tfmi2_import_parse_xml (fmi_import_context_t *context, const char *dirPath, fmi2_xml_callbacks_t *xml_callbacks)
 Create fmi2_import_t structure and parse the FMI 2.0 XML file found in the directory dirName. More...
 

Detailed Description

Interaction with an FMU by means of the FMI Library starts with allocation of an fmi_import_context_t structure. This is done with a call to fmi_import_allocate_context(). The next step is detection of FMI standard used in the specific FMU. This is achieved by calling fmi_import_get_fmi_version() function. When the standard is known a standard specific function for processing model description XML should be called to create an opaque FMU structure. This is done by calling either fmi1_import_parse_xml() or fmi2_import_parse_xml(). With the FMU structure available one can proceed by loading the FMU binary (fmi1_import_create_dllfmu() or fmi2_import_create_dllfmu()). After that the code is able to interact with the FMU by means of the methonds presented in Interface to the standard FMI 1.0 "C" API and Interface to the standard FMI 2.0 "C" API.

Macro Definition Documentation

#define FMI_IMPORT_NAME_CHECK   1

If this configuration option is set, the model description will be checked to follow the variable naming conventions. Variables not following the convention will be logged.

Definition at line 84 of file fmi_import_context.h.

Typedef Documentation

typedef struct fmi_xml_context_t fmi_import_context_t

FMI version independent library context. Opaque struct returned from fmi_import_allocate_context()

Definition at line 65 of file fmi_import_context.h.

typedef struct fmi1_import_t fmi1_import_t

FMU version 1.0 object.

Definition at line 105 of file fmi_import_context.h.

typedef struct fmi2_import_t fmi2_import_t

FMU version 2.0 object.

Definition at line 110 of file fmi_import_context.h.

Function Documentation

FMILIB_EXPORT fmi_import_context_t* fmi_import_allocate_context ( jm_callbacks callbacks)

Create fmi_import_context_t structure.

Parameters
callbacks- a pointer to the library callbacks for memory management and logging. May be NULL if defaults are utilized.
Returns
A new structure if memory allocation was successful.
FMILIB_EXPORT void fmi_import_free_context ( fmi_import_context_t c)

Free memory allocated for the library context.

Parameters
c- library context allocated by fmi_import_allocate_context()
FMILIB_EXPORT void fmi_import_set_configuration ( fmi_import_context_t c,
int  conf 
)

Sets advanced configuration, if zero is passed default configuration is set. Currently only one non default configuration is available: FMI_IMPORT_XML_NAME_CHECK.

Parameters
conf- specifies the configuration to use
FMILIB_EXPORT fmi_version_enu_t fmi_import_get_fmi_version ( fmi_import_context_t c,
const char fileName,
const char dirName 
)

Unzip an FMU specified by the fileName into directory dirName and parse XML to get FMI standard version.

Parameters
c- library context.
fileName- an FMU file name.
dirName- a directory name where the FMU should be unpacked
FMILIB_EXPORT fmi1_import_t* fmi1_import_parse_xml ( fmi_import_context_t c,
const char dirName 
)

Parse FMI 1.0 XML file found in the directory dirName.

Parameters
c- library context.
dirName- a directory where the FMU was unpacked and XML file is present.
Returns
fmi1_import_t:: opaque object pointer
FMILIB_EXPORT fmi2_import_t* fmi2_import_parse_xml ( fmi_import_context_t context,
const char dirPath,
fmi2_xml_callbacks_t xml_callbacks 
)

Create fmi2_import_t structure and parse the FMI 2.0 XML file found in the directory dirName.

Parameters
context- library context.
dirPath- a directory where the FMU was unpacked and XML file is present.
xml_callbacksCallbacks to use for processing of annotations (may be NULL).
Returns
fmi2_import_t:: opaque object pointer