Building and Running MicroFMU on Unix
Overview
This guide walks you through compiling and running the MicroFMU library on a Unix-based system using MicroPython.
Prerequisites
A Unix-based system (Linux/macOS)
Installed dependencies:
gcc
,make
,python3
, andpip
MicroPython source code (
micropython_dir
set correctly)
Steps
Navigate to the Unix port directory
cd "$micropython_dir/ports/unix"
Compile MicroPython with MicroFMU support
make submodules make USER_C_MODULES=$micropython_dir/MicroFMU-library
Run MicroPython and test FMU simulation
./build-standard/micropython
>>> import ufmu as fmu >>> simulation = fmu.setup_simulation(0, 3, 0.1) >>> for step, time, h, _, v, _, g, e in simulation: ... print(time, h)
(Optional) Enable Debugging
make DEBUG=1 STRIP= USER_C_MODULES=$micropython_dir/MicroFMU-library/micropython.cmake