Scilab Website | Contribute with GitLab | Scilab Community | ATOMS toolboxes
Scilab Online Help
2027.0.0 - 日本語


loadFMU

load an FMU file returning its raw content.

Calling Sequence

[workdir, xml] = loadFMU(filepath)
[workdir, xml, libname] loadFMU(filepath)
[workdir, xml, libname, modelIdentifier, fmuImpl] = loadFMU(filepath, workdir)
[workdir, xml, libname, modelIdentifier] = loadFMU(filepath, workdir, fmuImpl)

Arguments

filepath

string, a path for a model.

workdir

string, a path to the extracted file content.

fmuImpl

string, the FMU versioned implementation like "me 1.0" for Model Exchange 1.0. Multiple values can be returned if the FMU supports multiple versions.

xml

xmlDocument, the XML content of modelDescription.xml.

libname

string, a path to the library used for the simulation.

modelIdentifier

string, the model identifier to pass to fmu_link.

Description

loadFMU is the function which decompress a model at TMPDIR Folder with the same name as the name of the FMU file. It also extracts the XML information of the modelDescription.xml file which contains all the information about the FMU as well as returns the path to the shared library associated with the current operating system and architecture.

The workdir can be passed around the function to retrieve part of the information at different times without unzipping the FMU multiple times.

To link and use an FMU, you shoud pass libname, modelIdentifier, fmuImpl output arguments to fmu_link and use fmu_callto manipulate the FMU.

Examples

// Decompressing the model "SCADE_CruiseControl__CruiseControl_FMU".
filepath = fullfile(SCI, "modules", "fmu", "tests", "unit_tests", "SCADE_CruiseControl__CruiseControl_FMU.fmu");
[workdir, xml] = loadFMU(filepath);

// check the xml, retrieve the inputs and outputs
in = xmlXPath(xml, "//ScalarVariable[@causality=""input""]")
out = xmlXPath(xml, "//ScalarVariable[@causality=""output""]")

// link the FMU, retrieve the type and version
[workdir, xml, libname, modelIdentifier, fmuImpl] = loadFMU(filepath, workdir);

disp(fmuImpl)
FMUs = listfiles(fullfile(SCI, "modules", "fmu", "tests", "unit_tests", "*.fmu"));

// display fmuImpl for each FMU
st = struct();
for filepath=FMUs'
    try
        [workdir, xml, libname, modelIdentifier, fmuImpl] = loadFMU(filepath);
        
        st(fmuImpl)($+1) = modelIdentifier;
        
        rmdir(workdir,'s');
    catch
        st("invalid") = modelIdentifier;
    end
end
disp(st)

See Also

  • fmu_link — (Internal) Loading the FMU library into the address space of the calling process.
  • fmu_ulink — (Internal) Freeing the loaded FMU library.
  • importFMU — Decompressing the model and parsing of XML description file.
  • fmiModelVariables — Full information about model variables.
Report an issue
<< importFMU Functional Mock-up Interface (FMU) Comparison of numerical results of simulation >>

Copyright (c) 2022-2026 (Dassault Systèmes S.E.)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Thu Oct 15 11:22:07 CEST 2026