pub trait CoSimulation: Common {
// Required methods
fn enter_step_mode(&mut self) -> Result<Fmi3Res, Fmi3Error>;
fn get_output_derivatives(
&mut self,
vrs: &[fmi3ValueReference],
orders: &[i32],
values: &mut [f64],
) -> Result<Fmi3Res, Fmi3Error>;
fn do_step(
&mut self,
current_communication_point: f64,
communication_step_size: f64,
no_set_fmu_state_prior_to_current_point: bool,
event_handling_needed: &mut bool,
terminate_simulation: &mut bool,
early_return: &mut bool,
last_successful_time: &mut f64,
) -> Result<Fmi3Res, Fmi3Error>;
}Available on crate feature
fmi3 only.Expand description
Interface for Co-Simulation instances
Required Methods§
Sourcefn enter_step_mode(&mut self) -> Result<Fmi3Res, Fmi3Error>
fn enter_step_mode(&mut self) -> Result<Fmi3Res, Fmi3Error>
This function must be called to change from Event Mode into Step Mode in Co-Simulation.
Sourcefn get_output_derivatives(
&mut self,
vrs: &[fmi3ValueReference],
orders: &[i32],
values: &mut [f64],
) -> Result<Fmi3Res, Fmi3Error>
fn get_output_derivatives( &mut self, vrs: &[fmi3ValueReference], orders: &[i32], values: &mut [f64], ) -> Result<Fmi3Res, Fmi3Error>
The returned values correspond to the derivatives at the current time of the FMU. For example, after a
successful call to CoSimulation::do_step, the returned values are related to the end of the communication
step.
Arguments:
vrs: the variables whose derivatives shall be retrieved. If multiple derivatives of a variable shall be retrieved, list the value reference multiple times.orders: the orders of the respective derivative (1 means the first derivative, 2 means the second derivative, …, 0 is not allowed). If multiple derivatives of a variable shall be retrieved, its value reference must occur multiple times in valueReferences aligned with the corresponding orders array.values: the values of the derivatives are returned in this array. The order of the values corresponds to the order of the value references. Array elements are laid out contiguously.
See https://fmi-standard.org/docs/3.0.1/#fmi3GetOutputDerivatives
Sourcefn do_step(
&mut self,
current_communication_point: f64,
communication_step_size: f64,
no_set_fmu_state_prior_to_current_point: bool,
event_handling_needed: &mut bool,
terminate_simulation: &mut bool,
early_return: &mut bool,
last_successful_time: &mut f64,
) -> Result<Fmi3Res, Fmi3Error>
fn do_step( &mut self, current_communication_point: f64, communication_step_size: f64, no_set_fmu_state_prior_to_current_point: bool, event_handling_needed: &mut bool, terminate_simulation: &mut bool, early_return: &mut bool, last_successful_time: &mut f64, ) -> Result<Fmi3Res, Fmi3Error>
The importer requests the computation of the next time step.
Arguments:
current_communication_point: the current communication point of the importer (t_i). At the first call ofdo_step, must be equal to the argumentstart_timeofenter_initialization_mode.communication_step_size: the communication step size (h_i). Must be >0.0. The FMU is expected to compute until timet_i+1 = t_i + h_i.