programming forums Java Java JSRs Mobile Certification Databases Caching Books Engineering OS Languages Paradigms IDEs Build Tools Frameworks Products This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Sheriffs:
Saloon Keepers:
Bartenders:

# How begin a simulation module

Greenhorn
Posts: 5
Hello, my final project consists on developing a road traffic simulation based on mathematical model .
the inputs of this one are : the network, arrival rate of vehicles to each lane ,matrix which contain the probability of passing from a queue to another, the plan of traffic lights(green periode,red period,) .
I have difficulty to define them, esppacially the network .
Can someone help me.

Sheriff
Posts: 4935
334
• 1
Welcome to the Ranch

Since it is your final year project, you need to research the problem first (a lot) in order to define if you could do it, and only then give a proposal to your supervisor. In case you did that already, you'll need to research even much more

Am Ka wrote:I have difficulty to define them, esppacially the network
Well, I'd start with the UML diagram. But here is some info how you could do that:

• Think that there is a roads segment where each segment has 2 types of roads.
• 1. A source roads, which begin for instance from somebody's houses, parks, shops, anywhere.
2. Roads, which begin in confluence of two or more roads (has left child, right child).

Such data structure would be a recursive.

• Then, there is a network itself, which has different road segments.
• Road segments are not necessarily directly connected, they could be indirectly connected via the "Highway" for instance. Highway could be another road type.

Then there would be a crosses. Lights. Well, it won't be an easy, but sounds an interesting project.

I'd say, start modeling your network by drawing UML class diagram.

Rancher
Posts: 2240
28
• 1

Bartender
Posts: 10575
66
• 1
Am Ka wrote:Hello, my final project consists on developing a road traffic simulation based on mathematical model .
the inputs of this one are : the network, arrival rate of vehicles to each lane ,matrix which contain the probability of passing from a queue to another, the plan of traffic lights(green periode,red period,) .
I have difficulty to define them, esppacially the network .

OK, well by "network", I assume you mean the road network, and since I presume the controlling factor is traffic lights, you could possibly describe it as a graph of nodes, where each "node" is a junction with set of traffic lights, maybe including any information gathering equipment for them, such as pressure sensors.

However, I suspect that's for the future. For now, I suggest you concentrate on a single junction, for example a crossroads, with a single set of lights, and worry about connecting them together later.

One other tip: When I'm unsure about how to map out a project or scenario, I often fall back on the old "lexical analysis".

If you're in your final year, you may already have heard of the technique: Take your requirements document and read it through thoroughly - five or six times if necessary - noting down all the nouns and verbs it contains in two columns. What you'll find is that nouns often equate to classes, and verbs to methods or Events, so you can start to map these out, even if you have no idea of how they're going to be implemented yet.

It's by no means foolproof, and often takes a bit of "massaging" to get right; but the thing I like about it is that it's mechanical - it uses a different part of your brain - so you're not constantly agonising about how you're going to put everything together.

I'm quite sure you didn't include the full requirements in your post, but just from what I see, I'd say that some of the major "nouns" you have are: Network, Road, Lane, Junction (or perhaps this is your 'Matrix'), Vehicle, TrafficLight and Simulation - and you'll probably find several others yourself as you go through your requirements.

It's basically a way of getting the "what" part of your project down. There'll be plenty of time to worry about how it all fits together later.

HIH

Winston

Winston Gutkowski
Bartender
Posts: 10575
66
• 1

Thanks Norm.

@Am Ka: If you do post on other sites, please let us know. Thanks.

Winston

Am Ka
Greenhorn
Posts: 5

I'm gonna explain the different phases of my project :
1- searching about a mathematical model based on queuing theory used in order to simulate the road traffic (done)
2- write a module with java which reflect the mathematical model . (not yet :/)
The inputs are : +a road network composed by : -roads with multiple lanes (each lane is considered as a queue )
-noads: it can be a simple noad or crosses light one or highway
+ the arrival rate of vehicles coming from the outside of network to each lane .
+ when the junction controled by a traffic light (we have to define the period of green time and red time to each lane)
+ matrix which contain the probability that a vehicle pass from queue to an other (lane to an other one)
For instance if we present a network as a graph, therer we can't present the road with multiple lanes

Am Ka
Greenhorn
Posts: 5
@Winston Gutkowski Sorry  , because i didn't know that is a bad .

Am Ka
Greenhorn
Posts: 5
Am Ka wrote:
I'm gonna explain the different phases of my project :
1- searching about a mathematical model based on queuing theory used in order to simulate the road traffic (done)
2- write a module with java which reflect the mathematical model . (not yet :/)
The inputs are : +a road network composed by : -roads with multiple lanes (each lane is considered as a queue )
-noads: it can be a simple noad or crosses light one or highway
+ the arrival rate of vehicles coming from the outside of network to each lane .
+ when the junction controled by a traffic light (we have to define the period of green time and red time to each lane)
+ matrix which contain the probability that a vehicle pass from queue to an other (lane to an other one)
For instance if we present a network as a graph, therer we can't present the road with multiple lanes

Winston Gutkowski
Bartender
Posts: 10575
66
• 1
Am Ka wrote:For instance if we present a network as a graph, therer we can't present the road with multiple lanes

Why not?

I fear you're trying to "visualise" the interactions between all the various components yourself - lanes, roads, traffic lights, vehicles, etc. - and I suspect you're going to tie yourself in knots.

My suggestion is to take each component - a Traffic Light, for example - and describe what it does. It clearly has state (its colour), which changes over time, but when, and why?

And a Lane. What is it? You call it a queue, which may go part-way to describing traffic flow (especially in a specific sector), but what about a lane change? In the real world, this usually involves a vehicle removing itself from some part of the queue - but probably not either end - and "barging" into another parallel queue at roughly the same point; so if you want to simulate this accurately, you'll need some notion of "distance along the queue".

I think if I were tackling this, I'd leave lane changes until much later, when I've actually got a basic model that works. I think I might also start out trying to model a basic crossroads with one lane in each direction (4 total), and build up from there; maybe adding a left-turn lane (or right, depending which side of the road you drive on) and traffic light; then a second lane each way on one of the roads...

Do you follow what I'm saying? Build this model up gradually, rather than trying to bash out the entire network in one go.

HIH

Winston

Liutauras Vilda
Sheriff
Posts: 4935
334
• 1
@Am Ka

Ah, I thought it is final year project for honors degree where you need to come up with the project idea yourself and do it from scratch without any written and given requirements in advance. It seems it isn't true and you got actual requirements written.
Winston gave you much more and better insights on how to start, pretty much ignore my initial post, however I did similar project, so I thrown some ideas from there, but it seems it isn't very similar, but still quite few similarities are as it was about the River Networks, yours just Road Networks

Liutauras Vilda
Sheriff
Posts: 4935
334
• 1
And my suggestion still remains in addition to Winston's. Once you identify nouns and verbs (as your possible classes and methods) - create an UML diagram. Visual picture will help you a lot not to lose yourself in amount of classes, interfaces. UML class diagram will be like a guy who stands next to you and holding the board in front of you so at any given time you can look at and see the whole picture of your Network, so you'd know where to start and what next most likely you are going to need to do.

Am Ka
Greenhorn
Posts: 5
I think if I were tackling this, I'd leave lane changes until much later, when I've actually got a basic model that works. I think I might also start out trying to model a basic crossroads with one lane in each direction (4 total), and build up from there; maybe adding a left-turn lane (or right, depending which side of the road you drive on) and traffic light; then a second lane each way on one of the roads...

I'm gonna begin with the simple instance you have proposed.