package fmi:fmi3@3.0.0;
interface types {
// ── Value reference ─────────────────────────────────────────────────────────
/// Identifies a model variable. Corresponds to fmi3ValueReference.
type value-reference = u32;
// ── Status ──────────────────────────────────────────────────────────────────
/// Return status for most FMI functions. Corresponds to fmi3Status.
enum status {
/// All OK; no further action required.
ok,
/// Non-fatal issue; result may still be used.
warning,
/// Step was discarded; do not use results (only from fmi3DoStep).
discard,
/// Unrecoverable error; instance must be freed.
error,
/// Unexpected fatal error; process should be restarted.
fatal,
}
// ── Interval qualifier ───────────────────────────────────────────────────────
/// Qualifies a clock interval returned by fmi3GetIntervalDecimal /
/// fmi3GetIntervalFraction. Corresponds to fmi3IntervalQualifier.
enum interval-qualifier {
/// Interval value is not yet determined.
interval-not-yet-known,
/// Interval is the same as the last activation.
interval-unchanged,
/// Interval has changed and the new value is provided.
interval-changed,
}
// ── Dependency kind ──────────────────────────────────────────────────────────
/// Describes how one variable depends on another.
/// Corresponds to fmi3DependencyKind.
enum dependency-kind {
/// Output depends on the input in an unspecified way.
dependent,
/// Output is a constant with respect to the input.
constant,
/// Dependency is fixed (cannot change after initialisation).
fixed,
/// Dependency is tunable (may change at event boundaries).
tunable,
/// Dependency is discrete (changes only at events).
discrete,
}
// ── Opaque FMU state ─────────────────────────────────────────────────────────
/// Serialised snapshot of internal FMU state.
/// Corresponds to the data pointed to by fmi3FMUState.
/// The host must treat the content as opaque bytes.
type fmu-state = list<u8>;
// ── Clock interval as a fraction ─────────────────────────────────────────────
/// A rational representation of a clock interval or shift:
/// value = counter / resolution (seconds)
/// Corresponds to the (fmi3UInt64 counter, fmi3UInt64 resolution) pair
/// used by fmi3GetIntervalFraction / fmi3SetIntervalFraction and
/// fmi3GetShiftFraction / fmi3SetShiftFraction.
record interval-fraction {
counter: u64,
resolution: u64,
}
// ── Variable dependency entry ────────────────────────────────────────────────
/// One entry in the variable-dependency table returned by
/// fmi3GetVariableDependencies.
record variable-dependency {
/// Index into the model-description variable list for the dependent variable.
dependent-value-reference: value-reference,
/// Index of the element within a structured variable (0-based; 0 for scalars).
element-index-of-dependent: u32,
/// Index into the model-description variable list for the independent variable.
independent-value-reference: value-reference,
/// Index of the element within the independent structured variable.
element-index-of-independent: u32,
/// Nature of the dependency.
kind: dependency-kind,
}
// ── Event info ───────────────────────────────────────────────────────────────
/// Aggregated event information returned after event iteration.
/// Corresponds to the output parameters of fmi3UpdateDiscreteStates
/// (FMI 3.0 § 2.3.5), which replaces the fmi2EventInfo struct.
record discrete-states-info {
/// Another internal event is pending; iterate again.
new-discrete-states-needed: bool,
/// No further event processing is required; proceed to continuous mode.
terminate-simulation: bool,
/// Nominals of continuous states have changed.
nominals-of-continuous-states-changed: bool,
/// Values of continuous states have changed (state re-initialisation needed).
values-of-continuous-states-changed: bool,
/// Next event time is defined.
next-event-time-defined: bool,
/// Value of the next event time (valid only when next-event-time-defined).
next-event-time: f64,
}
}