ropensci / stplanr

Sustainable transport planning with R
https://docs.ropensci.org/stplanr
Other
417 stars 66 forks source link

Support SUMO #284

Closed harryprince closed 5 years ago

harryprince commented 5 years ago

hi stplanr team, As your mention as the stplanr paper, integrating stplanr with SUMO, MATSim and MITSIMLAB is the next direction. Does anyone get interested in this topic? Currently, I am focusing on microscopic simulation and bike-sharing economics.

harryprince commented 5 years ago

Currently, sumopy is very bugy under python2.7 and wxversion2.8, maybe shiny is a better option to build the web interface for SUMO.

Robinlovelace commented 5 years ago

Hi @harryprince I'm interested in this for sure and think that an R interface to SUMO is a logical next step for making R a stronger environment for transport planning. Such a project could build on the experience of other R interfaces to external programs, such as:

The second one provides a function, tensorflow::install_tensorflow() to even do the installation. I think a function install_sumo() would be possible and desirable.

A key concept in software design that I learned late is modularity. I Therefore propose that code that provides this interface should be put in a separate repo and R package. If it works, we can add it to the Suggests or even Imports in stplanr. The only questions in my mind are who should lead this effort and where should the repo live? I'm happy to know of demand for this and would like to support with the development of a sumor (or similarly/better named!) package.

harryprince commented 5 years ago

Totally agree with your idea. I am willing to contribute my effort to the sumor package to make microsimulation become easier.

SUMO becoming more and more popular to integrate with flow and reinforcement learning. However, the scenario building stage from large-scale data is so hard for SUMO users, wish to leverage OSM and sparklyr power to make scenario construction easier.

SUMO package contains some domain specific key concepts in microsimulation, such as scenario, trip, flow, DUAROUTER, JTRROUTER and so on.

Currently, using sumo to build a free-floating bicycle parking scenario by real trip order data and road network is pretty hard and not mature.

Wish to discuss more detail about this with you.

Reference

harryprince commented 5 years ago

nlrx or SpaDES interface is currently that I found in R for spatial simulation tools. However, the interface of these tools are not tidy, and maybe we need to list the modularity and process before we get started.

aimsun and ptv group are the leading company in transportation simulation which integrated microscopic and macroscopic simulation all in one. Maybe we can learn more about these advanced commercial softwares.

Anyaoha commented 5 years ago

@harryprince I think techniques of routing and plotting of routes can be learned from [http://ptvgroup.com/] ptv group. I am also interested in this topic because I am looking for a better and easy way of plotting vehicle routes on a map in R because I have the co-ordinates of the locations. So I would want to plot routes from a location through to other locations and back to the origin

harryprince commented 5 years ago

here is the possible sumor project structure:

  1. SUMO: command line simulation
  2. OSMWebWizard: The OSM Web Wizard offers one of the easiest solutions to start with SUMO.
  3. GUISIM: simulation with a graphical user interface
  4. NETCONVERT: network importer
  5. NETGEN: abstract networks generator
  6. OD2TRIPS: converter from O/D matrices to trips
  7. JTRROUTER: routes generator based on turning ratios at intersections
  8. DUAROUTER: routes generator based on a dynamic user assignment
  9. DFROUTER: route generator with use of detector data
  10. MAROUTER: macroscopic user assignment based on capacity functions
  11. NETEDIT: Visual editor for street networks, traffic lights, detectors, and further network elements
  12. TraCI: online interaction with the simulation
  13. SUMOPy: a tool by Joerg Schweizer supporting the whole SUMO toolchain with a GUI especially for demand modelling
  14. Cadyts: Calibration of Dynamic Traffic Simulations between SUMO and MATSIM
  15. FLOW: a framework for applying reinforcement learning and custom controllers to SUMO, developed at the University of California, Berkeley.

Currently, simmer R package is a very good tidy example in simulation field, @Anyaoha we could learn lots of things from it.

Robinlovelace commented 5 years ago

Heads-up @harryprince, I've created package here - on this org because @mpadge has expressed interest and it's our joint GH space / organisation. Can add you as a collaborator if you'd like. One question: please test the install_SUMO() function - does it work for you? Needs some work: it provides instructions on how to install SUMO but doesn't actually install it which is fine IMO. But should work on Windows. reprex on my machine:

devtools::install_github("ATFutures/sumor")
#> Downloading GitHub repo ATFutures/sumor@master
#>   
   checking for file ‘/tmp/Rtmp6PAjQN/remotes2a2f35bcfd64/ATFutures-sumor-c0a6374/DESCRIPTION’ ...

✔  checking for file ‘/tmp/Rtmp6PAjQN/remotes2a2f35bcfd64/ATFutures-sumor-c0a6374/DESCRIPTION’ (790ms)
#> 

─  preparing ‘sumor’:
#> 

   checking DESCRIPTION meta-information ...

✔  checking DESCRIPTION meta-information
#> 

   checking for LF line-endings in source and make files and shell scripts

─  checking for LF line-endings in source and make files and shell scripts
#> 

─  checking for empty or unneeded directories
#> ─  building ‘sumor_0.0.0.9000.tar.gz’
#> 

#> 
#> Installing package into '/home/robin/R/x86_64-pc-linux-gnu-library/3.5'
#> (as 'lib' is unspecified)
    sumor::install_SUMO()
#> To install sumo in Ubuntu, please add the ppa with:
#> sudo add-apt-repository ppa:sumo/stable
#> sudo apt-get update
#> sudo apt install sumo
#> To build from source, see:
#> https://github.com/eclipse/sumo#build-and-installation

Created on 2019-03-14 by the reprex package (v0.2.1)

Robinlovelace commented 5 years ago

Note: I'm currently building it from source. Any experience installing it on Windows?

Anyaoha commented 5 years ago

@Robinlovelace I just ran the install package for sumor devtools::install_github("ATFutures/sumor") and I think it installed on R studio in windows. But it seem to be at it's infancy stage as you said. Let me know in ways I can help.

`devtools::install_github("ATFutures/sumor") Downloading GitHub repo ATFutures/sumor@master √ checking for file 'C:\Users\Public\Documents\Wondershare\CreatorTemp\RtmpWMzgXi\remotes3a28eb82ad3\ATFutures-sumor-7498073/DESCRIPTION' ...

Installing package into ‘C:/Users/Uche/Documents/R/win-library/3.5’ (as ‘lib’ is unspecified)

Robinlovelace commented 5 years ago

Heads-up @Anyaoha the package is no where near ready. One thing that would help: small (<1 MB) example input datasets and SUMO commands you'd like to run on them.

Anyaoha commented 5 years ago

@Robinlovelace okay. I'd be ready to help if you need me. :)

Robinlovelace commented 5 years ago

Great. If you can create a scenario with input data that can form the basis of a SUMO simulation, that would be great. I've created an issue here, where this can be discussed: https://github.com/ATFutures/sumor/issues/3

harryprince commented 5 years ago

Hi Robin, I added a Windows/Mac OS installation branch at GitHub. Wish to discuss more module design at repo issue or gitchat.

Best Regards, Harry Zhu

On Thu, Mar 14, 2019 at 6:11 PM Robin notifications@github.com wrote:

Note: I'm currently building it from source. Any experience installing it on Windows?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ropensci/stplanr/issues/284#issuecomment-472786128, or mute the thread https://github.com/notifications/unsubscribe-auth/AFHTkWo6z_SliAayfrYfLOyoDcApBbNpks5vWiBMgaJpZM4bnsSr .

Robinlovelace commented 5 years ago

Great. Many thanks.