Skip to content

Commit

Permalink
modified README
Browse files Browse the repository at this point in the history
some tiny changes
  • Loading branch information
techy4shri committed Jan 27, 2025
1 parent ccb2026 commit 5ffd42e
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 93 deletions.
131 changes: 44 additions & 87 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,127 +1,84 @@
# **OpenModelica GUI Application**

This project involves two parts:
1. **Compiling a model** using OpenModelica to create an executable program.
This project involves two parts:

1. **Compiling a model** using OpenModelica to create an executable program.
2. **Building a Python-based GUI application** to run the executable with specified parameters.

---

## **Features**
- Intuitive and functional GUI.
- Input fields for:

- **Intuitive and functional GUI**: Easy-to-use interface for running simulations.
- **Input fields for**:
- **Executable File**: The compiled model.
- **Start Time**: The simulation start time (integer).
- **Stop Time**: The simulation stop time (integer).
- User specified `start time` and `stop time`.
- Pythonic and PEP 8-compliant code.
- Well-structured and modular design.
- Proper input validation and meaningful error messages.
---

## **Technologies Used**
Python 3.12.6
- `PyQt6 for GUI`
- `PyQt6==6.8.0`
- `PyQt6-Qt6==6.8.1`
- `PyQt6_sip==13.9.1`

- Testing and Linting Tools
- `black==24.10.0`
- `flake8==7.1.1`
- `pylint==3.3.3`
- **User-specified time constraints**: Allows users to set `start time` and `stop time`.
- **Pythonic and PEP 8-compliant code**: Ensures readability and maintainability.
- **Well-structured and modular design**: Organized codebase for easy navigation and modification.
- **Proper input validation and meaningful error messages**: Ensures robust and user-friendly experience.

---

## **Installation Guide**
## **Technologies Used**

### **1. Prerequisites**
- **Install Python 3.6+**: Download and install from [Python.org](https://www.python.org/).
- **Install PyQt6**:
```bash
pip install PyQt6
```
- **Install OpenModelica**: Download and install from [OpenModelica.org](https://www.openmodelica.org/).
- **Python 3.12.6**
- **PyQt6 for GUI**:
- `PyQt6==6.8.0`
- `PyQt6-Qt6==6.8.1`
- **OpenModelica**: For compiling the model into an executable.

---

### **2. Steps to Compile the Model**
1. **Download OpenModelica** and install it on a Windows 10/11 machine.
2. Open the **OMEdit (OpenModelica Connection Editor)**.
3. Download the **TwoConnectedTanks** model package from the provided link.
4. **Load the model** in OMEdit:
- Go to `File > Open Model/Library File` and select the model file.
5. **Build (Compile) the Model**:
- Select the `TwoConnectedTanks` model and click the **Simulate** button.
- The compiled executable and its dependent files will be saved in the working directory.
## **Installation**

---
1. **Clone the repository**:

### **3. Run the Python GUI**
1. Fork the repo.
2. Clone this repository:
```bash
git clone https://github.com/user_name/OpenModelica-GUI
git clone https://github.com/yourusername/OpenModelica-GUI.git
cd OpenModelica-GUI
```
3. Run the Python application:
```bash
python main.py
```

---
2. **Create a virtual environment**:

## **Usage**
1. Launch the GUI application.
2. Use the **Browse** button to select the compiled executable.
3. Enter valid `start time` and `stop time` (integer values, ensuring `0 <= start time < stop time < 5`).
4. Click the **Run** button.
```bash
python -m venv venv
source venv/bin/activate # On Windows use `venv\Scripts\activate`
```

---
Here’s the **Testing** section in Markdown format:
3. **Install the required packages**:
```bash
pip install -r requirements.txt
```

---

## **Testing the Code**
## **Usage**

This project uses **Flake8**, **Black**, and **Pylint** to ensure high code quality, proper formatting, and adherence to PEP 8 guidelines.
1. **Run the GUI application**:

### **1. Install Linters and Formatters**
First, ensure all necessary testing dependencies are installed:
```bash
pip install -r requirements_test.txt
```
```bash
python main.py
```

### **2. Testing Tools**
2. **Using the GUI**:
- **Browse**: Select the compiled executable file.
- **Set Start Time**: Enter the simulation start time.
- **Set Stop Time**: Enter the simulation stop time.
- **Run**: Click the "Run" button to start the simulation.

#### **a. Code Formatting with Black**
Run Black to format your code automatically:
```bash
black .
```
---

#### **b. Code Linting with Flake8**
Use Flake8 to check for PEP 8 violations and other linting issues:
```bash
flake8 .
```
## **License**

#### **c. Static Analysis with Pylint**
Run Pylint for an in-depth code analysis and suggestions:
```bash
pylint main.py
```
This project is licensed under the MIT License. See the LICENSE file for details.

---
## **Adherence to Requirements**:
- Handles `0 <= start time < stop time < 5` validation correctly.
- Successfully executes the model via the GUI.

---
## **Acknowledgements**

## **References**
- [OpenModelica User's Guide](https://openmodelica.org/doc/OpenModelicaUsersGuide/latest/simulationflags.html#simflag-override)
- [Python PEP 8 Guidelines](https://peps.python.org/pep-0008/)
- **OpenModelica**: For providing the tools to compile the model.
- **PyQt6**: For the GUI framework.

---

Made by [Garima](https://github.com/techy4shri)👩‍💻
11 changes: 5 additions & 6 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ def init_ui(self):
QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Fixed
)

# here comes browse
browse_button = QPushButton("Browse", self)
browse_button.setFixedSize(90, 30)
browse_button.clicked.connect(self.browse_file)
Expand All @@ -83,7 +82,6 @@ def init_ui(self):

layout.addLayout(exe_layout)

# Start time layout
start_layout = QHBoxLayout()
start_label = QLabel("Start Time:")
start_label.setFixedWidth(60)
Expand All @@ -98,7 +96,6 @@ def init_ui(self):
start_layout.addStretch()
layout.addLayout(start_layout)

# Stop time layout
stop_layout = QHBoxLayout()
stop_label = QLabel("Stop Time:")
stop_label.setFixedWidth(60)
Expand Down Expand Up @@ -201,8 +198,10 @@ def run_app(self):
)
except OSError as e:
QMessageBox.critical(
self, "OS Error", f"OS error occurred: {str(e)}"
) # ignore
self,
"OS Error",
f"OS error occurred: {str(e)}",
)
# Debugging information
except Exception as e:
QMessageBox.critical(
Expand All @@ -218,7 +217,7 @@ def run_app(self):
# this runs the GUI application
if __name__ == "__main__":
# no CLI here, everything happens on the active window
app = QApplication(sys.argv)
app = QApplication([])
mainWindow = MainWindow()
mainWindow.show()
sys.exit(app.exec())
File renamed without changes.

0 comments on commit 5ffd42e

Please sign in to comment.