block = fmuToBlock(fmu)
block = fmuToBlock(fmu, name, value)
| Parameter | Description |
|---|---|
| fmu | a string scalar or character row vector: the path to a .fmu archive or to an already-extracted FMU directory. |
| name, value | option pairs: 'Name' (block label / library title, default the FMU model identifier), 'IconDir' (directory to extract the FMU icon into), 'LibraryFile' (also write a one-block library.json to this path), 'LibraryId' (the library id, default user.<name>). |
| Parameter | Description |
|---|---|
| block | a structure describing the generated block, in the same schema as a library.json block entry. |
fmuToBlock is the nflow FMU import assistant. It reads an FMU's modelDescription.xml and produces a native-looking nflow block: one input port per variable with causality input, one output port per output, the FMU parameters, the FMU's icon (its model.png when present, otherwise a labelled fallback), and a default path parameter pointing at the .fmu.
The generated block targets the engine's fmu handler, so placing it yields a working FMU block that simulates through the existing FMI path -- there is no new runtime. The value is authoring: an FMU becomes a first-class, named, icon'd palette block instead of a generic browse box. This pairs with the Modelica bridge, whose modelicaToFmu produces FMUs that fmuToBlock can then wrap.
With the 'LibraryFile' option, a one-block library.json is also written, ready to load in the nflow editor. Many FMUs ship no icon; in that case the render is a clean labelled fallback.
fmu = [modulepath('nflow_fmi'), '/examples/VanDerPol.fmu'];
block = fmuToBlock(fmu, 'Name', 'VanDerPol', 'LibraryFile', [tempdir(), '/vdp.json'])
src = sprintf('model FO\n output Real x(start = 1.0);\nequation\n der(x) = -x;\nend FO;\n');
fmu = modelicaToFmu(src);
block = fmuToBlock(fmu, 'Name', 'FirstOrder')
| Version | Description |
|---|---|
| 1.0.0 | initial version |