OpenModelica plugin for Funz framework - simulate and analyze Modelica models through parametric studies.
This plugin integrates OpenModelica with the Funz framework, enabling:
- Parametric studies of Modelica models
- Batch simulations with different parameter sets
- Result extraction and analysis
- Optimization and design of experiments using Funz capabilities
- Funz framework:
pip install funz-fz - OpenModelica: Install from https://openmodelica.org/ (see INSTALL_OPENMODELICA.md)
- Python 3.7+: With pandas package
# Core dependencies
pip install funz-fz pandas
# For running example notebooks
pip install jupyter matplotlib scipy
See INSTALL_OPENMODELICA.md for detailed OpenModelica installation instructions for different platforms.
python tests/verify_installation.py
The examples/ directory contains comprehensive Jupyter notebooks demonstrating the plugin:
📓 01_NewtonCooling_Parametric.ipynb
- Introduction to Funz-Modelica workflow
- Single and parametric simulations
- Visualization of cooling curves
- Analysis of convection effects
📓 02_ProjectileMotion_Parametric.ipynb
- Projectile motion physics
- Effect of launch angle and velocity
- Range and height calculations
- Classical mechanics validation
📓 03_ProjectileMotion_Advanced.ipynb
- 2D parameter space exploration
- Contour plots and heatmaps
- Target hitting optimization
- Result caching for efficiency
# Start Jupyter
jupyter notebook
# Or use JupyterLab
jupyter lab
# Navigate to examples/ and open any notebook
.
├── .fz/ # Funz plugin configuration
│ ├── models/
│ │ └── Modelica.json # Model definition
│ └── calculators/
│ ├── localhost.json # Calculator configuration
│ └── Modelica.sh # Execution script
├── examples/ # Jupyter notebook examples
│ ├── 01_NewtonCooling_Parametric.ipynb # Intro to parametric studies
│ ├── 02_ProjectileMotion_Parametric.ipynb # Physics simulations
│ └── 03_ProjectileMotion_Advanced.ipynb # Advanced features & optimization
├── tests/
│ └── verify_installation.py # Installation verification
└── Documentation files
├── README.md # This file
├── STRUCTURE.md # Repository structure details
├── MIGRATION.md # Migration from old plugin
├── INSTALL_OPENMODELICA.md # OpenModelica setup
└── CONTRIBUTING.md # Contribution guidelines
Add variable syntax to your Modelica model parameters:
model MyModel
parameter Real param1=${var1~default_value};
// ... rest of model
end MyModel;
Then run with Funz:
import fz
results = fz.fzr(
"MyModel.mo",
{"var1": [0.5, 0.7, 0.9]}, # Test multiple values
"Modelica",
calculators="localhost"
)
Verify the plugin structure:
python tests/verify_installation.py
This checks:
- Directory structure
- Configuration files
- Example notebooks
- Plugin executability
The notebooks demonstrate complete workflows and can be run interactively:
# Install Jupyter if needed
pip install jupyter matplotlib scipy
# Launch Jupyter
jupyter notebook examples/
Error: omc command not found
Install OpenModelica from https://openmodelica.org/ or see INSTALL_OPENMODELICA.md
Error: No module named 'fz'
Install Funz: pip install funz-fz
Check the temporary directory for *.moo log files from OpenModelica.
- README.md - This file (quick start)
- STRUCTURE.md - Complete repository structure
- MIGRATION.md - Migration guide from old plugin
- INSTALL_OPENMODELICA.md - OpenModelica installation
- CONTRIBUTING.md - Contribution guidelines
This project is part of the Funz framework. See LICENSE for details.