GithubHelp home page GithubHelp logo

athena-sumo's Introduction

ATHENA MODELING: SIMULATION WITH SUMO

Contributors:

Juliette Ugirumurera [email protected].
Joseph Severino: [email protected]
Monte Lunacek: [email protected]
Yanbo Ge: [email protected]
Qichao Wang: [email protected]

THIS IS A CONFIG/ANALYSIS REPO

Description of REPO

This repo is contains all the code related to modeling the Dallas-Fort Worth International Airport (DFW) curbside (CTA modeling) using SUMO simulator. It demonstrates how to install, run and derive useful data from SUMO simulations. We will describe the basic files needed to run a simulation and how those files are generated.The repository also has code for generating simulations representing different traffic managment policies for DFW and simulating those policies on personal computer or on NREL's Eagle supercomputer. The examples provided are a representation of the DFW airport for curbside dropoff and and pickup.

The following are contained in this repository

File System for ATHENA SUMO

  • Install_SUMO

  • Generate_SUMO_demand

  • Process_SUMO_outputs

  • Congestion_Policies

    • README.md
    • Simulate_on_Eagle folder with instructions on how to simulate on Eagle Supercomputer.
    • Master_Function.ipynb: main notebook for generating simulations for different congestion policies
    • Ipython notebooks used by the Master_Function.ipynb notebooks
    • Ipython notebooks to test the functionality of Master_Function.ipynb
  • Simulate_on_Eagle:

    • README.md
    • Create_Script.ipynb Ipython notebook for creating batch script files for running SUMO simulations on Eagle supercomputer
    • Create_Script*.py python scripts to create batch files for running SUMO simulations on Eagle
    • generateEdges*.py scripts to create SUMO xml files to get outputs from SUMO simulations
  • Example_Files

    • Prediction File
    • Folder w/ Sample Inputs
    • Folder w/ Sample OUTPUTS
  • .gitignore

  • README.md

HOW TO - GENERATE A SUMO SIMULATION

WorkFlow!

1. Setup Conda Environment

use this README.md for instructions

2. Select day and generate Demand

use this README.md for instructions

3. Run SUMO simulation - this steps SUMO has already been installed as shown above

use this README.md

4. Process Outputs

use this README.md for
instructions

HOW TO - GENERATE A CONGESTION POLICY SIMULATION

Master_function!

1. Generate a congestion policy by running the Master_Function.ipynb notebook. This results in a SUMO route file that encodes the congestion policy.

use this README.md for instructions

2. Simulate the congestion policy scenario to evaluate the policy:

  • This can be done by running SUMO on personal computer using these instruction.
  • Or by generating many route files with step 1 to run many simulations in parallel on NREL's HPC system using these instructions.

athena-sumo's People

Contributors

ugirumurera avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

jiangchenli101

athena-sumo's Issues

Unexplained cells in Output_for_objective_function.ipynb

It is unclear to me what the following cells do in the notebook, and there are no markdown cells to explain:

  1. In[5]: Why are we overwriting the duration of trips over 3600 time units (seconds?) with the mean value?
dur_mean = trip['tripinfo_duration'].mean()
trip.loc[trip['tripinfo_duration']>3600, 'tripinfo_duration'] = dur_mean
terminal = []
for i in trip.tripinfo_id:
    
    position = i.find('_')
    t = i[:position]
    if len(t) == 2:
        t = t[1]
    terminal.append(t)
trip['terminal'] = terminal
  1. In[6]: What do these globals represent? An hour?
AM = [4,9]
MID = [9,15]
PM = [15,18]
  1. In [14],15,16,17,18: Could explain the tables in english in a Markdown cell.

  2. Same with the graphs at the bottom. Would be nice to have an explanation in english - especially if this is to be published.

Swap apply(gmtime) for vectorized operations using to_datetime in Output_for_objective_function.ipynb

In Output_for_objective_function, we have the following lines of code:

bus['time_start'] = bus['stopinfo_started'].apply(lambda x: time.strftime('%H:%M:%S', time.gmtime(int(x))))
bus['time_end'] = bus['stopinfo_ended'].apply(lambda x: time.strftime('%H:%M:%S', time.gmtime(int(x))))
bus['hour_start'] = bus['stopinfo_started'].apply(lambda x: time.strftime('%H', time.gmtime(int(x))))
bus['hour_end'] = bus['stopinfo_ended'].apply(lambda x: time.strftime('%H', time.gmtime(int(x))))

These lines are going to be inefficient. Apply is employing a hidden for loop behind the scenes, so you're not taking advantage of vectorization with these. Suggested format (please test this to make sure it works. Timezones can make weird things happen):

start_ts = pd.to_datetime(bus['stopinfo_started'], unit='s', utc=True)
end_ts = pd.to_datetime(bus['stopinfo_ended'], unit='s', utc=True)

bus['time_start'] = start_ts.strftime('%H:%M:%S')
bus['time_end'] = end_ts.strftime('%H:%M:%S')
bus['hour_start'] = start_ts.strftime('%H')
bus['hour_end'] = start_ts.strftime('%H')

Non-vectorized code in DFW_gen_flow.py

There are a coulpe of instances where an explicit for-loop is used to add a new column to a dataframe. Better approach is to leverage panda's vectorization:

Existing code:

dw = []
for i, row in enumerate(demand['scheduled_fight_time']):
    today = datetime_object = datetime.strptime(row, '%Y-%m-%d %H:%M:%S')
    dow = today.weekday()
    dw.append(dow)
demand['day_of_week'] = dw #adding a column day of week

Preferred style:

demand['day_of_week'] = pandas.to_datetime(demand['scheduled_fight_time'], format='%Y-%m-%d %H:%M:%S').dayofweek

This style is both more compact, is easier to read (IMO), and will be faster on most hardware.

It will be easy to change the style for these functions:

https://github.com/NREL/ATHENA-siem-sumo/blob/ea45e67c38cf4a640483f2402ab4745a82de67f2/Generate_SUMO_demand/DFW_gen_flow.py#L53

https://github.com/NREL/ATHENA-siem-sumo/blob/ea45e67c38cf4a640483f2402ab4745a82de67f2/Generate_SUMO_demand/DFW_gen_flow.py#L74

Will take more time to refactor this one. May provide a speed boost for large files, but I wouldn't refactor the whole thing unless speed is a bottleneck.

https://github.com/NREL/ATHENA-siem-sumo/blob/ea45e67c38cf4a640483f2402ab4745a82de67f2/Generate_SUMO_demand/DFW_gen_flow.py#L259

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.