Class simulation_framework::core::lifecycle::FmuBaseActivity
Last update: 22.04.2026
Definition: core/lifecycle/fmu_activity/fmu_base_activity.h (line 32)
An activity that subscribes to messages to input to an FMU and publishes the FMU output.
The configuration of the topics and which FMU variables they contain is given by the FmuConfig.
See also: FmuConfig
Inherits from:
Members
- AddPublisher
- AddPublisherAndSubscriber
- AddPublisherForTopic
- AddSubscriber
- AddSubscriberForTopic
- BaseActivity
- BaseActivity
- BaseActivity
- BaseActivity
- DecodeBytesMessage
- DecodeMessage
- EncodeBytesMessage
- EncodeMessage
- ExecuteStep
- Finalize
- FmuBaseActivity
- GetCurrentTimestamp
- GetCustomizedParameters
- GetCycleTime
- GetName
- GetSimulationOutputDirectory
- Init
- SetSimulationSettings
- SetUpCommunication
- Shutdown
- Step
- ~BaseActivity
- ~IActivity
Protected attributes
Variable fmu_config_
Definition: core/lifecycle/fmu_activity/fmu_base_activity.h (line 91)
FmuConfig simulation_framework::core::lifecycle::FmuBaseActivity::fmu_config_ {}
A struct containing information about topics and corresponding FMU variables.
Type: FmuConfig
Variable fmu_logic_
Definition: core/lifecycle/fmu_activity/fmu_base_activity.h (line 94)
std::unique_ptr<IFmuLogic> simulation_framework::core::lifecycle::FmuBaseActivity::fmu_logic_
A pointer to the logic that manages simulating the FMU.
Type: std::unique_ptr< IFmuLogic >
Variable step_size_
Definition: core/lifecycle/fmu_activity/fmu_base_activity.h (line 97)
std::optional<double> simulation_framework::core::lifecycle::FmuBaseActivity::step_size_
The step size to increment the FMU's independent variable.
Type: std::optional< double >
Variable init_param_topics_to_var_map_
Definition: core/lifecycle/fmu_activity/fmu_base_activity.h (line 100)
FmuTopicToVarMap simulation_framework::core::lifecycle::FmuBaseActivity::init_param_topics_to_var_map_ {}
A mapping of intialization parameter topics to FMU variables.
Type: FmuTopicToVarMap
Variable input_topics_to_var_map_
Definition: core/lifecycle/fmu_activity/fmu_base_activity.h (line 103)
FmuTopicToVarMap simulation_framework::core::lifecycle::FmuBaseActivity::input_topics_to_var_map_ {}
A mapping of input topics to FMU variables.
Type: FmuTopicToVarMap
Variable output_topics_to_var_map_
Definition: core/lifecycle/fmu_activity/fmu_base_activity.h (line 106)
FmuTopicToVarMap simulation_framework::core::lifecycle::FmuBaseActivity::output_topics_to_var_map_ {}
A mapping of output topics to FMU variables.
Type: FmuTopicToVarMap
Public functions
Function FmuBaseActivity
simulation_framework::core::lifecycle::FmuBaseActivity::FmuBaseActivity(const std::string &name, std::shared_ptr< CommunicationManager > communication_manager, std::unique_ptr< scheduling::ISchedulerClient > scheduler_client, FmuConfig fmu_config, std::unique_ptr< IFmuLogic > fmu_logic, const std::optional< double > step_size=std::nullopt)
Construct an FMU activity to join the simulation.
Parameters:
- name: A unique name for the activity, which is used as identifier for connections
- communication_manager: Communication Manager to enable the activity join in the communication channel
- scheduler_client: The client which receives events from the scheduler server
- fmu_config: A struct containing information about topics and corresponding FMU variables
- fmu_logic: An IFmuLogic implementation responsible for setting up and simulating the FMU
- step_size: A fixed step size to increment the FMU's independent variable. if not given, the step size will be retrieved from json scheduling configuration
Parameters:
- const std::string & name
- std::shared_ptr< CommunicationManager > communication_manager
- std::unique_ptr< scheduling::ISchedulerClient > scheduler_client
- FmuConfig fmu_config
- std::unique_ptr< IFmuLogic > fmu_logic
- const std::optional< double > step_size = std::nullopt
Return type:
Function ExecuteStep
virtual void simulation_framework::core::lifecycle::FmuBaseActivity::ExecuteStep() override
Sets FMU inputs from subscribed topics, steps the FMU, and gets FMU outputs ready for published topics.
Return type: void
Reimplements: ExecuteStep
Function Init
virtual void simulation_framework::core::lifecycle::FmuBaseActivity::Init() override
Initialize FMU parameters.
Return type: void
Reimplements: Init
Function AddPublisherAndSubscriber
virtual void simulation_framework::core::lifecycle::FmuBaseActivity::AddPublisherAndSubscriber() override
Adds publishers and subscribers of rtidds::FmuMessage based on information from FmuConfig.
Return type: void
Reimplements: AddPublisherAndSubscriber
Protected functions
Function DecodeMessage
FmuInOutMap simulation_framework::core::lifecycle::FmuBaseActivity::DecodeMessage(const rtidds::FmuMessage &message) const
Put the received FmuMessage values in a format understood by the IFmuLogic implementation.
Parameters:
- message: The published message which was received
Returns:
A map of variable names to variable values to be sent to the FMU
Parameters:
- const rtidds::FmuMessage & message
Return type: FmuInOutMap
Function EncodeMessage
rtidds::FmuMessage simulation_framework::core::lifecycle::FmuBaseActivity::EncodeMessage(const FmuInOutMap &outputs) const
Put the outputs from the IFmuLogic implementation into an FmuMessage to be published.
Parameters:
- outputs: A map of variable names to variable values from the FMU
Returns:
The message to be published
Parameters:
- const FmuInOutMap & outputs
Return type: rtidds::FmuMessage
Function DecodeBytesMessage
FmuInOutMap simulation_framework::core::lifecycle::FmuBaseActivity::DecodeBytesMessage(const rtidds::GenericBytesMessage &message) const
Put the received GenericBytes values in a format understood by the IFmuLogic implementation.
Parameters:
- message: The published message which was received
Returns:
A map of variable names to variable values to be sent to the FMU
Parameters:
- const rtidds::GenericBytesMessage & message
Return type: FmuInOutMap
Function EncodeBytesMessage
rtidds::GenericBytesMessage simulation_framework::core::lifecycle::FmuBaseActivity::EncodeBytesMessage(const FmuInOutMap &outputs) const
Put the outputs from the IFmuLogic implementation into an GenericBytes to be published.
Parameters:
- outputs: A map of variable names to variable values from the FMU
Returns:
The message to be published
Parameters:
- const FmuInOutMap & outputs
Return type: rtidds::GenericBytesMessage
Function AddSubscriberForTopic
void simulation_framework::core::lifecycle::FmuBaseActivity::AddSubscriberForTopic(const std::string &topic_name, FmuInOutMap &var_map)
Helper to add a subscriber for a topic whose values should populate the provided variable map.
Parameters:
- topic_name: Name of the topic to subscribe to
- var_map: Map to be updated when messages arrive
Parameters:
- const std::string & topic_name
- FmuInOutMap & var_map
Return type: void
Function AddPublisherForTopic
void simulation_framework::core::lifecycle::FmuBaseActivity::AddPublisherForTopic(const std::string &topic_name, const FmuInOutMap &var_map)
Helper to add a publisher for a topic whose values come from the provided variable map.
Parameters:
- topic_name: Name of the topic to publish to
- var_map: Map whose current values will be encoded and published
Parameters:
Return type: void