m0in92 / EV_sim

Electric Vehicle Dynamics Simulation
MIT License
11 stars 6 forks source link
dataset drivecycle electric-vehicles simulations vehicle

EV_sim

Copywrite©️ 2023 by Moin Ahmed. All Rights Reserved.

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.

Features

image

Installation

Either of the two recommended installation procedures can be used and the steps for these installation procedures are listed below.

Git Clone

  1. Ensure python version >= 3.10.0 is used.
  2. External Python dependencies can be installed to your system or Python virtual environment using the command pip install -r requirements.txt.
  3. Clone the repository, for example using git clone git@github.com:m0in92/EV_sim.git using Git Bash.

    Python setup

  4. Download or clone this repository
  5. 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 a dist directory in the repository. Within this directory, a zip or a tar.gz file resides.
  6. It is recommended to create a python virtual environment before the installation of this project as a Python package.
  7. Once the Python virtual environment is created, run the command pip install -r requirements.txt to install all the external Python dependencies.
  8. 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.
  9. 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.

Basic Usage

Using Source code

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()

Using GUI

One way to execute gui is to run python -m EV_sim on the command line.

Vehicles in the Database:

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

Drive Cycles in the Package:

File Directories

References

  1. Gillespie, T. D. (Thomas D. ). (1992). Fundamentals of vehicle dynamics.
  2. Plett, G. (2015). Simulating Battery Packs. In Battery Management Systems, vol 2 (1st Edition, pp. 31–67). Artech House.
  3. https://evspecifications.com
  4. https://ev-database.org
  5. https://insideevs.com/
  6. https://www.torquenews.com/
  7. https://www.guideautoweb.com/en/
  8. https://www.caranddriver.com/
  9. https://www.nrel.gov/transportation/drive-cycle-tool/
  10. https://www.epa.gov/vehicle-and-fuel-emissions-testing/dynamometer-drive-schedules
  11. https://www.batterydesign.net/
  12. https://pushevs.com/2021/03/30/ncm-712-by-lg-chem-e66a-and-e78-battery-cells/