## 4 Implementation
### Smart EMS System
#### 4.3.1 Description  
Smart EMS (emergency medical service) systems deal with the emergency situations of critical patients with the support of smart IoT environments. When an emergency situation occurs with a critical patient, 911 is notified of the situation by some hotline, and 911 informs the ambulance of the situation for emergency medical treatment and transfer to the proper hospital if necessary. In cases of multiple situations of this kind occurring simultaneously, it is necessary for 911 and ambulances to transfer the patients on the spot to proper hospitals based on some prediction with respect to the criticalities of the patients. The critical status of the patients is assumed to be classified depending on emergency situations, as shown in Table 12.  
The operational requirements specifications for smart EMS are as follows:  
1. EMS consists of 911 (911 Center1), ambulances (AmbX1, AmbY1), locations of patients (LocA, LocB, LocC, LocD), and hospitals (HospM1 and HospN1); 1. 911 Center1 contains ambulances; 2. Both AmbX1 and AmbY1 imply ambulances; 3. LocA LocB, LocC and LocD imply locations; 4. HospM1 and HospN1 imply hospitals. 2. Assuming that there is a T1 patient of Table 12 in LocA; 4. Assuming that there is a T2 patient of Table 12 in LocB; 5. Assuming that there is a T3 patient of Table 12 in LocC; 6. 911 Center1 receives patient information from locations LocA, LocB, LocC, and LocD; 7. 911 Center1 sends AmbX1 both the priority information for rescue based on Table 12 and the patient information received from LocA and LocB; 8. 911 Center1 sends AmbY1 both the priority information for rescue based on Table 12 and the patient information received from LocC and LocD. 3. AmbX1 moves to LocA and LocB, based on the information received from 911 Center1; 1. In the case where AmbX1 moves to LocA first, it transfers the patient at the location to HospM1 after sending a message to the hospital and it moves to HospM1. 1. In the case where AmbX1 moves to LocC first, it transfers the patient at the location, and transfers the  
\(SmartEMS::=LocA|LocB|LocC|LocD|911 Center_{1}[AmbX_{1}|AmbY_{1}]|HospM_{1}|HospN_{1}\) shows the inclusion relations among the components of the EMS example; 2. LocA transmits the patient's information to 911 Center with \(CALL911\_LocA(\overline{\text{T1}})\); 3. LocB transmits the patient's information to 911 Center with \(CALL911\_LocB(\overline{\text{T2}})\); 4. LocC transmits the patient's information to 911 Center with \(CALL911\_LocC(\overline{\text{T2}})\); 5. LocD transmits the patient's information to 911 Center with \(CALL911\_LocD(\overline{\text{T3}})\); 6. 911 Center\({}_{1}\) sends the patients' information to \(\text{AmbX}_{1}\) and \(\text{AmbY}_{1}\); 1. The probabilities that 911 Center\({}_{1}\) sends \(\text{AmbX}_{1}\) the rescue order for the patients are 1. \(ORDER\_AmbX_{1}(\overline{T1-T2})\{0.9\}\)--the probability that a T1 patient at LocA is rescued first (90%); 2. \(ORDER\_AmbX_{1}(\overline{T2-T1})\{0.1\}\)--the probability that a T2 patient at LocB is rescued first (10%). 2. The probabilities that 911 Center\({}_{1}\) sends \(\text{AmbY}_{1}\) the rescue order for the patients are 1. \(ORDER\_AmbY_{1}(\overline{T2-T3})\{0.7\}\)--the probability that a T2 patient at LocC is rescued first (70%); 2. \(ORDER\_AmbY_{1}(\overline{T3-T2})\{0.3\}\)--the probability that a T2 patient at Location LocC is rescued first (30%). 7. \(\text{AmbX}_{1}\) receives the patient's information from 911 Center\({}_{1}\) and transfers the patient to \(\text{HospM}_{1}\) after rescuing the patient; 1. \(ORDER\_AmbX_{1}(T1-T2)\{0.9\}\)--the probability that \(\text{AmbX}_{1}\) moves first to LocA (90%); 2. \(ORDER\_AmbX_{1}(T2-T1)\{0.1\}\)--the probability that \(\text{AmbX}_{1}\) moves first to LocB (10%); 3. \(TRANSFER\_to\_HospM_{1}(\overline{T1})\{0.9\}\)--the probability that \(\text{AmbX}_{1}\) transmits the information of a T1 patient at LocA to \(\text{HospM}_{1}\) (90%); 4.