Friday, April 15, 2011

Successful Compile, Whats Next?

This afternoon I successfully compiled my model, all of the code is posted on my repository for you to look at, however it is not quite finished.  I still have to write a small function to generate a map, there should be examples of this function somewhere on the ROSS website.

So far I have forward event handling completed however I will not be able to test it until I have written the map generator.  This should be done hopefully before the end of the weekend and I hope to have a serial test done before next Tuesday.  Once this is done, I will write the reverse event handler which should be much easier than the forward event handler and run my parallel tests.

Hopefully I will be able to test my model in parallel before next Friday so I will have some results to present.  Overall there doesn't seem to bee a while lot of coding left to do before I am able to begin analyzing results.

--J

Sunday, April 10, 2011

Using Lanes to Determine Traffic Flow

Since The last post I have included the concept of lanes to direct traffic because it is more realistic and will make the results of tests more accurate.  I will explain how this works through an example.
The concept of lanes is evaluated during the execution of the DIRECTION_SELECT event.  At the beginning of the event, the car is in the lane represented by the blue arrow, and came from the arrow represented by the red arrow.  The blue arrow represents the incoming right turning lane on the east side of intersection 1.  Because the blue lane is a right turning lane, the car can only go either north or back east, the objective of DIRECTION_SELECT is to determine which of the north three lanes the car wishes to enter or sending the car back east.  To choose one of the outgoing north lanes, the event first checks if the car wants to go north or south to get to its destination, if it wishes to go north and the center green north lane is free, it will enter that lane, the same is true for the left and right turning lanes.  If the car however cannot enter either of these three lanes going north it will be sent back east to simulate a traffic jam.  To determine which lane the car enters of the three outgoing east lanes, the event must determine how the car arrived at the previous intersection (intersection 2) this is to ensure that there is not an excess of cars in any lane.  The orange arrows represent the possible ways the car arrived at intersection 2 and by determining which of these was true, the car is placed in the appropriate outgoing lane to send the car back in the direction it came from.

The next step in coding is to code the reverse event handler which is used to "undo" events when rollbacks occur, this should bee done by the end of the week.

Sunday, April 3, 2011

I figured out how to push code!

The code that I have pushed today is a framework of how my model will work.  Unless I can figure out a better way compatible with ROSS, I will probably end up using the huge set of switches that you see in the event handler.

Another added item that was not discussed in my previous blog posts is lanes.  As you can see I have included data for relative directions (left turning land, right turning land, and straight) and cardinal directions for the roads adjacent to a particular intersection (north, south, east, and west).  This allows for a few things that improve the accuracy of my model.  The first improvement is more traffic through intersections, most intersections and roads have more than one lane, especially in a large city.  In addition, this allows for a sort of one step pre-calculation of direction meaning that by the time the car gets to the center of the intersection, the cardinal direction it will move in is already determined and it just needs to select which lane it will enter (left, straight, or right), which is more realistic than one lane intersections.  The introduction of lanes makes u turns a little harder though because it is unclear which lane a car would go into when it turns around (left, right, or straight), I think the car will go into the lane that would lead to the intersection it came from, however this may be hard to calculate.

Hopefully by the end of this week my model will be done (if I don't run into any major problems) and I will have some test results to post.

--J