# Transformer Optimizer Web App A Flask-based web application for optimizing transformer designs and running manual simulations. ## Pages ### 1. Optimizer (http://localhost:5000/) Automatically finds the best tap configuration and input voltage to maximize efficiency. ### 2. Manual Simulation (http://localhost:5000/manual) Directly specify tap settings and input voltage to see performance results. ## Features ### Optimizer Page - **Interactive Sliders** for all parameters: - Load resistance (5Ω to 10kΩ) - Target power output (1W to 100W) - Operating frequency (100Hz to 50kHz) - Core loss (0W to 5W) - Maximum flux density (0.05T to 0.5T) - Maximum secondary voltage (10V to 500V) - Input voltage range (min/max) - **Real-time Optimization** using the transformer optimizer ### Manual Simulation Page - **Tap Selection**: Choose primary and secondary taps from dropdowns - **Input Parameters**: Set input voltage and frequency with sliders - **Load Conditions**: Configure load resistance and core loss ### Both Pages Display: - Efficiency (color-coded: green >90%, yellow >80%, red <80%) - Tap selections with turn counts - All voltages and currents - Separate copper losses for primary and secondary - Flux density and turns ratio - Input and output power ## Installation 1. Install dependencies: ```bash pip install -r requirements.txt ``` ## Running the App ```bash python app.py ``` Then open your browser to: http://localhost:5000 ## Configuration Edit `app.py` and modify the `get_default_transformer()` function to match your transformer specifications: - Tap positions - Core area - Turn counts - Resistance per turn for each segment ## API Endpoints - `GET /` - Optimizer page - `GET /manual` - Manual simulation page - `POST /api/optimize` - Run optimization with parameters - `POST /api/simulate` - Run manual simulation - `GET /api/transformer_info` - Get transformer configuration ## Usage ### Optimizer Mode 1. Adjust sliders to set your desired operating conditions 2. Click "⚡ Optimize Transformer" 3. View the optimized configuration and performance metrics 4. The optimizer will find the best tap combination and input voltage to maximize efficiency while meeting your constraints ### Manual Simulation Mode 1. Select primary and secondary taps from dropdowns 2. Adjust input voltage, frequency, load, and core loss with sliders 3. Click "▶️ Run Simulation" 4. View the performance results for your specified configuration