Main Content

Simulink.SFunctionBuilder.generateFMU

Generate FMU compatible with FMI 3.0 standards from C/C++ code using S-Function Builder block

Since R2023b

    Description

    Simulink.SFunctionBuilder.generateFMU(blk) generates a standalone co-simulation FMU that is compatible with FMI 3.0 standards for the specified S-Function Builder block blk.

    The following limitations apply for this function:

    • Continuous states are not supported for Co-simulation FMU

    • Access to SimStruct is not supported

    Note

    This function requires the FMU Builder for Simulink® support package.

    For an example of generating an FMU from C/C++ using Simulink.SFunctionBuilder.generateFMU, see Generate FMU from C/C++ Code Using S-Function Builder (Simulink Compiler).

    Simulink.SFunctionBuilder.generateFMU(blk, Name,Value) generates FMU that is compatible with FMI 3.0 standards with additional options.

    Input Arguments

    collapse all

    S-Function Builder block, specified as a block handle or as a string or a character vector that defines the block path.

    Tips

    • To get the block handle for a block in your model, use the getSimulinkBlockHandle function.

    • To get the block handle for the most recently selected or added block, use the gcbh function.

    Name-Value Arguments

    Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

    Example: Simulink.SFunctionBuilder.generateFMU(gcd, 'FMUType', 'ModelExchange') generates a model exchange FMU that is compatible with FMI 3.0 standards.

    Specify the FMI version for the generated FMU.

    Data Types: char | string

    Specify the solver type for the generated FMU. Use 'CS' or ''Co-Simulation' to generate a standalone co-simulation FMU. Use 'ME' or 'ModelExchange' to generate a model exchange FMU.

    Note

    Co-simulation FMU only supports S-Function Builder with discrete states and Discrete sample mode.

    Data Types: char | string

    Specify author name for the generated FMU. It is added to the modelDescription.xml file of the FMU.

    Data Types: char | string

    Specify a short description for the generated FMU. It is added to the modelDescription.xml file of the FMU and appears as the FMU description on the block dialog of FMU import block when it is used to import the generated FMU.

    Data Types: char | string

    Specify copyright for the generated FMU. It is added to the modelDescription.xml file of the FMU.

    Data Types: char | string

    Specify license for the generated FMU. It is added to the modelDescription.xml file of the FMU.

    Data Types: char | string

    Specify the path to the icon file for the generated FMU.

    Data Types: char | string

    Version History

    Introduced in R2023b