Description

Collaboration diagram for FMI 2.0 support:

Classes

class  chrono::fmi2::ChOutputFMU
 Class for serializing variables to FmuComponentBase. More...
 
class  chrono::fmi2::FmuChronoComponentBase
 Extension of FmuComponentBase class for Chrono FMUs. More...
 
class  chrono::fmi2::FmuChronoUnit
 Extension of FmuUnit class for Chrono FMUs. More...
 

Macros

#define ADD_BVAL_AS_FMU_GETSET(returnType, codeGet, codeSet)
 
#define ADD_BVAL_AS_FMU_POINTER(returnType)
 

Typedefs

using chrono::fmi2::FmuVariable = fmu_tools::fmi2::FmuVariable
 

Functions

void chrono::fmi2::FmuChronoComponentBase::AddFmuVisualShapes (const ChPhysicsItem &pi, std::string custom_pi_name="")
 Add FMU variables corresponding to the visual shapes attached to the specified ChPhysicsItem. More...
 
void chrono::fmi2::FmuChronoComponentBase::AddFmuVisualShapes (const ChAssembly &ass)
 Add FMU variables corresponding to the visual shapes attached to the specified ChAssembly. More...
 

Variables

const std::unordered_map< chrono::ChVariabilityType, FmuVariable::VariabilityType > chrono::fmi2::VariabilityType_conv
 
const std::unordered_map< chrono::ChCausalityType, FmuVariable::CausalityType > chrono::fmi2::CausalityType_conv
 
static const std::unordered_set< std::string > chrono::fmi2::FmuChronoComponentBase::supported_shape_types
 list of supported shapes for visualization, required to provide a memory position to getters of shape type More...
 

Macro Definition Documentation

◆ ADD_BVAL_AS_FMU_GETSET

#define ADD_BVAL_AS_FMU_GETSET (   returnType,
  codeGet,
  codeSet 
)
Value:
_fmucomp->AddFmuVariable( \
std::make_pair(std::function<fmi2##returnType(void)>([bVal]() -> fmi2##returnType codeGet), \
std::function<void(fmi2##returnType)>([bVal](fmi2##returnType val) codeSet)), \
getCurrentVarName(bVal.name()), FmuVariable::Type::returnType, "", "", \
CausalityType_conv.at(bVal.GetCausality()), VariabilityType_conv.at(bVal.GetVariability()));

◆ ADD_BVAL_AS_FMU_POINTER

#define ADD_BVAL_AS_FMU_POINTER (   returnType)
Value:
_fmucomp->AddFmuVariable(&(bVal.value()), getCurrentVarName(bVal.name()), FmuVariable::Type::returnType, "", "", \
CausalityType_conv.at(bVal.GetCausality()), \
VariabilityType_conv.at(bVal.GetVariability()));

Function Documentation

◆ AddFmuVisualShapes() [1/2]

void chrono::fmi2::FmuChronoComponentBase::AddFmuVisualShapes ( const ChAssembly ass)

Add FMU variables corresponding to the visual shapes attached to the specified ChAssembly.

Refer to the AddFmuVisualShapes(ChPhysicsItem) function for details on the variables created.

◆ AddFmuVisualShapes() [2/2]

void chrono::fmi2::FmuChronoComponentBase::AddFmuVisualShapes ( const ChPhysicsItem pi,
std::string  custom_pi_name = "" 
)

Add FMU variables corresponding to the visual shapes attached to the specified ChPhysicsItem.

Variables with the following names are created for each visual shape:

  • VISUALIZER[i].frame.pos.[x|y|z]: position from global to shape local frame in global reference frame
  • VISUALIZER[i].frame.rot.[e0|e1|e2|e3]]: rotation from shape local to global frame
  • VISUALIZER[i].shape.type [fmi2String]: one of the supported_shape_types
  • VISUALIZER[i].owner [fmi2String]: owner of the shape, either custom_pi_name or from ChPhysicsItem::GetName()
  • VISUALIZER[i].owner_id [fmi2String]: id of the owner ChPhysicsItem
  • VISUALIZER[i].shape.<shape-specific variables>: depends on the shape type Variables are of fmi2Real type if not otherwise specified.

Variable Documentation

◆ CausalityType_conv

const std::unordered_map<chrono::ChCausalityType, FmuVariable::CausalityType> chrono::fmi2::CausalityType_conv
Initial value:
= {
{chrono::ChCausalityType::parameter, FmuVariable::CausalityType::parameter},
{chrono::ChCausalityType::calculatedParameter, FmuVariable::CausalityType::calculatedParameter},
{chrono::ChCausalityType::input, FmuVariable::CausalityType::input},
{chrono::ChCausalityType::output, FmuVariable::CausalityType::output},
{chrono::ChCausalityType::local, FmuVariable::CausalityType::local},
{chrono::ChCausalityType::independent, FmuVariable::CausalityType::independent}}

◆ supported_shape_types

const std::unordered_set< std::string > chrono::fmi2::FmuChronoComponentBase::supported_shape_types
staticprotected
Initial value:
= {
"ChVisualShapeModelFile", "ChVisualShapeTriangleMesh",
"ChVisualShapeSurface", "ChVisualShapeSphere",
"ChVisualShapeEllipsoid", "ChVisualShapeCylinder",
"ChVisualShapeCapsule", "ChVisualShapeBox",
"ChVisualShapeBarrel", "ChGlyphs",
"ChVisualShapePath", "ChVisualShapeLine",
"ChVisualShapeUNKNOWN"}

list of supported shapes for visualization, required to provide a memory position to getters of shape type

◆ VariabilityType_conv

const std::unordered_map<chrono::ChVariabilityType, FmuVariable::VariabilityType> chrono::fmi2::VariabilityType_conv
Initial value:
= {
{chrono::ChVariabilityType::constant, FmuVariable::VariabilityType::constant},
{chrono::ChVariabilityType::fixed, FmuVariable::VariabilityType::fixed},
{chrono::ChVariabilityType::tunable, FmuVariable::VariabilityType::tunable},
{chrono::ChVariabilityType::discrete, FmuVariable::VariabilityType::discrete},
{chrono::ChVariabilityType::continuous, FmuVariable::VariabilityType::continuous}}