*FMU()
Creates a functional mock-up unit (FMU) entity.
Syntax
*FMU(varname, "label", “filename”)
Arguments
- varname
- The variable name of the FMU entity.
- label
- The descriptive label for the entity.
- filename
- The FMU filename with path.
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_control, "Controller", "C:/Users/Tutorials/sb_Controller.fmu" )
*SetFMUInputs( fmu_control,{ "Angle (rad);`{j_pend_cart.AZ}+3.1416`", "Angular Velocity (rad/s);`{j_pend_cart.WZ}`", "Position (mm);`DY({b_cart.cm.id},{b_plat.cm.id})`" } )
*SetForce( frc_control, EXPR, `ARYVAL({fmu_control.y_array.idstring},1)`, LIN, , LIN )
*EndMDL()
Context
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 a very diverse range of domains and applications (http://www.fmi-standard.org/).
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.