Skip to main content

AVxcelerate Simulation Framework 2026 R1 SP01

Class simulation_framework::core::lifecycle::FmuLogic

Last update: 22.04.2026

Definition: core/lifecycle/fmu_activity/fmu_logic.h (line 42)

An implementation of the IFmuLogic interface using the FMI4cpp library.

Inherits from:

Members

Public functions

Function FmuLogic

simulation_framework::core::lifecycle::FmuLogic::FmuLogic(const std::string &fmu_path)

Constructor for FmuLogic.

Parameters:

  • fmu_path: The path to the FMU file

Parameters:

  • const std::string & fmu_path

Return type:

Function SetupExperiment

void simulation_framework::core::lifecycle::FmuLogic::SetupExperiment(double start=0, double stop=0, double tolerance=0) override

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.

Parameters:

Return type: void

Reimplements: SetupExperiment

Function EnterInitialization

void simulation_framework::core::lifecycle::FmuLogic::EnterInitialization() override

Call fmi2EnterInitializationMode

Return type: void

Reimplements: EnterInitialization

Function ExitInitialization

void simulation_framework::core::lifecycle::FmuLogic::ExitInitialization() override

Call fmi2ExitInitializationMode

Return type: void

Reimplements: ExitInitialization

Function Setup

void simulation_framework::core::lifecycle::FmuLogic::Setup(double start=0, double stop=0, double tolerance=0) override

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.

Parameters:

Return type: void

Reimplements: Setup

Function InitInOutMap

FmuInOutMap simulation_framework::core::lifecycle::FmuLogic::InitInOutMap(std::set< std::string > variable_names) override

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

Parameters:

  • std::set< std::string > variable_names

Return type: FmuInOutMap

Reimplements: InitInOutMap

Function Step

bool simulation_framework::core::lifecycle::FmuLogic::Step(double step_size, const FmuInOutMap &input) override

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

Parameters:

Return type: bool

Reimplements: Step

Function Step

bool simulation_framework::core::lifecycle::FmuLogic::Step(double step_size) override

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

Parameters:

Return type: bool

Reimplements: Step

Function SetInitializationParams

void simulation_framework::core::lifecycle::FmuLogic::SetInitializationParams(const FmuInOutMap &params) override

Set the fmu initialization parameters.

Parameters:

  • params: The map of initialization parameters to set where keys are variable name, and the value is the variable value

Parameters:

  • const FmuInOutMap & params

Return type: void

Reimplements: SetInitializationParams

Function SetInputs

void simulation_framework::core::lifecycle::FmuLogic::SetInputs(const FmuInOutMap &inputs) override

Set the fmu inputs.

Parameters:

  • inputs: The map of inputs to set where keys are variable name, and the value is the variable value

Parameters:

  • const FmuInOutMap & inputs

Return type: void

Reimplements: SetInputs

Function 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.

parameterlist {"type":"element","name":"parameterlist","attributes":{"kind":"templateparam"},"children":[{"type":"element","name":"parameteritem","attributes":{},"children":[{"type":"text","text":"\n"},{"type":"element","name":"parameternamelist","attributes":{},"children":[{"type":"text","text":"\n"},{"type":"element","name":"parametername","attributes":{},"children":[{"type":"text","text":"T"}]},{"type":"text","text":"\n"}]},{"type":"text","text":"\n"},{"type":"element","name":"parameterdescription","attributes":{},"children":[{"type":"text","text":"\n"},{"type":"element","name":"para","attributes":{},"children":[{"type":"text","text":"Type of the object. Supported types: "},{"type":"element","name":"computeroutput","attributes":{},"children":[{"type":"text","text":"bool"}]},{"type":"text","text":", "},{"type":"element","name":"computeroutput","attributes":{},"children":[{"type":"text","text":"int"}]},{"type":"text","text":", "},{"type":"element","name":"computeroutput","attributes":{},"children":[{"type":"text","text":"double"}]},{"type":"text","text":", "},{"type":"element","name":"computeroutput","attributes":{},"children":[{"type":"text","text":"std::string"}]},{"type":"text","text":", "},{"type":"element","name":"computeroutput","attributes":{},"children":[{"type":"text","text":"std::vector<uint8_t>"}]},{"type":"text","text":" "}]},{"type":"text","text":"\n"}]},{"type":"text","text":"\n"}]},{"type":"text","text":"\n"}]}

Parameters:

  • variable_name: The name of the variable in the FMU
  • value: The value of the variable to set

Parameters:

Return type: void

Function GetOutput

T simulation_framework::core::lifecycle::FmuLogic::GetOutput(const std::string &variable_name) const

Get the value of a single variable from the FMU.

parameterlist {"type":"element","name":"parameterlist","attributes":{"kind":"templateparam"},"children":[{"type":"element","name":"parameteritem","attributes":{},"children":[{"type":"text","text":"\n"},{"type":"element","name":"parameternamelist","attributes":{},"children":[{"type":"text","text":"\n"},{"type":"element","name":"parametername","attributes":{},"children":[{"type":"text","text":"T"}]},{"type":"text","text":"\n"}]},{"type":"text","text":"\n"},{"type":"element","name":"parameterdescription","attributes":{},"children":[{"type":"text","text":"\n"},{"type":"element","name":"para","attributes":{},"children":[{"type":"text","text":"Type of the object. Supported types: "},{"type":"element","name":"computeroutput","attributes":{},"children":[{"type":"text","text":"bool"}]},{"type":"text","text":", "},{"type":"element","name":"computeroutput","attributes":{},"children":[{"type":"text","text":"int"}]},{"type":"text","text":", "},{"type":"element","name":"computeroutput","attributes":{},"children":[{"type":"text","text":"double"}]},{"type":"text","text":", "},{"type":"element","name":"computeroutput","attributes":{},"children":[{"type":"text","text":"std::string"}]},{"type":"text","text":", "},{"type":"element","name":"computeroutput","attributes":{},"children":[{"type":"text","text":"std::vector<uint8_t>"}]},{"type":"text","text":" "}]},{"type":"text","text":"\n"}]},{"type":"text","text":"\n"}]},{"type":"text","text":"\n"}]}

Parameters:

  • variable_name: The name of the variable in the FMU

Returns:

The value of the variable

Parameters:

  • const std::string & variable_name

Return type: T

Function GetOutputs

FmuInOutMap simulation_framework::core::lifecycle::FmuLogic::GetOutputs() const override

Get all fmu outputs.

Returns:

The map of outputs, where keys are variable name, and the value is the variable value

Return type: FmuInOutMap

Reimplements: GetOutputs

Function GetOutputs

void simulation_framework::core::lifecycle::FmuLogic::GetOutputs(FmuInOutMap &requested_outputs) const override

Get a subset of the fmu outputs.

Parameters:

  • 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.

Parameters:

  • FmuInOutMap & requested_outputs

Return type: void

Reimplements: GetOutputs

Function GetSimulationTime

double simulation_framework::core::lifecycle::FmuLogic::GetSimulationTime() const

Get the simulation time.

Returns:

The value of the simulation time as a double

Return type: double

Function 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::status enumeration

Return type: fmi4cpp::status

Function 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

Return type: const fmi::fmu *

Function 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

Return type: const fmi::cs_fmu *

Function 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

Return type: const fmi::cs_slave *

Function GetFmuState

FmuState simulation_framework::core::lifecycle::FmuLogic::GetFmuState() const override

Get the Fmu state.

Returns:

The current FmuState enum value

Return type: FmuState

Reimplements: GetFmuState

Connect with Ansys