Changes between Version 3 and Version 4 of PTVS_Ideas


Ignore:
Timestamp:
Dec 27, 2009, 9:31:04 AM (14 years ago)
Author:
mihaela.teler
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • PTVS_Ideas

    v3 v4  
    11[wiki:ParallelTrafficViewSimulator << Home]
    22
    3 '''Analysis of simulator components and implementation vs. performance'''
     3'''Analysis of simulator components and implementation vs. performance'''[[BR]]
     4
    45 
    5 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.
     6After analyzing the performance of the simulator, we’ve concluded that we don’t need to use threads in the processing of GPS events and Cleanup events, 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. [[BR]]
     7
    68The 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.
    7 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.
    8 These events are processed by the main thread in the engine of the simulator.
    9 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. 
    10 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.
    11 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.
    12 For example for a GPSEvent we must update the information for each car and then create and schedule the next event:
     9The 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.[[BR]]
     10
     11These events are processed by the main thread in the engine of the simulator.[[BR]]
     12
     13For 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.[[BR]]
     14 
     15The 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. [[BR]]
     16
     17In 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.[[BR]]
     18
     19For example for a GPS event we must update the information for each car and then create and schedule the next event:[[BR]]
     20
    1321Iterator<SimulatedCarInfo> it = cars.iterator();
    1422        while (it.hasNext()) {
     
    1927        schedEvent(newEvent);
    2028
    21 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.
     29Another 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. [[BR]]
     30
    2231Generally 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).