|
virtual coral::model::SlaveTypeDescription | TypeDescription () const =0 |
| Returns an object that describes the slave type.
|
|
virtual void | Setup (const std::string &slaveName, const std::string &executionName, coral::model::TimePoint startTime, coral::model::TimePoint stopTime, bool adaptiveStepSize, double relativeTolerance)=0 |
| Instructs the slave to perform pre-simulation setup and enter initialisation mode. More...
|
|
virtual void | StartSimulation ()=0 |
| Informs the slave that the initialisation stage ends and the simulation begins.
|
|
virtual void | EndSimulation ()=0 |
| Informs the slave that the simulation run has ended.
|
|
virtual bool | DoStep (coral::model::TimePoint currentT, coral::model::TimeDuration deltaT)=0 |
| Performs model calculations for the time step which starts at the time point currentT and has a duration of deltaT . More...
|
|
virtual double | GetRealVariable (coral::model::VariableID variable) const =0 |
| Returns the value of a real variable. More...
|
|
virtual int | GetIntegerVariable (coral::model::VariableID variable) const =0 |
| Returns the value of an integer variable. More...
|
|
virtual bool | GetBooleanVariable (coral::model::VariableID variable) const =0 |
| Returns the value of a boolean variable. More...
|
|
virtual std::string | GetStringVariable (coral::model::VariableID variable) const =0 |
| Returns the value of a string variable. More...
|
|
virtual bool | SetRealVariable (coral::model::VariableID variable, double value)=0 |
| Sets the value of a real variable. More...
|
|
virtual bool | SetIntegerVariable (coral::model::VariableID variable, int value)=0 |
| Sets the value of an integer variable. More...
|
|
virtual bool | SetBooleanVariable (coral::model::VariableID variable, bool value)=0 |
| Sets the value of a boolean variable. More...
|
|
virtual bool | SetStringVariable (coral::model::VariableID variable, const std::string &value)=0 |
| Sets the value of a string variable. More...
|
|
An interface for classes that represent slave instances.
The function call sequence is as follows:
Setup()
: Configure the slave and enter initialisation mode.
Get...Variable()
, Set...Variable()
: Variable initialisation. The functions may be called multiple times in any order.
StartSimulation()
: End initialisation mode, start simulation.
DoStep()
, Get...Variable()
, Set...Variable()
: Simulation. The functions may be called multiple times in any order.
EndSimulation()
: End simulation.
Any method may throw an exception, after which the slave instance is considered to be "broken" and no further method calls will be made.
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.
- Returns
true
if the model calculations for the given time step were successfully carried out, or false
if they were not because the time step was too long.
- Note
- Currently, retrying a failed time step is not supported, but this is planned for a future version.
Implemented in coral::fmi::SlaveInstance1, coral::fmi::SlaveInstance2, and coral::slave::LoggingInstance.
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 DoStep() will never be called with a time point outside this interval.)
- Parameters
-
[in] | slaveName | The name of the slave in the current execution. May be empty if this feature is not used. |
[in] | executionName | The name of the current execution. May be empty if this feature is not used. |
[in] | startTime | The earliest possible time point for the simulation. |
[in] | stopTime | The latest possible time point for the simulation. May be infinity if there is no defined stop time. |
[in] | adaptiveStepSize | Whether the step size is being controlled by error estimation. |
[in] | relativeTolerance | Only used if adaptiveStepSize == true , and then contains the relative tolerance of the step size controller. The slave may then use this for error estimation in its internal integrator. |
Implemented in coral::fmi::SlaveInstance1, coral::fmi::SlaveInstance2, and coral::slave::LoggingInstance.