## 2 Distance Measurement Module Development
### DIAM Design and Development  
The DIAM is saved in real-time to collect the sensor distance information of each lane from three VDMs. The stored data are transmitted to the DMCA of the ground control part in real-time to calculate the traffic and the velocity information. The real-time raw information is stored in the micro san disk (SD) memory unit and the DIAA of the ground control part measures the accurate vehicle information when the traffic information collection is completed. The detection algorithm determines the vehicle front/rear using the collected raw information. The generated information is transferred to the DMCA queue.  
The vehicle is detected using the detection algorithm and the DMCA transmission is determined by the command mode received from the DMCA detection mode. The detection algorithm is composed of normal mode and debug mode. The normal mode transmits the vehicle entry/exit detection information to calculate the vehicle velocity in the DMCA. The information of each sensor is checked in debug mode. In this mode, the DMCA sends 1 or 2 sensor selection commands and the selected sensor information is grouped by 10 to be transmitted to the DMCA.  
* Normal mode activity:
* sensor number: check the sensor status detected entry/exit.
* status: front/rear status;
* tick: calculation of the time required for tick data rate in the front/rear detection (operates at 800 us/tick);
* base value: represents data to obtain the distance between two sensor measurement points;
* data produce: all distance information received from the VDM is saved in a file.
* Debug mode activity:
* sensor number: identify and check the selected sensor information;
* current value: check the current sensor distance data;
* base value: check the currently applied base value;
* status: check the current status of sensors such as vehicle entry/exit, standby, status, etc.;
* wait count: a specific time is counted when the condition of transitioning from the current stat to another state is satisfied (800 us/count).  
Figure 6 shows the DIAM artwork and the developed DIAM (Figure 6); DIAM processes more than 1000 distance information per second from the three VDMs simultaneously and transmits it to the DMCA.  
Figure 6 the DIAM performs the following functions:  
* VDM and communication function (RS232 communication):
* acquisition of front/rear real-time sensor distance information;
* acquisition of sensor operation status information;
* control commands such as start/stop of collection;
* simultaneous processing of multiple VDM information.
* DMCA and communication function (Ethernet 915 MHz wireless):
* compression function of real-time detection information (transmission of entry/exit event information);
* integrity of event information delivery (transmission confirmation and error check);
* real time information transmission function for validating detection processing.
* Vehicle detection function:
* distance value slope and change amount search function;
* front/rear decision;
* determine the validity of status transition;
* separate management of parameters for each sensor (expected to be different for each detection location and inspection pattern).
* Real-time raw information storage function:
* include in the parameter file header for vehicle detection.