Spaces:
Running
Running
title: Eng Calc | |
emoji: π’ | |
colorFrom: indigo | |
colorTo: green | |
sdk: gradio | |
sdk_version: 5.36.2 | |
app_file: app.py | |
pinned: false | |
license: agpl-3.0 | |
short_description: engineering calculator | |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference | |
# Engineering Calculator | |
A comprehensive Gradio-based web application providing multiple calculator modes for engineering, scientific, and programming calculations. | |
## Features | |
### Calculator Modes | |
- **Standard Calculator**: Basic arithmetic with infinite precision | |
- **Scientific Calculator**: Trigonometric functions, logarithms, and advanced mathematical operations | |
- **Programming Calculator**: Base conversions and bitwise operations | |
- **Engineering Calculator**: Specialized engineering calculations including 3-phase impedance analysis | |
### Key Capabilities | |
- **Infinite Precision Arithmetic**: No precision loss for basic operations (addition, subtraction, multiplication, division) | |
- **Calculation History**: Track and review previous calculations | |
- **Memory Functions**: Store and recall values | |
- **AI Assistant**: Interactive chat interface for calculation help (placeholder) | |
- **Complex Number Support**: Full support for complex numbers with j notation for electrical engineering | |
## Installation | |
1. Clone the repository: | |
```bash | |
git clone <repository-url> | |
cd calculator | |
``` | |
2. Install dependencies: | |
```bash | |
pip install -r requirements.txt | |
``` | |
3. Run the application: | |
```bash | |
python app.py | |
``` | |
The application will start on `http://localhost:7860` | |
## Engineering Functions | |
### 3-Phase Impedance Calculator | |
Calculate equivalent impedance matrices for 5-wire power systems (A, B, C, N, PE) using: | |
- Modified Carson's equations for earth return effects | |
- Kron reduction technique for system simplification | |
- IEEE standard electrical engineering practices | |
**Input Parameters:** | |
- Conductor coordinates (feet) | |
- Conductor electrical parameters (resistance in Ξ©/mile, GMR in feet) | |
**Output:** | |
- 5Γ5 primitive impedance matrix | |
- 3Γ3 reduced phase impedance matrix | |
- Distance calculations between conductors | |
- Matrix analysis and properties | |
## Project Structure | |
``` | |
calculator/ | |
βββ app.py # Main Gradio application | |
βββ requirements.txt # Python dependencies | |
βββ README.md # This file | |
βββ CLAUDE.md # Development guidance | |
βββ calculator/ # Core calculator modules | |
β βββ __init__.py | |
β βββ core.py # Calculator classes | |
βββ engineering/ # Engineering calculations | |
β βββ __init__.py | |
β βββ impedance.py # 3-phase impedance calculator | |
βββ tests/ # Test files (to be implemented) | |
βββ static/ # CSS and JavaScript assets | |
``` | |
## Usage Examples | |
### Standard Calculator | |
- Basic arithmetic operations with button interface | |
- Memory functions (MS, MR, MC) | |
- Calculation history tracking | |
### Scientific Calculator | |
- Trigonometric functions (sin, cos, tan, etc.) | |
- Inverse trigonometric functions (asin, acos, atan) | |
- Logarithmic functions (log, ln) | |
- Angle mode selection (degrees/radians) | |
### Programming Calculator | |
- Base conversions between decimal, binary, hexadecimal, and octal | |
- Support for various input formats | |
### Engineering Calculator | |
- Load test data for quick verification | |
- Input conductor coordinates and electrical parameters | |
- Calculate comprehensive impedance analysis | |
## Development | |
### Running Tests | |
```bash | |
python -m pytest tests/ # When test suite is implemented | |
``` | |
### Adding New Engineering Functions | |
1. Implement the calculation logic in the `engineering/` module | |
2. Add the function to the dropdown in `app.py` | |
3. Create the corresponding input interface | |
4. Update this README with usage instructions | |
## Dependencies | |
- **Gradio**: Web interface framework | |
- **NumPy**: Numerical computations and matrix operations | |
- **Pandas**: Data analysis and manipulation | |
- **Matplotlib**: Plotting and visualization | |
- **Seaborn**: Statistical visualization | |
## License | |
[Add license information here] | |
## Contributing | |
[Add contributing guidelines here] |