Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

FORTRAN 77 Microsimulation at traffic signals 2

Status
Not open for further replies.

ikirkellis

Civil/Environmental
Jun 2, 2004
4
I am a civil engineer undertaking a research project into the comparison of conventional vehicle actauted traffic signals against MOVA. What I need to do is using FORTRAN develop a form of microsimulation, that enables individual vehciles to move, have a record of their position, and be able to record start and end times to calaculate total delays. Into this the program will respond due to the positions of the vehicles on inductive loops in the road surface, so the system is demand responsive system. My grasp of Fortran 77 is limited at this time, and I know that this is a mammoth task, but I just wondered if anyone here had any ideas as to the best method of achieveing this.

Thanks
 
Replies continue below

Recommended for you

Well I have some knowledge of FORTRAN, it is essentially suited to mathematical problems (I am reliably informed, and I have a compiler for it. I have had a look at using C and C++ but as my knoweldge of these languages is less than that of Fortran, I would be starting lower down the ladder.
 
I suggest using GW-BASIC for writing/debugging and TURBO-B
for runnibg/data collection.

Do you have the loop sensors designed?


<nbucska@pcperipherals DOT com> subj: eng-tips
 
I wont be using actual loops, merely simulating them in the program. Similarly I will be simulating the vehicle flows. I will discharge them into the target area at a point upstream of the loops at a set time and velocity. Depending upon what the "car" finds in front will depend upon what it does, ie if there is queue of traffic the car brakes to a point 2m behid the car preceding, if the preceeding car begins to accelerate during the following cars approach the following car will respond. In order to do this I will have to make certain rules, such as the acceleration and deceleration values / distances.

The signals will operate as a function of the flows arriving to some degree but are also fixed by certain limitations such as a 7 second minimum green signal, certain stage change sequences. The loops will be double function they will botha ct as a demand for a stage and to extend stages up to there maximum. In some instances the loops will provide inputs for a more complex process. Basically the whole system is interactive, the traffic responds to the signals and the signals respond to the traffic.

Why do you suggest GW BAsic as opposed to fortran? What is Turbo B and why would this be better than a native fortran compiled programme.

The complex issues that I am wrestling with (I am not a computer programmer and have merely dabbled in the past)is to process the information. I believe and correct me if I am wrong, in order to simulate such process I will need to carry out the analysis for every 1/2 second (the on the bround equipent works in 0.5 second increments) for each vehicle working from the traffic nearest the stopline (as the other traffic works as a fuction of these) IN order to do this I will need each "car" to know its position, velocity, and the response of the vehicle in front, and the signal showing (with the exception of the vehicle at the front who will respond directly and only to the signals)

One of the previous posters (either here or in a newsgroup) has recommended a later version of FORTRAN that supports derived types. As I understand it from the post derived types allows a "car" to have a set of variables that are allied to it, ie position, speed etc. In order to do this I would need to learn the new aspects of the language, but book son the subject are rather expensive so Im looking for a pdf file or online website that explains this.
 
You should be looking for a language that supports some degree of Object Orientation and User Defined types. With modern processing power available (compared with the relatively simple math processes required) the math ability is likely to be a minor requirement.

If you are considering some visual output, need UDT and some OOP, plus ease of programming then it's worth looking at Visual Basic.

The hard part is likely to be defining movement and distance algorithms. The programming looks fairly straightforward.

Good Luck
johnwm
________________________________________________________
To get the best from these forums read faq731-376 before posting
 
Seems like something like Matlab Simulink or a number of other discrete time simulators are more appropos for this application.

Why spend time re-inventing and programming a simulator, when you could spend the time doing the actual modelling?

TTFN
 
Presumably MAtlab is quite costly?? I am not uinfortunately getting any financial help with this project, so I have to adopt the most economic method. I would like to spend more time on the modelling but I fear that any other approach than from thr ground up will prove beyond my financial means.
 
If you send me your URL I send you a simulation for a 48 station thermostat written in BASIC ( debugged in GWBASIC,compiled in TURBOBASIC) to show what you can do
in 2 pages...

<nbucska@pcperipherals DOT com> subj: eng-tips
 
The other choice might be some sort of freeware UML or logic simulator.

If you are qualified as an academic user, Mathworks has discounts.

TTFN
 
May I assume that you are simulating the interaction of the trafic light and the vehicles ?

I suggest you set up a 4 dimensional array representing
the crossing trafic lanes. Use a high sample rate e.g. 1/1000 sec. Calculate the position of the vehicles
with a reasonable accuracy ( I would start with 2 inches)
and start the vehicles from the 4 enry points -- 0 in
each dimension with a speed with some random variation, while the middle of the array dimension represents the location of the trafic light. ( e.g. the array is 4 by
10000 points. the light is a 5000. On each lane 0 is the
start and 10000 is the exit point.

The value of a point may be 0 -- no vehicle -- or
the speed of the vehicle. At each iteration you call
a subroutine/function which searches each lane,
calculates the next position of each vehicle etc,etc...

About the BASIC question: For a simple problem like
this the BASIC seems to be easier...but "the gustibus
non est disputandum"







<nbucska@pcperipherals DOT com> subj: eng-tips
 
Personally, I'd use Fortran 95. It is MUCH, MUCH more suited to the task than F77 is. Of course... it will cost you some money. Consider F by Imagine ( free I believe ). Or ELF90 by Lahey ( not free, but very cheap ). Both are subset compilers for the Fortran 90 language.

In any case... if you are paying for your school, you really should consider paying some for appropriate software and books. Otherwise, you'll spend 12 months on your project instead of just 6. And... your code will likely be messier and less intelligible.

And yes... you really should use some type of abstract data type ( a derived type in fortran ). VB, C++ and other languages have other names for essentially the same thing.

I note however that your major problem is going to be your algorithm logic itself. I suspect the coding for your project is simple compared to figuring out the logic to make your program work as it should. That's not to say that the coding will be simple. It's all relative.

Either way... good luck!!

Dan :)
 
Matlab Simulink, GPSS, or whatever for simulation - are they really that expensive when you consider that you begin with a system that already understands basic simulation concepts, probably has a built-in graphic display to show the simulation while it is running, and allowa you to define simple paramaters and get comprehensive results analysis?

A few thousand dollars will get the simulator, and probably will save its own cost many times over. My experience has always been that the first-cut simulation has more flawed assumptions in the simulation than it has meaningful results. Rework in FORTRAN will be more costly than rework in a simulator software too. The ease of refinement from first-cut to finished product alone is worth the cost. The built-in report generation will amaze you. The graphics will "wow" you.

I agree with DanTex that you'll spend months more time, and you'll probably end up with "spaghetti code" by the time it's all done, but I'll disagree about using another flavor of FORTRAN. Whether it's in FORTRAN, C/C++, VB, Gee-Whiz-BASIC, PASCAL or whatever, you're still spending project time to reinvent something that already exists. If you have the research project established, you already have an estimate of the cost-per-hour of that project. How many hours does it take to payback the cost of decent simulation software? Download a student version or a demo version of a simulator package and play with it for a day or two. You may even find they have a city-traffic simulation as a demo! You might also get in touch with a local conveyor supplier; they do these kinds of traffic simulations routinely, and may be able to suggest a better simulation package and show you how it works. Most of the traffic management concepts are the same, just on a smaller scale.

Nobody writes finite-element analysis in FORTRAN anymore, because so many good analysis packages exist. Ditto motion simulation.

BTW - the "best" computer program is a fiction. What's the "best" kind of car? A Cadillac or a Rolls-Royce is really neat, but not if you want to get 50 MPG. Everything is comprimise, especially in computers. Does it do what you need done, the way you want it done? That's the question.

Howard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor