pub trait Model: Default {
const MODEL_NAME: &'static str;
const INSTANTIATION_TOKEN: &'static str;
const MAX_EVENT_INDICATORS: usize;
const SUPPORTS_MODEL_EXCHANGE: bool;
const SUPPORTS_CO_SIMULATION: bool;
const SUPPORTS_SCHEDULED_EXECUTION: bool;
// Required methods
fn build_metadata(
variables: &mut ModelVariables,
model_structure: &mut ModelStructure,
vr_offset: u32,
prefix: Option<&str>,
) -> u32;
fn set_start_values(&mut self);
// Provided methods
fn build_toplevel_metadata() -> (ModelVariables, ModelStructure) { ... }
fn validate_variable_setting(
vr: fmi3ValueReference,
state: &ModelState,
) -> Result<(), &'static str> { ... }
}Expand description
Model trait. This trait should be implementing by deriving FmuModel on the user model struct.
It provides the necessary back-end functionality for the FMI 3.0 API, delegating user-specific
behavior to the UserModel trait.
Required Associated Constants§
const MODEL_NAME: &'static str
const INSTANTIATION_TOKEN: &'static str
Sourceconst MAX_EVENT_INDICATORS: usize
const MAX_EVENT_INDICATORS: usize
Number of event indicators
Sourceconst SUPPORTS_MODEL_EXCHANGE: bool
const SUPPORTS_MODEL_EXCHANGE: bool
Whether this model supports Model Exchange interface
Sourceconst SUPPORTS_CO_SIMULATION: bool
const SUPPORTS_CO_SIMULATION: bool
Whether this model supports Co-Simulation interface
Sourceconst SUPPORTS_SCHEDULED_EXECUTION: bool
const SUPPORTS_SCHEDULED_EXECUTION: bool
Whether this model supports Scheduled Execution interface
Required Methods§
Sourcefn build_metadata(
variables: &mut ModelVariables,
model_structure: &mut ModelStructure,
vr_offset: u32,
prefix: Option<&str>,
) -> u32
fn build_metadata( variables: &mut ModelVariables, model_structure: &mut ModelStructure, vr_offset: u32, prefix: Option<&str>, ) -> u32
Recursively build the model variables and structure by appending to the provided
ModelVariables and ModelStructure instances.
Returns the number of variables that were added.
Sourcefn set_start_values(&mut self)
fn set_start_values(&mut self)
Set start values
Provided Methods§
Sourcefn build_toplevel_metadata() -> (ModelVariables, ModelStructure)
fn build_toplevel_metadata() -> (ModelVariables, ModelStructure)
Build the top-level model variables and structure, including the ‘time’ variable.
Sourcefn validate_variable_setting(
vr: fmi3ValueReference,
state: &ModelState,
) -> Result<(), &'static str>
fn validate_variable_setting( vr: fmi3ValueReference, state: &ModelState, ) -> Result<(), &'static str>
Validate that a variable can be set in the current model state This method should be implemented by the generated code to check causality and variability restrictions for each variable
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.