appendix files of the study
TRANSCRIPT
-
7/29/2019 Appendix Files of the Study
1/97
APPENDICES
Appendix A
Gantt Chart
-
7/29/2019 Appendix Files of the Study
2/97
Appendix B
Bill of Materials
Items Price (Php) Quantity Total Cost
3-axis ADXL345 299 1 299
GSM/GPRS Shield 1995 1 1995
GPS Shield 1385 1 1385
Gizduino+ ATmega644 760 1 760
12V/3A DC Adaptor 360 1 360
Spray Paint 95 1 95
Toy Truck 130 1 130Pre-synthesized PCB 50 1 50
Mighty Bond 50 1 50
Hook & Loop Fastener 50 1 50
Dupont Wires 32 2 64
Printer Ink 150 4 600
Sliding Folder and Clips 40 6 240
Copier Paper 190 1 190
Shipping & Delivery miscellaneous 446Fuel (For Testing) miscellaneous 500
Bolts and Screws
miscellaneous 250
Fuse 2.5A and Holder
Resistors
LEDs
Switch
Soldering Lead
Cable WireHeaders
Electrical Wires
Total Amount: Php7,964
-
7/29/2019 Appendix Files of the Study
3/97
Appendix C
Client Module Hardware Connections
-
7/29/2019 Appendix Files of the Study
4/97
Appendix D
Module Schematics
The following schematics were taken from E-Gizmo module manuals providedupon purchase of the modules.
E-Gizmo Gizduino+ ATmega644
-
7/29/2019 Appendix Files of the Study
5/97
E-Gizmo GSM/GPRS Shield
-
7/29/2019 Appendix Files of the Study
6/97
E-Gizmo GPS Shield
-
7/29/2019 Appendix Files of the Study
7/97
Appendix E
Datasheets
-
7/29/2019 Appendix Files of the Study
8/97
-
7/29/2019 Appendix Files of the Study
9/97
-
7/29/2019 Appendix Files of the Study
10/97
-
7/29/2019 Appendix Files of the Study
11/97
-
7/29/2019 Appendix Files of the Study
12/97
-
7/29/2019 Appendix Files of the Study
13/97
-
7/29/2019 Appendix Files of the Study
14/97
-
7/29/2019 Appendix Files of the Study
15/97
-
7/29/2019 Appendix Files of the Study
16/97
-
7/29/2019 Appendix Files of the Study
17/97
-
7/29/2019 Appendix Files of the Study
18/97
-
7/29/2019 Appendix Files of the Study
19/97
-
7/29/2019 Appendix Files of the Study
20/97
-
7/29/2019 Appendix Files of the Study
21/97
-
7/29/2019 Appendix Files of the Study
22/97
-
7/29/2019 Appendix Files of the Study
23/97
-
7/29/2019 Appendix Files of the Study
24/97
-
7/29/2019 Appendix Files of the Study
25/97
-
7/29/2019 Appendix Files of the Study
26/97
-
7/29/2019 Appendix Files of the Study
27/97
-
7/29/2019 Appendix Files of the Study
28/97
-
7/29/2019 Appendix Files of the Study
29/97
-
7/29/2019 Appendix Files of the Study
30/97
-
7/29/2019 Appendix Files of the Study
31/97
-
7/29/2019 Appendix Files of the Study
32/97
-
7/29/2019 Appendix Files of the Study
33/97
-
7/29/2019 Appendix Files of the Study
34/97
-
7/29/2019 Appendix Files of the Study
35/97
-
7/29/2019 Appendix Files of the Study
36/97
-
7/29/2019 Appendix Files of the Study
37/97
-
7/29/2019 Appendix Files of the Study
38/97
-
7/29/2019 Appendix Files of the Study
39/97
-
7/29/2019 Appendix Files of the Study
40/97
-
7/29/2019 Appendix Files of the Study
41/97
-
7/29/2019 Appendix Files of the Study
42/97
-
7/29/2019 Appendix Files of the Study
43/97
-
7/29/2019 Appendix Files of the Study
44/97
-
7/29/2019 Appendix Files of the Study
45/97
-
7/29/2019 Appendix Files of the Study
46/97
-
7/29/2019 Appendix Files of the Study
47/97
-
7/29/2019 Appendix Files of the Study
48/97
-
7/29/2019 Appendix Files of the Study
49/97
Appendix F
Microcontroller Unit Code
#include
//LED indicatorsint led_1 = 12; //Data activeint led_2 = 13; //Connectedint led_3 = 14; //Sensor startint led_4 = 15; //Sensor alarmint led_5 = 2; //GPRS sentint led_6 = 3; //SMS sent
//ADXL345 declarationsint CS=4; //Chip Select signaldouble vg, rg, xg, yg, zg;char accel[6];
char POWER_CTL = 0x2D;char DATA_FORMAT = 0x31;char DATAX0 = 0x32; //X-Axis Data 0char DATAX1 = 0x33; //X-Axis Data 1char DATAY0 = 0x34; //Y-Axis Data 0char DATAY1 = 0x35; //Y-Axis Data 1char DATAZ0 = 0x36; //Z-Axis Data 0char DATAZ1 = 0x37; //Z-Axis Data 1
char values[10];int x,y,z;
//GPS declarationsint rx = 10; //GPSRXint tx = 11; //GPSTXchar rawdata[200]={'\0'};int i=0,j=0,length;char *ptr = '\0';char gpgga_data[65]={'\0'};
char longitude_d[4]={'\0'};char longitude[5]={'\0'};double lngitude =0; //longitude valuechar lng[9]; //longitude stringchar lng2[2]={'\0'}; //N or S
-
7/29/2019 Appendix Files of the Study
50/97
char latitude_d[4]={'\0'};char latitude[5]={'\0'};double ltitude =0; //latitude valuechar lat[9]; //latitude string
char lat2[2]={'\0'}; //E or W
char time_h[3]={'\0'}; //UTC hourchar time_m[3]={'\0'};char time_s[3]={'\0'};double time_hx = 0; //local hour valuechar hour[3] = {'\0'}; //local hour stringchar time[12] = {'\0'}; //local time
//GPRS declarationschar Rx_data[1000];
int k=0;char at_cmd[160]={'\0'};char string[160]={'\0'};char msg[100]={'\0'}; //GPRS messagechar msg2[80]="Host: sirena1234.vacau.com";char msg3[80]="Connection: Keep-Alive";char msgl[500]={'\0'};char ctl_z = 0x1A;
//SMS declarationsunsigned char Rx_index = 0;char mensahe[100]={'\0'}; //SMS messagechar msgx[160];
void setup(){pinMode(led_1, OUTPUT);pinMode(led_2, OUTPUT);pinMode(led_3, OUTPUT);pinMode(led_4, OUTPUT);pinMode(led_5, OUTPUT);pinMode(led_6, OUTPUT);
Serial.begin(57600); //GSM module communication
initGPRS(); //Initialize for GPRS
SPI.begin(); //sensor communicationdigitalWrite(led_3, HIGH); //LED indicator
-
7/29/2019 Appendix Files of the Study
51/97
pinMode(CS, OUTPUT);digitalWrite(CS, HIGH); //start communication
writeRegister(DATA_FORMAT, 0x01); //set sensor to +/- 4G rangewriteRegister(POWER_CTL, 0x08); //Measurement mode
//read sensor output until resultant acceleration exceeds threshold valuewhile(1){readRegister(DATAX0, 6, values);
x = ((int)values[1]
-
7/29/2019 Appendix Files of the Study
52/97
//read sensor registersvoid readRegister(char registerAddress, int numBytes, char * values){char address = 0x80 | registerAddress;if(numBytes > 1)address = address | 0x40;
digitalWrite(CS, LOW);SPI.transfer(address);for(int i=0; i
-
7/29/2019 Appendix Files of the Study
53/97
strncpy(longitude_d,ptr+30,3);strncpy(longitude,ptr+33,7);//longitude valuelngitude=stringtoInt(longitude_d,3) + stringtoInt(longitude,7)/60.0;
//convert to stringdtostrf(lngitude,7,4,lng);strncpy(lng2,ptr+41,1); //N or S
//UTC timestrncpy(time_h,ptr+7,2);strncpy(time_m,ptr+9,2);strncpy(time_s,ptr+11,2);
//convert to local (Pacific) timetime_hx=stringtoInt(time_h,2)+8;
if(time_hx>23){time_hx=time_hx-24;
}dtostrf(time_hx,2,0,hour);strcat(time,hour);strcat(time,":");strcat(time,time_m);strcat(time,":");strcat(time,time_s);
dtostrf(rg,5,3,accel);
j=1;}i=0;ptr='\0';delay(10);
//GPRS messagestrcat(msg,"GET /receive.php?acceleration=");strcat(msg,accel); //accelerationstrcat(msg,"G");strcat(msg,"&coorX=");strcat(msg,lat); //latitudestrcat(msg,lat2);strcat(msg,"&coorY=");strcat(msg,lng); //longitudestrcat(msg,lng2);strcat(msg,"&plate=DFK625");
-
7/29/2019 Appendix Files of the Study
54/97
strcat(msg,"&time2=");strcat(msg,time); //local timestrcat(msg,"&send=ok HTTP/1.0");
send_gprs(); //send GPRS data
digitalWrite(led_5, HIGH); //LED indicator
//SMS messagestrcat(mensahe,"Geographic Coordinates: ");strcat(mensahe,lat);strcat(mensahe,lat2);strcat(mensahe," ");strcat(mensahe,lng);strcat(mensahe,lng2);strcat(mensahe,"\n\nTime (UTC): ");strcat(mensahe,time);
strcat(mensahe,"\nAcceleration: ");strcat(mensahe,accel);strcat(mensahe,"G");
initGSM(); //initialize for SMSsend_msg("09339952872", mensahe); //send SMSdigitalWrite(led_6, HIGH); //LED indicator
}
//string to float converterdouble stringtoInt(char *string, int length){float ans=0,n=0;i=0;while(i
-
7/29/2019 Appendix Files of the Study
55/97
switch(string[i+1]){case '0': n=n+1;break;case '1': n=n+1;ans=ans+pow(0.1,n)*1;break;case '2': n=n+1;ans=ans+pow(0.1,n)*2;break;
case '3': n=n+1;ans=ans+pow(0.1,n)*3;break;case '4': n=n+1;ans=ans+pow(0.1,n)*4;break;case '5': n=n+1;ans=ans+pow(0.1,n)*5;break;case '6': n=n+1;ans=ans+pow(0.1,n)*6;break;case '7': n=n+1;ans=ans+pow(0.1,n)*7;break;case '8': n=n+1;ans=ans+pow(0.1,n)*8;break;case '9': n=n+1;ans=ans+pow(0.1,n)*9;break;
}i++;
}break;default: break;
}i++;}return ans;
}
//GPRS subfuctions
void initGPRS(){
send_cmd("AT\r\n"); //check communicationdelay(200);send_cmd("AT+CGATT=1\r\n"); //attach GPRS servicedelay(500);digitalWrite(led_1, HIGH); //LED indicatorsend_cmd("AT+CIPCSGP=1,\"internet\"\r\n"); //connection modedelay(200);send_cmd("AT+CLPORT=\"TCP\",\"80\"\r\n"); //set local portdelay(200);send_cmd("AT+CIPMUX=0\r\n"); //single IP connectiondelay(200);send_cmd("AT+CSTT=\"internet\",\"\",\"\"\r\n"); //start taskdelay(200);send_cmd("AT+CIICR\r\n"); //bring up connectiondelay(1000);digitalWrite(led_2, HIGH); //LED indicatorsend_cmd2("AT+CIFSR\r\n"); //get local IP addressdelay(200);send_cmd("AT+CIPHEAD=0\r\n"); //IP headdelay(200);
-
7/29/2019 Appendix Files of the Study
56/97
//configure domain name serversend_cmd("AT+CDNSCFG=\"208.67.222.222\",\"208.67.220.220\"\r\n");
}
//send command to GSM module and wait for OK reply
void send_cmd(char *at_cmd){char *stat='\0';while(!stat){sendGSM(at_cmd);delay(200);readSerialString(Rx_data);stat=strstr(Rx_data, "OK");
}clearString(Rx_data);
delay(200);Rx_data[0]='\0';stat='\0';
}
//send command to GSM module and wait for IP replyvoid send_cmd2(char *at_cmd){char *stat='\0';while(!stat){sendGSM(at_cmd);delay(200);readSerialString(Rx_data);stat=strstr(Rx_data, "10");
}clearString(Rx_data);delay(200);Rx_data[0]='\0';stat='\0';
}
void sendGSM(char *string){Serial.write(string);
}
//read reply from GSM modulevoid readSerialString(char *strArray){
-
7/29/2019 Appendix Files of the Study
57/97
k=0;if(!Serial.available()){return;
}
while(Serial.available()){strArray[k]=Serial.read();k++;if(k==1000){k=0;};
}}
//clear reply from GSM modulevoid clearString(char *strArray){
int l;for (l = 1000; l > 0; l--)strArray[l] = 0x00;strArray = '\0';
}
void send_gprs(){//set domain name and portsend_cmd3("AT+CIPSTART=\"TCP\",\"sirena1234.vacau.com\",\"80\"\r\n");//data to be sentsprintf(msgl, "%s\r\n%s\r\n%s\r\n\r\n%c", msg,msg2,msg3,ctl_z);//send datasend_cmd4("AT+CIPSEND\r\n");Serial.write(msgl);delay(10000);}
//send command to GSM module and wait for CONNECT OK replyvoid send_cmd3(char *at_cmd){char *stat='\0';sendGSM(at_cmd);while(!stat){delay(90);readSerialString(Rx_data);stat=strstr(Rx_data, "CONNECT");if(stat=="ERROR")
-
7/29/2019 Appendix Files of the Study
58/97
{sendGSM(at_cmd);}
}clearString(Rx_data);
delay(50);Rx_data[0]='\0';stat='\0';
}
//send command to GSM module and wait for > replyvoid send_cmd4(char *at_cmd){sendGSM(at_cmd);delay(1000);readSerialString(Rx_data);
clearString(Rx_data);delay(45);Rx_data[0]='\0';
}
//SMS subfunctions
void initGSM(){send_cmd("AT\r\n");send_cmd("AT+CMGF=1\r\n");delay(1000);
}
void send_msg(char *number, char *msgx){char at_cmgs_cmd[30] = {'\0'};char msgG[160] = {'\0'};
sprintf(msgG, "%s%c", msgx, ctl_z);sprintf(at_cmgs_cmd, "AT+CMGS=\"%s\"\r\n",number);
sendGSM(at_cmgs_cmd);delay(500);sendGSM(msgG);delay(100);
}
void loop(){}
-
7/29/2019 Appendix Files of the Study
59/97
Appendix G
Default.php Page Code
//title of the pageDesign of A Vehicular Collision Automatic Advisory and Data Management
System
//Java Script for embedding google maps starts here
//sets the center of the map to Cebu City
var mapcenter = new google.maps.LatLng(10.315,123.885);var map;var infowindow = new google.maps.InfoWindow();var time = new Array();var myimage = 'http://www.skyscrapercity.com/images/smilies/sad.gif';var coorX = new Array();var coorY = new Array();var acceleration = new Array();var myfunc = {};var marker = [],circles = [], mapinfo = {},lid=2,i;var myCircle;function initialize() {
var mapOptions = {zoom: 11,mapTypeId: google.maps.MapTypeId.ROADMAP,center: mapcenter
};//sets the ID name to be recognized by the html document or PHP page
-
7/29/2019 Appendix Files of the Study
60/97
map = new google.maps.Map(document.getElementById('map_canvas'),mapOptions);
display(-1);}
function warshock(lid)
{//Acquire data from HTML document with variables set by the PHP Pagetime.push(document.getElementById('mytime'+lid).innerHTML);coorX.push(document.getElementById('coorX'+lid).innerHTML);coorY.push(document.getElementById('coorY'+lid).innerHTML);
acceleration.push(document.getElementById('myacceleration'+lid).innerHTML);
//Create Map Markers..var myobject = new google.maps.Marker({
map:map,
draggable:false,animation: google.maps.Animation.DROP,// icon: myimage,
position: new google.maps.LatLng(coorX[coorX.length-1],coorY[coorY.length-1])
});marker.push(myobject);var cid=time.length-1;var did=acceleration.length-1;c="infowindow.setContent(' '+time["+cid+"]+'
PeakAcceleration: '+acceleration["+did+"]+'');infowindow.open(map, this);";google.maps.event.addListener(myobject, 'click', new Function(c));
//Create intensity Circlesvar intensity = parseFloat(acceleration[acceleration.length-1]);
//sets the value/threshold and settings of markers for very severe accidentsif(intensity>=8){
var Severity = {strokeColor: '#FF0000',strokeOpacity: 0.8, strokeWeight: 1,fillColor: '#000FFF', fillOpacity: 0.75,map: map, center: new google.maps.LatLng(coorX[coorX.length-
1],coorY[coorY.length-1]),radius: intensity*60};
}//sets the value/threshold and settings of markers for light accidents
else if(intensity
-
7/29/2019 Appendix Files of the Study
61/97
map: map, center: new google.maps.LatLng(coorX[coorX.length-1],coorY[coorY.length-1]),
radius: intensity*60};
}
//sets the value/threshold and settings of markers for very moderate accidentselse{
var Severity = {strokeColor: '#FF0000',strokeOpacity: 0.8, strokeWeight: 1,fillColor: '#660000', fillOpacity: 0.65,map: map, center: new google.maps.LatLng(coorX[coorX.length-
1],coorY[coorY.length-1]),radius: intensity*60};
}
myCircle = new google.maps.Circle(Severity);circles.push(myCircle);}
//function display/not displayfunction display(parameter){
i = parseInt(document.getElementById('numberofitems').value);if( parameter>-1){if(document.getElementById('action'+parameter).checked==false){
circles[parameter].setMap(null);marker[parameter].setMap(null);}
else {circles[parameter].setMap(map);marker[parameter].setMap(map);
}}
//displays the markers for x=0 where x stands as the identifier for data in each rowif( parameter == -1){
j=0while(j
-
7/29/2019 Appendix Files of the Study
62/97
//Refresh page every 300 secondssetTimeout('location.reload()', 300000); //refreshes the page every five minutes
//initializes all the scripts loaded into the page
//embeds the header image//embeds the navigation links//navigation links
Home
Faqdocumentationownerscreditscontact
//puts a horizontal border for separating the main content and header area
//embeds the map in the page//embeds the content of the page
Welcome to our website!This website was made in the fulfillment of our undergraduate thesis.In this page you can see all the logged data from our database.The table below includes all the important details of the accident - time, location (withcoordinates) and severity of the accident. Click on thecheckbox 'View Accident' in order to see the location of the accident in the map providedon the right side. To view the details of a specific accident,just click on the of the accident and it will redirect you to its details page. You canexplore the different pages of this site using the navigation links above.If you have any questions, you may contact us in the Contacts page.
All accidents are classified into three types: Very Severe(for accidents having a peak acceleration of more than 8g); Moderate (for accidentshaving a peak
Note: -
7/29/2019 Appendix Files of the Study
63/97
acceleration in between 3g to 8g); and Light (for accidents having a peak acceleration ofless than or equal to 3g).All peak accelearations are measured in terms ofg where 1g = acceleration on earth due to gravity = 9.81 meters per secondsquared.
All displayed time in the table below are of GMT+8Standards while the time logged onto the database is on GMT-5Collision Time is in 24-hour format and is in GMT+8settings.All positive X-Coordinates are coordinates in thenorthern hemisphere of the earth, while all negative X-coordinates are coordinates of thesouthern hemisphere of the earth. (e.g. 123.221N = 123.221; 112.331S = -112.331) All positive Y-Coordinates are coordinates in the easternhemisphere of the earth, while all negative Y-coordinates are coordinates of the westernhemisphere of the earth. (e.g. 123.221E = 123.221; 112.331W = -112.331)You can sort the list of accidents by Date of Accident or by SeverityThis site is best viewed with 1280x800 resolution andup.
//embeds the table with the information from the database ACCIDENTS LISTDate and TimeSeverityPeak Acceleration (in g)Plate No.X - CoordinateY - CoordinateCollision TimeLocation//connects the PHP page into the database -
7/29/2019 Appendix Files of the Study
64/97
//function that converts the GMT-5 timezone of the database to GMT+8function revertTimeStamp($timestamp){$year=substr($timestamp,0,4);$month=substr($timestamp,5,2);
$day=substr($timestamp,8,2);$hour=substr($timestamp,11,2);$minute=substr($timestamp,14,2);$second=substr($timestamp,17,2);$newdate=mktime($hour,$minute,$second,$month,$day, $year);return($newdate);}//pagination of tables starts here
if (!isset($_GET['pn'])) {$pn = 1;
}else$pn = $_GET['pn'];$itemsPerPage = 5; //sets the number of rows to be displayed on the table per page
$query="SELECT * FROM $db_table ORDER BY Date DESC"; //a query that selectsthe information from the table and sorts it according to date in a descending order$result=mysql_query($query); //executes the query above$maxentries = mysql_num_rows($result); //gets the total number of rows for pagination$lastPage = ceil($maxentries / $itemsPerPage); // calculates the number of pages forpagination//sets the variables to be used in linking or displaying page numbers$centerPages = "";$sub1 = $pn - 1;$sub2 = $pn - 2;$add1 = $pn + 1;$add2 = $pn + 2;//sets the condition of the links displayed when the user or viewer is at a certain pageif ($pn == 1) {
$centerPages .= ' ' . $pn . ' ';$centerPages .= ' ' .
$add1 . ' ';} else if ($pn == $lastPage) {
$centerPages .= ' ' .$sub1 . ' ';
$centerPages .= ' ' . $pn . ' ';} else if ($pn > 2 && $pn < ($lastPage - 1)) {
$centerPages .= ' ' .$sub2 . ' ';
-
7/29/2019 Appendix Files of the Study
65/97
$centerPages .= ' ' .$sub1 . ' ';
$centerPages .= ' ' . $pn . ' ';$centerPages .= ' ' .
$add1 . ' ';
$centerPages .= ' ' .$add2 . ' ';} else if ($pn > 1 && $pn < $lastPage) {
$centerPages .= ' ' .$sub1 . ' ';
$centerPages .= ' ' . $pn . ' ';$centerPages .= ' ' .
$add1 . ' ';}
// sets the limit range for pagination
$limit =($pn - 1)*$itemsPerPage;$query2 = "SELECT * FROM $db_table ORDER BY Date DESC LIMIT$limit,$itemsPerPage";$sql2 = mysql_query($query2) or die ('Error in request');;?>
-
7/29/2019 Appendix Files of the Study
66/97
$intense="vsevere";}
if ($rows['acceleration']=3 && $rows['acceleration']
-
7/29/2019 Appendix Files of the Study
67/97
$previous = $pn - 1;$paginationDisplay .= ' Back ';}// Lay in the clickable numbers display here between the Back and Next links
$paginationDisplay .= '' . $centerPages . '';// If we are not on the very last page we can place the Next buttonif ($pn != $lastPage) {
$nextPage = $pn + 1;$paginationDisplay .= ' Next ';}
}
?>
-
7/29/2019 Appendix Files of the Study
68/97
Appendix H
Acceleration.php Page Code
//title of the pageDesign of A Vehicular Collision Automatic Advisory and Data Management
System
//Java Script for embedding google maps starts here
//sets the center of the map to Cebu City
var mapcenter = new google.maps.LatLng(10.315,123.885);var map;var infowindow = new google.maps.InfoWindow();var time = new Array();var myimage = 'http://www.skyscrapercity.com/images/smilies/sad.gif';var coorX = new Array();var coorY = new Array();
var acceleration = new Array();var myfunc = {};var marker = [],circles = [], mapinfo = {},lid=2,i;var myCircle;function initialize() {
var mapOptions = {zoom: 11,mapTypeId: google.maps.MapTypeId.ROADMAP,
-
7/29/2019 Appendix Files of the Study
69/97
center: mapcenter};
//sets the ID name to be recognized by the html document or PHP pagemap = new google.maps.Map(document.getElementById('map_canvas'),
mapOptions);
display(-1);}function warshock(lid){
//Acquire data from HTML document with variables set by the PHP Pagetime.push(document.getElementById('mytime'+lid).innerHTML);coorX.push(document.getElementById('coorX'+lid).innerHTML);coorY.push(document.getElementById('coorY'+lid).innerHTML);
acceleration.push(document.getElementById('myacceleration'+lid).innerHTML);
//Create Map Markers..var myobject = new google.maps.Marker({map:map,
draggable:false,animation: google.maps.Animation.DROP,
// icon: myimage,position: new google.maps.LatLng(coorX[coorX.length-
1],coorY[coorY.length-1])});
marker.push(myobject);var cid=time.length-1;var did=acceleration.length-1;c="infowindow.setContent(' '+time["+cid+"]+'
PeakAcceleration: '+acceleration["+did+"]+'');infowindow.open(map, this);";google.maps.event.addListener(myobject, 'click', new Function(c));
//Create intensity Circlesvar intensity = parseFloat(acceleration[acceleration.length-1]);
//sets the value/threshold and settings of markers for very severe accidentsif(intensity>=8){
var Severity = {strokeColor: '#FF0000',strokeOpacity: 0.8, strokeWeight: 1,fillColor: '#000FFF', fillOpacity: 0.75,map: map, center: new google.maps.LatLng(coorX[coorX.length-
1],coorY[coorY.length-1]),radius: intensity*60};
}//sets the value/threshold and settings of markers for light accidents
else if(intensity
-
7/29/2019 Appendix Files of the Study
70/97
var Severity = {strokeColor: '#FF0000',strokeOpacity: 0.8, strokeWeight: 1,fillColor: '#FFFF00', fillOpacity: 0.35,map: map, center: new google.maps.LatLng(coorX[coorX.length-
1],coorY[coorY.length-1]),
radius: intensity*60};}
//sets the value/threshold and settings of markers for very moderate accidentselse{
var Severity = {strokeColor: '#FF0000',strokeOpacity: 0.8, strokeWeight: 1,fillColor: '#660000', fillOpacity: 0.65,map: map, center: new google.maps.LatLng(coorX[coorX.length-
1],coorY[coorY.length-1]),
radius: intensity*60};}
myCircle = new google.maps.Circle(Severity);circles.push(myCircle);}
//function display/not displayfunction display(parameter){
i = parseInt(document.getElementById('numberofitems').value);if( parameter>-1){if(document.getElementById('action'+parameter).checked==false){
circles[parameter].setMap(null);marker[parameter].setMap(null);}
else {circles[parameter].setMap(map);marker[parameter].setMap(map);
}}
//displays the markers for x=0 where x stands as the identifier for data in each rowif( parameter == -1){
j=0while(j
-
7/29/2019 Appendix Files of the Study
71/97
}return 'ok'; //signals that the script is working
}//Refresh page every 300 secondssetTimeout('location.reload()', 300000); //refreshes the page every five minutes
//initializes all the scripts loaded into the page
//embeds the header image//embeds the navigation links
//navigation linksHome
Faqdocumentationownerscreditscontact
//puts a horizontal border for separating the main content and header area
//embeds the map in the page//embeds the content of the page
Welcome to our website!This website was made in the fulfillment of our undergraduate thesis.In this page you can see all the logged data from our database.The table below includes all the important details of the accident - time, location (withcoordinates) and severity of the accident. Click on thecheckbox 'View Accident' in order to see the location of the accident in the map providedon the right side. To view the details of a specific accident,just click on the of the accident and it will redirect you to its details page. You canexplore the different pages of this site using the navigation links above.If you have any questions, you may contact us in the Contacts page.
Note: -
7/29/2019 Appendix Files of the Study
72/97
All accidents are classified into three types: Very Severe(for accidents having a peak acceleration of more than 8g); Moderate (for accidentshaving a peakacceleration in between 3g to 8g); and Light (for accidents having a peak acceleration ofless than or equal to 3g).
All peak accelearations are measured in terms ofg where 1g = acceleration on earth due to gravity = 9.81 meters per secondsquared.All displayed time in the table below are of GMT+8Standards while the time logged onto the database is on GMT-5Collision Time is in 24-hour format and is in GMT+8settingsAll positive X-Coordinates are coordinates in thenorthern hemisphere of the earth, while all negative X-coordinates are coordinates of thesouthern hemisphere of the earth. (e.g. 123.221N = 123.221; 112.331S = -112.331) All positive Y-Coordinates are coordinates in the eastern
hemisphere of the earth, while all negative Y-coordinates are coordinates of the westernhemisphere of the earth. (e.g. 123.221E = 123.221; 112.331W = -112.331)You can sort the list of accidents by Date of Accident or by SeverityThis site is best viewed with 1280x800 resolution andup.
//embeds the table with the information from the database ACCIDENTS LISTDate and TimeSeverityPeak Acceleration (in g)Plate No.X - CoordinateY - CoordinateCollision TimeLocation//connects the PHP page into the database -
7/29/2019 Appendix Files of the Study
73/97
or die ('Error connecting to mysql');//connects to the database through username and password and database hostmysql_select_db($dbname);//function that converts the GMT-5 timezone of the database to GMT+8function revertTimeStamp($timestamp)
{$year=substr($timestamp,0,4);$month=substr($timestamp,5,2);$day=substr($timestamp,8,2);$hour=substr($timestamp,11,2);$minute=substr($timestamp,14,2);$second=substr($timestamp,17,2);$newdate=mktime($hour,$minute,$second,$month,$day, $year);return($newdate);}//pagination of tables starts here
if (!isset($_GET['pn'])) {$pn = 1;
}else$pn = $_GET['pn'];$itemsPerPage = 5; //sets the number of rows to be displayed on the table per page
$query="SELECT * FROM $db_table ORDER BY acceleration DESC"; //a query thatselects the information from the table and sorts it according to date in a descending order$result=mysql_query($query); //executes the query above$maxentries = mysql_num_rows($result); //gets the total number of rows for pagination$lastPage = ceil($maxentries / $itemsPerPage); // calculates the number of pages forpagination//sets the variables to be used in linking or displaying page numbers$centerPages = "";$sub1 = $pn - 1;$sub2 = $pn - 2;$add1 = $pn + 1;$add2 = $pn + 2;//sets the condition of the links displayed when the user or viewer is at a certain pageif ($pn == 1) {
$centerPages .= ' ' . $pn . ' ';$centerPages .= ' ' .
$add1 . ' ';} else if ($pn == $lastPage) {
$centerPages .= ' ' .$sub1 . ' ';
$centerPages .= ' ' . $pn . ' ';} else if ($pn > 2 && $pn < ($lastPage - 1)) {
-
7/29/2019 Appendix Files of the Study
74/97
$centerPages .= ' ' .$sub2 . ' ';
$centerPages .= ' ' .$sub1 . ' ';
$centerPages .= ' ' . $pn . ' ';
$centerPages .= ' ' .$add1 . ' ';$centerPages .= ' ' .
$add2 . ' ';} else if ($pn > 1 && $pn < $lastPage) {
$centerPages .= ' ' .$sub1 . ' ';
$centerPages .= ' ' . $pn . ' ';$centerPages .= ' ' .
$add1 . ' ';}
// sets the limit range for pagination$limit =($pn - 1)*$itemsPerPage;$query2 = "SELECT * FROM $db_table ORDER BY acceleration DESC LIMIT$limit,$itemsPerPage";$sql2 = mysql_query($query2) or die ('Error in request');;?>
-
7/29/2019 Appendix Files of the Study
75/97
{$intensity ="Very Severe";$intense="vsevere";}
if ($rows['acceleration']=3 && $rows['acceleration']
-
7/29/2019 Appendix Files of the Study
76/97
// If we are not on page 1 we can place the Back buttonif ($pn != 1) {
$previous = $pn - 1;$paginationDisplay .= ' Back ';
}// Lay in the clickable numbers display here between the Back and Next links$paginationDisplay .= '' . $centerPages . '';// If we are not on the very last page we can place the Next buttonif ($pn != $lastPage) {
$nextPage = $pn + 1;$paginationDisplay .= ' Next ';}
}
?>
-
7/29/2019 Appendix Files of the Study
77/97
Appendix I
Details.php Page Code
//title of the pageDesign of A Vehicular Collision Automatic Advisory and Data Management
System
//Java Script for embedding google maps starts here
//sets the center of the map to Cebu City
var mapcenter = new google.maps.LatLng(10.315,123.885);var map;var infowindow = new google.maps.InfoWindow();var time = new Array();var myimage = 'http://www.skyscrapercity.com/images/smilies/sad.gif';var coorX = new Array();var coorY = new Array();var acceleration = new Array();var myfunc = {};
var marker = [],circles = [], mapinfo = {},lid=2,i;var myCircle;function initialize() {
var mapOptions = {zoom: 11,mapTypeId: google.maps.MapTypeId.ROADMAP,center: mapcenter
};
-
7/29/2019 Appendix Files of the Study
78/97
//sets the ID name to be recognized by the html document or PHP pagemap = new google.maps.Map(document.getElementById('map_canvas'),
mapOptions);display(-1);
}
function warshock(lid){//Acquire data from HTML document with variables set by the PHP Page
time.push(document.getElementById('mytime'+lid).innerHTML);coorX.push(document.getElementById('coorX'+lid).innerHTML);coorY.push(document.getElementById('coorY'+lid).innerHTML);
acceleration.push(document.getElementById('myacceleration'+lid).innerHTML);
//Create Map Markers..var myobject = new google.maps.Marker({
map:map,draggable:false,animation: google.maps.Animation.DROP,
// icon: myimage,position: new google.maps.LatLng(coorX[coorX.length-
1],coorY[coorY.length-1])});
marker.push(myobject);var cid=time.length-1;var did=acceleration.length-1;c="infowindow.setContent(' '+time["+cid+"]+'
PeakAcceleration: '+acceleration["+did+"]+'');infowindow.open(map, this);";google.maps.event.addListener(myobject, 'click', new Function(c));
//Create intensity Circlesvar intensity = parseFloat(acceleration[acceleration.length-1]);
//sets the value/threshold and settings of markers for very severe accidentsif(intensity>=8){
var Severity = {strokeColor: '#FF0000',strokeOpacity: 0.8, strokeWeight: 1,fillColor: '#000FFF', fillOpacity: 0.75,map: map, center: new google.maps.LatLng(coorX[coorX.length-
1],coorY[coorY.length-1]),radius: intensity*60};
}//sets the value/threshold and settings of markers for light accidents
else if(intensity
-
7/29/2019 Appendix Files of the Study
79/97
fillColor: '#FFFF00', fillOpacity: 0.35,map: map, center: new google.maps.LatLng(coorX[coorX.length-
1],coorY[coorY.length-1]),radius: intensity*60};
}//sets the value/threshold and settings of markers for very moderate accidentselse{
var Severity = {strokeColor: '#FF0000',strokeOpacity: 0.8, strokeWeight: 1,fillColor: '#660000', fillOpacity: 0.65,map: map, center: new google.maps.LatLng(coorX[coorX.length-
1],coorY[coorY.length-1]),radius: intensity*60};
}myCircle = new google.maps.Circle(Severity);circles.push(myCircle);}
//function display/not displayfunction display(parameter){
i = parseInt(document.getElementById('numberofitems').value);if( parameter>-1){if(document.getElementById('action'+parameter).checked==false){
circles[parameter].setMap(null);marker[parameter].setMap(null);}
else {circles[parameter].setMap(map);marker[parameter].setMap(map);
}}
//displays the markers for x=0 where x stands as the identifier for data in each rowif( parameter == -1){
j=0while(j
-
7/29/2019 Appendix Files of the Study
80/97
}//Refresh page every 300 secondssetTimeout('location.reload()', 300000); //refreshes the page every five minutes
//initializes all the scripts loaded into the page
//embeds the header image//embeds the navigation links//navigation links
HomeFaqdocumentationownerscreditscontact
//puts a horizontal border for separating the main content and header area
//embeds the map in the page//embeds the content of the page
Welcome to our website!This website was made in the fulfillment of our undergraduate thesis.In this page you can see all the logged data from our database.The table below includes all the important details of the accident - time, location (withcoordinates) and severity of the accident. Click on thecheckbox 'View Accident' in order to see the location of the accident in the map providedon the right side. To view the details of a specific accident,just click on the of the accident and it will redirect you to its details page. You canexplore the different pages of this site using the navigation links above.If you have any questions, you may contact us in the Contacts page.
All accidents are classified into three types: Very Severe(for accidents having a peak acceleration of more than 8g); Moderate (for accidentshaving a peak
Note: -
7/29/2019 Appendix Files of the Study
81/97
acceleration in between 3g to 8g); and Light (for accidents having a peak acceleration ofless than or equal to 3g).All peak accelearations are measured in terms ofg where 1g = acceleration on earth due to gravity = 9.81 meters per secondsquared.
All displayed time in the table below are of GMT+8Standards while the time logged onto the database is on GMT-5Collision Time is in 24-hour format and is in GMT+8settingsAll positive X-Coordinates are coordinates in thenorthern hemisphere of the earth, while all negative X-coordinates are coordinates of thesouthern hemisphere of the earth. (e.g. 123.221N = 123.221; 112.331S = -112.331) All positive Y-Coordinates are coordinates in the easternhemisphere of the earth, while all negative Y-coordinates are coordinates of the westernhemisphere of the earth. (e.g. 123.221E = 123.221; 112.331W = -112.331)You can sort the list of accidents by Date of Accident or by SeverityThis site is best viewed with 1280x800 resolution andup.
//embeds the table with the information from the database ACCIDENTS LISTDate and TimeSeverityPeak Acceleration (in g)Plate No.X - CoordinateY - CoordinateCollision TimeLocation//connects the PHP page into the database -
7/29/2019 Appendix Files of the Study
82/97
//function that converts the GMT-5 timezone of the database to GMT+8function revertTimeStamp($timestamp){$year=substr($timestamp,0,4);$month=substr($timestamp,5,2);
$day=substr($timestamp,8,2);$hour=substr($timestamp,11,2);$minute=substr($timestamp,14,2);$second=substr($timestamp,17,2);$newdate=mktime($hour,$minute,$second,$month,$day, $year);return($newdate);}//query for displaying a details of the accident$sql = "SELECT * FROM $db_table WHERE identity='$id'";$result = mysql_query($sql) or die(mysql_error()); //executes the query
}?>
-
7/29/2019 Appendix Files of the Study
83/97
$intensity ="Light";$intense="light";}
if ($rows['acceleration']>=3 && $rows['acceleration']
//script that automatically zooms the map to the location of the accidentsetTimeout( function(){
map.setZoom(13);map.setCenter(new google.maps.LatLng(,));}, 4000);
//table for displaying the details
-
7/29/2019 Appendix Files of the Study
84/97
// This shows the user what page they are on, and the total number of pages$paginationDisplay .= 'Page ' . $pn . ' of ' . $lastPage. '
';// If we are not on page 1 we can place the Back buttonif ($pn != 1) {
$previous = $pn - 1;$paginationDisplay .= ' Back ';
}// Lay in the clickable numbers display here between the Back and Next links$paginationDisplay .= '' . $centerPages . '';// If we are not on the very last page we can place the Next buttonif ($pn != $lastPage) {
$nextPage = $pn + 1;$paginationDisplay .= ' Next ';
}}
?>
Note:
All accidents are classified into three types: Very Severe(for accidents having a peak acceleration of more than 8g); Moderate (for accidentshaving a peakacceleration in between 3g to 8g); and Light (for accidents having a peak acceleration ofless than or equal to 3g).All peak accelearations are measured in terms ofg where 1g = acceleration on earth due to gravity = 9.81 meters per secondsquared.All displayed time in the table below are of GMT+8Standards while the time logged onto the database is on UTC StandardsCollision Time is in 24-hour format and is in GMT+8settings.All positive X-Coordinates are coordinates in thenorthern hemisphere of the earth, while all negative X-coordinates are coordinates of thesouthern hemisphere of the earth. (e.g. 123.221N = 123.221; 112.331S = -112.331) All positive Y-Coordinates are coordinates in the easternhemisphere of the earth, while all negative Y-coordinates are coordinates of the westernhemisphere of the earth. (e.g. 123.221E = 123.221; 112.331W = -112.331)This site is best viewed with 1280x800 resolution andup.
-
7/29/2019 Appendix Files of the Study
85/97
All PAGES CODED BY TEAMWARSHOCK 2013
-
7/29/2019 Appendix Files of the Study
86/97
Appendix J
Receive.php Page Code
//trims the data from the url
-
7/29/2019 Appendix Files of the Study
87/97
Appendix K
Greys.css Cascading Style Sheet
body
{background-color:#ffffff;background-image: url('background.jpg');color: #000000;font-family:Helvetica;font-size:10pt;overflow auto;}
#header{
height:300px;float: top;}
#navigation{
}
#horizon{border-bottom:2px solid #888888;}#welcome{margin-left:auto;margin-right:auto;position: absolute;overflow:auto;top: 380px;max-width:800px;}
#accident{margin-left:auto;margin-right:auto;overflow-x:visible;overflow-y:visible;position: absolute;
-
7/29/2019 Appendix Files of the Study
88/97
width:50%;left: 10px;top: 210px;padding:10px;max-width:800px;
}
#map_canvas{overflow:auto;position:absolute;top:240px;left:57%;height: 700px;width: 40%!important;border: 1px solid #000000;
padding-bottom:10px;}
.map{width:50%;height:60%;float: rightborder:1px solid #000000;}
#footer{font-family: Helvetica;font-size:9pt;text-transform: uppercase;text-align:center;position: absolute;top:950px;}h1{color:#000000;font-weight:bold;text-align:center;font-size: 9pt;}
.separate{
-
7/29/2019 Appendix Files of the Study
89/97
border-bottom:2px solid #000000;}
h2{
font-family: Helvetica;font-weight: bold;text-transform: uppercase;font-size: 13pt;}
h3{font-family: helvetica;font-size:11pt;text-transform:uppercase;
}
a:link{color:#ff0000;font-size: 9pt;text-transform:uppercase;font-family: Helvetica;border-bottom:0px;text-decoration: none;}a:visited{color:#ff0000;font-size: 9pt;text-transform:uppercase;font-family: Helvetica;border-bottom:0px;text-decoration: none;}a:hover{color:#ffffff;background-color:#000000;border-bottom:0px;text-transform:uppercase;font-family: Helvetica;font-size: 9pt;border-bottom:0px;text-decoration: none;
-
7/29/2019 Appendix Files of the Study
90/97
}a:active{color:#ff0000;
text-transform:uppercase;font-family: Helvetica;font-size: 9pt;font-style: italic;border-bottom:0px;text-decoration: none;}
p{font-family:Helvetica;
font-size:10pt;text-align: justify;}
i{font-family:Georgia;font-style:italic;}
p.note{font-family: Helvetica;font-size:8.5pt;}
li.note{font-family: Helvetica;font-size:8.5pt;}a.head:link{color:#757575;font-family: Helvetica;font-weight: bold;font-size: 11pt;text-transform: uppercase;}a.head:visited
-
7/29/2019 Appendix Files of the Study
91/97
{color:#757575;font-weight: bold;font-family: Helvetica;font-size: 11pt;
text-transform: uppercase;}a.head:hover{color:#ffffff;font-weight: bold;font-family: Helvetica;font-size: 11pt;background-color:#4b545f;font-weight:bold;border-bottom: 0px solid #000000;
text-decoration: none;text-transform: uppercase;}a.head:active{color:#757575;font-family: Helvetica;font-size: 11pt;font-weight: bold;text-transform: uppercase;}
td{table-layout:auto;min-width:60px;width:350px;border:1px solid #000000;color: #000000;font-family:Helvetica;font-size:9pt;overflow:hidden;background-color: #ffffff;}
tr{table-layout:auto;background-color: #ffffff;
-
7/29/2019 Appendix Files of the Study
92/97
}
table{table-layout:auto;
width:350px;color: #000000;font-family:Helvetica;font-size:9pt;overflow:hidden;border:1px solid #000000;background-color: #ffffff;}
td.invi{
table-layout:auto;}
tr.invi{table-layout:auto;}
table.invi{table-layout:auto;}
th{table-layout:auto;width:350px;
height:50px;overflow:hidden;background-color: #ffffff;}
td{table-layout:fixed;width:350px;text-align:center;border:1px solid #000000;overflow:hidden;
-
7/29/2019 Appendix Files of the Study
93/97
background-color: #ffffff;}
table, td{
table-layout:auto;width:50%;height:35px;vertical-align:center;border:1px solid #000000;color: #000000;font-family:Helvetica;font-size:9pt;overflow:hidden;background-color: #ffffff;}
td{table-layout:auto;width:350px;padding:5px;overflow:hidden;background-color: #ffffff;}
td.vsevere{border:1px solid #000000;font-family: Helvetica;font-size:9pt;background-color:#6391b2;overflow:hidden;height:35px;color:#000000;}td.moderate{border:1px solid #000000;font-family: Helvetica;font-size:9pt;background-color:#ff8989;overflow:hidden;height:35px;color:#000000;}
-
7/29/2019 Appendix Files of the Study
94/97
td.light{border:1px solid #000000;font-family: Helvetica;font-size:9pt;
background-color:#f2ff95;overflow:hidden;height:35px;color:#000000;}
nav ul {background: #efefef;background: linear-gradient(top, #efefef 0%, #bbbbbb 100%);background: -moz-linear-gradient(top, #efefef 0%, #bbbbbb 100%);background: -webkit-linear-gradient(top, #efefef 0%,#bbbbbb 100%);
box-shadow: 0px 0px 9px rgba(0,0,0,0.15);padding: 0 20px;border-radius: 7px;list-style: none;position: relative;display: inline-table;
}nav ul:after {
content: ""; clear: both; display: block;}
nav ul li {float: left;
}nav ul li:hover {
background: #4b545f;background: linear-gradient(top, #4f5964 0%, #5f6975 40%);background: -moz-linear-gradient(top, #4f5964 0%, #5f6975 40%);background: -webkit-linear-gradient(top, #4f5964 0%,#5f6975 40%);
}nav ul li:hover a {
color: #fff;}
nav ul li a {display: block; padding: 15px 20px;color: #757575; text-decoration: none;
}
-
7/29/2019 Appendix Files of the Study
95/97
Appendix L
Photo Documentation
Screenshots of the text messages transmitted by the Client Module
Prototype and its LED Indicator
Testing at Paseo Arcenas, Banawa, Cebu
-
7/29/2019 Appendix Files of the Study
96/97
Testing at Shell Basak, Pardo, Cebu
Testing at Jollibee North Reclamation Area
Testing at McDonalds Lapu-Lapu
-
7/29/2019 Appendix Files of the Study
97/97