Monday, March 23, 2015

Vehicular Traffic Simulation Using SUMO (Windows based)

A: Getting Your System Ready
First, you need to download the following:
SUMO 0.22.0 (but I changed to SUMO 0.19.0 later on)
Python 2.7.0 (I tried Python 3.6 but got errors)
JOSM (optional)

Before we move on...
You might want to get familiar with running programs from the windows command line (cmd). Check the common command such as cd, dir, etc..

Also, Python scripts have to be processed by another program called the Python Interpreter. The Interpreters read the scripts, compiles it into bytecodes, executes the bytecodes to run the program. So, we have to make sure the command window recognises the word "python" as an instruction to start the interpreter. 

Let's say if you entered the command python and hitting return, you should see the version of the Python installed in your system, but.. If you see something like :

'python' is not recognized as an internal or external command, operable program or batch file.

Then you have to make sure your computer knows where to find the Python interpreter. 
To do this:
  1. Open system properties
  2. Advanced system settings
  3. Click on environment variables @ bottom right 
  4. In system variables, scroll down and look for "path"
  5. Edit the path by append ";C:\python27"
  6. Restart cmd
No space at all ";C\python27"


B: Simple Traffic Simulation

After you have done all the above, use the following steps to create a simple vehicular traffic simulation in SUMO.


1. Export (download) the OSM map. I rename my map to tfs.osm and put all simulation-needed files in one directory, named tfs.

2. In windows terminal, cd to tfs directory.

3. Enter 
netconvert --osm-files tfs.osm -o tfs.net.xml
4. Add polygons features to be displayed in sumo-gui. (You may copy typemap_example.xml script from sumo installation file itself into your working directory, and renamed to typemap.xml. Mine located at C>ProgramFilesx86>DLR>Sumo>tools>import>osm). In terminal, enter 
polyconvert --net-file tfs.net.xml --type-file typemap.xml -o tfs.poly.xml
After run, a file named "tfs.poly.xml" will be created in tfs directory.

5. Next, we want to generate random vehicular routes. Enter 
python randomTrips.py-full-path -n tfs.net.xml -e 50 -l 
if no error, then enter
python randomTrips.py-full-path -n tfs.net.xml -r tfs.rou.xml -e 50 -l 

(You may drag&drop randomTrips.py full path to terminal. Mine located at C>>sumo-0.19.0>tools>trip).

Step 5:
Post edited on 02/06/15, coz I find this step abit confusing (regarding randomTrips.py full path).
This figure is based on another example ysgbridge.osm.


6. Save the following script as tfs.sumo.cfg. Replace "tfs" to your own file name.
<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sumo.sf.net/xsd/sumoConfiguration.xsd">
    <input>        <net-file value="tfs.net.xml"/>        <route-files value="tfs.rou.xml"/>        <additional-files value="tfs.poly.xml"/>    </input>
    <time>        <begin value="0"/>        <end value="1000"/>        <step-length value="0.1"/>    </time></configuration>

7. Finally, enter sumo-gui


7 files will be created from all the steps above

Disclaimer: This post is based on a very helpful SUMO tutorial on Linux . Check it out here.

Other useful links:
Python on Windows FAQ
Sumo, randomTrips.py







Tuesday, March 10, 2015

Geoje Island Winter Getaway

From 12 Feb to 22 Feb 2015.

I had a very sweet vacation (solo traveller) in Geoje Island, South Korea. It wasn't like my other vacations with friends in Hong Kong, Philippines and Bali, where everyday packed with activities and places to go. It was very tiring and super exhausted in the end of the day. My 10 days in South Korea more like a retreat, relaxing getaway. What made it sweet was I didn't have anything plan out, in fact I never plan to visit South Korea. It's more like an impulse vacation, got the air tickets 10 days before takeoff. I stayed at friend's place thus not feeling guilty for just lie-in instead of grabbing all the waking moments to visit all the places I can. 

enjoyed the chilling weather, the gloomy spooky tree scenery, Korean naked bath in Spa Land, pork bbq was very nice in the winter (I think we will melt having bbq in tropical country), the Korean top notch Customer Service (felt like a VVIP), Korean skincare haul (I'm not myself anymore at Incheon Airport duty free), and etc etc etc...

Let's see bits of the photo diaries:

Travel by AirAsia X. Arrive in Gimhae Airport, Busan. 
Took a bus from Gimhae Airport to Okpo, 7000 KRW


Arrive ~ 8am 

Walking around Okpo


Oedo Botanica Garden
Took a bus from Okpo to Jangseungpo, 1200 KRW
Entrance fee 30,000 KRW

Just opposite Ocean Hotel, walk heading to jetty





Kinda cloudy

Stairway to Heaven



Adam and Eve and the apple.






Haeundae Beach
Bus from Okpo to Sasang, 6800 KRW and Metro 1 day pass 4500 KRW

Get off at Haundae Station

The weather forecast said it will be cloudy in Busan, seems like it doesn't apply to this sun & fun place


It was a sunny day.






Great walk on the beach..


Okpo Great View






This is how Geoje pull off the name 'blue city'

Last day in Okpo, Geoje. Taking the moment to write my diary.


Some yummy meal


Street food. This ajumma very friendly









And the best part - skincare haul in Korea






I really enjoy my days in Okpo although I didn't go much places. I certainly come back again to visit this beautiful city.