10#ifndef COSIM_FMI_V2_FMU_HPP
11#define COSIM_FMI_V2_FMU_HPP
65 fmu& operator=(
const fmu&) =
delete;
67 fmu& operator=(
fmu&&) =
delete;
78 std::string_view instanceName)
override
80 return std::static_pointer_cast<fmi::slave_instance>(
93 std::string_view instanceName);
105 fmi2_import_t* handle_;
136 std::optional<time_point> stopTime,
137 std::optional<double> relativeTolerance)
override;
143 gsl::span<const value_reference> variables,
144 gsl::span<double> values)
const override;
146 gsl::span<const value_reference> variables,
147 gsl::span<int> values)
const override;
149 gsl::span<const value_reference> variables,
150 gsl::span<bool> values)
const override;
152 gsl::span<const value_reference> variables,
153 gsl::span<std::string> values)
const override;
156 gsl::span<const value_reference> variables,
157 gsl::span<const double> values)
override;
159 gsl::span<const value_reference> variables,
160 gsl::span<const int> values)
override;
162 gsl::span<const value_reference> variables,
163 gsl::span<const bool> values)
override;
165 gsl::span<const value_reference> variables,
166 gsl::span<const std::string> values)
override;
171 return std::static_pointer_cast<fmi::fmu>(
v2_fmu());
182 fmi2_import_t* handle_;
184 bool setupComplete_ =
false;
185 bool simStarted_ =
false;
An interface for classes that represent imported FMUs.
Definition: fmu.hpp:52
Imports and caches FMUs.
Definition: importer.hpp:43
An FMI co-simulation slave instance.
Definition: fmu.hpp:74
A class which represents an imported FMI 2.0 FMU.
Definition: fmu.hpp:54
fmi2_import_t * fmilib_handle() const
Returns the underlying C API handle (for FMI Library)
cosim::filesystem::path directory() const
Returns the path to the directory in which this FMU was unpacked.
std::shared_ptr< v2::slave_instance > instantiate_v2_slave(std::string_view instanceName)
Creates a new co-simulation slave instance.
fmi::fmi_version fmi_version() const override
Which FMI standard version is used in this FMU.
std::shared_ptr< fmi::slave_instance > instantiate_slave(std::string_view instanceName) override
Creates a co-simulation slave instance of this FMU.
Definition: fmu.hpp:77
std::shared_ptr< fmi::importer > importer() const override
The fmi::importer which was used to import this FMU.
std::shared_ptr< const cosim::model_description > model_description() const override
A description of this FMU.
An FMI 2.0 co-simulation slave instance.
Definition: fmu.hpp:118
void get_boolean_variables(gsl::span< const value_reference > variables, gsl::span< bool > values) const override
Retrieves the values of boolean variables.
std::shared_ptr< fmi::fmu > fmu() const override
Returns a reference to the FMU of which this is an instance.
Definition: fmu.hpp:169
fmi2_import_t * fmilib_handle() const
Returns the underlying C API handle (for FMI Library)
void setup(time_point startTime, std::optional< time_point > stopTime, std::optional< double > relativeTolerance) override
Instructs the slave to perform pre-simulation setup and enter initialisation mode.
void set_string_variables(gsl::span< const value_reference > variables, gsl::span< const std::string > values) override
Sets the values of string variables.
void get_real_variables(gsl::span< const value_reference > variables, gsl::span< double > values) const override
Retrieves the values of real variables.
void start_simulation() override
Informs the slave that the initialisation stage ends and the simulation begins.
void get_integer_variables(gsl::span< const value_reference > variables, gsl::span< int > values) const override
Retrieves the values of integer variables.
step_result do_step(time_point currentT, duration deltaT) override
Performs model calculations for the time step which starts at the time point currentT and has a durat...
void get_string_variables(gsl::span< const value_reference > variables, gsl::span< std::string > values) const override
Retrieves the values of string variables.
void set_integer_variables(gsl::span< const value_reference > variables, gsl::span< const int > values) override
Sets the values of integer variables.
std::shared_ptr< v2::fmu > v2_fmu() const
Returns the same object as fmu(), only statically typed as a v2::fmu().
void set_boolean_variables(gsl::span< const value_reference > variables, gsl::span< const bool > values) override
Sets the values of boolean variables.
void end_simulation() override
Informs the slave that the simulation run has ended.
void set_real_variables(gsl::span< const value_reference > variables, gsl::span< const double > values) override
Sets the values of real variables.
Defines a version-independent FMU interface.
fmi_version
Constants that refer to FMI version numbers.
Definition: fmu.hpp:28
FMU import functionality.
Model-descriptive types and constants.
Top-level libcosim namespace.
Definition: algorithm.hpp:27
step_result
Possible outcomes of a subsimulator time step.
Definition: model_description.hpp:205
A description of a model.
Definition: model_description.hpp:180
Time-related functions and types.