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.
python -m EV_sim
on the command line.Either of the two recommended installation procedures can be used and the steps for these installation procedures are listed below.
pip install -r requirements.txt
.git clone git@github.com:m0in92/EV_sim.git
using Git Bash.
python setup.py sdist
on the command line. This will create a dist
directory in the repository. Within this directory, a zip or a tar.gz file resides.pip install -r requirements.txt
to install all the external Python dependencies.cd
into the dist
directory and run pip install .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.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:
1. EV
2. DriveCycle
3. 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