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.post1-cp310-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d7418447bdabfe643dd91dd8e640eb2bd96ac528f3fd02756c576c39f523a268 |
|
MD5 | a4c062f670467acbbad5ef3fec33ffa8 |
|
BLAKE2b-256 | 4ac4fedba78d3bebcdf82a907aada7228216fd0af064b7bbf59ee7adcf187714 |
Hashes for altrios-0.1.0.post1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4eb24e133f502ccecc11231411aa7769f08f9b9336d5d8f97ede76588ccb7c34 |
|
MD5 | 484294ab771959968afa377f7ec45eea |
|
BLAKE2b-256 | 2f1d6b7116f2ea858909f3b2bccd96eb625213e5ab9441ad660cbedd6d2eda79 |
Hashes for altrios-0.1.0.post1-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6c26ba1ccb089ab68d21ba12bb9dac7e7815c7ea467f64491fd2e3dd38fc38f8 |
|
MD5 | 086eb7323ee3b61b680cc0c12e9db3eb |
|
BLAKE2b-256 | 272df37147a64d86c12b00f506eb29b2e7e01f90fda68162e8a1271144766d11 |
Hashes for altrios-0.1.0.post1-cp39-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6528af1d52c126bb2b72711ca8fb3fbf787248558ee36cb28132a13e000df9e6 |
|
MD5 | ccbed97cb961bfbb0edf9338c4798c4b |
|
BLAKE2b-256 | c79c3b4bdd02b0c7d23edcfd37b45db62c94a7b6e8504a32547b2ebc88ff1b18 |
Hashes for altrios-0.1.0.post1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5aa1fa016cda8329d6c95c57223953ed280ae6edb647528e24fb12c919e6514b |
|
MD5 | 3e7b71a5ac30ab512c749a553b9f79b9 |
|
BLAKE2b-256 | 00671156abaad1feaf7bd38fd225956a34bb24d3a530e51af19bbbed2e89dfbc |
Hashes for altrios-0.1.0.post1-cp39-cp39-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8b77c0596412886fb4c5b461aaa8e8d03b6702d5031a4a56eb43a9d82279b8fe |
|
MD5 | 0689662df4ab6282305c414da6b0344b |
|
BLAKE2b-256 | 44d8f236d1da01949d4622a9c4293e803e207c5771411b5383397d7a5818d8a6 |
Hashes for altrios-0.1.0.post1-cp38-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0e3409b6a256c0add0d3c364eb7ec8cc2817c27d9e5c974220690a85cf653f69 |
|
MD5 | 62a1c32d5c76607c2074a3761a897eff |
|
BLAKE2b-256 | 75cc6c3ac7c34c9b4eb7b5ecdddb4442c4cb66437963b6df58b07e297a914830 |
Hashes for altrios-0.1.0.post1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9005a85903fc0b8227b37189d72c26c2163511aa1735810d19f5ca33f8d8c9b1 |
|
MD5 | 0f8c31f8c79c0c81bd395ef65c852957 |
|
BLAKE2b-256 | 4c1b7588c26974cca05fb6a52209ec1383533d59a6fd151d6dd96f13f6b76542 |
Hashes for altrios-0.1.0.post1-cp38-cp38-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b0cc98d3029fc67c660e4fe92ed422dd43f4aa704d9631cc7f6918054e70e532 |
|
MD5 | 20402789ece512229e39f9f1f18989ba |
|
BLAKE2b-256 | ae069e194f4dac783c0b05b952f06c0114295b92cfd51b7b785c178d18860e0e |