simulation_framework::core::lifecycle::FmuLogic Class Reference
Last update: 16.07.2025An implementation of the IFmuLogic interface using the FMI4cpp library. More...
#include <fmu_logic.h>


Public Member Functions | |
| FmuLogic (const std::string &fmu_path) | |
| Constructor for FmuLogic. | |
| void | SetupExperiment (double start=0, double stop=0, double tolerance=0) override |
Call fmi2SetupExperiment | |
| void | EnterInitialization () override |
Call fmi2EnterInitializationMode | |
| void | ExitInitialization () override |
Call fmi2ExitInitializationMode | |
| void | Setup (double start=0, double stop=0, double tolerance=0) override |
| Call SetupExperiment, EnterInitialization, and ExitInitialization. | |
| FmuInOutMap | InitInOutMap (std::set< std::string > variable_names) override |
| Use the internal implementation to initialize the inputs or outputs with the correct underlying type. | |
| bool | Step (double step_size, const FmuInOutMap &input) override |
Set the fmu inputs and step the FMU model for given step size by calling fmi2DoStep | |
| bool | Step (double step_size) override |
Step the FMU model for given step size by calling fmi2DoStep | |
| void | SetInputs (const FmuInOutMap &inputs) override |
| Set the fmu inputs. | |
| template<typename T > | |
| void | SetValue (const std::string &variable_name, const T &value) |
| Modify or set a parameter for a single variable in the FMU. | |
| template<typename T > | |
| T | GetOutput (const std::string &variable_name) const |
| Get the value of a single variable from the FMU. | |
| FmuInOutMap | GetOutputs () const override |
| Get all fmu outputs. | |
| void | GetOutputs (FmuInOutMap &requested_outputs) const override |
| Get a subset of the fmu outputs. | |
| double | GetSimulationTime () const |
| Get the simulation time. | |
| fmi4cpp::status | GetLastStatus () const |
| Get the status from the last fmi2 function call. | |
| const fmi::fmu * | GetFmuPtr () const |
| Get the pointer to the FMU object. | |
| const fmi::cs_fmu * | GetCsFmuPtr () const |
| Get the pointer to the Co-simulation FMU object. | |
| const fmi::cs_slave * | GetFmuInstancePtr () const |
| Get the pointer to the Co-simulation FMU instance object. | |
| FmuState | GetFmuState () const |
| Get the Fmu state. | |
Detailed Description
An implementation of the IFmuLogic interface using the FMI4cpp library.
Definition at line 40 of file fmu_logic.h.
Constructor & Destructor Documentation
◆ FmuLogic()
| simulation_framework::core::lifecycle::FmuLogic::FmuLogic | ( | const std::string & | fmu_path | ) |
Constructor for FmuLogic.
- Parameters
-
fmu_path The path to the FMU file
Member Function Documentation
◆ EnterInitialization()
|
overridevirtual |
Call fmi2EnterInitializationMode
Implements simulation_framework::core::lifecycle::IFmuLogic.
◆ ExitInitialization()
|
overridevirtual |
Call fmi2ExitInitializationMode
Implements simulation_framework::core::lifecycle::IFmuLogic.
◆ GetCsFmuPtr()
| const fmi::cs_fmu * simulation_framework::core::lifecycle::FmuLogic::GetCsFmuPtr | ( | ) | const |
Get the pointer to the Co-simulation FMU object.
- Returns
- The pointer to the Co-simulation FMU object
◆ GetFmuInstancePtr()
| const fmi::cs_slave * simulation_framework::core::lifecycle::FmuLogic::GetFmuInstancePtr | ( | ) | const |
Get the pointer to the Co-simulation FMU instance object.
- Returns
- The pointer to the Co-simulation FMU instance object
◆ GetFmuPtr()
| const fmi::fmu * simulation_framework::core::lifecycle::FmuLogic::GetFmuPtr | ( | ) | const |
Get the pointer to the FMU object.
- Returns
- The pointer to the FMU object
◆ GetFmuState()
| FmuState simulation_framework::core::lifecycle::FmuLogic::GetFmuState | ( | ) | const |
Get the Fmu state.
- Returns
- The current FmuState enum value
◆ GetLastStatus()
| fmi4cpp::status simulation_framework::core::lifecycle::FmuLogic::GetLastStatus | ( | ) | const |
Get the status from the last fmi2 function call.
- Returns
- The status as an
fmi4cpp::statusenumeration
◆ GetOutput()
| T simulation_framework::core::lifecycle::FmuLogic::GetOutput | ( | const std::string & | variable_name | ) | const |
Get the value of a single variable from the FMU.
- Template Parameters
-
T Type of the object. Supported types: bool,int,double,std::string,std::vector<uint8_t>
- Parameters
-
variable_name The name of the variable in the FMU
- Returns
- The value of the variable
◆ GetOutputs() [1/2]
|
overridevirtual |
Get all fmu outputs.
- Returns
- The map of outputs, where keys are variable name, and the value is the variable value
Implements simulation_framework::core::lifecycle::IFmuLogic.
◆ GetOutputs() [2/2]
|
overridevirtual |
Get a subset of the fmu outputs.
- Parameters
-
[in,out] requested_outputs The map of requested outputs, whose keys are already set to the requested subset of variables. The values will contain the output variable values.
Implements simulation_framework::core::lifecycle::IFmuLogic.
◆ GetSimulationTime()
| double simulation_framework::core::lifecycle::FmuLogic::GetSimulationTime | ( | ) | const |
Get the simulation time.
- Returns
- The value of the simulation time as a double
◆ InitInOutMap()
|
overridevirtual |
Use the internal implementation to initialize the inputs or outputs with the correct underlying type.
- Parameters
-
variable_names A set of strings of variable names to initialize
- Returns
- The map of variables with the values being initialized to the correct std::variant type
Implements simulation_framework::core::lifecycle::IFmuLogic.
◆ SetInputs()
|
overridevirtual |
Set the fmu inputs.
- Parameters
-
inputs The map of inputs to set where keys are variable name, and the value is the variable value
Implements simulation_framework::core::lifecycle::IFmuLogic.
◆ Setup()
|
overridevirtual |
Call SetupExperiment, EnterInitialization, and ExitInitialization.
- Parameters
-
start The fixed initial value of the independent variable stop The final value of the independent variable tolerance The tolerance when using a numerical integration scheme. Can be ignored for co-simulation.
Implements simulation_framework::core::lifecycle::IFmuLogic.
◆ SetupExperiment()
|
overridevirtual |
Call fmi2SetupExperiment
- Parameters
-
start The fixed initial value of the independent variable stop The final value of the independent variable tolerance The tolerance when using a numerical integration scheme. Can be ignored for co-simulation.
Implements simulation_framework::core::lifecycle::IFmuLogic.
◆ SetValue()
| void simulation_framework::core::lifecycle::FmuLogic::SetValue | ( | const std::string & | variable_name, |
| const T & | value | ||
| ) |
Modify or set a parameter for a single variable in the FMU.
- Template Parameters
-
T Type of the object. Supported types: bool,int,double,std::string,std::vector<uint8_t>
- Parameters
-
variable_name The name of the variable in the FMU value The value of the variable to set
◆ Step() [1/2]
Step the FMU model for given step size by calling fmi2DoStep
- Parameters
-
step_size The update interval of the independent variable
- Returns
- A boolean value indicating whether the step was successful
Implements simulation_framework::core::lifecycle::IFmuLogic.
◆ Step() [2/2]
|
overridevirtual |
Set the fmu inputs and step the FMU model for given step size by calling fmi2DoStep
- Parameters
-
step_size The update interval of the independent variable input The map of inputs to set where keys are variable name, and the value is the variable value
- Returns
- A boolean value indicating whether the step was successful
Implements simulation_framework::core::lifecycle::IFmuLogic.
The documentation for this class was generated from the following file: