Skip to main content

optiSLang 3D Postprocessing Script API 2025 R1

FMU Class Reference

Last update: 16.07.2025

Public Member Functions

 addScalarVariable (string name, string type, string causality, string variability, string description, number min=0, number max=0, number start=0)
 Add a scalar variable to the FMU, see the FMI documentation at https://fmi-standard.org for details on the scalar variable description schema. More...
 
 FMU ()
 Create an FMU 2.0 (Functional Mockup Unit, https://fmi-standard.org). More...
 
 setAuthor (string author)
 Set m_model_name.
 
 setDllPath (string path)
 Set the path pointing to the SoS libraries. An auto-detection attempt is performed on FMU construction.
 
 setModelDescription (string model_description)
 Set m_model_name.
 
 setModelName (string model_name)
 Set m_model_name.
 
 setScript (string code)
 Writes the script code to a temporary file and calls setScriptFile(). Only use either of setScript or setScriptFile. More...
 
 setScriptFile (string filename)
 Set the absolute path to an existing script file to be included with the .fmu archive. Only use either of setScript or setScriptFile.
 
bool writeFMU (string archive, bool includeEntireDatabase=false, bool replace_files=false)
 Write the .fmu archive file to disk. More...
 

Constructor & Destructor Documentation

◆ FMU()

FMU ( )

Create an FMU 2.0 (Functional Mockup Unit, https://fmi-standard.org).

Usage:

  • addScalarVariable to add scalar input and output variables.
  • setScript to set code to be executed by the FMU (calls setScriptFile
  • setScriptFile to create an FMU from a given script file
  • writeFMU to write the .fmu archvive file.

Member Function Documentation

◆ addScalarVariable()

addScalarVariable ( string  name,
string  type,
string  causality,
string  variability,
string  description,
number  min = 0,
number  max = 0,
number  start = 0 
)

Add a scalar variable to the FMU, see the FMI documentation at https://fmi-standard.org for details on the scalar variable description schema.

Parameters
nameVariable name
typeVariable type: supporting String or Real
causalityFor SoS FMUs this is either "input" or "output".
variabilitySoS FMUs support "discrete" variability only.
descriptionVariable description.
minThe variable's lower bound.
maxThe variable's upper bound.
startThe variables's default value.

◆ setScript()

setScript ( string  code)

Writes the script code to a temporary file and calls setScriptFile(). Only use either of setScript or setScriptFile.

Parameters
codeThe script code to be executed by the FMU.

◆ writeFMU()

bool writeFMU ( string  archive,
bool  includeEntireDatabase = false,
bool  replace_files = false 
)

Write the .fmu archive file to disk.

Parameters
archiveA absolute or relative path to the archive to be written.
includeEntireDatabaseIf false, a reduced .sdb database file, containing minimal Information (e.g. no designs), is included with the .fmu archive.
replace_filesIf false, an already existing .fmu archive is not overwritten. Instead an error message is displayed.

Connect with Ansys