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

Arrival features #61

Open
wants to merge 33 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
3373951
Update running instructions and clean code base.
Sep 15, 2018
c5127c1
Use code block syntax for code blocks.
Sep 15, 2018
953fc72
Set up Travis CI.
Sep 15, 2018
fa6f79d
Move docs from doc folder to Google Docs.
Sep 16, 2018
0620e6d
Fix typos and test syntax errors.
Sep 18, 2018
41c7965
Merge pull request #1 from nasa-airport/issue/update-dev-env
Sep 18, 2018
0b72a23
Add files via upload
morris0427 Sep 28, 2018
588ea53
Add requirements used by airport data generator.
Sep 30, 2018
5619389
Add expended SFO data (for all terminals).
Sep 30, 2018
8593829
Optimize node-link construction algorithm.
Sep 30, 2018
8c5b31d
Change shortest path algorithm from Floyd to SPFA.
Oct 1, 2018
dd7e6c7
Apply SLF optimization to SPFA.
Oct 2, 2018
36b5e59
Remove build output from git history.
Oct 2, 2018
b5ea2a5
Update SFO kml.
Oct 2, 2018
269ff62
Log break nodes kml for debugging purpose.
Oct 2, 2018
4c83845
Update travis CI script.
Oct 2, 2018
fd04e0f
Fix tests.
Oct 2, 2018
3320c6f
Merge pull request #2 from nasa-airport/feature/support-larger-map
Oct 2, 2018
a32fa70
Fix pip install command.
Oct 17, 2018
c7459ba
Merge pull request #3 from nasa-airport/issue/fix-readme-pip
Oct 17, 2018
7ec78ef
Generate scenario json for arrivals.
ylc0sky Oct 24, 2018
40555c3
Merge pull request #5 from nasa-airport/arrival_flight_feature
ylc0sky Oct 24, 2018
2b26237
Add the get_spots function to Gate class
ylc0sky Oct 24, 2018
b6a7d6c
Merge pull request #6 from nasa-airport/add_the_mapping_from_gate_to_…
ylc0sky Oct 24, 2018
084745f
Generate scenario json for arrivals.
ylc0sky Oct 24, 2018
4689ae0
Merge pull request #7 from nasa-airport/add_the_mapping_from_gate_to_…
ylc0sky Oct 24, 2018
96dc55d
Update airport.py
ylc0sky Oct 30, 2018
0bdd6ea
Update airport.py
ylc0sky Oct 30, 2018
2c424aa
Merge pull request #8 from nasa-airport/ylc0sky-patch-1
ylc0sky Oct 30, 2018
5a87d37
Update airport.py
ylc0sky Oct 30, 2018
e3aeb37
fix the broken test
ylc0sky Oct 30, 2018
d7e41ea
fix the broken test
ylc0sky Oct 30, 2018
4d75681
Fixed all test cases after adding the arrival scenarios
ylc0sky Nov 7, 2018
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
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,11 @@ states.json
log
.todo
*.swp
data/*/build

### JetBrains template
.idea

### Output
output
batch_output
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,10 @@ python:
- "3.6"
install:
- pip install -r requirements.txt
before_script:
- cd data/simple
- python generate.py
- python generate_scenario.py
- cd ../..
script:
- travis_wait python -m unittest discover tests
96 changes: 56 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,74 +1,90 @@
# ASSET2 - Airport Surface Simulator and Evaluation Tool 2

[![Build Status](https://travis-ci.org/heronyang/airport-simulation.svg?branch=master)](https://travis-ci.org/heronyang/airport-simulation)
[![Build Status](https://travis-ci.com/nasa-airport/airport-simulation.svg?branch=master)](https://travis-ci.com/nasa-airport/airport-simulation)

![demo](https://user-images.githubusercontent.com/7262715/45591580-ef937f80-b90b-11e8-9c15-a596be0bd283.gif)

![Demo](doc/independent-study/figure/demo.gif)

## About

ASSET2 is a generic airport simulation tool for research purpose. It is designed to support multiple airports, to test and to evaulate customized schedulers. Please check out [our paper](https://github.com/heronyang/airport-simulation/raw/master/doc/analaysing-effect-uncertainty.pdf) for more information.
ASSET2 is a generic airport simulation tool for research purpose. It is designed to support multiple airports, to test and to evaluate customized schedulers. Please check out [our paper](https://drive.google.com/file/d/0B8ck8iyI0dnfSEtUSDl3SjBiYXgwdXpOWERvaWMzZ1NtV3A0/view?usp=sharing) for more information.

> This tool is built for Carnegie Mellon University MSIT Practicum Project and Master Independent Study sponsored by the NASA Ames Research Center.

## Prepare airport data

Place airport related data under `data` folder like `data/sfo-terminal-2/build/` (use IATA airport code).

## Install
## How to Run

If you're on Ubuntu:
> **Please note that the code runs in Python 3.**
>
> **Please avoid Python>=3.7.0** because it breaks the legacy Cython, which one of the dependencies line-profiler depends on. The issue has not been [fixed](https://github.com/rkern/line_profiler/issues) at the moment. Try to install a lower version instead.

$ sudo apt-get update
$ sudo apt-get install -y python3-pip
$ mkdir -p ~/.config/matplotlib/
$ echo "backend : Agg" >> ~/.config/matplotlib/matplotlibrc
### Prepare Airport Data

Install dependencies:
Place airport related data under `data` folder like `data/sfo-terminal-2/build/` (use IATA airport code).

$ pip3 install -r requirements.txt
### First-Time Installation
**If you're on Ubuntu:**

## Run
```sh
$ sudo apt-get update
$ sudo apt-get install -y python3-pip
$ mkdir -p ~/.config/matplotlib/
$ echo "backend : Agg" >> ~/.config/matplotlib/matplotlibrc
```

$ python3 simulator.py -f plans/base.yaml
**Set-up Virtual Environment (highly recommended):**

### Batch Run
- If you are using IntelliJ or any other JetBrain IDE, see [this link](https://www.jetbrains.com/help/idea/creating-virtual-environment.html) (recommended).

$ python3 simulator.py -f batch_plans/simple-uc.yaml
- If you are using commend line:

```sh
$ {path/to/python3} -m venv venv # create a new virtual environment
$ source venv/bin/activate # activate the virtual environment
$ pip install -r requirements.txt # install dependencies locally
$ python simulator.py -f plans/base.yaml # execute the simulation
```

### Execution under Virtual Environtment
**Install dependencies:**

If you don't want to install the dependencies for the whole system, you may
want to use the virtual environment where we install dependencies under this
project folder.
```sh
$ pip install -r requirements.txt
```

$ python3 -m venv env # create a new virtual environment
$ source env/bin/activate # activate the virtual environment
$ python3 -m pip -r install requirements.txt # install dependencies locally
$ python3 simulator.py -f plans/base.yaml # execute the simulation
### Run
```sh
$ python simulator.py -f plans/base.yaml
$ python simulator.py -f batch_plans/simple-uc.yaml # Batch Run
```

## Tests
### Visualization
```sh
$ python visualization/server.py
```

$ python3 -m unittest discover tests # all tests
$ python3 -m unittest tests/test_scheduler.py # single test
### Tests
```sh
$ python -m unittest discover tests # all tests
$ python -m unittest tests/test_scheduler.py # single test
```

### Check Style
```sh
$ pycodestyle --show-pep8 --show-source --exclude=venv .
$ ls -1 *py scheduler/*py | xargs pylint # optional but recommended
```

$ pycodestyle --show-pep8 --show-source .
$ ls -1 *py scheduler/*py | xargs pylint # optional but recommended

## Visiualization

$ python3 visualization/server.py

## Documentation

$ pydoc <python-file-name-without-.py>
### Documentation
```sh
$ pydoc <python-file-name-without-.py>
```

## Developer Guidelines

### Sequential Diagram

![sequential diagram](doc/independent-study/figure/flow.png)
![image](https://user-images.githubusercontent.com/7262715/45591601-63358c80-b90c-11e8-809c-54c3446258fa.png)


### Experiment Flow

Expand Down
8 changes: 6 additions & 2 deletions airport.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@ def __add_aircrafts_from_scenario(self, scenario, now, sim_time):
for flight in scenario.departures:

# Only if the scheduled appear time is between now and next tick
if not (now <= flight.appear_time and
flight.appear_time < next_tick_time):
if not (now <= flight.appear_time < next_tick_time):
continue

gate, aircraft = flight.from_gate, flight.aircraft
Expand All @@ -117,6 +116,11 @@ def __add_aircrafts_from_scenario(self, scenario, now, sim_time):
self.add_aircraft(aircraft)
self.logger.info("Adds %s into the airport", flight)

# # Deal with the arrival flights
# for flight in scenario.arrivals:
# if not (now <= flight.appear_time < next_tick_time):
# continue

def remove_aircrafts(self, scenario):
"""Removes departure aircrafts if they've moved to the runway.
"""
Expand Down
Binary file added assetsimulator.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed batch_output/sfo-terminal-2-rt-failed/conflicts.png
Binary file not shown.
Binary file not shown.
Loading