Skip to main content
. 2019 May 3;19(9):2071. doi: 10.3390/s19092071
Algorithm 2: Algorithms for notification
 Data: MESSAGE=(location,Owner_Info,Vehicle_Info)
 Result: Ambulance Dispatched;
 Server decode the message;
 lat1 = start.lat;
 lon1 = start.lng;
 lat2 = end.lat;
 on2 = end.lng;
 dLat = lat2 - lat1;
 dLon = lon2 - lon1;
 a= Math.sin(dLat / 2) * Math.sin(dLat / 2);
 b= Math.cos(this.toRad(lat1)) * Math.cos(this.toRad(lat2));
 c= Math.sin(dLon / 2) * Math.sin(dLon / 2);
 d= a+b*c;
 e= 2 * Math.atan2(Math.sqrt(d), Math.sqrt(1 - d));
 Dist= R * c;
 Cloud finds the nearest hospital using the HAVERSINE;
 Hospital= nearest_hospital;
 Update the data base;
 Server sends notification to Hospital Web Interface;
 Hospital dispatch the ambulance;