This is the fastim-3
version of NREL's FASTSim.
It introduces numerous new enhancements and features, including:
- ~10x faster! -- when setting
save_interval
toNone
, which means only the state at the last time step, which includes fuel consumption and/or battery depletion, among other useful cumulative state variables. - Roughly ~60% reduction in memory consumption (~160 mb in
fastsim-2
v. 60 mb infastsim-3
- object-oriented, hierarchical model structure
- ability to control granularity of time-resolved data -- e.g. save at every time step, save at every _n_th time step, or never save at all (saving only cumulative trip-level results)
- component-specific vehicle models -- i.e. the conventional vehicle contains only data for the fuel
converter and other relevant components but does contain any dummy battery or motor parameters as
is the case in
fastsim-2
- file formats that are more robust and more human readable
- backwards compatibility with
fastsim-2
- flexible data structures to allow for future model types
- ability to simulate standalone component models
- flexible model interfacing (e.g. multiple folder/file formats for reading and/or writing data)
- more accurate interpolation methods
Set up and activate a python environment (compatible with Python 3.8 - 3.10; we recommend Python 3.10) with the following steps.
- Create:
conda create -n fastsim python=3.10
- Activate:
conda activate fastsim
There is some variation based on your Operating System:
-
PowerShell (windows):
- Create:
python -m venv fastsim-venv
-- name is user decision - Activate:
fastsim-venv/Scripts/Activate.ps1
- Create:
-
Bash (i.e. unix/linux/mac):
- Create:
python -m venv fastsim-venv
-- name is user decision - Activate:
source fastsim-venv/bin/activate
- Create:
-
Command Prompt (windows):
- Create:
python -m venv fastsim-venv
-- name is user decision - Activate:
fastsim-venv/Scripts/activate.bat
- Create:
Pixi (recommended for developers)
pixi shell -e dev
-- this creates the environment, installs all the dependencies, builds fastsim, and activates the environment
In an active Python environment created above, run pip install fastsim
.
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:
- Run
pip install -e ".[dev]"
Optional testing steps: - Run
cargo test
- Run
pytest -v python/fastsim/tests/
- Run
To see and run examples, download the fastsim-3
demo files using the following code (with your Python environment activated and fastsim-3
installed):
from fastsim import utils
utils.copy_demo_files()
This code downloads demo files into a specified local directory (if no directory is specified, it will create a \demos
folder in the current working directory). WARNING: If you download the demo files to a location where files of the same name already exist, the original files will be overwritten.
Chad Baker -- [email protected]
Aaron Brooker -- [email protected]
Kyle Carow -- [email protected]
Jeffrey Gonder -- [email protected]
Jacob Holden -- [email protected]
Jinghu Hu -- [email protected]
Jason Lustbader -- [email protected]
Sean Lopp -- [email protected]
Matthew Moniot -- [email protected]
Grant Payne -- [email protected]
Laurie Ramroth -- [email protected]
Eric Wood -- [email protected]
Robin Steuteville -- [email protected]