Skip to content

OM-Sim is a openmodelica simulator, made for FOSSEE Internship screening task.This desktop application is designed to facilitate simulations of OpenModelica models through a user-friendly GUI built with Python library PyQt6. Users can easily select compiled model executables, input simulation parameters, and view output directly within the app.

License

Notifications You must be signed in to change notification settings

techy4shri/OM-Sim

Repository files navigation

OpenModelica Simulation Desktop App

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:

  1. Compiling a model (e.g., TwoConnectedTanks) using OpenModelica to create an executable.
  2. Building a GUI application that runs the executable with adjustable parameters like start and stop times.

Table of Contents

  1. OpenModelica Simulation Desktop App
  2. Features
  3. Technologies Used
  4. Installation
  5. Usage Instructions
  6. Project Structure
  7. Simulation Flags
  8. Troubleshooting
  9. Contributing
  10. License
  11. Acknowledgements

Project Structure

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)

Features

  • 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.

Technologies Used

  • 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)

Installation

Clone the repository:

git clone https://github.com/yourusername/OpenModelica-GUI.git
cd OpenModelica-GUI

Set up a virtual environment:

python -m venv venv
source venv/bin/activate  # On Windows use `venv\Scripts\activate`

Install the required packages:

pip install -r requirements.txt

Install OpenModelica (if not already installed):

Set environment variables:

Ensure that OpenModelica is added to your PATH.


Usage Instructions

Running the Application

  1. Launch the application:
    python main.py

In the GUI:

  • 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.

Simulation Flags

The executable is run with the following flags:

  • -override: Allows dynamic setting of startTime and stopTime.
  • -lv=LOG_STDOUT,LOG_STATS: Enables streaming logs for monitoring simulation progress.

For detailed documentation on simulation flags, visit the OpenModelica Documentation.


Troubleshooting

Common Issues:

  • 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.

Contributing

  • Currently not accepting contributions unless from FOSSEE.
  • Please ensure your code adheres to PEP8 standards.
  • Run flake8 and black before submitting pull requests.

License

This project is licensed under the MIT License. See the LICENSE file for details.


Acknowledgements

  • 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

About

OM-Sim is a openmodelica simulator, made for FOSSEE Internship screening task.This desktop application is designed to facilitate simulations of OpenModelica models through a user-friendly GUI built with Python library PyQt6. Users can easily select compiled model executables, input simulation parameters, and view output directly within the app.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published