Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update readme with new installation instructions #30

Merged
merged 3 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 21 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,61 +9,54 @@

This repo houses T3CO (Transportation Technology Total Cost of Ownership), software for modeling total cost of ownership for commercial vehicles with advanced powertrains.

To get started, read the [Quick Start Guide](https://github.com/NREL/T3CO/blob/1eefffc251fcbd2b0c0515512f51d1b27bb978fd/docs/quick_start.md)
To get started, read the [Quick Start Guide](https://github.com/NREL/T3CO/blob/main/docs/quick_start.md)

For information on the T3CO models, go to the [Overview](https://github.com/NREL/T3CO/blob/264a730de942671eb2345a5afca7e1afd6d67666/docs/T3CO_Overview.md)
For information on the T3CO models, go to the [Overview](https://github.com/NREL/T3CO/blob/main/docs/T3CO_Overview.md)

## Usage

**T3CO** is a general framework allowing a user to determine the total cost of ownership (TCO) of a FASTSim vehicle (paired with a FASTSim DriveCycle(s) for determining fuel efficiency). The user can also determine performance of gradability, acceleration, and range. In addition to straight TCO computation there is also the option to optimize a vehicle powertrain such that it meets performance optional targets while also optionally minimizing TCO.
**T3CO** is a general framework allowing a user to determine the total cost of ownership (TCO) of a FASTSim vehicle (paired with a FASTSim DriveCycle(s) for determining fuel efficiency). The user can also determine performance of gradeability, acceleration, and range. In addition to straight TCO computation there is also the option to optimize a vehicle powertrain such that it meets performance optional targets while also optionally minimizing TCO.

## Installation
### Installing From [PyPI](https://pypi.org/project/t3co/)
T3CO can be easily installed from PyPI. This is the preferred method when using T3CO as a dependency for a project. To install the latest release:
T3CO is available on PyPI and as a public access GitHub repository. This gives the user two ways of installing the T3CO Python Package.
### 1. Installing From [PyPI](https://pypi.org/project/t3co/)
```bash
pip install t3co
```

To install a specific version (for example T3CO v1.0.8):
```bash
pip install t3co==1.0.8
```

### From GitHub
T3CO can also be installed directly from the GitHub repository for accessing demo input files and running T3CO using the Command Line Interface.
### 2. Cloning the [GitHub Repo](https://github.com/NREL/T3CO)
T3CO can also be installed directly from a clone of the GitHub repository which makes it easier to access input files and run the tool using a Command Line Interface.

First, clone the repository from [GitHub](https://github.com/NREL/T3CO):
First, [clone](https://git-scm.com/docs/git-clone) the repository from [GitHub](https://github.com/NREL/T3CO) from your desired directory:
```bash
git clone https://github.com/NREL/T3CO.git T3CO
```

From within the [Python environment](#setting-up-env) Navigate to the parent directory containing the T3CO repository e.g. `cd github/T3CO/` and run:
From within the [Python environment](./docs/installation.md#setting-up-env), navigate to the parent directory containing the T3CO repository (e.g. `cd GitHub/T3CO/`) and run:
```bash
pip install -e .
```
This installs the local version of the T3CO clone along with all its [dependencies](https://github.com/NREL/T3CO/blob/29b0e848360b3b2de84b555bf52c52bf6e76134e/requirements.txt).


## Demo
**Using the [T3CO Config](https://github.com/NREL/T3CO/blob/c3df6421033cef7d35b7d7cd575ab94e85fcd9a9/t3co/resources/T3COConfig.csv) file**

Create a new `analysis_id` on `./t3co/resources/T3COConfig.csv` or update the existing rows and use them to run T3CO.
This installs the local version of the T3CO clone along with all its [dependencies](https://github.com/NREL/T3CO/blob/main/requirements.txt).

### Copying the Demo Input Files
The [`t3co.resources`](https://github.com/NREL/T3CO/tree/main/t3co/resources) folder contains all the necessary input files needed for running T3CO. To get an offline copy of this folder in your preferred directory, run:
```bash
cd t3co
python sweep.py --analysis-id=0
install_t3co_demo_inputs
```

**Using Command Line Arguments**
More information on the demo input files can be found in the [Installation Guide](https://github.com/NREL/T3CO/blob/main/docs/installation.md#copy-demo-inputs)


## Running T3CO
T3CO needs three main input files (*Vehicles*, *Scenarios*, and *Config*) to run an analysis. The analysis settings, file paths to main and auxiliary input files, and other parameter overrides are saved as an entry on the *Config* file. The user is provided with 500+ *Vehicle-Scenario* pairs inputs and four *Config* sample analyses to choose from to modify parameters and/or run their first T3CO analysis. The main module for T3CO,`t3co.sweep`, can be run using:

```bash
cd t3co
python sweep.py --skip_all_opt --selections [1,2,3,4,5] --dst_dir .t3co_results/demodata
python -m t3co.sweep --analysis-id=0 --config=<path/to/T3COConfig.csv>
```

Point the `--config` argument to the `T3COConfig.csv` file path (either the t3co/resource/T3COConfig.csv file in a repo clone or the demo_inputs/T3COConfig.csv file after copying the demo input files. This parameter defaults to the T3COConfig.csv file in the t3co.resources module) and `--analysis-id` to the desired `config.analysis_id` (either an existing row or a newly added "Analysis" row in the `T3COConfig.csv` file. Default = `0`).

**using optimiztion in sweep module** [see](https://github.com/NREL/T3CO/blob/master/docs/optimization.md#optimization-from-sweep-module-)

Additional information on the inputs, the Batch Mode feature, other CLI arguments, and description of T3CO results are mentioned in the [Quick Start Guide](https://github.com/NREL/T3CO/blob/main/docs/quick_start.md)

## Acknowledgements
This tool was developed with funding support from the US Department of Energy's Office of Energy Efficiency and Renewable Energy (EERE)'s Vehicle Technology Office.
Expand Down
2 changes: 1 addition & 1 deletion docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ T3CO depends on [Python](https://www.python.org/downloads/)>=3.8 and <=3.10. To
## Installing T3CO Python Package
T3CO is available on PyPI and as a public access GitHub repository. This gives the user two ways of installing the T3CO Python Package.
### 1. Installing From [PyPI](https://pypi.org/project/t3co/) <a name=install-from-pypi></a>
T3CO can be easily installed from PyPI. This is the preferred method when using T3CO to run analysis using input files. To install the latest release:
T3CO can be easily installed from PyPI. This is the preferred method for using T3CO to run analysis with input files. To install the latest release:
```bash
pip install t3co
```
Expand Down
6 changes: 1 addition & 5 deletions t3co/run/run_scenario.py
Original file line number Diff line number Diff line change
Expand Up @@ -734,14 +734,12 @@ def load_design_cycle_from_scenario(
sdc = str(config.dc_files[dc_id])
else:
sdc = str(scenario.drive_cycle)
print(f"sdc: {sdc}")
print(f"Drivecycle: {sdc}")
if "[" in sdc and "]" in sdc and "(" in sdc and ")" in sdc:
scenario.drive_cycle = ast.literal_eval(sdc)
range_cyc = []
for dc_weight in scenario.drive_cycle:
cycle_file_name = Path(dc_weight[0]).name
print(f"Drivecycle= {cycle_file_name} weight = {dc_weight[1]}")

dc = load_design_cycle_from_path(
cyc_file_path=Path(cyc_file_path) / dc_weight[0]
)
Expand All @@ -750,7 +748,6 @@ def load_design_cycle_from_scenario(
range_cyc.append((dc, weight))
else:
cycle_file_name = Path(sdc).name
print(f"Drivecycle= {cycle_file_name}")
range_cyc = load_design_cycle_from_path(cyc_file_path=sdc)
range_cyc.name = cycle_file_name

Expand All @@ -773,7 +770,6 @@ def load_design_cycle_from_path(cyc_file_path: str) -> fastsim.cycle.Cycle:

else:
finalized_path = cyc_file_path
print(f"Drivecycle final path: {finalized_path}")
range_cyc = cycle.Cycle.from_file(finalized_path)
range_cyc = range_cyc.to_rust()
return range_cyc
Expand Down
Loading