The Battery Life Calculator is a Python application designed to help users calculate the battery life of various devices and configurations. Built with the tkinter
library for a graphical user interface (GUI), this tool provides a user-friendly way to input device specifications and view results in a dynamic Treeview table. It supports multiple calculation modes and offers a robust error handling system to ensure accurate calculations.
- Multiple Calculation Modes:
- Always ON Mode
- Log Mode
- Sleep Mode
- User Input Fields:
- Battery voltage and capacity
- Power consumption for different modes
- Consumer currents and voltages
- Booster efficiency and self-discharge rate
- Dynamic Results Display:
- Results are shown in a sortable Treeview table
- Users can filter results based on selected modes and probes
- Error Handling:
- Displays error messages for invalid input values
- Python (3.x recommended)
- Basic knowledge of Python and GUI programming.
- Clone the repository:
git clone https://github.com/mootseeker/batteryCalculator.git cd batteryCalculator
- Ensure Python is installed. This project uses
tkinter
, which is included with most Python installations by default.
-
Start the application:
python calculator.py
-
Input Data:
- Enter battery specifications in the provided fields.
- Choose operating modes and probes from the listboxes.
- Click the "Calculate" button to perform the calculations.
-
View Results:
- Results are displayed in the Treeview table.
- Sort and filter results by selecting different modes and probes.
-
Exit the Application:
- Click the "Exit" button to close the application.
- Add additional calculation modes
- Enhance error handling for edge cases
- Improve user interface design
- Implement data export features (e.g., CSV, PDF)
treeview_sort_column(tv, col, reverse)
: Sorts columns in the Treeview widget.berechne_akkulaufzeit()
: Calculates battery life based on user inputs.berechne_laufzeit(akkuenergie_wh, leistung_watt, selbstentladung_prozent)
: Helper function for runtime calculation.berechne_akkulaufzeit_always_on(...)
: Computes battery life for Always ON Mode.berechne_akkulaufzeit_log_mode(...)
: Computes battery life for Log Mode.berechne_akkulaufzeit_sleep_mode(...)
: Computes battery life for Sleep Mode.get_selected_modus()
: Retrieves selected modes from the Mode Listbox.get_selected_probe()
: Retrieves selected probes from the Probe Listbox.beenden()
: Exits the application.
- Input Fields: For entering specifications and power details.
- Listboxes: For selecting modes and probes.
- Buttons: For calculating and exiting the application.
- Treeview: Displays results with sortable columns.
This project is licensed under the MIT License. See the LICENSE file for details.
Contributions are welcome! Please fork the repository, create a feature branch, commit your changes, and submit a pull request.
For questions or feedback, please open an issue on the repository or contact MootSeeker.
Happy coding!