FMU

class pathsim.blocks.fmu.CoSimulationFMU(fmu_path, instance_name='fmu_instance', start_values=None, dt=None, verbose=False)[source]

Bases: Block

Co-Simulation FMU block using FMPy with support for FMI 2.0 and FMI 3.0.

This block wraps an FMU (Functional Mock-up Unit) for co-simulation. The FMU encapsulates a simulation model that can be executed independently and synchronized with the main simulation.

Parameters:
  • fmu_path (str) – path to the FMU file (.fmu)

  • instance_name (str, optional) – name for the FMU instance (default: ‘fmu_instance’)

  • start_values (dict, optional) – dictionary of variable names and their initial values

  • dt (float, optional) – communication step size for co-simulation. If None, uses the FMU’s default experiment step size if available.

fmu_wrapper

version-agnostic FMU wrapper instance

Type:

FMUWrapper

dt

communication step size

Type:

float

update(t)[source]

Update FMU inputs/outputs between scheduled steps if interpolation supported.

reset()[source]

Reset the FMU instance.

class pathsim.blocks.fmu.ModelExchangeFMU(fmu_path, instance_name='fmu_instance', start_values=None, tolerance=1e-10, verbose=False)[source]

Bases: DynamicalSystem

Model Exchange FMU block using FMPy with support for FMI 2.0 and FMI 3.0.

This block wraps an FMU (Functional Mock-up Unit) for model exchange. The FMU provides the right-hand side of an ODE system that is integrated by PathSim’s numerical solvers. Internal FMU events (state events, time events, and step completion events) are translated to PathSim events.

Parameters:
  • fmu_path (str) – path to the FMU file (.fmu)

  • instance_name (str, optional) – name for the FMU instance (default: ‘fmu_instance’)

  • start_values (dict, optional) – dictionary of variable names and their initial values

  • tolerance (float, optional) – tolerance for event detection (default: 1e-10)

  • verbose (bool, optional) – enable verbose output (default: False)

fmu_wrapper

version-agnostic FMU wrapper instance

Type:

FMUWrapper

time_event

dynamic time event for FMU-scheduled events

Type:

ScheduleList or None

sample(t, dt)[source]

Sample block after successful timestep and handle FMU step completion events.

Parameters:
  • t (float) – evaluation time for sampling

  • dt (float) – integration timestep

reset()[source]

Reset the FMU instance.