This application provides a simple and intuitive GUI for executing a compiled OpenModelica model with user-defined start and stop times. It enables users to select the executable file, input simulation parameters, and ensures that the time constraints adhere to the condition: 0 ≤ start time < stop time < 5. The tool streamlines the simulation process by automating execution while enhancing user experience through validation and error handling.
The project consists of two main tasks:
- Model Compilation – Using OpenModelica to compile the "TwoConnectedTanks" model and generate an executable program along with its required dependencies.
- GUI Application Development – Creating a Python-based graphical user interface (GUI) to run the generated executable with specified parameters.
- Install OpenModelica on a Windows 10/11 system.
- Download the model package and load all models into OMEdit, which is bundled with OpenModelica.
- Compile the "TwoConnectedTanks" model to generate an executable and its necessary dependencies.
- Gather the executable and its dependent files (not all are uploaded due to size constraints).
- Develop a Python GUI application with the following features:
- Three input fields:
- Executable Path: Allows selection of the compiled OpenModelica executable.
- Start Time: Numeric input for the simulation's start time.
- Stop Time: Numeric input for the simulation's stop time.
- A Browse button for selecting the executable file.
- A Run button to launch the executable with the specified start and stop times.
- Three input fields:
- Implement argument passing to the executable using OpenModelica’s simulation flags (Refer to: OpenModelica User Guide).
- Ensure input validation, enforcing the constraint: 0 ≤ start time < stop time < 5.
- Python 3.6+
- PyQt6
- OpenModelica
- Windows 10/11
- Input fields for selecting the executable, start time, and stop time.
- A file browser for easy executable selection.
- A button to execute the model simulation.
- Ensures valid numeric input and adheres to 0 ≤ start time < stop time < 5.
- Checks for a valid file path and prevents execution if inputs are incorrect.
- Displays user-friendly error messages for invalid selections.
- Encapsulates logic within a ModelLauncherApp class.
- Implements modular methods for clarity and maintainability.
- Follows PEP8 standards for readability and organization.
- Install PyQt6:
pip install PyQt6
- Save the script as ModelLauncher.py.
- Run the script:
python ModelLauncher.py
- Click Browse to select the compiled OpenModelica executable.
- Enter valid start and stop times.
- Click Run to execute the simulation with the specified parameters.