|
libcosim 0.8.2
C++ library for distributed co-simulation
|
An FMI 2.0 co-simulation slave instance. More...
#include <cosim/fmi/v2/fmu.hpp>
Public Member Functions | |
| slave_instance (const slave_instance &)=delete | |
| slave_instance & | operator= (const slave_instance &)=delete |
| slave_instance (slave_instance &&)=delete | |
| slave_instance & | operator= (slave_instance &&)=delete |
| 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. More... | |
| void | start_simulation () override |
| Informs the slave that the initialisation stage ends and the simulation begins. More... | |
| void | end_simulation () override |
| Informs the slave that the simulation run has ended. More... | |
| 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 duration of deltaT. More... | |
| void | get_real_variables (gsl::span< const value_reference > variables, gsl::span< double > values) const override |
| Retrieves the values of real variables. More... | |
| void | get_integer_variables (gsl::span< const value_reference > variables, gsl::span< int > values) const override |
| Retrieves the values of integer variables. More... | |
| void | get_boolean_variables (gsl::span< const value_reference > variables, gsl::span< bool > values) const override |
| Retrieves the values of boolean variables. More... | |
| void | get_string_variables (gsl::span< const value_reference > variables, gsl::span< std::string > values) const override |
| Retrieves the values of string variables. More... | |
| void | set_real_variables (gsl::span< const value_reference > variables, gsl::span< const double > values) override |
| Sets the values of real variables. More... | |
| void | set_integer_variables (gsl::span< const value_reference > variables, gsl::span< const int > values) override |
| Sets the values of integer variables. More... | |
| void | set_boolean_variables (gsl::span< const value_reference > variables, gsl::span< const bool > values) override |
| Sets the values of boolean variables. More... | |
| void | set_string_variables (gsl::span< const value_reference > variables, gsl::span< const std::string > values) override |
| Sets the values of string variables. More... | |
| std::shared_ptr< fmi::fmu > | fmu () const override |
| Returns a reference to the FMU of which this is an instance. More... | |
| std::shared_ptr< v2::fmu > | v2_fmu () const |
Returns the same object as fmu(), only statically typed as a v2::fmu(). | |
| fmi2_import_t * | fmilib_handle () const |
| Returns the underlying C API handle (for FMI Library) | |
Public Member Functions inherited from cosim::fmi::slave_instance | |
| cosim::model_description | model_description () const final override |
| Returns a model description. More... | |
Friends | |
| std::shared_ptr< slave_instance > | fmu::instantiate_v2_slave (std::string_view) |
An FMI 2.0 co-simulation slave instance.
|
virtualnoexcept |
Reimplemented from cosim::fmi::slave_instance.
|
overridevirtual |
Performs model calculations for the time step which starts at the time point currentT and has a duration of deltaT.
If this is not the first time step, it can be assumed that the previous time step ended at currentT. It can also be assumed that currentT is greater than or equal to the start time, and currentT+deltaT is less than or equal to the stop time, specified in the setup() call.
Implements cosim::slave.
|
overridevirtual |
Informs the slave that the simulation run has ended.
Implements cosim::slave.
|
inlineoverridevirtual |
Returns a reference to the FMU of which this is an instance.
Implements cosim::fmi::slave_instance.
|
overridevirtual |
Retrieves the values of boolean variables.
On return, the values array will be filled with the values of the variables specified in variables, in the same order.
variables.size() == values.size() Implements cosim::slave.
|
overridevirtual |
Retrieves the values of integer variables.
On return, the values array will be filled with the values of the variables specified in variables, in the same order.
variables.size() == values.size() Implements cosim::slave.
|
overridevirtual |
Retrieves the values of real variables.
On return, the values array will be filled with the values of the variables specified in variables, in the same order.
variables.size() == values.size() Implements cosim::slave.
|
overridevirtual |
Retrieves the values of string variables.
On return, the values array will be filled with the values of the variables specified in variables, in the same order.
variables.size() == values.size() Implements cosim::slave.
|
overridevirtual |
Sets the values of boolean variables.
This will set the value of each variable specified in the variables array to the value given in the corresponding element of values.
The function may throw nonfatal_bad_value to indicate that one or more values were out of range or invalid, but that these values have been accepted or ignored so the simulation can proceed.
variables.size() == values.size() Implements cosim::slave.
|
overridevirtual |
Sets the values of integer variables.
This will set the value of each variable specified in the variables array to the value given in the corresponding element of values.
The function may throw nonfatal_bad_value to indicate that one or more values were out of range or invalid, but that these values have been accepted or ignored so the simulation can proceed.
variables.size() == values.size() Implements cosim::slave.
|
overridevirtual |
Sets the values of real variables.
This will set the value of each variable specified in the variables array to the value given in the corresponding element of values.
The function may throw nonfatal_bad_value to indicate that one or more values were out of range or invalid, but that these values have been accepted or ignored so the simulation can proceed.
variables.size() == values.size() Implements cosim::slave.
|
overridevirtual |
Sets the values of string variables.
This will set the value of each variable specified in the variables array to the value given in the corresponding element of values.
The function may throw nonfatal_bad_value to indicate that one or more values were out of range or invalid, but that these values have been accepted or ignored so the simulation can proceed.
variables.size() == values.size() Implements cosim::slave.
|
overridevirtual |
Instructs the slave to perform pre-simulation setup and enter initialisation mode.
This function is called when the slave has been added to an execution. The arguments startTime and stopTime represent the time interval inside which the slave's model equations are required to be valid. (In other words, it is guaranteed that do_step() will never be called with a time point outside this interval.)
| [in] | startTime | The earliest possible time point for the simulation. |
| [in] | stopTime | The latest possible time point for the simulation. May be left unspecified if there is no defined stop time. |
| [in] | relativeTolerance | If specified, this contains the relative tolerance of the step size controller. The slave may then use this for error control in its internal integrator. |
Implements cosim::slave.
|
overridevirtual |
Informs the slave that the initialisation stage ends and the simulation begins.
Implements cosim::slave.