Development of an Automated Testing System with Real-Time Monitoring and Report Generation
Posted: Sun Nov 10, 2024 6:24 am
For the development of the program described in the provided material, the main aspects and components that need to be implemented in Python can be outlined as follows:
#### 1. **Splash Screen (Welcome Window)**
- **Functionality**: Upon startup, the program should display a welcome screen for 5 seconds.
- **Implementation**: Use the `tkinter` module or another graphical library in Python to display the splash screen, after which it automatically transitions to the main program window.
- **Parameters**: Program title "Corrected Stand NS", welcome text, and image for the splash screen (can be set in the code).
#### 2. **Main Program Window**
The main window should include several components:
- **Input Fields**: For entering user data (operator’s name, test date, block number, test location, etc.).
- **Buttons**:
- For starting tests.
- For connecting to Arduino.
- For opening and printing reports.
- For closing the program.
- **Dynamic Elements**:
- Display real-time voltage data received from Arduino.
- Test status indicators (green, red, gray).
- Connection status indicators for Arduino (red, yellow, green).
#### 3. **Algorithm of Operation**
1. Upon launching the main window, the program attempts to connect to Arduino via the COM port.
2. The program checks the connection status and the regularity of data reception.
3. The user fills out all required fields and clicks a button to start the test.
4. The program ensures all mandatory fields are filled before starting the test.
5. The program sends data to Arduino via the COM port.
6. It receives the test result from Arduino, updates the test status, generates a PDF report, and opens it.
#### 4. **Data Formats for Communication with Arduino**
**Sent Data Format**:
1. For each of the 5 tests, send data in the following format:
- `START` – to start the test.
- `UNUSED` – do not perform action.
Example for testing the first block:
```
START; UNUSED; UNUSED; UNUSED; UNUSED;
```
**Received Data Format**:
1. Voltage in volts.
2. Test status for each block:
- `RES_OK` – test passed.
- `RES_ERROR` – test failed.
- `UNUSED` – test not performed.
- `TOUCH_ERROR` – failed to start test due to limit switch error.
#### 5. **PDF Report Generation**
- Use Python libraries like `reportlab` or `fpdf` to generate PDF reports.
- The PDF report will include user-entered data and test results.
- Two templates exist:
- **If the test passed**: Write a report indicating the block is functional.
- **If the test failed**: Write a report indicating a block malfunction.
#### 6. **Implementation Details**:
- **Arduino Connection via COM Port**: Use the `pyserial` library for Arduino communication.
- **Status Indicators**: Use `tkinter` to display graphical elements such as status indicators.
- **Input Validation**: Ensure all required fields are filled before starting the test.
#### 7. **Cross-Platform Compatibility**
The program should be compatible with both Windows and macOS, requiring proper configuration of the Python environment and libraries for each operating system.
- Include installation instructions for Python and necessary libraries for each OS.
- Provide paths for compiling the program for Windows and macOS.
#### **Next Steps**:
1. Develop the main program structure and implement the interface.
2. Set up data exchange with Arduino.
3. Implement report generation logic and PDF handling.
4. Test the program and make necessary adjustments.
This plan covers the main functional requirements and steps for developing the program.
#### 1. **Splash Screen (Welcome Window)**
- **Functionality**: Upon startup, the program should display a welcome screen for 5 seconds.
- **Implementation**: Use the `tkinter` module or another graphical library in Python to display the splash screen, after which it automatically transitions to the main program window.
- **Parameters**: Program title "Corrected Stand NS", welcome text, and image for the splash screen (can be set in the code).
#### 2. **Main Program Window**
The main window should include several components:
- **Input Fields**: For entering user data (operator’s name, test date, block number, test location, etc.).
- **Buttons**:
- For starting tests.
- For connecting to Arduino.
- For opening and printing reports.
- For closing the program.
- **Dynamic Elements**:
- Display real-time voltage data received from Arduino.
- Test status indicators (green, red, gray).
- Connection status indicators for Arduino (red, yellow, green).
#### 3. **Algorithm of Operation**
1. Upon launching the main window, the program attempts to connect to Arduino via the COM port.
2. The program checks the connection status and the regularity of data reception.
3. The user fills out all required fields and clicks a button to start the test.
4. The program ensures all mandatory fields are filled before starting the test.
5. The program sends data to Arduino via the COM port.
6. It receives the test result from Arduino, updates the test status, generates a PDF report, and opens it.
#### 4. **Data Formats for Communication with Arduino**
**Sent Data Format**:
1. For each of the 5 tests, send data in the following format:
- `START` – to start the test.
- `UNUSED` – do not perform action.
Example for testing the first block:
```
START; UNUSED; UNUSED; UNUSED; UNUSED;
```
**Received Data Format**:
1. Voltage in volts.
2. Test status for each block:
- `RES_OK` – test passed.
- `RES_ERROR` – test failed.
- `UNUSED` – test not performed.
- `TOUCH_ERROR` – failed to start test due to limit switch error.
#### 5. **PDF Report Generation**
- Use Python libraries like `reportlab` or `fpdf` to generate PDF reports.
- The PDF report will include user-entered data and test results.
- Two templates exist:
- **If the test passed**: Write a report indicating the block is functional.
- **If the test failed**: Write a report indicating a block malfunction.
#### 6. **Implementation Details**:
- **Arduino Connection via COM Port**: Use the `pyserial` library for Arduino communication.
- **Status Indicators**: Use `tkinter` to display graphical elements such as status indicators.
- **Input Validation**: Ensure all required fields are filled before starting the test.
#### 7. **Cross-Platform Compatibility**
The program should be compatible with both Windows and macOS, requiring proper configuration of the Python environment and libraries for each operating system.
- Include installation instructions for Python and necessary libraries for each OS.
- Provide paths for compiling the program for Windows and macOS.
#### **Next Steps**:
1. Develop the main program structure and implement the interface.
2. Set up data exchange with Arduino.
3. Implement report generation logic and PDF handling.
4. Test the program and make necessary adjustments.
This plan covers the main functional requirements and steps for developing the program.