| Crates.io | fmi-test-data |
| lib.rs | fmi-test-data |
| version | 0.5.0 |
| created_at | 2024-04-15 20:47:16.530314+00 |
| updated_at | 2025-08-23 17:06:09.331857+00 |
| description | Utilities for fetching test data from Modelica's Reference-FMUs repository. |
| homepage | |
| repository | https://github.com/jondo2010/rust-fmi |
| max_upload_size | |
| id | 1209630 |
| size | 72,708 |
Utilities for fetching test data from Modelica's Reference-FMUs repository.
This crate provides easy access to the official Modelica Reference FMUs for testing and validation purposes. It automatically downloads and caches the FMU archive, providing convenient methods to access individual FMUs.
use fmi_test_data::ReferenceFmus;
use fmi::traits::FmiImport;
# fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a new instance (downloads archive if needed)
let mut reference_fmus = ReferenceFmus::new()?;
// Load a specific FMU
let fmu: fmi::fmi3::import::Fmi3Import = reference_fmus.get_reference_fmu("BouncingBall")?;
// List all available FMUs
let available_fmus = reference_fmus.list_available_fmus()?;
println!("Available FMUs: {:?}", available_fmus);
// Extract FMU to a temporary file
let temp_file = reference_fmus.extract_reference_fmu("BouncingBall", fmi::schema::MajorVersion::FMI3)?;
# Ok(())
# }
The Reference FMUs package includes several test models such as:
Use ReferenceFmus::list_available_fmus() to get the complete list.
The crate uses version constants for easy upgrades:
use fmi_test_data::ReferenceFmus;
// Check the current Reference FMUs version
println!("Using Reference FMUs version: {}", ReferenceFmus::version());
// Access version constants
println!("Archive: {}", fmi_test_data::REF_ARCHIVE);
println!("URL: {}", fmi_test_data::REF_URL);
To upgrade to a newer version, simply update the REF_FMU_VERSION constant in the source code.
The crate includes comprehensive tests for all functionality:
cargo test -p fmi-test-data
See https://github.com/modelica/Reference-FMUs
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.