fmi-test-data

Crates.iofmi-test-data
lib.rsfmi-test-data
version0.5.0
created_at2024-04-15 20:47:16.530314+00
updated_at2025-08-23 17:06:09.331857+00
descriptionUtilities for fetching test data from Modelica's Reference-FMUs repository.
homepage
repositoryhttps://github.com/jondo2010/rust-fmi
max_upload_size
id1209630
size72,708
John Hughes (jondo2010)

documentation

README

fmi-test-data

github crates.io docs.rs build status

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.

Features

  • Automatic Download: Downloads and caches Reference FMUs from the official GitHub repository
  • Version Management: Easy upgrade path with centralized version constants (currently v0.0.39)
  • FMI Support: Works with both FMI 2.0 and FMI 3.0 standards
  • Multiple Access Methods: Load FMUs directly into memory or extract to temporary files
  • Archive Exploration: List all available FMUs in the archive
  • Integrity Verification: SHA256 checksum validation of downloaded archives

Usage

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(())
# }

Available FMUs

The Reference FMUs package includes several test models such as:

  • BouncingBall: A simple bouncing ball simulation
  • Dahlquist: A test equation for numerical solvers
  • VanDerPol: Van der Pol oscillator
  • Feedthrough: Simple input/output feedthrough
  • Clocks: Clock-based simulation (FMI 3.0)
  • And many more...

Use ReferenceFmus::list_available_fmus() to get the complete list.

Version Management

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.

Testing

The crate includes comprehensive tests for all functionality:

cargo test -p fmi-test-data

References

See https://github.com/modelica/Reference-FMUs

License

Licensed under either of

at your option.

Contribution

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.

Commit count: 49

cargo fmt