FMI MCL API Reference

FMI Model Compatibility Library

The FMI Model Compatibility Library provides an interfaces for loading and operating FMUs.

Sequence Diagram

mcl_create

Create an instance of the MCL which will then be used to operate the Model that the MCL represents.

Parameters

model (ModelDesc*)
Model descriptor object.

Returns

MclDesc (pointer)
Object representing the MCL Model, an extended ModelDesc type (derived from parameter model).
NULL
The MCL Model could not be created. Inspect errno for more details.

Error Conditions

Available by inspection of errno.

mcl_destroy

Releases memory and system resources allocated by mcl_create().

Parameters

model (ModelDesc*)
Model descriptor object.

Typedefs

FmuData

typedef struct FmuData {
    int count;
    const char** name;
    uint32_t* binary_len;
    int* kind;
    int* mg_table;
}

FmuModel

typedef struct FmuModel {
    int mcl;
    const char* name;
    const char* version;
    int cosim;
    const char* guid;
    const char* resource_dir;
    const char* path;
    const char* handle;
    FmuSignal* signals;
    void* m_doc;
    void* adapter;
    FmuData data;
    struct (anonymous struct at dse/fmimcl/fmimcl.h:266:5) measurement;
}

FmuSignal

typedef struct FmuSignal {
    const char* name;
    uint32_t variable_vref;
    const char* variable_name;
    int variable_kind;
    int variable_dir;
    int variable_type;
    const char* variable_annotation_encoding;
}

Functions

fmimcl_adapter_create

This method creates an adapter object based on the configuration in the FMU Model object.

Parameters

fmu_model (FmuModel*)
FMU Model descriptor object.

Returns

0 (int32_t)
The related adapter was loaded by the fmimcl.
-EINVAL (-22)
No matching adapter found.

fmimcl_allocate_source

For each Signal parsed from the Signalgroup, this function creates an intermediate signal object for mapping between SignalVector and FMU Variable.

Parameters

fmu_model (FmuModel*)
FMU Model descriptor object.

fmimcl_destroy

Releases memory and system resources allocated by FMI Model Compatibility Library.

Parameters

fmu_model (FmuModel*)
FMU Model descriptor object.

fmimcl_generate_marshal_table

The FMU Signals are sorted according to the marshal groups. A source vector is already allocated of N signals. This function will create a marshal table, which is a mapping from the vector to a sequential list of signal blocks, each representing a marshal group.

Parameters

fmu_model (FmuModel*)
FMU Model descriptor object.

fmimcl_load_encoder_funcs

Parse the MarshalGroup NTL and for each Kind which supports an encoder function attempt to load the configured encoder functions to:

  • .functions.string_encode
  • .functions.string_decode

Parameters

fmu_model (FmuModel*)
FMU Model descriptor object.

fmimcl_parse

This function parses the given yaml files into a FMU Model descriptor object and into a mapping list between the signals and FMU variables.

Parameters

fmu_model (FmuModel*)
FMU Model descriptor object.