# sakthi8888-tech/ev-powertrain-sim architecture

> Architecture diagram of the GitHub repository sakthi8888-tech/ev-powertrain-sim, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sakthi8888-tech/ev-powertrain-sim
- Repository: https://github.com/sakthi8888-tech/ev-powertrain-sim

## Overview

This repository is a first-principles EV powertrain sizing and range simulator. Its main workflow builds a mixed urban/highway drive cycle, evaluates vehicle and motor behavior at each timestep, then calculates energy use, range, and sizing metrics and writes reports. The README also documents three plots and the CSV and text outputs. The sampled source shows the simulator’s direct calls; the graph omits internal relationships not evidenced in the excerpts.

Main entry points: [`simulate.py`](https://github.com/sakthi8888-tech/ev-powertrain-sim/blob/main/simulate.py) (Simulation runner), [`drive_cycle.py`](https://github.com/sakthi8888-tech/ev-powertrain-sim/blob/main/drive_cycle.py) (Mixed cycle generator), [`vehicle_model.py`](https://github.com/sakthi8888-tech/ev-powertrain-sim/blob/main/vehicle_model.py) (Vehicle parameters), [`results/drive_cycle_log.csv`](https://github.com/sakthi8888-tech/ev-powertrain-sim/blob/main/results/drive_cycle_log.csv) (Drive-cycle log)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cycle["Drive cycle"]
  node_cycle_generator["Mixed cycle generator<br/>[drive_cycle.py]"]
end

subgraph group_model["Vehicle model"]
  node_vehicle_parameters["Vehicle parameters<br/>[vehicle_model.py]"]
  node_road_load["Road-load dynamics<br/>[vehicle_model.py]"]
  node_motor_conversion["Wheel-to-motor conversion<br/>[vehicle_model.py]"]
  node_motor_limits["Motor limits<br/>[vehicle_model.py]"]
end

subgraph group_analysis["Simulation and results"]
  node_simulation["Simulation runner<br/>[simulate.py]"]
  node_energy_range["Energy and range metrics<br/>[simulate.py]"]
  node_visualizations["Plots<br/>[simulate.py]"]
  node_csv_log["Drive-cycle log"]
  node_summary_file["Summary report<br/>[summary.txt]"]
end

node_engineer(("Engineer"))

node_engineer -->|"runs"| node_simulation
node_simulation -->|"builds cycle"| node_cycle_generator
node_simulation -->|"uses defaults"| node_vehicle_parameters
node_simulation -->|"computes force"| node_road_load
node_simulation -->|"converts demand"| node_motor_conversion
node_simulation -->|"clips demand"| node_motor_limits
node_simulation -->|"summarizes"| node_energy_range
node_simulation -->|"generates plots"| node_visualizations
node_simulation -->|"writes log"| node_csv_log
node_simulation -->|"writes report"| node_summary_file

click node_cycle_generator "https://github.com/sakthi8888-tech/ev-powertrain-sim/blob/main/drive_cycle.py"
click node_vehicle_parameters "https://github.com/sakthi8888-tech/ev-powertrain-sim/blob/main/vehicle_model.py"
click node_road_load "https://github.com/sakthi8888-tech/ev-powertrain-sim/blob/main/vehicle_model.py"
click node_motor_conversion "https://github.com/sakthi8888-tech/ev-powertrain-sim/blob/main/vehicle_model.py"
click node_motor_limits "https://github.com/sakthi8888-tech/ev-powertrain-sim/blob/main/vehicle_model.py"
click node_simulation "https://github.com/sakthi8888-tech/ev-powertrain-sim/blob/main/simulate.py"
click node_energy_range "https://github.com/sakthi8888-tech/ev-powertrain-sim/blob/main/simulate.py"
click node_visualizations "https://github.com/sakthi8888-tech/ev-powertrain-sim/blob/main/simulate.py"
click node_csv_log "https://github.com/sakthi8888-tech/ev-powertrain-sim/blob/main/results/drive_cycle_log.csv"
click node_summary_file "https://github.com/sakthi8888-tech/ev-powertrain-sim/blob/main/results/summary.txt"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cycle_generator toneBlue
class node_vehicle_parameters,node_road_load,node_motor_conversion,node_motor_limits toneAmber
class node_simulation,node_energy_range,node_visualizations,node_csv_log,node_summary_file toneMint
class node_engineer toneIndigo
```

## Components

### Drive cycle

- [Mixed cycle generator](https://github.com/sakthi8888-tech/ev-powertrain-sim/blob/main/drive_cycle.py): `drive_cycle.py`

### Vehicle model

- [Vehicle parameters](https://github.com/sakthi8888-tech/ev-powertrain-sim/blob/main/vehicle_model.py): `vehicle_model.py`
- [Road-load dynamics](https://github.com/sakthi8888-tech/ev-powertrain-sim/blob/main/vehicle_model.py): `vehicle_model.py`
- [Wheel-to-motor conversion](https://github.com/sakthi8888-tech/ev-powertrain-sim/blob/main/vehicle_model.py): `vehicle_model.py`
- [Motor limits](https://github.com/sakthi8888-tech/ev-powertrain-sim/blob/main/vehicle_model.py): `vehicle_model.py`

### Simulation and results

- [Simulation runner](https://github.com/sakthi8888-tech/ev-powertrain-sim/blob/main/simulate.py): `simulate.py`
- [Energy and range metrics](https://github.com/sakthi8888-tech/ev-powertrain-sim/blob/main/simulate.py): `simulate.py`
- [Plots](https://github.com/sakthi8888-tech/ev-powertrain-sim/blob/main/simulate.py): `simulate.py`
- [Drive-cycle log](https://github.com/sakthi8888-tech/ev-powertrain-sim/blob/main/results/drive_cycle_log.csv): `results/drive_cycle_log.csv`
- [Summary report](https://github.com/sakthi8888-tech/ev-powertrain-sim/blob/main/results/summary.txt): `results/summary.txt`

### Other components

- **Engineer**

## Connections

- Engineer → Simulation runner: runs (evidence: `README.md`)
- Simulation runner → Mixed cycle generator: builds cycle (evidence: `simulate.py`)
- Simulation runner → Vehicle parameters: uses defaults (evidence: `simulate.py`)
- Simulation runner → Road-load dynamics: computes force (evidence: `simulate.py`)
- Simulation runner → Wheel-to-motor conversion: converts demand (evidence: `simulate.py`)
- Simulation runner → Motor limits: clips demand (evidence: `simulate.py`)
- Simulation runner → Energy and range metrics: summarizes (evidence: `simulate.py`)
- Simulation runner → Plots: generates plots (evidence: `simulate.py`)
- Simulation runner → Drive-cycle log: writes log (evidence: `simulate.py`)
- Simulation runner → Summary report: writes report (evidence: `simulate.py`)
