info = fmiInfo(fmu)
| Parameter | Description |
|---|---|
| fmu | a string scalar or character row vector: the path to a .fmu archive, or to an already-extracted FMU directory (a folder that contains a modelDescription.xml file at its root). |
| Parameter | Description |
|---|---|
| info | a scalar structure describing the FMU, with the fields listed below. |
fmiInfo parses the modelDescription.xml of a Functional Mock-up Unit (FMU) that follows the FMI 2.0 or 3.0 standard and returns its metadata as a Nelson structure. It performs no simulation: it only reads the static description, so it is inexpensive and safe to call for inspection before setting up a run.
The fmu argument may be given in two forms:
a path to a .fmu archive. The archive (a ZIP container) is unpacked with a ZIP-slip-hardened extractor into a fresh temporary directory, which is removed automatically before fmiInfo returns. Entries with absolute paths, drive letters, or .. traversal are rejected.
a path to an already-extracted FMU directory. In that case nothing is unpacked and the directory is read in place.
The returned structure info has the following fields:
| Field | Class | Details |
|---|---|---|
| modelIdentifier | char | the C model identifier declared by the FMU (used to locate its binary). |
| fmiVersion | char | the FMI version string reported by the FMU (for example 2.0 or 3.0). |
| coSimulation | logical | true when the FMU provides the Co-Simulation interface (required by fmiCoSimulate). |
| modelExchange | logical | true when the FMU provides the Model Exchange interface. |
| scheduledExecution | logical | true when the FMU provides the Scheduled Execution interface. |
| names | cell of char | the names of the scalar variables declared by the FMU, in declaration order. |
| valueReferences | double | the value reference of each variable (the numeric handle used by the FMI get/set calls). |
| causalities | cell of char | the causality of each variable: one of parameter, calculatedParameter, input, output, local, independent, or structuralParameter. |
| dataTypes | cell of char | the declared data type of each variable (for example Float64, Int32, Boolean, String). |
| descriptions | cell of char | the description string of each variable (empty when none is declared). |
| startValues | double | the Float64 start value of each variable, or NaN when the variable declares no start value. |
The four variable fields (names, valueReferences, causalities, dataTypes) are aligned element by element: the k-th entry of each describes the same variable. To list the outputs of an FMU, select the entries whose causality is output; those are exactly the signals recorded by fmiCoSimulate.
An error is raised when the path does not exist, when the archive cannot be extracted, or when the FMU does not contain a readable modelDescription.xml.
info = fmiInfo('VanDerPol.fmu')
info = fmiInfo('VanDerPol.fmu');
isOutput = strcmp(info.causalities, 'output');
outputs = info.names(isOutput)
info = fmiInfo('VanDerPol.fmu');
if ~info.coSimulation
error('This FMU does not provide the Co-Simulation interface.');
end
| Version | Description |
|---|---|
| 2.0.0 | initial version |