FmuInstance

Struct FmuInstance 

Source
pub struct FmuInstance<C: Borrow<FmuLibrary>> {
    pub lib: C,
    /* private fields */
}
Expand description

A simulation “instance”, ready to execute.

Fields§

§lib: C

The loaded dll library.

This is generic behind the Borrow trait so that the user can pass in a reference or different Cell types such as [Arc].

The presence of this enforces that the FmuLibrary will outlive the FmuInstance.

Implementations§

Source§

impl<C: Borrow<FmuLibrary>> FmuInstance<C>

Source

pub fn instantiate(lib: C, logging_on: bool) -> Result<Self, FmuError>

Call fmi2Instantiate() on the FMU library to start a new simulation instance.

Source

pub fn get_set_state_capability( &self, ) -> Option<FmuGetSetStateCapability<'_, C>>

Source

pub fn serialize_state_capability( &self, ) -> Option<FmuSerializeStateCapability<'_, C>>

Source

pub fn get_types_platform(&self) -> &str

Source

pub fn set_debug_logging( &self, logging_on: bool, log_categories: &[&str], ) -> Result<(), FmuError>

Source

pub fn setup_experiment( &self, start_time: f64, stop_time: Option<f64>, tolerance: Option<f64>, ) -> Result<(), FmuError>

Source

pub fn enter_initialization_mode(&self) -> Result<(), FmuError>

Source

pub fn exit_initialization_mode(&self) -> Result<(), FmuError>

Source

pub fn get_reals<'fmu>( &'fmu self, signals: &[&'fmu ScalarVariable], ) -> Result<HashMap<&ScalarVariable, fmi2Real>, FmuError>

Source

pub fn get_integers<'fmu>( &'fmu self, signals: &[&'fmu ScalarVariable], ) -> Result<HashMap<&ScalarVariable, fmi2Integer>, FmuError>

Source

pub fn get_booleans<'fmu>( &'fmu self, signals: &[&'fmu ScalarVariable], ) -> Result<HashMap<&ScalarVariable, fmi2Integer>, FmuError>

Source

pub fn set_reals( &self, value_map: &HashMap<&ScalarVariable, fmi2Real>, ) -> Result<(), FmuError>

Source

pub fn set_integers( &self, value_map: &HashMap<&ScalarVariable, fmi2Integer>, ) -> Result<(), FmuError>

Source

pub fn set_booleans( &self, value_map: &HashMap<&ScalarVariable, fmi2Integer>, ) -> Result<(), FmuError>

Source

pub fn do_step( &self, current_communication_point: fmi2Real, communication_step_size: fmi2Real, no_set_fmustate_prior_to_current_point: bool, ) -> Result<(), FmuError>

Trait Implementations§

Source§

impl<C: Borrow<FmuLibrary>> Drop for FmuInstance<C>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<C: Borrow<FmuLibrary>> Send for FmuInstance<C>

Auto Trait Implementations§

§

impl<C> Freeze for FmuInstance<C>
where C: Freeze,

§

impl<C> RefUnwindSafe for FmuInstance<C>
where C: RefUnwindSafe,

§

impl<C> !Sync for FmuInstance<C>

§

impl<C> Unpin for FmuInstance<C>
where C: Unpin,

§

impl<C> UnwindSafe for FmuInstance<C>
where C: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.