**2. Related work**

Several remote e-healthcare monitoring applications deployed on different computing paradigms are presented in this section. In Ref. [6], a mobile cloud computing paradigm is adopted to deploy applications to provide remote healthcare services. The authors discussed various schemes for the interconnection of different healthcare systems and proposed a design of an application used for fall detection of patients based on the cloud paradigm. The authors in Ref. [7] presented a design of an application that utilizes the cry of newborn babies as a pathological tool for the detection of pain. This remote pain detection application is designed on a cloud paradigm. The Support Vector Machine (SVM)-based neural networks are used for the classification of patterns and the proposed application provides remote access to the detected pain statistics by using the Thinkspeak IoT platform. Medical practitioners and medical service providers can access the detected pain by using mobile devices. The research in Ref. [8] presents a cloud paradigm-based application for remote pain monitoring of patients. In the proposed design, the cloud server acts as a link between the edge nodes and the web platform. The proposed design includes a wearable sensor mask as an edge node for the detection of different biopotential signals of patients, which are processed at the cloud server for the detection of pain intensity. Afterward, the detected pain information is transmitted to the web platform connected to the cloud server for providing remote access to the end users. Researchers adopt the same paradigm in Ref. [9] for the implementation of an application for remote monitoring of patients that are in a persistent vegetative state (PVS) by analyzing their real-time facial expressions.

For the provision of pervasive healthcare services to end users, the system deployed in Ref. [10] is based on the mobile cloud paradigm. High network consumption, latency, and reliability are the major limitations in the large-scale deployment of efficient e-healthcare applications on mobile computing paradigm for the provision of real-time medical services to the patients. To resolve these problems and to provide high QoS the researchers designed a layered healthcare architecture named as UbeHealth. For remote services and supervision related to healthcare, the first layer is based on medical practitioners and doctors. The second layer contains cloudlets that are used for the prediction of the upcoming network traffic volume which is used for adaptation of a specific data rate to maintain high QoS. The cloud server is placed at the third layer for the provision of high computational and storage resources.

For the provision of advanced healthcare services to the end users, the importance of the placement of gateway devices close to the network edge is enlightened by authors in Ref. [11]. The authors proposed a fog-based healthcare warning system that provides an early warning related to healthcare issues. The authors in Ref. [12] describe the major issues involved in the deployment of healthcare applications on cloud computing and mobile computing paradigms. The authors also proposed the fog computing paradigm for the execution of healthcare applications in a scattered manner to efficiently utilize available resources. In Ref. [13], a fog-based healthcare application monitors the patients using the sensor nodes and processes this information using fog computing resources. The cloud server resides on the top of the network to provide additional processing services. An application for the monitoring of ECG signals of patients is designed in Ref. [14] that utilizes the cloud and mobile platforms for the provision of healthcare services.

In Ref. [15], a cloud-based system that employs a social-technical design scheme to implement a healthcare application in the Nigerian healthcare system is presented. The proposed system is used to provide services to the residents of rural areas, which results in the reduction of cost and delay. The fog-based remote healthcare monitoring design is emerging as a solution to several existing healthcare issues in developing countries. The system presented in Ref. [16] is specially designed to provide services to patients suffering from chikungunya. The proposed system avoids an outbreak by enabling real-time virus detection and diagnosis arrangement. In their strategy, classification is accomplished on patients' data using a decision tree for the detection of viruses and the result is instantaneously communicated to the users through mobile. Furthermore, the virus outbreak state is monitored by performing chronological network analysis on the patient's data collected from the vicinity.

Integration of IoT, biosensors, and cloud computing paradigm enhances the implementation of e-healthcare applications that results in addressing the factors limiting the delivery of healthcare services to each patient, which includes the availability of expensive, sensitive medical equipment in each medical unit, shortage of medics and health workers, limitations in hospital information systems. Cloud computing enhanced the medical facilities provision on large scales by providing a remote interconnection between patients and doctors. Besides this interconnection, the cloud also offers continuous access to medical records whenever and from wherever required, further enhancing patient care. Cloud servers have plenty of resources to handle the huge and heterogeneous types of medical data sensed by healthcare IoT devices.

Several e-healthcare applications are designed on the cloud paradigm. An existing challenge in the healthcare and medical support systems is the delivery of medical services to the increasing number of elderly people. To overcome the challenges involved in this area, the authors in Ref. [17] proposed a Cloud-Based Smart Home Environment (CoSHE) for home healthcare, which uses Software-as-a-Service (SaaS) architecture with wearable sensors to collect different biopotentials of the patient to provide information remotely to doctors and caretakers. This application uses a private cloud facility that enables remote monitoring of patient records by healthcare professionals. The proposed system consumes high energy as it uses non-invasive sensors for the monitoring of the entire home.

In cloud-based healthcare applications, the IoT devices are equipped with different types of sensors that are used to sense different medical information related to patients, which are conveyed to cloud servers by IoT devices through the wireless communication link. The sensed data of patients are stored in cloud databases and are used for further analysis in diagnostic procedures. Based on the patient's condition, alert signals are conveyed to the doctors and related caregivers. Cloud-based healthcare systems provide initial diagnosis and some precautionary measures for better health.

The integration of IoT devices, biosensors, and cloud paradigm results in an efficient structure for the implementation of real-time healthcare applications to remotely facilitate elderly and disabled persons. For real-time monitoring of disabled and elderly patients, a cloud-based structure is presented by authors in Ref. [6] based on sensors to continuously detect ECG signals of patients. Cloud computing provides a huge amount of storage and computational resources to process the sensed data from many patients. The cloud server provides access to the stored medical data to several healthcare service providers. To achieve medical data privacy, ECG signals are watermarked and enhanced on the client side and are stored in databases before

#### *Cloud Computing to Fog Computing: A Paradigm Shift DOI: http://dx.doi.org/10.5772/intechopen.110751*

sending to the cloud for further processing. This process enables sharing of specific medical information with the only relevant and appropriate healthcare services.

Owing to the integration of IoT technology in the healthcare industry, this area is not just limited to Electronic Medical Records (EMRs) and Hospital Management Systems (HMS). Healthcare systems are becoming more digital and patient-centric by providing computer-aided surgical treatments and remote patient healthcare management. The research in Ref. [18] provides the challenges faced by the healthcare industry related to the adoptation of digital data. Afterward, a system as an example based on the cloud computing paradigm is illustrated, offering healthcare as a service (HaaS). By adopting cloud-based healthcare applications, patients can connect to healthcare specialists to attain medical guidance on time. Cloud computing is a centralized approach that stores all the collected data at cloud servers located at remote locations, which seems to be challenging in preserving the privacy of the stored data. The aforementioned concern is one of the key motives behind the limited adaptation of such centralized systems. In Ref. [19] a fog-based framework for cloud healthcare applications is presented that uses intermediate fog nodes to pre-process the patient's data to maintain privacy and confidentiality of their health record. The proposed approach provides an accurate outcome with the facility of content privacy and security at the edge. Privacy concerns appear to be more significant in cloud-based healthcare systems where the sensitive and heterogeneous type of data generated from wearable biosensors needs to be processed and stored. The existing privacy preservation techniques available are not applicable due to their high processing and communication cost. To address this issue, a cloud-based user validation scheme for medical data is presented in Ref. [20] that performs mutual authentication for secure transmission between patient and wearable sensor nodes by secret session key allocation. To address the existing problems in the information exchange procedures in healthcare systems, a novel hybrid cloud system named MedShare is presented in Ref. [21]. Medical organizations operating on large scales maintain their cloud servers, and to share the medical records of patients with other organizations, they use peer-to-peer (P2P) mode following some defined policies. To preserve the privacy of the sensitive medical record and patient identity on cloud-based healthcare networks from impostors and to maintain security, anonymous authentication data exchange is vital among the different peer organizations.

On pairing-based cryptography, an anonymous on-the-fly secure data exchange protocol is proposed in Ref. [22] that permits cloud servers to vigorously create temporary identities to generate session keys for each session of information exchange. The proposed approach is beneficial against different cyber-attacks. To significantly reduce the processing time of medical queries in cloud-based healthcare services, the optimal selection of virtual machines (VMs) plays an important role. To achieve optimal VM selection, a chronic kidney disease diagnosis and the prediction model are presented that employs Parallel Particle Swarm Optimization (PPSO) with linear regression and a neural network. The prediction of the proposed model is 97.8% with a reduction in execution time [23]. The engagement of mobile devices for the facilitation of human lives through useful applications has almost achieved its ultimate level. The factors restricting the use of mobile devices are the limited amount of processing, storage, and battery. A mobile cloud computing model for big data ehealthcare services is presented in Ref. [24] that engages cloudlets. A huge amount of data is generated and needs to be processed to provide remote healthcare services. One of the best choices to handle this big data is cloud computing.

A detailed analysis of cloud computing techniques to handle the healthcare big data segment and future research dimensions in this area are discussed in Ref. [25]. In Ref. [26], a mobile cloud computing-based effective and intelligible framework for stroke detection is presented, which consists of two application elements, for example, mobile application and server application. For the classification of subtypes of strokes, an artificial neural network module is used, whereas a server module is used to save the information from the patients. Robust protection against untrusted clouds and unauthorized users is mandatory to secure sensitive healthcare data in cloud-based healthcare systems.

Currently, security mechanisms adopted in most of the cloud-based healthcare systems are based on cryptography, SOA, Secure Multi-party Computation (SMC), and Secret Share Schemes (SSS). The computational cost of image processing tasks performed to prevent unauthorized access to healthcare records is a significant problem in the implementation of such security techniques. To protect healthcare information from possible disclosure, machine learning-based security schemes using SVM and Fuzzy C-means Clustering (FCM) to classify image pixels are applied. Results of the evaluations performed utilizing the proposed technique using two datasets confirm that for data protection and simultaneous image segmentation use of SVMs is an efficient concept. ECG monitoring plays a vital role in diagnosing and monitoring heart conditions.

Almost all ECG monitoring systems deployed so far are based on mobile applications. A new monitoring method was proposed that uses wearable sensor nodes for ECG detection. The proposed system uses a cloud-based framework with Hypertext Transfer Protocol (HTTP) and MQTT protocols to provide visual and timely access to recorded ECG data [27]. A blockchain-based approach for secure and robust healthcare data transmission is presented that collects the sensed data of patients using wearable devices to store it in cloud storage. The blockchain concept is implemented on individual patient records to maintain the privacy that generates a distinct block as a chain. Experimental results reveal that the proposed model provides a reduction in average delay and execution time with an improved success rate as compared to conventional models [28].

Cloud computing is the base architecture to implement IoT-enabled applications. Cloud due to its centralized architectural approach offers high latency and restricts large-scale implementation. Fog computing offers solutions to these problems. The issues involved in interoperability and integration of cloud and fog architectures are explored in Ref. [29] to provide healthcare services. To provide cost-efficient healthcare services with low latency and reliability, several IoT-based healthcare frameworks are designed using different paradigms. The challenges to maintaining the quality of service in such systems are due to the heterogeneous nature of healthcare data.

A five-layered heterogeneous architecture to simultaneously handle mist, fog, and cloud-based networks to efficiently handle and route real-time healthcare data is proposed. The proposed framework ensures efficient resource allocations, high QoS, and reduction in latency by adopting software-defined networking and link adaptation-based load balancing [30]. A new public, private, and hybrid cloud-based conceptual computing model is presented that adopts multiple cloud services to resolve existing critical issues involved in the modeling of health management systems [31].

A cloud-based framework using a fuzzy rule-based neural classification algorithm for the diagnosis of diabetes is designed in Ref. [32]. The cloud paradigm offers a twolevel hierarchical processing structure that is inefficient in reducing delay and energy utilization. A model is proposed in Ref. [33] that provides an energy-efficient cloud paradigm for deploying IoT applications using dynamic voltage and frequency scaling (DVFS) technology. The proposed model migrates and reuses virtual machines with round-robin scheduling.

In Ref. [34], a module placement for the fog-cloud paradigm is proposed that splits the resources of fog nodes into slots to which slotted versions of services are allocated on availability to perform energy-efficient execution of services. To increase the reliability, efficiency, and performance of the computing systems with efficient network bandwidth consumption, a data duplication idea is proposed in Ref. [35] that provides a copy of original data near the end nodes. The proposed concept reduces the burden on the network. A cognitive intelligent IoT smart healthcare framework, based on a cloud paradigm to provide cost-efficient and rapid healthcare services for monitoring patient state, is presented in [36].

In Ref. [37], a deep learning-based seizure detection of epileptic patients is proposed that consumes cloud resources for the execution of sensed information. Cloud computing architecture proves to be a cost-efficient solution to deliver flexible and enhanced quality of service in the healthcare industry. Deploying e-Healthcare applications on the cloud paradigm results in the transfer of sensitive health-related data of patients between several entities. Due to the application of modern cryptographic techniques, the communication channels between these entities are secure enough but the protection of data at the endpoints from malicious insider attacks is still a problematic task. To prevent false examination of patients due to data manipulation from malicious insiders, the study in Ref. [38] provides an insider attack detection process. The proposed approach uses a combination of watermarking and cryptographic techniques to provide transparency of patient data.

ECG feature extraction plays a pivotal role in detecting and diagnosing various cardiac diseases. In cloud-based healthcare systems, the detected ECG signals of patients are directly transmitted from biosensors to cloud servers for processing. In Ref. [39], the fog computing concept is adopted to enhance the performance of such health monitoring systems by providing distributed storage and processing resources at the edge nodes. In their proposed model, ECG features extraction performed *via* the lightweight wavelet transform method at fog devices, which results in achieving high bandwidth efficiency and reduced latency.

In Ref. [40], a fog paradigm-based health monitoring system that uses Gigabit Passive Optical Network (GPON) as an access scheme is presented. The designed approach places fog nodes at optimum locations, calculated using Mixed Integer Linear Programming (MILP) for energy-efficient implementation. The experimental results confirm that the proposed approach is energy-efficient as compared to the centralized cloud computing approach when used for healthcare applications with low and high data rates.

In smart cities concepts, the fog computing paradigm bridges sensor networks and smart homes. Fog nodes usually execute basic data processing and data translation tasks. In smart healthcare systems, fog nodes, the gateway to sensitive medical data, have high privacy and security threats. So, to deploy a secure and smart healthcare system, a cognitive fog model is designed [41] that is capable of taking decisions related to processes joining and relieving. The proposed model is also self-capable and self-aware to initiate new processes to provide security to running modules in the fog environment. In addition, the proposed model provides better accuracy, detection, and error rate as compared to other available algorithms.

iFogSim is the simulator used for the execution of various scenarios based on cloud and fog computing paradigms. Most of the researchers have used this simulator for the evaluation of their fog computing-based applications. The authors explain the steps and procedures involved in modeling and implementing fog computing-based applications in iFogSim [42]. A fog paradigm-based disaster management system is implemented in Ref. [43] and is compared with the cloud-based deployment using iFogSim. Authors in Ref. [43] used iFogSim to monitor the effects of the CPU speed of fog devices on energy utilization and latency of the system.

For optimum scheduling of tasks, a whale optimization-based scheme is compared with the available several heuristic algorithms in implementing healthcare applications using the iFogSim simulator [44]. An efficient car parking application based on the fog paradigm is simulated using the iFogSim toolkit and is compared with the cloud-based deployment to illustrate the beneficial aspects of adopting the fog paradigm [45]. The research in Ref. [46] categorized the iFogSim toolkit as the most effective simulator available for the execution of different applications on the fog computing paradigm. An energy-efficient module allocation approach based on a heuristic algorithm is presented and simulated using the iFogSim toolkit by the authors in [45].

#### **3. Internet of thing-based remote pain monitoring application**

Wearable sensors existing in the market by 2020 are about to be 237.1 million, with an estimated reach of the market segment associated with the medical industry being \$117 billion by 2020 [47]. The data communicated by these large number of applications based on such a large number of sensors is estimated to be 507.5 zettabytes [48]. Generally, these applications are deployed using the cloud paradigm. The cloud paradigm offers resources in a centralized way to process the huge amount of volume sensed by a large number of sensor nodes. Due to the availability of large resources at cloud servers, the cloud paradigm is very viable for implementing healthcare applications [49].

The cloud paradigm offers all resources in a centralized fashion for the completion of different tasks. Gigantic and diverse type of information is sensed by the edge nodes, which is to be handled by the cloud server. Due to the centralized nature, this paradigm offers high latency and huge network consumption, which limits the deployment of healthcare applications on large scale. Healthcare applications dealing with the processing of ECG signals have strict QoS and latency requirements that are not fulfilled by the cloud-centric paradigm when deploying applications on large scales [38]. Therefore, the cloud paradigm is not viable for providing healthcare services with stringent QoS requirements.

Pain is a significant factor in detecting a patient's distress and ailment. The consequences of an investigation performed on diverse groups of patients favor the necessity of remote pain monitoring [50]. The key restrictions in the manual reporting method are non-compliance of patients to manual entry, delay in medication, and the inability of patients to express their conditions. The main factor that makes the selfreporting scheme impracticable is the delayed provision of diagnosis. Significant methods applied for the monitoring of pain comprise facial expression recognition using face video [51], physiological signal fusion [52], and facial EMG. However, various methods have been applied in designing systems for the remote detection of pain that incorporates cloud services and various pain detection schemes [53]. The

core issue in the large-scale deployment of healthcare applications that needs to be resolved is the attainment of strict QoS requirements. Huge network consumption and high latency are the major limitations in the implementation of pain monitoring applications on the cloud paradigm.

In Ref. [8], an application based on a cloud paradigm for the detection of pain is designed using wearable sensor nodes. The designed application provides remote access to pain statistics through a web platform. The designed sensor nodes are used to detect the patients' biopotential signals, which are further processed by using the cloud resources. The useful pain information is transmitted to the web platform for the provision of remote access. This consistent involvement of cloud server introduces high latency in the provision of services, which is not suitable for e-healthcare applications. Hence, a remote pain monitoring application based on the fog paradigm is designed in this research to resolve these issues.

A summary of the main contributions of this research is defined below:


#### **3.1 Background**

Cloud computing architecture based on resourceful cloud servers delivers effective handling of big data generated by different applications. This provision of a resourceful solution by cloud paradigm makes cloud architecture the most viable paradigm for implementing Internet-based applications demanding analysis and processing of big data. Due to the rise in the deployment of these types of applications, the main restrictions confronted by the researcher in the cloud-based deployment of applications are high delay, and inefficient network consumption [54]. Owing to these problems, deploying latency-sensitive healthcare applications on a cloud paradigm is not feasible.

Fog paradigm, by offering resources close to the network boundary, significantly reduces the network load and improves the quality of experience (QoE). This provision of resources close to the edge also decreases the latency in the delivery of services to the end user. The fog-based model presented in Ref. [55] attains a 41% reduction in power consumption by effectively offloading data between cloud and fog nodes. To achieve stringent QoS requirements of the applications, the fog paradigm distributes resources throughout the network for the provision of services adjacent to the sensor nodes [56].

The latency offered by cloud-based healthcare applications is proportional to the scale on which they are deployed [11], thus failing to attain real-time data provision


#### **Table 1.**

*QoS requirements for time-sensitive healthcare services.*

for latency-sensitive healthcare applications [57]. Latency requirements to maintain QoS in e-healthcare services are presented in **Table 1** [58]. Cisco introduced the idea of fog computing in January 2014 to resolve the high network utilization and delay problems caused by cloud-based implementations [24].

The fog paradigm distributes the resources in such a manner that reduces the computational load. The resource-constraint fog devices exist throughout the system [27, 59]. The main reason behind the adoption of the fog paradigm is the real-time provision of healthcare services to users [60].

Various applications built on distributed paradigms are proposed in different studies providing efficient utilization of resources and cost-efficient implementations. For seamless service provision to the end users, a multi-tier fog paradigm is proposed in Ref. [61]. A mobility-aware three-layer fog computing structure for optimal resource allocation is presented in Ref. [62]. The proposed model engages a Gini coefficient-based FCNs selection algorithm (GCFSA) to get the optimum results. To enhance security in fog-based *ad hoc* vehicular networks, the authors in Ref. [63] presented a design of a new authenticated key agreement protocol. To provide services like network virtualization and edge resource management to the end-users by different network service providers using a fog-cloud paradigm is proposed in Ref. [64].

Fog computing architecture reduces repeated cloud server participation for the execution of tasks, resulting in reduced network utilization and delay. Several types of research have shown a decrease in latency by adopting the fog paradigm as an alternative to cloud architecture to implement different applications [26, 43, 65]. Due to the distributed structure of the fog paradigm, improved scalability and mobility are offered. The reduction in network utilization is achieved by adopting the fog paradigm because fog nodes process the sensed information near the end users. A doublematching resource allocation scheme is proposed in Ref. [66] that achieves cost efficiency by effectively allocating the network resources. Similarly, an algorithm is presented in Ref. [67], which offers dynamic offloading and resource assignment to achieve a reduction in cost and latency.

Fog computing distributes limited resources in the form of fog devices throughout the network. The limited resources available at the fog devices are sufficient to perform various dynamic tasks assigned by the edge nodes [29]. In this chapter, a threelayer fog paradigm-based design is proposed and implemented for the deployment of an e-healthcare application that provides remote access to pain-related information of the patients. The prominent characteristics of fog computing architecture include reduced delay and efficient network utilization, which make this architecture the most suitable candidate for the implementation of latency-sensitive e-healthcare applications [68].

The proposed design integrates a fog computing paradigm and web platform to provide real-time access to pain-related information of the patients. Several signal processing techniques are executed utilizing fog resources to complete the pain detection process. The pre-processing opportunity offered by the fog nodes in between the cloud server and edge nodes correspondingly reduces the execution cost.

### **3.2 Proposed architecture**

**Figure 1** describes the three-layer fog paradigm proposed for the deployment of a remote pain monitoring application. The first layer is at the edge of the network, which is based on biopotential sensors connected to patients admitted to the hospitals. This layer exploits the sensors to detect and transmits the sEMG and ECG signals of the patients to the second layer for further processing. The second layer consists of resource-constraint fog devices that provide resources near the edge layer to process the sensed biopotential information. The last layer in the proposed architecture consists of a cloud server that provides a massive amount of storage and computational resources for the execution of sensed and preprocessed information forwarded by the connected fog nodes. The designed architecture also provides remote access to pain-related information of patients through a web platform. The proposed architecture minimizes the latency and network utilization in providing remote services to the end users. A brief introduction of each component involved in the proposed design is described in the following sections.

**Figure 1.** *Proposed fog-based remote e-healthcare application for pain monitoring.*

#### *3.2.1 The sensor layer*

The sensor layer is responsible for detecting and transmitting biopotential signals from hospitals to the fog layer. For the fulfillment of this purpose, the sensor layer is comprised of wearable biosensors. The edge nodes contain battery-operated sensors and are equipped with passive electrodes to detect biopotential signals. The edge devices are responsible for the transmission of detected medical information to the fog nodes, which is why they are integrated with the Wi-Fi module. The designed sensor nodes for the detection of biopotential signals have a sampling rate satisfying the Nyquist criteria. The edge nodes transmit the detected biopotential signals of patients to the parent fog nodes for additional processing [69].

#### *3.2.2 The fog layer*

The fog layer exists in the middle of the proposed design. The fog computing layer is comprised of resource-constraint fog devices that are responsible for the provision of resources close to the edge of the network for providing real-time processing of pain-related sensed data detected at the edge layer. The fog layer performs primary processing on the detected biopotential signals for the recognition of pain in patients.

Interoperability is an important feature of fog computing that permits various fog devices to interconnect, allowing dealing with multiple types of edge devices. Multiple fog devices contribute some of their available resources to fulfill the assigned processing tasks [28]. The proposed design takes interoperability as an integral characteristic of fog computing which is why the delay factor in intercommunication between fog devices is not considered [45].

Specific indexes are used to distinguish between various patients, such as HS22 defines the second patient of hospital 2, as shown in **Figure 2**. To offer remote access for pain monitoring to doctors and users, the proposed design links a web platform with fog devices. The fog devices utilize limited available resources for the processing of the detected pain-related biopotential signals and transfer the results of the processed information to the web application. The cloud server is a resourceful entity used to permanently store pain-related statistics to maintain patient records. Before transferring pain-related information to a storage module located at a cloud server, this data is temporarily stored in a fog database using limited available storage. The proposed fog computing paradigm provides resources near the patients for providing real-time processing of the pain-related signals detected at the hospitals.

#### *3.2.3 The cloud layer*

This layer contains a cloud server accountable for providing storage and computational resources for processing tasks related to pain detection forwarded by the connected fog nodes. The cloud server being a resourceful device is used for maintaining the database related to pain-related medical records of patients. A proxy server provides a link between the fog devices and the cloud server. Fog nodes process patients' detected sEMG and ECG signals for detecting pain and forward the pain-

#### **Figure 2.**

*The proposed design of e-healthcare application for multiple hospitals.*

related information to the cloud server after periodic intervals. The cloud server is only used in the proposed scheme when the resources available at the fog nodes cannot complete the pain-related processing task.

#### *3.2.4 Overview*

The fog computing paradigm is deployed in the proposed scheme to implement a remote pain monitoring application that uses ECG and EMG sensors for the continuous detection of biopotential signals of patients residing in hospitals situated at distant sites. The designed application structure consists of Wi-Fi modules assigned to different network devices for providing an interconnection between different network nodes.

The proposed design contains a web platform to offer users and medical practitioners remote access to pain-related information. The designed approach places the edge nodes at the hospitals that continuously detect patients' pain-related signals and transmit this information to the fog node assigned to that hospital. For detecting pain based on the Facial Action Coding System [70], various facial muscles under the observation of the detectors are Frontalis, Corrugator, Orbicularis oculi, Levator Nose, Zygomaticus, NS Risorius, respectively. The pain-related signals detected by the edge

nodes are processed using various signal processing and filtering techniques as defined in Ref. [8], by the fog devices utilizing limited local resources for identifying pain and its intensity. Afterward, the pain-related information is communicated to the web platform for remote visualization.

Each hospital in the proposed structure is equipped with multiple numbers of sensors to monitor patients. These sensor nodes are connected to fog nodes assigned to the hospitals. In the existing design, one fog device is assigned to each hospital to provide processing and storage facilities. The cloud server located at the top of the network structure periodically updates a medical database to keep a record of patients.

The resources available at the cloud server are enough to process the volume of biopotential signals generated by the connected fog nodes. However, this distant communication between sensor nodes and the cloud produces an additional delay and extra network utilization.

This increase in network consumption and latency restricts the practice of cloud paradigms for the implementation of such types of applications. The provision of a fog layer reduces network utilization and latency. This reduction in network consumption and latency is due to resource-constraint fog nodes providing computational services near the end users.

This pre-processing of detected information using fog resources also cuts the volume of information to be processed at the cloud server, resulting in saving execution costs at the cloud. Furthermore, the communication of pain-related statistics directly between fog devices and web applications eliminates the auxiliary involvement of cloud servers.

**Figure 2** describes the structure in which multiple hospitals are to be monitored using multiple fog devices. The network consumption and delay rise with an increase in the number of hospitals to be monitored because of the simultaneous transmission of the amplified size of information to the cloud and web server by multiple fog devices.

Initially, all the sensors are initialized for the detection of biopotential signals of the patients. These detected signals are transmitted to the parent fog nodes. Fog devices consume available resources for the execution of various feature extraction techniques, pattern recognition algorithms, segmentation schemes and data reduction approaches to generate useful results related to pain-related information of patients [71–75]. This pain-related information extracted from the sensed information is communicated to the cloud and web platform to offer remote access.

#### **3.3 Simulation setup and results**

An average of three simulations per scenario is executed to assess the proposed design. In all the executed scenarios, the edge devices are increased to monitor the increasing number of patients. The end devices are directly connected to their parent fog nodes. The sensed signals by the sensors are instantly transmitted to the resourceful fog devices. The iFogSim toolkit is used for the simulations of multiple scenarios generated for the comparison of the proposed design with the cloud-based deployment. The parameters under observation during these scenarios are end-to-end delay, network utilization, and execution cost.

### **Algorithm A:** Fog paradigm-based remote pain monitoring application with FCFS scheduling




In the simulated scenarios, variables for the representation of hospitals and edge devices are created. In all the scenarios, four hospitals are simulated. One fog device is allocated to each hospital. In the first scenario, there are four sensors connected to each hospital for monitoring patients. The proxy server provides an interconnection between the cloud server and fog nodes. The sensors deployed in all the simulations are designed with a CPU length of 1200 million instructions. The sensing frequency of sensors used in simulations is 25 milliseconds. The number of sensors is increased in each new simulated scenario.

Algorithm A defines the steps involved in the creation and execution of different topologies for the evaluation of the proposed remote pain monitoring application on different scales. Network utilization and delay are the parameters observed during all the evaluations. The RMS data stream module is placed at the sensor nodes for the detection of biopotential signals of patients. The digital filtering and dimension reduction modules require more computational resources, so these modules are assigned to fog devices. Furthermore, for the visualization of pain-related information to the remote users the pain detection module is placed on the web server. The scheduling scheme employed in our simulations is the First Come First Serve (FCFS)

scheduling strategy. The data dependency between different modules is shown in the algorithm. The tasks associated with any module are described in the form of tuples in the simulation environment. Tuples are transmitted between the modules for task assignment and are executed at modules.

For the assessment of the proposed design on multiple scales, the sensors associated with fog devices are increased in each subsequent simulation scenario. This increment of sensors gives rise to the volume of detected information to be processed at the fog node, which increases delay and network utilization. As a result, the resources available at the fog node are limited, and fog nodes have to perform all tasks within the limits of the available resources. The advantage of such distributed computing design is to reduce the processing burden on the cloud server and provide services near the edge of the network. The values of different network parameters adopted for the creation of different network devices in the simulation scenarios are defined in **Table 2**. The proposed design is compared with the traditional cloud-based deployment. One of the simulation scenarios created for fog-based deployments is shown in **Figure 3**.

#### *3.3.1 Execution cost*

In the scenarios, there are *H* number of smart hospitals (*H* ¼ *h1* f g , *h2*, *h3*, … , *hH* ) and the total volume of the sensed data of the system to be handled in a given time *t* is denoted by *V<sup>t</sup> <sup>H</sup>* is the sum of the individual volume of each hospital (*V<sup>t</sup> <sup>H</sup>* <sup>¼</sup> *vt <sup>h</sup>*<sup>1</sup> <sup>þ</sup> *vt <sup>h</sup>*<sup>2</sup> <sup>þ</sup> *<sup>v</sup><sup>t</sup> h*3 , … , *v<sup>t</sup> hH* ).


#### **Table 2.**

*Value of parameters associated with different network devices used in simulations [47].*

*One of the scenarios created in iFogSim for evaluating the proposed design.*

The overall time consumed (*T<sup>t</sup> s* ) in the processing of biopotential signals at any time *t* can be calculated by using Eq. (1), in which *T<sup>t</sup> <sup>p</sup>* denotes time spent at any interval *t* in the sensing and processing of signals of a patient.

$$T\_s^t = T\_p^t \times \sum\_{i=1}^{H} v\_{h\_i}^t \tag{1}$$

Eq. (2) is used for the calculation of the overall time consumed (*TF*) from detection of biopotential signals to the provision of pain-related information through the web platform.

$$T\_F = T\_s^t + T\_{ef}^t + T\_{fw}^t \tag{2}$$

Here, *T<sup>t</sup> ef* is the time spent in the transmission of detected information from edge nodes to fog devices and *T<sup>t</sup> fw* is the time spent to transmit pain evidence from fog device to web platform.

In cloud-based deployment, *Tec* is the time spent in the transmission of detected information from edge nodes to cloud server and the time it takes to provide this painrelated information at web platform for visualization to end-users is *Tcw*. The overall latency (*TC*) offered by the cloud-based deployment of remote pain applications is calculated using Eq. (3).

$$T\_{\mathcal{C}} = T\_s^t + T\_{\mathcal{ec}}^t + T\_{\mathcal{c}w}^t \tag{3}$$

At any time *t*, network utilization for cloud *U<sup>t</sup> c* � � and proposed fog-based design *Ut f* � � is calculated using Eqs. (3) and (4) in which *<sup>δ</sup>* is the length of data encapsulated in the tuple.

$$U\_c^t = \delta \times \left( T\_s^t + T\_{\alpha^t}^t + T\_{cw}^t \right) \tag{4}$$

$$U\_f^t = \delta \times \left( T\_s^t + T\_{ef}^t + T\_{fw}^t \right) \tag{5}$$

Fog nodes by utilizing the available resources process the sensed information. The tasks demanding additional resources than those available at the fog nodes are transferred to the cloud server. The proposed organization of network devices significantly reduces the load on the server resulting in the reduction of processing cost at the cloud server.

Eqs. (6) and (7) are derived from [76] to compute the cost of execution at cloud (*Ec*) and reduction in execution cost (Δ*Ec*) respectively.

$$E\_{\mathfrak{c}} = \mathfrak{f}\_{\mathfrak{c}} + (\mathbb{S}\_{\text{clock}} \times L\_{\text{time}} \times R\_{\text{MIPS}} \times L\_{\text{u}} \times T\_{\text{MIPS}}) \tag{6}$$

$$
\Delta\_{E\_\varepsilon} = E\_\varepsilon^{\text{cloud}} \text{-} E\_\varepsilon^{\text{fog}} \tag{7}
$$

Here, *ξ<sup>c</sup>* is the execution cost, *Sclock* is the CloudSim clock, *Ltime* is the last utilization update time, *RMIPS* is the rate per MIPS, *Lu* is the last utilization, *TMIPS* is the total MIPS of the host, *Ecloud <sup>c</sup>* is the cost of execution for cloud scenario, and *Efog <sup>c</sup>* is the cost of execution for fog computing scenario.

**Figure 4.** *Reduction in execution cost using the proposed approach.*

The cloud architecture provides additional computational support to the fog paradigm by providing a resourceful cloud server. Fog computing delivers services close to the edge users. The fog node provides resources for the processing of the detected biopotential signals at the edge layer.

The processing cost at the cloud is based on the consumption of cloud resources for the execution of tasks in the cloud [76–78]. The decrease in the processing cost at the cloud can be attained by the induction of fog nodes in the system, as fog nodes process the detected data by using their resources, resulting in the reduction of information to be processed at the cloud server. **Figure 4** illustrates the reduction in execution cost by adopting the proposed model as compared to cloud implementation. The reason for this decrease in information to be processed in the cloud is the introduction of fog resources in the network.

#### *3.3.2 Latency*

Healthcare applications require real-time processing. The key factor limiting the large-scale deployment of such e-healthcare applications on the cloud paradigm is the high delay offered by cloud architecture. The fog computing paradigm distributes the resources reducing the repetitive access to cloud servers. This ensures the reduction of offered delays in the provision of processing services to edge users. In the proposed design, one fog node is assigned to each hospital that processes the sensed data at the hospital and transmits the suitable information to the web platform without incorporating a cloud server. This procedure reduces the overall latency offered in the provision of remote services to end users. iFogSim simulator is used to execute all designed scenarios. **Figure 5** presents the delay offered in the provision of pain-related remote access services by the cloud and fog-based deployments. The delay produced by the cloud-based deployment of the application significantly rises with an increase in the number of patients, while the proposed design offers reduced latency due to the provision of service near the hospitals.

#### **Figure 5.**

*Latency comparison between the proposed paradigm and the cloud paradigm.*

To evaluate the proposed fog-based deployment, four fog nodes are installed to monitor four hospitals. In the initial scenario, each fog node is offered to process the data of four patients attached to it. Afterward, the number of patients per fog node increases in each succeeding scenario. The fog nodes have to process the information detected by the increasing number of patients. Therefore, a rise in the sensed volume results in an increased execution delay offered by the modules placed at fog nodes. This simultaneous rise in the sensed volume on each fog node results in a sudden rise in the latency of the system, as depicted in **Figure 5**, when the number of patients increases from 48 to 52. This abrupt rise in the delay is the effect of individual delays produced at each fog node which can be stabilized by the addition of more fog devices in the network.

#### *3.3.3 Network consumption*

In cloud-based deployment, the cloud server processes all the sensed volume of the patients. Thus, a rise in the number of patients to be monitored increases the volume of sensed data to be processed at the cloud server, resulting in higher network consumption. A reduction in network utilization is observed in the case of the proposed design due to the provision of resources near the patients through fog nodes. Furthermore, this reduction in network consumption is also because each fog device has to process the information of one specific hospital.

The achieved reduction in network consumption while deploying remote pain monitoring applications on the proposed design is depicted in **Figure 6**. In cloudbased deployment, all the connected patients'sensed data must be processed at the single cloud sever available. Thus, a simultaneous increase in the number of patients burdens the network due to a rise in the sensed load traffic toward the cloud server. Whereas, this abrupt increase of network load is not observed in the case of fog-based design because the fog devices have to process the sensed data of patients of only one hospital. In conclusion, the proposed design reduces latency and efficient network utilization compared to the cloud paradigm for the deployment of latency-sensitive e-healthcare applications.

**Figure 6.**

*Reduction in network utilization using the proposed fog paradigm.*

#### **4. Results and discussion**

In this chapter, a design of remote pain monitoring applications using the fog computing paradigm is presented. To confirm the effectiveness of the proposed design as compared to cloud-based implementations several scenarios are implemented [55, 56, 79]. During all these assessments, the parameters under observation are execution cost, end-to-end delay, and network utilization. The reduction in the execution cost at the cloud is observed, as shown in **Figure 4** while deploying the application on the proposed paradigm. This reduction in processing cost at the cloud is due to the provision of fog resources throughout the system.

**Figure 5** depicts the delay caused by both of the paradigms in implementing the application in all the simulated scenarios. The proposed design assigns one fog node to each hospital for the processing of the sensed data without incorporating a cloud server. This procedure reduces the overall latency offered in the provision of remote services to end-users. However, the latency provided by the cloud-based design significantly increases with an increase in the number of sensors, while the proposed design offers reduced latency due to the provision of service near the hospitals. **Figure 6** shows that very high network consumption is offered by the cloud paradigm for implementing remote pain monitoring applications. The reason behind this high network consumption in cloud-based deployment is the only availability of resources at cloud servers in a centralized manner.

#### **4.1 Comparative analysis**

The cloud computing paradigm offers resources in a centralized way. Real-time service provision is a major apprehension in the implementation of e-healthcare applications. Fog computing offers resources in a distributed manner through the deployment of fog nodes throughout the network. The fog resources are enough for the execution of processing tasks related to sensed medical signals. Hence, the fog paradigm is proved to be a more suitable candidate for the deployment of e-healthcare


**Table 3.**

*Comparison between the proposed design and the existing systems.*

applications. **Table 3** offers a brief comparison of the proposed fog-based design with the existing healthcare systems. The outcomes of the simulation carried out in this research validate that a decrease in network utilization and processing cost at the cloud is realized using the proposed approach.
