This project is designed to streamline the process of running simulations generated from OpenModelica models through a user-friendly Python GUI application built with PyQt6.
For detailed documentation, including model changes, code improvements, and troubleshooting, visit the Project Wiki.
Renamed OM-Sim, earlier named OpenModelica-GUI.
The task involves:
- Compiling a model (e.g., TwoConnectedTanks) using OpenModelica to create an executable.
- Building a GUI application that runs the executable with adjustable parameters like start and stop times.
- OpenModelica Simulation Desktop App
- Features
- Technologies Used
- Installation
- Usage Instructions
- Project Structure
- Simulation Flags
- Troubleshooting
- Contributing
- License
- Acknowledgements
OpenModelica-GUI/
├── .github/ # GitHub-related files (workflows, issue templates, etc.)
├── .venv/ # Python virtual environment directory (optional)
├── .vscode/ # VS Code configuration directory (settings, launch configurations, etc.)
├── assessts/ # application banner and icon files
├── logs/ # log of changes in application/repository
├── NonInteractingTanks/ # Directory containing the Tank and Tank2 Modelica files
├── NonInteractingTanks.TwoConnectedTanks/ # Directory for the compiled executable and dependencies
├── main.py # Main Python script for running the GUI application
├── requirements.txt # Python dependencies for the project
├── pyproject.toml # Project configuration file (e.g., for linters and formatters)
├── .pylintrc # Pylint configuration file
├── .pre-commit-config.yaml # Pre-commit hooks configuration
├── LICENSE # License information for the project
└── README.md # Project documentation (overview, features, usage)
- Intuitive and functional GUI: Simplifies simulation execution.
- Input fields:
- Executable File: Browse and select the compiled model executable.
- Start Time: Set the simulation start time (
0 ≤ start time < stop time ≤ 5
). - Stop Time: Set the simulation stop time.
- Output Display: Real-time streaming of logs and results.
- Input validation: Ensures time constraints and valid file selection.
- Error Handling: Displays simulation errors, missing file issues, and environment variable problems.
- Pythonic and PEP8-compliant code: Code follows best practices with linters and formatters.
- Project Linters and Formatters:
- flake8: For static code analysis.
- black: For automatic formatting.
- Python 3.6+
- PyQt6 (for GUI)
PyQt6==6.8.0
PyQt6-Qt6==6.8.1
- OpenModelica: For generating and running simulations.
- Windows OS (10/11)
git clone https://github.com/yourusername/OpenModelica-GUI.git
cd OpenModelica-GUI
python -m venv venv
source venv/bin/activate # On Windows use `venv\Scripts\activate`
pip install -r requirements.txt
Ensure that OpenModelica is added to your PATH
.
- Launch the application:
python main.py
- Use the Browse button to select the OpenModelica executable.
- Enter the Start Time and Stop Time values.
- Click Run to start the simulation.
- View the output in the real-time display area.
The executable is run with the following flags:
- -override: Allows dynamic setting of
startTime
andstopTime
. - -lv=LOG_STDOUT,LOG_STATS: Enables streaming logs for monitoring simulation progress.
For detailed documentation on simulation flags, visit the OpenModelica Documentation.
- Missing DLLs: Ensure all dependencies are present in the working directory.
- Environment Variable Errors: Add OpenModelica to the
PATH
variable. - Simulation Errors: Verify input parameters and check the output logs for details.
- Currently not accepting contributions unless from FOSSEE.
- Please ensure your code adheres to PEP8 standards.
- Run flake8 and black before submitting pull requests.
This project is licensed under the MIT License. See the LICENSE file for details.
- OpenModelica: For providing the simulation tools.
- PyQt6: For the graphical user interface library.
- FOSSEE: For providing the models for simulation.
- Icon: Mechanical icon by Icons8