Skip to main content

FmuModel

Derive Macro FmuModel 

Source
#[derive(FmuModel)]
{
    // Attributes available to this derive:
    #[model]
    #[variable]
    #[alias]
    #[child]
}
Expand description

Main derive macro for FMU models

§Example

use fmi_export::FmuModel;

/// Simple bouncing ball model
#[derive(FmuModel, Default)]
#[model()]
struct BouncingBall {
    /// Height above ground (state output)
    #[variable(causality = Output, start = 1.0)]
    h: f64,

    /// Velocity of the ball
    #[variable(causality = Output, start = 0.0)]
    #[alias(name="der(h)", causality = Local, derivative = h)]
    v: f64,
}