Skip to main content

Tool for modeling vehicle powertrains

Project description

FASTSim Logo

Description

This is the python/rust flavor of NREL's FASTSimTM, which is based on the original Excel implementation. Effort will be made to keep the core methodology between this software and the Excel flavor in line with one another.

All classes and methods are self-documented.

Installation

Python

Set up and activate a python environment (compatible with Python 3.8 - 3.10; we recommend Python 3.10) with the following steps.

Anaconda

  1. Create: conda create -n fastsim python=3.10
  2. Activate: conda activate fastsim

venv

There is some variation based on your Operating System:

  • PowerShell (windows):

    1. Create: python -m venv fastsim-venv -- name is user decision
    2. Activate: fastsim-venv/Scripts/Activate.ps1
  • Bash (i.e. unix/linux/mac):

    1. Create: python -m venv fastsim-venv -- name is user decision
    2. Activate: source fastsim-venv/bin/activate
  • Command Prompt (windows):

    1. Create: python -m venv fastsim-venv -- name is user decision
    2. Activate: fastsim-venv/Scripts/activate.bat

FASTSim

Via PyPI

In an active Python environment created above, run pip install fastsim.

Building from Scratch

Developers might want to install the code in place so that FASTSim files can be editable (the -e flag for pip provides this behavior). This option can be handy since FASTSim will be installed in place from the installation location and any updates will be propagated each time FASTSim is freshly imported. To do this, you'll need to have the Rust toolchain installed.

  • Option 1: run sh build_and_test.sh in root folder.
  • Option 2:
    1. Run pip install -e ".[dev]"
      Optional testing steps:
    2. Run cd rust/ && cargo test
    3. Run pytest -v python/fastsim/tests/

Usage

To see and run examples, navigate to ./python/fastsim/demos and run the various *demo.py files to see fastsim use cases. There are other examples in fastsim/tests.

Adding FASTSim as a Depency in Rust

Via GitHub

Add this line:
fastsim-core = { git = "https://github.nrel.gov/MBAP/fastsim", branch = "rust-port" }
to your Cargo.toml file, modifying the branch key as appropriate.

Via Cargo

This has not been implemented yet.

List of Abbreviations

cur = current time step
prev = previous time step
cyc = drive cycle
secs = seconds
mps = meters per second
mph = miles per hour
kw = kilowatts, unit of power
kwh = kilowatt-hour, unit of energy
kg = kilograms, unit of mass
max = maximum
min = minimum
avg = average
fs = fuel storage (eg. gasoline/diesel tank, pressurized hydrogen tank)
fc = fuel converter (eg. internal combustion engine, fuel cell)
mc = electric motor/generator and controller
ess = energy storage system (eg. high voltage traction battery)
chg = charging of a component
dis = discharging of a component
lim = limit of a component
regen = associated with regenerative braking
des = desired value
ach = achieved value
in = component input
out = component output

Known Issues

Rust versions of classes have limited Language Server Protocol integration, and we are actively working on fixing this.

Release Notes

2.1.1 -- license changed to Apache 2.0, default cycle grade and road type to zero if not provided, defaults to regenerative braking parameters, optional documentation fields now generated in Rust 2.1.0 -- release and installation improvements, RustVehicle init cleanup, calibration improvements 2.0.11 - 2.0.22 -- PyPI fixes. Also, Rust version is now >100x faster than Python version.
2.0.10 -- logging fixes, proc macro reorganization, some CAVs performance fixes
2.0.9 -- support for mac ARM/RISC architecture
2.0.8 -- performance improvements
2.0.6 -- dist_v2_m fixes and preliminary CAV functionality
2.0.5 -- added to_rust method for cycle
2.0.4 -- exposed veh.set_veh_mass
2.0.3 -- exposed veh.__post_init__
2.0.2 -- provisioned for non-default vehdb path
2.0.1 -- bug fix
2.0.0 -- All second-by-second calculations are now implemented in both rust and python. Rust provides a ~30x speedup
1.3.1 -- fastsim.simdrive.copy_sim_drive function can deepcopy jit to non-jit (and back) for pickling
1.2.6 -- time dilation bug fix for zero speed
1.2.4 -- bug fix changing == to =
1.2.3 -- veh_file can be passed as standalone argument. fcEffType can be anything if fcEffMap is provided, but typing is otherwise enforced.
1.2.2 -- added checks for some conflicting vehicle parameters. Vehicle parameters fcEffType and vehPtType must now be str type.
1.2.1 -- improved time dilation and added test for it
1.1.7 -- get_numba_veh() and get_numba_cyc() can now be called from already jitted objects
1.1.6 -- another bug fix for numba compatibility with corresponding unit test
1.1.5 -- bug fix for numba compatibility of fcPeakEffOverride and mcPeakEffOverride
1.1.4 -- nan bug fix for fcPeakEffOverride and mcPeakEffOverride
1.1.3 -- provisioned for optional load time motor and engine peak overrides
1.1.2 -- made vehicle loading more more robust
1.1.1 -- made vehicle loading more robust
1.1.0 -- separated jitclasses into own module, made vehicle engine and motor efficiency setting more robust
1.0.4 -- bug fix with custom engine curve
1.0.3 -- bug fixes, faster testing
1.0.2 -- forced type np.float64 on vehicle mass attributes
1.0.1 -- Added vehYear attribute to vehicle and other minor changes.
1.0.0 -- Implemented unittest package. Fixed energy audit calculations to be based on achieved speed. Updated this file. Improved documentation. Vehicle can be instantiated as dict.
0.1.5 -- Updated to be compatible with ADOPT
0.1.4 -- Bug fix: mcEffMap is now robust to having zero as first element
0.1.3 -- Bug fix: fastsim.vehicle.Vehicle method set_init_calcs no longer overrides fcEffMap.
0.1.2 -- Fixes os-dependency of xlwings by not running stuff that needs xlwings. Improvements in functional test. Refinment utomated typying of jitclass objects.
0.1.1 -- Now includes label fuel economy and/or battery kW-hr/mi values that match excel and test for benchmarking against Excel values and CPU time.

Contributors

Chad Baker -- Chad.Baker@nrel.gov
Aaron Brooker -- Aaron.Brooker@nrel.gov
Kyle Carow -- Kyle.Carow@nrel.gov
Jeffrey Gonder -- Jeff.Gonder@nrel.gov
Jacob Holden -- Jacob.Holden@nrel.gov
Jinghu Hu -- Jinghu.Hu@nrel.gov
Jason Lustbader -- Jason.Lustbader@nrel.gov
Sean Lopp -- sean@rstudio.com
Matthew Moniot -- Matthew.Moniot@nrel.gov
Grant Payne -- Grant.Payne@nrel.gov
Laurie Ramroth -- lramroth@ford.com
Eric Wood -- Eric.Wood@nrel.gov

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fastsim-2.1.1.tar.gz (5.3 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

fastsim-2.1.1-cp310-none-win_amd64.whl (7.9 MB view details)

Uploaded CPython 3.10Windows x86-64

fastsim-2.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.2 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

fastsim-2.1.1-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (10.1 MB view details)

Uploaded CPython 3.10macOS 10.9+ universal2 (ARM64, x86-64)macOS 10.9+ x86-64macOS 11.0+ ARM64

fastsim-2.1.1-cp39-none-win_amd64.whl (7.9 MB view details)

Uploaded CPython 3.9Windows x86-64

fastsim-2.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.2 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

fastsim-2.1.1-cp39-cp39-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (10.1 MB view details)

Uploaded CPython 3.9macOS 10.9+ universal2 (ARM64, x86-64)macOS 10.9+ x86-64macOS 11.0+ ARM64

fastsim-2.1.1-cp38-none-win_amd64.whl (7.9 MB view details)

Uploaded CPython 3.8Windows x86-64

fastsim-2.1.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.2 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

fastsim-2.1.1-cp38-cp38-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (10.1 MB view details)

Uploaded CPython 3.8macOS 10.9+ universal2 (ARM64, x86-64)macOS 10.9+ x86-64macOS 11.0+ ARM64

File details

Details for the file fastsim-2.1.1.tar.gz.

File metadata

  • Download URL: fastsim-2.1.1.tar.gz
  • Upload date:
  • Size: 5.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for fastsim-2.1.1.tar.gz
Algorithm Hash digest
SHA256 1ec10be8b5e77d907d9b4e33977363f5e009256b85a215fcc6f1ba273647a3fd
MD5 2d468afcb6c191eb81d316333066aa53
BLAKE2b-256 9071183ee91a27dd035d108500a8a5953ea184fb4340482a4de87c344fc4eb12

See more details on using hashes here.

File details

Details for the file fastsim-2.1.1-cp310-none-win_amd64.whl.

File metadata

  • Download URL: fastsim-2.1.1-cp310-none-win_amd64.whl
  • Upload date:
  • Size: 7.9 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for fastsim-2.1.1-cp310-none-win_amd64.whl
Algorithm Hash digest
SHA256 ceae47a3d782d96ca7354b3534a31d657435e91bc2f1803a21fe119876b4e40e
MD5 d3d9a03a640b39a8858731e7449398d7
BLAKE2b-256 8d1f82be3bff85744bf60f3230b0b1d0edfceda231a224076afc8edb8ea566bb

See more details on using hashes here.

File details

Details for the file fastsim-2.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fastsim-2.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2ac6e77a36ef216639c9eb93d6bdf2a9552607c91a099723ed6172a089b3dacb
MD5 5c5b7f0db366ec75e64c877d932d1301
BLAKE2b-256 282773b36e9d06c57574f9ee2908068573b7337b2bc6cb40e205e7af8884b8c0

See more details on using hashes here.

File details

Details for the file fastsim-2.1.1-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for fastsim-2.1.1-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 160e873c30039ea9bcbae7d4b8606cf8ffdc2ac2399717af3ea8c502278684da
MD5 1b32a20876622a04dd38b4cc7b886e37
BLAKE2b-256 f580539beda78395dddd622fa823e4f51fc28001588383ec6138128ab9bad749

See more details on using hashes here.

File details

Details for the file fastsim-2.1.1-cp39-none-win_amd64.whl.

File metadata

  • Download URL: fastsim-2.1.1-cp39-none-win_amd64.whl
  • Upload date:
  • Size: 7.9 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for fastsim-2.1.1-cp39-none-win_amd64.whl
Algorithm Hash digest
SHA256 c7d55684a23fa50d6aeeaf5daeb5ae97c46fae717120008ff73323db3c0e38a1
MD5 584beff97224e771f83fbdf6ccfe14a5
BLAKE2b-256 6e52c3d67eaa7ec535ac47c4fd3f61338a3c91e532ff104de94ae334b358dc7c

See more details on using hashes here.

File details

Details for the file fastsim-2.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fastsim-2.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3a41fb91bcec0f52680490157f8012e8f201d735dc6b09669be443c5ba06bfaa
MD5 6ed401e29cd8e01606d36c2177109e42
BLAKE2b-256 c1ea22e8b60ccd3facc488a7336f149d4fe4dd974fc03d8c0eb3ee0af21c1b11

See more details on using hashes here.

File details

Details for the file fastsim-2.1.1-cp39-cp39-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for fastsim-2.1.1-cp39-cp39-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 ba0e3e52b2c63be71e3e49ce1a973a68443358ddae7dde2eb523574fd1d853b6
MD5 68db0351325e4c97b79cad7ffaba020d
BLAKE2b-256 aaebdf3223eb7c906d825682e515cce16e8fc98fc53bca061b88837040f3896b

See more details on using hashes here.

File details

Details for the file fastsim-2.1.1-cp38-none-win_amd64.whl.

File metadata

  • Download URL: fastsim-2.1.1-cp38-none-win_amd64.whl
  • Upload date:
  • Size: 7.9 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for fastsim-2.1.1-cp38-none-win_amd64.whl
Algorithm Hash digest
SHA256 9cd4613770fb09a978eed223a7f14a757bd53950bf876ab03a8b67917c29a815
MD5 3558cdc7bb1f8c3d811c877be3ddc767
BLAKE2b-256 dd0ba0ea80164ebca0a102d4dbf03457cdd5fe1fd5acf66fc6fffb9004bd6096

See more details on using hashes here.

File details

Details for the file fastsim-2.1.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fastsim-2.1.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d767124df9802953c5b241847a6c68d48e59ff88f8201e49237aeced6a9d2a2a
MD5 4678a7210f084f87dde5f2589fd813ca
BLAKE2b-256 deba45483fe9872e302820e6f7878247e653832badf7edbb61404bf5340ef7a7

See more details on using hashes here.

File details

Details for the file fastsim-2.1.1-cp38-cp38-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for fastsim-2.1.1-cp38-cp38-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 8a9046629fef6a84636c50c548241e2c15bc3f05f8957cc047560c2544fa5210
MD5 eba7da345a38143d68f09e158f7cad98
BLAKE2b-256 387f9a1fa28b270505dd9972044239758e9fa7a1fe468dac386abc535ce551eb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page