Skip to main content

AVxcelerate Simulation Framework 2025 R2 SP02

fmu_logic

Last update: 19.09.2025
1
3
4#pragma once
5
6#include "core/lifecycle/fmu_activity/fmu_state.h"
7#include "core/lifecycle/fmu_activity/i_fmu_logic.h"
8#include <memory>
9#include <set>
10
11namespace fmi4cpp
12{
13namespace fmi2
14{
15class fmu;
16class cs_fmu;
17class cs_slave;
18} // namespace fmi2
19enum class status;
20} // namespace fmi4cpp
21
27{
28namespace core
29{
30
31namespace lifecycle
32{
33
34class FmuLogicImpl;
35
36namespace fmi = fmi4cpp::fmi2;
37
40class FmuLogic : public IFmuLogic
41{
42 public:
45 FmuLogic(const std::string& fmu_path);
46
48 virtual ~FmuLogic() override;
52
54 void SetupExperiment(double start = 0, double stop = 0, double tolerance = 0) override;
55
58
61
63 void Setup(double start = 0, double stop = 0, double tolerance = 0) override;
64
67
69 bool Step(double step_size, const FmuInOutMap& input) override;
70
72 bool Step(double step_size) override;
73
75 void SetInputs(const FmuInOutMap& inputs) override;
76
82 void SetValue(const std::string& variable_name, const T& value);
83
90
92 FmuInOutMap GetOutputs() const override;
93
98
102
106
110
114
118
122
123 private:
126};
127
128} // namespace lifecycle
129} // namespace core
130} // namespace simulation_framework
This is the concrete Topic class that can be used for creation of a communication channel with given ...
Definition topic.h:38
An implementation of the IFmuLogic interface using the FMI4cpp library.
Definition fmu_logic.h:41
void EnterInitialization() override
Call fmi2EnterInitializationMode
void SetInputs(const FmuInOutMap &inputs) override
Set the fmu inputs.
FmuState GetFmuState() const
Get the Fmu state.
void SetValue(const std::string &variable_name, const T &value)
Modify or set a parameter for a single variable in the FMU.
T GetOutput(const std::string &variable_name) const
Get the value of a single variable from the FMU.
void SetupExperiment(double start=0, double stop=0, double tolerance=0) override
Call fmi2SetupExperiment
fmi4cpp::status GetLastStatus() const
Get the status from the last fmi2 function call.
FmuInOutMap InitInOutMap(std::set< std::string > variable_names) override
Use the internal implementation to initialize the inputs or outputs with the correct underlying type.
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.
void ExitInitialization() override
Call fmi2ExitInitializationMode
FmuLogic(const std::string &fmu_path)
Constructor for FmuLogic.
double GetSimulationTime() const
Get the simulation time.
void Setup(double start=0, double stop=0, double tolerance=0) override
Call SetupExperiment, EnterInitialization, and ExitInitialization.
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
const fmi::cs_slave * GetFmuInstancePtr() const
Get the pointer to the Co-simulation FMU instance object.
FmuInOutMap GetOutputs() const override
Get all fmu outputs.
The interface for FMU Logic to be used by an FMU activity.
Definition i_fmu_logic.h:26
The namespace for all core functionalities under namespace simulation_framework.
The top namespace for simulation framework.

Connect with Ansys