pub trait CoSimulation: Common {
// Required methods
fn do_step(
&self,
current_communication_point: f64,
communication_step_size: f64,
new_step: bool,
) -> Result<Fmi2Res, Fmi2Error>;
fn cancel_step(&self) -> Result<Fmi2Res, Fmi2Error>;
fn do_step_status(&mut self) -> Result<Fmi2Status, Fmi2Error>;
fn pending_status(&mut self) -> Result<&str, Fmi2Error>;
fn last_successful_time(&mut self) -> Result<f64, Fmi2Error>;
fn terminated(&mut self) -> Result<bool, Fmi2Error>;
}Required Methods§
Sourcefn do_step(
&self,
current_communication_point: f64,
communication_step_size: f64,
new_step: bool,
) -> Result<Fmi2Res, Fmi2Error>
fn do_step( &self, current_communication_point: f64, communication_step_size: f64, new_step: bool, ) -> Result<Fmi2Res, Fmi2Error>
The computation of a time step is started.
Depending on the internal state of the slave and the last call of do_step(...), the slave
has to decide which action is to be done before the step is computed.
§Arguments
current_communication_point- the current communication point of the master.communication_step_size- the communication step size.new_step- If true, accept the last computed step, and start another.
Sourcefn cancel_step(&self) -> Result<Fmi2Res, Fmi2Error>
fn cancel_step(&self) -> Result<Fmi2Res, Fmi2Error>
Cancel a running asynchronous step.
Can be called if do_step(...) returned Pending in order to stop the current
asynchronous execution. The master calls this function if e.g. the co-simulation run is
stopped by the user or one of the slaves. Afterwards it is only allowed to call the
functions terminate() or reset().
Sourcefn do_step_status(&mut self) -> Result<Fmi2Status, Fmi2Error>
fn do_step_status(&mut self) -> Result<Fmi2Status, Fmi2Error>
Can be called when the CoSimulation::do_step function returned fmi2Pending. The function
delivers fmi2Pending if the computation is not finished. Otherwise the function returns the
result of the asynchronously executed CoSimulation::do_step call.
Sourcefn pending_status(&mut self) -> Result<&str, Fmi2Error>
fn pending_status(&mut self) -> Result<&str, Fmi2Error>
Can be called when the fmi2DoStep function returned fmi2Pending. The function delivers a string which informs about the status of the currently running asynchronous fmi2DoStep computation.
Sourcefn last_successful_time(&mut self) -> Result<f64, Fmi2Error>
fn last_successful_time(&mut self) -> Result<f64, Fmi2Error>
Returns the end time of the last successfully completed communication step. Can be called after fmi2DoStep(..) returned fmi2Discard.
Sourcefn terminated(&mut self) -> Result<bool, Fmi2Error>
fn terminated(&mut self) -> Result<bool, Fmi2Error>
Returns true, if the slave wants to terminate the simulation. Can be called after
[CoSimulation::do_step(..)] returned Fmi2Status::Discard. Use
CoSimulation::last_successful_time() to determine the time instant at which the slave
terminated.