*FMU()

Creates a functional mock-up unit (FMU) entity.

Syntax

*FMU(varname, "label", “filename”, [fmu_type], [{“input_1”,”input_2”,..”input_k”}], [{“par_1”,”par_2”…”par_n”]})
Note: [] indicates optional arguments

Arguments

varname
The variable name of the FMU entity.
Data type: varname
label
The descriptive label for the entity.
Data type: String
filename
The FMU filename with path.
Data type: File
fmu_type
Valid values are: ModelExchange | CoSimulation.
Keyword suggesting the type of FMU to be used during solution in case FMU has both ModelExchange and CoSimulation.
Data type: String
{"input_1", "input_2"…, "input_k"}
An input array vector with solver expression acting as input the FMU.
Data type: string vector
par_1, par_2 …, par_n
A vector array of parameter values to be passed to the FMU to set initial states.
Data type: string vector

Example

*BeginMDL( the_model, "Model", "2019.1" )
  *Point( p_0, "Point 0" )
  *Body( b_0, "Body 0", p_0, , , ,  )
  *Graphic( gbox_0, "Box 0", BOX, b_0, CENTER, p_0, ZX, POINT, P_Global_Origin, VECTOR, V_Global_X, 1, 1, 1, 3 )
  *TransJoint( j_0, "Joint 0", b_0, B_Ground, p_1, VECTOR, V_Global_X )
  *Point( p_1, "Point 1" )
  *ActionOnlyForce( frc_0, "Force 0", TRANS, b_0, p_4, Global_Frame )
  *Point( p_2, "Point 2" )
  *CoilSpring( sd_0, "SpringDamper 0", b_0, B_Ground, p_2, p_3 )
  *Point( p_3, "Point 3" )
  *Point( p_4, "Point 4" )
  *ActionOnlyForce( frc_pid, "PID", TRANS, b_0, p_2, Global_Frame )
  *Marker( m_0, "Marker 0", B_Ground, p_0 )
  *SetPoint( p_0,                        , , 1.5 )
  *SetPoint( p_1,                        , , 1 )
  *SetPoint( p_2,                        -0.5, , 1.5 )
  *SetPoint( p_3,                        -1, , 1.5 )
  *SetBodyInertia( b_0,                        1, 1e4, 1e4, 1e4 )
  *SetCoilSpring( sd_0,                       LIN, 20, LIN, 10 )
  *SetPoint( p_4,                        0.5, , 1.5 )
  *SetForce( frc_0,                      LIN, 1, LIN, , LIN )
  *FMU( fmu_0, "FMU 0", "C:/PID/sb_PID.fmu", ModelExchange, {"1-DX({b_0.cm.idstring},{m_0.idstring})", “DY({b_0.cm.idstring},{m_0.idstring})”, “DZ({b_0.cm.idstring},{m_0.idstring})” }, {“0.5”, “true”, “1”} )
  *SetForce( frc_pid,                    EXPR, `ARYVAL({fmu_0.y_array.idstring},1)`, LIN, , LIN )
  
*EndMDL()

In the above example, the FMU is “connected” to the rest of the model through the input array, {"1-DX({b_0.cm.idstring},{m_0.idstring})", “DY({b_0.cm.idstring},{m_0.idstring})”, “DZ({b_0.cm.idstring},{m_0.idstring})” } which acts as input to the FMU and through the ARYVAL solver expression to the force entity frc_pid. The ARYVAL function ARYVAL({fmu_0.y_array.idstring},1) refers to the 1st index of the output array of the FMU.

Context

*BeginMdl()

*DefineAssembly()

*DefineSystem()

*DefineAnalysis()

Properties

Property Returns Data Type Description
varname varname The variable name of the FMU.
label string The label of the FMU.
state Boolean Indicates the active/inactive state.
id integer The assigned ID of the entity.
idstring string The assigned ID in string form.
num_inputs string The number of inputs in the FMU.
num_states string The number of states in the FMU.
num_outputs string The number of outputs in the FMU.
num_params integer The number of parameters in the FMU.
filename file The FMU filename.
type string The type of FMU. MODEL_EXCHANGE or CO-SIMULATION.
x_array Solver Array States array.
y_array Solver Array Output array.
u_array Solver Array Input array.
static_hold Boolean A flag to hold the value of the FMU's dynamic states constant during a static or quasi-static simulation.
error_tolerance_factor real A scale factor that is multiplied to the displacement integration error tolerance define the integration error tolerance for the continuous states of the FMU.
fmu_communication_interval real The time interval of communication between the solver and FMU.
use_address Boolean Flag to use a different machine address where the FMU is run.
ip_address string The ip address of the machine where the FMU is run.

Comments

A Functional Mockup Unit (FMU) is an abstract representation of a dynamic system based on a tool independent standard interface called Functional Mockup Interface (FMI). An FMU enables exchange of models from very diverse range of domains and applications.

FMU seeks an array of input and provides an array of outputs. It can also have parameters that can be used to alter the initial state of the system. The FMU is a zipped package that contains the binaries and resources that solve the dynamic system along with model description in modelDescription.xml. This XML contains information on the number of inputs, outputs, parameters and states in the system.

An FMU could be of the type ModelExchange or CoSimulation or have both types. In the case of FMU having both types, use the fmu_type keyword to select the type to be used for the solution. If it not specified, ModelExchange will be used as default.

Input array if not provided will have values of zero as default.

Parameter values if not provided will take the default values as specified in the FMU. Parameters could be of type real, integer, Boolean or string

The number of entries in the vector of input/parameters should match the number of inputs/parameters in the FMU

Use the *SetFMU() statement to set simulation parameters of the FMU.

See the Control: FMU > XML Format topic in the MotionSolve Reference Guide for additional information.