This repository contains the Python source code for simulating the power and energy demand of an electric vehicle (EV) during its drive cycle. This simulation takes in various vehicle parameters as its inputs. The simulation uses the methods described by Gillespie1 and Plett2.
To summarize, the demanded motor power is calculated at every time step. This calculation is done by first calculating the desired speed, acceleration, force, and torques. The motor characteristics limit these desired variables, and hence the limited torque and actual forces, acceleration, and speed are then calculated2.
- Graphic User Interface (GUI)
- One way to execute gui is to run
python -m EV_sim
on the command line.
- One way to execute gui is to run
Either of the two recommended installation procedures can be used and the steps for these installation procedures are listed below.
- Ensure python version >= 3.10.0 is used.
- External Python dependencies can be installed to your system or Python virtual environment using the command
pip install -r requirements.txt
. - Clone the repository, for example using
git clone [email protected]:m0in92/EV_sim.git
using Git Bash.
- Download or clone this repository
- Ensure, on the command line, you are on the repository directory (where the setup.py resides) and run
python setup.py sdist
on the command line. This will create adist
directory in the repository. Within this directory, a zip or a tar.gz file resides. - It is recommended to create a python virtual environment before the installation of this project as a Python package.
- Once the Python virtual environment is created, run the command
pip install -r requirements.txt
to install all the external Python dependencies. cd
into thedist
directory and runpip install <EV_sim_version>.tar.gz
(or zip file) on the command line. This will install EV_sim on your system (or virtual environment) and EV_sim can be imported as any other Python package.- Run an example in the examples folder to test the installation. Alternatively, the gui version can be opened using the the command
python -m EV_sim
on the command line.
Import the EV_sim module using Python's import command, and this imports relevant submodules within EV_sim.
import EV_sim
Simulation requires instances of three classes:
- EV
- DriveCycle
- ExternalConditions
Then, "EV" class object needs to be initialized. Various vehicle parameters needs to be defined to initialize it. Instead, EV_sim provides a database of commercial electric vehicles (EV), which contains all the relevant required parameters. For the list of supported commercial EV, refer to the "Vehicles in the Database" section. When using the parameters from the database, "EVfromDatabase" class object (derived child of EV class) is called instead. The "EVfromDatabase" takes vehicle alias as its input parameter. In EV_sim, vehicle alias is a string and follows the convention: 'manufacturer_year_model name_trim'.
For example:
alias_name = "Tesla_2022_Model3_RWD"
volt = EV_sim.EVFromDatabase(alias_name=alias_name)
Specify the DriveCycle and ExternalConditions class objects.
udds = EV_sim.DriveCycle(drive_cycle_name="us06")
waterloo = EV_sim.ExternalConditions(rho=1.225, road_grade=0.3)
Finally, declare the VehicleDynamics object and use it's simulate method.
model = EV_sim.VehicleDynamics(ev_obj=volt, drive_cycle_obj=udds, external_condition_obj=waterloo)
sol = model.simulate()
One way to execute gui is to run python -m EV_sim
on the command line.
The following vehicles and their corresponding vehicle alias names are listed below. This list will be updated as the vehicle database grows. For sources of the vehicle parameters in the database, refer to the References section. Please note that certain approximations and assumptions were made for the vehicle parameters. Feel free to contact the author for more details, corrections, and/or contributions.
- Audi 2021 e-tron 55 quattro : Audi_2021_e-tron 55 quattro
- Chevy 2017 Volt : Volt_2017
- Tesla 2022 Model 3 RWD : Tesla_2022_Model3_RWD
- Tesla 2022 Model 3 Long Range AWD : Tesla_2022_Model3_LongRangeAWD
- Tesla 2022 Model 3 Performance AWD : Tesla_2022_Model3_PerformanceAWD
- Tesla 2022 Model S Plaid Tri Motor : Tesla_2022_ModelS_PlaidTriMotorAWD
- Tesla 2022 ModelS Long Range : Tesla_2022_ModelS_LongRange
- Tesla 2022 ModelX : Tesla_2022_ModelX
- Tesla 2022 ModelX Plaid : Tesla_2022_ModelX_Plaid
- Tesla 2022 ModelY RWD : Tesla_2022_ModelY_RWD
- Tesla 2022 ModelY Long Range AWD : Tesla_2022_ModelY_LongRangeAWD
- Tesla 2022 ModelY Performance AWD : Tesla_2022_ModelY_PerformanceAWD
- Air Conditioning Supplemental Driving Schedule (sc03) 10
- Braunschweig City Driving Cycle (bcdc) 9
- Federal Test Procedure (ftp) 10
- Highway Fuel Economy test (hwfet)
- New York City Cycle (nycc)
- Unified Cycle Driving Schedule (ucds) 9
- US06 (us06)
- Urban Dynamometer Driving Schedule (udds)
- Assets: Contains images for the README.md file
- EV_Sim: Source code
- config: path configurations
- examples: example implementation using source code
- data: datafiles for EVs and drive cycles
- utils: utility code for timing simulation times and printing useful database information.
- tests: Test code using the results from MATLAB code2.
- Gillespie, T. D. (Thomas D. ). (1992). Fundamentals of vehicle dynamics.
- Plett, G. (2015). Simulating Battery Packs. In Battery Management Systems, vol 2 (1st Edition, pp. 31–67). Artech House.
- https://evspecifications.com
- https://ev-database.org
- https://insideevs.com/
- https://www.torquenews.com/
- https://www.guideautoweb.com/en/
- https://www.caranddriver.com/
- https://www.nrel.gov/transportation/drive-cycle-tool/
- https://www.epa.gov/vehicle-and-fuel-emissions-testing/dynamometer-drive-schedules
- https://www.batterydesign.net/
- https://pushevs.com/2021/03/30/ncm-712-by-lg-chem-e66a-and-e78-battery-cells/