Tool for modeling and optimization of advanced locomotive powertrains for freight rail decarbonization.
Project description
ALTRIOS
The Advanced Locomotive Technology and Rail Infrastructure Optimization System (ALTRIOS) is a tool for simulating and optimizing the rollout of advanced locomotive technologies and associated infrastructure with the goal of decarbonizing freight rail. ALTRIOS-lite will be released no later than June 2023, but for a richer, full-featured experience, we recommend using ALTRIOS through the Python API user interface, and we offer full installation instructions and numerous usage examples.
Installation
All Users
Python Setup
- Python installation options:
- Option 1 -- Python: https://www.python.org/downloads/. We recommend Python 3.10. Be sure to check the
Add to PATH
option during installation. - Option 2 -- Anaconda: we recommend https://docs.conda.io/en/latest/miniconda.html.
- Option 1 -- Python: https://www.python.org/downloads/. We recommend Python 3.10. Be sure to check the
- Setup a python environment. ALTRIOS can work with Python 3.8, 3.9, or 3.10, but we recommend 3.10 for better performance and user experience. Create a python environment for ALTRIOS with either of two methods:
- Option 1 -- Python Venv
- Navigate to the ALTRIOS folder you just cloned or any folder you'd like for using ALTRIOS. Remember the folder you use!
- Assuming you have Python 3.10 installed, run
python3.10 -m venv altrios-venv
in your terminal enviroment (we recommend PowerShell in Windows, which comes pre-installed). This tells Python 3.10 to use thevenv
module to create a virtual environment (which will be ignored by git if namedaltrios-venv
) in theALTRIOS/altrios-venv/
. - Activate the environment you just created to install packages or anytime you're running ALTRIOS:
- Mac and Linux:
source altrios-venv/bin/activate
- Windows:
altrios-venv/Scripts/activate.bat
in a windows command prompt or power shell orsource ./altrios-venv/scripts/activate
in git bash terminal - When the environment is activated, your terminal session will have a decorator that looks like
(altrios-venv)
.
- Mac and Linux:
- Option 2 -- Anaconda:
- Open an Anaconda prompt (in Windows, we recommend Anaconda Powershell Prompt) and run the command
conda create -n altrios python=3.10
to create an Anaconda environment namedaltrios
. - Activate the environment to install packages or anytime you're running ALTRIOS: run
conda activate altrios
.
- Open an Anaconda prompt (in Windows, we recommend Anaconda Powershell Prompt) and run the command
- Option 1 -- Python Venv
ALTRIOS Setup
- Download an
all-wheels.zip
file from ALTRIOS release. - Unzip the release in the folder where you want to install ALTRIOS.
- With your Python environment activated, run
pip install --find-links <path-to-release-folder> altrios
Congratulations, you've completed installation! Whenever you need to use ALTRIOS, be sure to activate your python environment created above.
Developers
Cloning the GitHub Repo
Clone the repository:
- Download and install git -- accept all defaults when installing.
- Create a parent directory in your preferred location to contain the repo -- e.g.
<USER_HOME>/Documents/altrios_project/
. - Open git bash, and inside the directory you created, clone the ALTRIOS repository with e.g.
git clone https://github.com/NREL/ALTRIOS.git
.
Installing the Python Package
Within the ALTRIOS folder, run pip install -e ".[dev]"
Using Pinned Package Versions
If you want to use pinned package versions to make sure you're environment is the same as the developers, you can do:
pip install -r requirements-dev.txt
Updating Pinned Package Versions
If you add a new package as a dependency, you should update the pinned requirements files.
To do this you can install pip tools: pip install pip-tools
and then:
pip-compile && pip-compile requirements-dev.in
This will generate two files: requirements.txt
and requirements-dev.txt
which you can check into the repository.
Rust Installation
Install Rust: https://www.rust-lang.org/tools/install.
Automated Building and Testing
There is a shortcut for building and running all tests, assuming you've installed the python package with develop mode. In the root of the ALTRIOS/
folder, run the build_and_test.sh
script. In Windows bash (e.g. git bash), run sh build_and_test.sh
, or in Linux/Unix, run ./build_and_test.sh
. This builds all the Rust code, runs Rust tests, builds the Python-exposed Rust code, and runs the Python tests.
Manually Building the Python API
Run maturin develop --release
. Note that not including --release
will cause a significant computational performance penalty.
Manually Testing
Whenever updating code, always run cargo test --release
inside ALTRIOS/rust/
to ensure that all tests pass. Also, be sure to rebuild the Python API regularly to ensure that it is up to date. Python unit tests run with python -m unittest discover
in the root folder of the git repository.
How to run ALTRIOS
With your activated Python environment with ALTRIOS fully installed, you can run several scripts in ALTRIOS/applications/demos/
.
You can run the Simulation Manager through a multi-week simulation of train operations with ALTRIOS/applications/demos/sim_manager_demo.py
by running python sim_manager_demo.py
in ALTRIOS/applications/demos/
. This will create a plots
subfolder in which the plots will be saved. To run interactively, fire up a Python IDE (e.g. VS Code, Spyder), and run the file. If you're in VS Code, you can run the file as a virtual jupyter notebook because of the "cells" that are marked with the # %%
annotation. You can click on line 2, for example, and hit <Shift> + <Enter>
to run the current cell in an interactive terminal (which will take several seconds to launch) and advance to the next cell. Alternatively, you can hit <Ctrl> + <Shift> + p
to enable interactive commands and type "run current cell".
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for altrios-0.1.0-cp310-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 025914ae1714b3b6a6f3ae6a6a84b3a1ebe54a94d2a930d2ed391553fb9b1f1f |
|
MD5 | 7a952d199ea76298860d32f3b8fc49a0 |
|
BLAKE2b-256 | 83773fd24f5b2d1aac8a17905c04cbb65724aa1b3a17aaef0e7c00d20717342b |
Hashes for altrios-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c262a0697160a1ca10d568dc3ccdd1d4142bdb83f9f1541b3c5190295be50d5 |
|
MD5 | 4e96f00cc1f2479a15f3f89e88fde4af |
|
BLAKE2b-256 | 17c27965164b088dec6bf2d612ebbe650344eb121b22f6e7535fea8ee3d74db5 |
Hashes for altrios-0.1.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ead293e3076be19baaf627eacaff0a0c88765f4c2b6614b64ab1f4bd4c12d00 |
|
MD5 | 45ed13da95e0e80fc2e6f25d68370157 |
|
BLAKE2b-256 | c2653738e2adeaf008d469fad9461f2b39a72434abd3cf75c09434879cbdd88d |
Hashes for altrios-0.1.0-cp39-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 80105f1a46e226c82567208991415d34b43250c95c0463a028c1097f95321f6f |
|
MD5 | 0e4c30e23e8b878fc4f267449ef3de0b |
|
BLAKE2b-256 | 55d7cf9535c83ada8a55419e648ef21c0a982207a0fbda38e8521cdc36e95535 |
Hashes for altrios-0.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 35ae1492246df012c4f25e7d614831797184b39def56b7c1b2428cb8f2a65982 |
|
MD5 | 70f69ed44bbf5e0052d93fb1f9a45568 |
|
BLAKE2b-256 | 12a04453e6d8ef38546ba9dc70024912740741bcd7f98333cf9bbca756e73677 |
Hashes for altrios-0.1.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23166422345370ee3cbff39e67a6f8b7aa2dc99e078660b8c51d419f40a4badf |
|
MD5 | 172954c7a16cefc31d3c8beac5a741bd |
|
BLAKE2b-256 | fad4b1d7ba4ddc22f05c6e840741a656e4c20309d411a39020a3923389850641 |
Hashes for altrios-0.1.0-cp38-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6024255b98f8018875b60bee6b5b3df951d929f1a380471f47fbdd32d66708c4 |
|
MD5 | 216ffcb517f24c98dbea68903d4822e5 |
|
BLAKE2b-256 | 27ac064844c18d2acfe3283422eab260c9426aab97158f48836a068e81f90a9a |
Hashes for altrios-0.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b73934aabe12113d988f5cdf9f9bc8574e6f32253f59fce7c8361afba323962 |
|
MD5 | 6e6d64addc1f68e997411385f7df435a |
|
BLAKE2b-256 | b5dddc36ec0c640a7a50f252f21686bc1ec2290d51b38a76cd2f0f26cafeba5c |
Hashes for altrios-0.1.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23aad0bae60f9202c6d8691ea90f58d40f66078e4f090ce6c5a7acabed0294e8 |
|
MD5 | 5472f25c29df14da6e18e12af6faeeaa |
|
BLAKE2b-256 | b9fd8fd2c92bf16edfb5000245d62f01364d7f4feaf703883e9e097ca4286bcc |