Version 3 (modified by mihaela.teler, 14 years ago) (diff)


<< Home

Analysis of simulator components and implementation vs. performance After analyzing the performance of the simulator, we’ve concluded that we don’t need to use threads in the processing of GPS events and CleanupEvents?, because these operations are not computationally intensive. Another important reason for taking this decision is that are these events are not directly linked to an event coming from a certain location, so the location is irrelevant. The GPS events are used to find out the new position of a vehicle. The GPS Event is scheduled at a regular time interval for each node thus accurately simulating the way a real VANET application collects GPS data periodically. The Cleanup events have the role of cleaning the database of records. Every car holds a trafficDB with records of the type CarInfo. Each CarInfo has an expiration time and the processing of a CleanupEvent iterates through the database and deletes the old records. These events are processed by the main thread in the engine of the simulator. For the other 2 types of events we use separate processing threads. These are the most numerous events and the time spent to process these events is the biggest. The engine first starts with an empty event queue. At the moment zero a GPS event is added to the queue: eventQueue.add(new GPSEvent(0)); At the moment one a Cleanup event: eventQueue.add(new CleanupEvent(1)); Then some standard Send events are scheduled. This is done in the initialization area so when we start the simulator there will be events to process and while processing these events new ones are generated and scheduled. In the method playEvent the events corresponding to the current time are extracted from the queue (e = eventQueue.remove(0) ;) and then processed. The type of event is determined and specific processing is done. For example for a GPSEvent we must update the information for each car and then create and schedule the next event: Iterator<SimulatedCarInfo> it = cars.iterator();

while (it.hasNext()) {

SimulatedCarInfo r =; r.update();

} GPSEvent newEvent = new GPSEvent(crtTime + fps); schedEvent(newEvent);

Another example: when the method simulateCommunication() is called for a send event, receive events are created and scheduled for all the vehicles in the wireless range of the sender. Generally the processing of an event consists in the determination of its type and then the execution of specific actions, followed by the creation and planning of the next events (method schedEvent).

Attachments (1)

Download all attachments as: .zip