pub struct Fmu {
pub model_description: FmiModelDescription,
/* private fields */
}Expand description
A unpacked FMU with a parsed model description.
Fields§
§model_description: FmiModelDescriptionParsed model description XML.
Implementations§
Source§impl Fmu
impl Fmu
Sourcepub fn unpack(fmu_path: impl Into<PathBuf>) -> Result<Self, FmuUnpackError>
pub fn unpack(fmu_path: impl Into<PathBuf>) -> Result<Self, FmuUnpackError>
Unpack an FMU file to a tempdir and parse it’s model description.
Sourcepub fn unpack_to(
fmu_path: impl Into<PathBuf>,
target_dir: impl Into<PathBuf>,
) -> Result<Self, FmuUnpackError>
pub fn unpack_to( fmu_path: impl Into<PathBuf>, target_dir: impl Into<PathBuf>, ) -> Result<Self, FmuUnpackError>
Unpack an FMU file to a given target dir and parse it’s model description.
Sourcepub fn load(self, simulation_type: fmi2Type) -> Result<FmuLibrary, FmuLoadError>
pub fn load(self, simulation_type: fmi2Type) -> Result<FmuLibrary, FmuLoadError>
Load the FMU dynamic library.
Sourcepub fn load_with_handler<F>(
self,
simulation_type: fmi2Type,
handler: F,
) -> Result<FmuLibrary, FmuLoadError>
pub fn load_with_handler<F>( self, simulation_type: fmi2Type, handler: F, ) -> Result<FmuLibrary, FmuLoadError>
Load the FMU dynamic library, but pass in a handler to load custom symbols from the dynamic library before it’s passed to the runner.
This is useful for loading custom symbols and functions from the FMU library that are not part of the FMI standard.
§Example
let mut register_handler: Option<force_injector::RegisterHandlerFn> = None;
let fmu = Fmu::unpack(Path::new("./tests/fmu/planar_ball.fmu"))
.unwrap()
.load_with_handler(fmi2Type::fmi2CoSimulation, |lib| {
register_handler = unsafe { lib.get(b"register_handler\0") }
.map(|sym| *sym)
.ok();
})
.unwrap();pub fn variables(&self) -> &HashMap<String, ScalarVariable>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Fmu
impl RefUnwindSafe for Fmu
impl Send for Fmu
impl Sync for Fmu
impl Unpin for Fmu
impl UnwindSafe for Fmu
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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