Introduction

Wearable medical devices have grown in popularity due to their ability to improve people’s lives. The rapid development in medical wearable devices has attracted research communities’ interest over the past years [1, 2]. Wearable technology has aided healthcare professionals in intervening early in chronic diseases, particularly among patients who live lonely, and has enabled remote real-time monitoring of various vital signs [3]. So, any delay in monitoring vital signs could result in undesired health consequences for the users. Consequently, a continuous source of electrical power is critical to prevent wearable device malfunctions of the operation [4, 5].

The term "wearable" indicates that the device is either supported on the human body or a piece of clothing, and that it has a suitable design that allows it to be used as a wearable accessory for an extended period of time. Wearable technology represents a new methodology for improving healthy lifestyles [6]. The main constraints of impeding the adoption of wearable devices are their need for continuous power supply [6], and their size where, most of wearable medical devices depend on rechargeable batteries that increase their size and weight. Subsequently, this makes them unappealing to users, and uncomfortable [6, 7]. Battery-based wearable devices confirmed inefficient and limited operation as well as human intervention [8].

To overcome these constraints, many researchers tended to use energy harvesting technology to power wearable devices [9,10,11]. As a result, scavenging energy from the ambient environment helps to solve the problem of battery source [12]. Energy scavenging means gathering and converting renewable power for use in wearable devices [13]. Energy harvesting technology is commonly used in wearable medical devices as the main source of energy due to the process of absorbing and converting energy from the environment into electricity such as kinetic, solar, thermal, and radio-frequency (RF) waves [14, 15]. By taking advantage of the human body as an energy source, kinetic activity can guarantee a long-lasting operation. Nevertheless, when the kinetic energy of the human activity is high, there is sufficient energy to be used for powering wearable devices and tasks are executed regularly without interruption. In the contrast, this stored energy is used when the human body activity is low and insufficient to supply the wearable device [16]. The human body is a potential source of energy. The human body generates a large amount of mechanical energy [17] as shown in Fig. 1.

Several studies suggested to increasing the benefits of the energy harvesting system [18,19,20]. Harvesting energy from ambient vibration using piezoelectric elements is a practical interest in portable electronics, and in wireless sensor networks that demand battery-less operation, which helps to solve the interruption of an operating wearable device and reduces reliance on battery energy [12]. In recent years, research has focused on harvesting energy from the atmosphere (transforming ambient energy sources into electrical energy) to operate wearable devices rather than batteries [21]. As well as in wireless sensor networks that require a battery-free operation. Medical implants and sensors in the Internet of Things (IoT) are two major applications that will benefit significantly from energy harvesting. Many researchers have worked to develop energy harvesting-based wearable devices that can improve users’ quality of life [11, 22].

Fig. 1
figure 1

Harvesting energy from human activities

This paper uses a nature-inspired optimization algorithm that can be classified as human-behaviour inspired algorithm. Gaining–Sharing Knowledge (GSK) is based on the concept of gaining and sharing knowledge during human life.

GSK is a robust and reliable optimization algorithm and have been proved to be superior to other nature inspired algorithms [23], tackling complex optimization problems with better performance than other state of the art algorithms. The algorithm has been applied in several optimization problems as feature selection [24,25,26], scheduling problems [27,28,29], maximal covering model [30], parameter extraction of photo voltaic models [31] and combinatorial optimization problems as knapsack [25], travelling salesman problem [32], travelling advisor problem [33] and transportation problem [34].

The purpose towards adopting an efficient task scheduling technique as the main objective of our work is to guarantee the continuous and efficient functionality of the sensors within a simple medical wearable device based on the energy harvesting technology.

The main contributions of this work can be listed as follows:

  • Proposing a task scheduling algorithm based on GSK which is used for the first time for wearable medical devices that optimizes energy management (minimize the energy consumption and maximize the energy throughout) for wearable medical devices.

  • The experiments demonstrated that the proposed GSK algorithm outperforms the state-of-the-art FPA (Flower Pollination Algorithm).

  • Studying the impact of the task scheduling on the battery lifetime for the wearable devices.

The rest of this paper is organized as follows. The literature review is presented in Sect. 2, the system description and data profiling are illustrated in Sect. 3 and the details of problem formulation and optimization algorithm GSK are in Sect. 4, the results are discussed in Sect. 5, and conclusion is in Sect. 6.

Related work

This section reviews previous related work on managing and optimizing energy throughout energy harvesting-based wearable devices. Previous research considers task scheduling algorithms for wearable technology based on energy harvesting. The power consumption of the sensor nodes varies with the voltage and frequency. As a result, changing both the operating frequency and the supplied voltage is feasible to optimize the amount of power used and minimize the power consumption. The energy consumption can be reduced while considering the performance limits using the idea of dynamic voltage and frequency scaling (DVFS). The goal of DVFS is to maximize the performance given the limited energy budget or to minimize the energy consumption [35, 36].

The authors of [37] suggested an energy-aware DVFS (EA-DVFS) algorithm that slows task processing based on the available as well as predicted harvested energy. Tasks are executed at high speed if there is sufficient energy available otherwise, they are slowed down. The main drawbacks of this work are, the “sufficient available energy” is determined based on a single current task. The remaining time operation of the system at the full speed is more than the relative deadline of the task, then the system considers it has sufficient energy. However, there might be only 1% energy left in the energy storage while the system can operate at maximum speed for a task without depleting the energy. As a result, the EA-DVFS algorithm schedules the task at maximum speed. A behavior like that is not desired. The EA-DVFS algorithm takes only one task into consideration when the program is scheduled and the operating voltage is selected, instead of considering all tasks. Due to this, task slacks are not fully exploited to save energy. This is critical for achieving higher performance while avoiding any interruptions in the operation of the device. To further improve system performance and energy efficiency, our work propose a task scheduling algorithm based on GSK that optimizes energy management (minimize the energy consumption and maximize the energy throughout) for wearable medical devices.

In [38] they presented a literature survey on different task scheduling algorithms for energy harvesting-based sensors (i.e., energy positive sensors) to achieve the sustainable operation of IoT operation. Also, they presented a comprehensive analysis for developing new task scheduling algorithms that incorporate this new class of sensors. Due to the resource constraints of the hardware, DVFS algorithms may not be acceptable for task scheduling on energy harvesting-based battery-less sensors; they may not provide a range of voltage levels to execute tasks on the sensor node.

In [39], the authors focused on enhancing the short-term performance of energy harvesting-based communication systems as time scheduling, and power allocation optimizations are required in such systems. In [40], a task scheduling technique using DVFS was developed to optimize rechargeable sensor nodes. These tasks are queued according to their deadlines. Task execution relies on the available energy, the task can be completed if the current energy is greater than a threshold; else, the task will be delayed. In [41], task decomposition and combining algorithm was presented to reduce the energy consumption of sensor node and can be split into two sub-tasks: sensing and data transmission. The two transmission sub-tasks can be combined by grouping the data from these sub-tasks and transmitting them in a single data packet to reduce energy consumption. Also, they evaluated their task scheduling algorithm, where the results showed that their method completed more tasks with fewer missed deadlines than previous algorithms that did not use the decomposing/combining algorithm for energy-intensive tasks. In [42], a mathematical model for duty cycling sensor nodes based on harvested energy is described where it maximizes the system performance by adapting the dynamics of the energy source during operation by employing the exponentially weighted moving average scheme to predict future harvested energy, which is then used to compute a nodes’ duty cycle. The limitation of the minimally adaptive duty-cycling mechanism was overcome by incorporating a new technique that ensures duty cycle stability without the need for prior knowledge of the incoming energy [43]. Authors in [44] presented a framework for energy management in energy harvesting embedded systems. Using energy harvesters for both simultaneous sensing and energy harvesting enables energy-positive sensing, which is an increasingly prominent class of sensors. Harvesting more energy than is required for context detection, and the extra energy can be used to power other system components [45]. All Previous researchers used task scheduling for energy harvesting in different methods not in wearable medical devices and meta-heuristics.

A prior study [46] proposing sensors task scheduling for the first time in the energy harvesting-based wearable medical devices. Flower Pollination Algorithm (FPA) was employed in this scheme. FPA is a nature-inspired metaheuristic algorithms used to solve optimization problems. In our work, we used a nature-inspired optimization algorithm GSK, that can be classified as human-behaviour inspired algorithm. GSK is based on the concept of gaining and sharing knowledge during human life [23]. We proposed a task scheduling algorithm based on GSK for the first time in wearable medical devices to enhance the energy managements (minimize the energy consumption and maximize the energy throughout).

The experiments showed that the proposed GSK algorithm outperforms the state-of-the-art FPA in terms of energy management, and computation time as discussed in Sect. 5.

System description

System overview

This section describes the in-lab wearable medical system that will be used in this research study for investigating the optimization approach. Afterwards, the data profiling will be elaborated for further usage during the problem formulation. The functionality of our energy harvesting-based wearable system is the continuous monitoring via a heart rate sensor [47] and a temperature sensor [48]. So, the medical wearable device is ought to contain a micro-controller [49] to be connected to the two adopted sensors. The basic energy harvesting-based wearable device should also contain a piezoelectric harvester, a bridge rectifier, and supercapacitor. The main components that involves in our problem formulation are the two sensors and the supercapacitor. The supercapacitor acts as the energy reservoir of the wearable device and our vision in this study is to optimize the energy consumption so that the voltage stored in it is maximized. Figure 2 illustrate the adopted hardware system upon which we will construct our data-set.

Fig. 2
figure 2

Hardware diagram of wearable medical device

The piezoelectric energy harvesters are great means of powering self-sustaining electronic devices [50]. The usage of the piezoelectric elements is to harvest energy from ambient vibration and convert energy from ambient to electricity to power the wearable device. Afterward, the electrical energy is passes through a bridge rectifier and a supercapacitor. The supercapacitor is capable of storing a large amount of electrical charge than normal capacitor. In other words, it has a substantially larger capacitance value than regular capacitors. This allows the supercapacitor to store energy for a longer period of time. A micro-controller is essential for wearable technology to function, which is act as small computer (system on chip) to keep wearable device in small size [51].

Data profiling

The energy consumption of the components within the wearable device can affect the neutral operation, thus, it is necessary to reduce total energy consumption [52]. Therefore, the main goal of this work is to maximize the stored energy in the supercapacitor by reducing the overall energy consumption. The amount of the energy consumed varies according to the change in current/voltage passing through the supercapacitor. The consumption of energy is affected by a nonlinear load such as the sensors. The task scheduling technique of this study aims to manage the activity of the two adopted sensors. Accordingly, we need to represent the activity of the sensors to be used during the problem formulation. We refer to the status of two sensors either ON or OFF by representing this in an integer number from 0 to 3. This representation is considered a compact form of the original binary representation (e.g. ON (1) or OFF (0)). In this study, the Least Significant Bit (LSB) indicates the state of the temperature sensor and the Most Significant Bit (MSB) indicates the state of the heart rate sensor. The mapping from decimal to binary can be easily done, for example, the states combination represented in decimal as 2 is equal to \((1 \,0)\) in binary which implies that temperature sensor is OFF while the heart rate sensor is ON. The combination profiling is considered very crucial as the final desired task schedule is supposed to be set of these combinations.

Table 1 depicts a representative sample of the generated dataset, which is measured from the datasheets.

where, \(Volt\_level\) refer to the voltage across the supercapacitor, combination column refers to the status of two sensors ON/OFF which was elaborated earlier and \(\Delta V\) is the result value of voltage drop.

In first scenario we have four states as we use two sensors, the all possible probabilities for working temperature sensor and heart rate sensor respectively as follow:

  • When both sensors are off \((0 \ 0)\) the combination equal to 0.

  • When temperature sensor is ON and Heart rate sensor is OFF \((0 \ 1)\) the combination equal to 1.

  • When temperature is OFF and Heart rate sensor is ON \((1 \ 0)\) the combination equal to 2.

  • When both sensors are ON \((1 \ 1)\) the combination equal to 3.

Table 1 Sample from generated data-set

As an extension for the proposed algorithm, two sensors have been added. The new dataset for the two added sensors has been generated and measured from the datasheets.

As a result, we also should demonstrate the action of the sensors that will be used throughout the problem formulation. We correspond to the status of four sensors, either ON or OFF, using an integer number ranging from 0 to 15. This depiction is thought to be a version of the binary representation (e.g., ON (1) or OFF (0)). When the sensor is turned on, the binary value of its representation is 1, and when the sensor is turned off, the binary value of its representation bit is 0.

In the second scenario, we have four sensors as the following order:

  1. 1.

    Temperature sensor (T)

  2. 2.

    Heart rate sensor (H)

  3. 3.

    Glucose sensor (G)

  4. 4.

    Communication module (C)

The LSB refers to the state of the temperature sensor, the second bit refers to the state of the heart rate sensor, the third bit refers to the state of the Glucose sensor, and MSB tends to the communication module state. The conversion of decimal values to four binary bit representation is obtained as follows:

$$\begin{aligned} Y=\{y_0,y_1,y_2,y_3,\ldots ,y_{15}\} \end{aligned}$$
(1)

where Y is the obtained best schedule from optimization algorithm, \(\{ y_0, y_1,\ldots ,y_{15}\}\) are the states of the sensors at time slots \(\{0,1,\ldots ,15\}\). For example at \({y_{10}}\) in decimal representation is equal to \((1010)_{\textrm{bin}}\) in binary representation which indicates that the Temperature sensor (LSB) is ON, second bit/next bit refer to Heart rate sensor is OFF, third bit/next bit refer to Glucose sensor is ON, and MSB refer to the communication module is OFF as shown in Table 2. The combination is thought to be crucial because the final desired task schedule is supposed to be set up of these combinations.

Table 2 All possible combination in case of using four sensors

Task scheduling approach

Problem formulation

In this part, the problem formulation is introduced to handle the energy consumption throughout the wearable device. Once the problem is formulated including the objective function, the adopted GSK algorithm will be applied to it to achieve the desired solution or the schedule. However, before proceeding in the objective function formulation, we need to get more familiar with the expected solution. The suggested algorithm tends to generate an optimal schedule for operating the temperature and heart rate sensors to save power without considering the devices’ functional constraints.

In this study, we recognize the task schedule of our wearable medical device in decimal representation and the operation duration is divided into a number of time slots \(N_{\textrm{slot}}\). The desired task schedule X is anticipated to be a series of combinations along the defined number of time slots in case of two sensors as follows:

$$\begin{aligned}{} & {} X=\{x_{1},x_{2},\dots ,x_{N_{\textrm{slot}}}\} \end{aligned}$$
(2)
$$\begin{aligned}{} & {} x_i \in {\{ 0,1,2,3\}}_{\textrm{dec}} \end{aligned}$$
(3)

where i refers to number of time slot and \(x_i\) refers to the sensors status at time slot i.

In the case of using four sensors, the task schedule is in decimal representation, and the operation duration is split into a number of time slots \(N_{\textrm{tslot}}\). The optimum task schedule (solution) X is expected to be a sequence of combinations along the defined number of time slots \(N_{\textrm{tslot}}\), as follows:

$$\begin{aligned}{} & {} X=\{x_{1},x_{2},\dots ,x_{N_{\textrm{slot}}}\} \end{aligned}$$
(4)
$$\begin{aligned}{} & {} x_n \in {\{ 0,1,2,\dots ,15\}}_{\textrm{dec}} \end{aligned}$$
(5)
$$\begin{aligned}{} & {} x_n \in {\{ 0000,0001,0010,\dots ,1111\}}_{\textrm{bin}} \end{aligned}$$
(6)

where n corresponds to the number of time slot and \(x_n\) corresponds to the sensors’ status at time slot n.

Objective function

The main objective of our study is to maximize the energy throughout the energy harvesting-based medical wearable device. This is done in this research by applying GSK optimization algorithm to find best schedule X that leads to energy maximization. The objective function is described as follows:

$$\begin{aligned} f(X)= V_{f}(X) \end{aligned}$$
(7)

where \(V_f(X)\) refers to the final voltage across the supercapacitor which can be calculated according to the generated data-set by defining an initial voltage and attaining the voltage drop across the supercapacitor at the end of each time slot due to the operated combination. As per our goal of maximizing energy, we should ensure that the final voltage across the supercapacitor \(V_{final}\) is also maximized and the optimum solution is:

$$\begin{aligned} {\hat{X}} = \mathop {\textrm{argmax}}\limits _{\forall X} (f(X)) \end{aligned}$$
(8)

where \({\hat{X}}\) is the optimum schedule.

Gaining–sharing knowledge algorithm

The basic version of GSK was released in [23]. GSK is a nature-inspired algorithm that is based on human social behavior. GSK comprises two major stages: junior stage and senior stage for gaining and sharing the knowledge. Everybody gains knowledge and then shares it back with their own perspectives with other individuals. In the initial phase, humans gain from their small social network, which includes members of their families, relatives, neighbors, and so on. Afterwards, people share their newly acquired knowledge with others. Using the same notion for human with middle or large ages, they gain their knowledge from wide area network such as social media, and coworkers, and then, share their knowledge with others. GSK algorithm has several steps shown in Fig. 3 and explained as follows:

  1. 1.

    To initiate the optimization procedure, it begins with the initialization of the population (solution) which is randomly generated considering constraints as follows:

    $$\begin{aligned} x_{i}=\hbox {LB}+\hbox {rand} \left( {\hbox {UB}-\hbox {LB} }\right) \end{aligned}$$
    (9)

    where i is the number of the individual in the population, x represents the decision variables, rand refers to a random number from \([0 -1]\), UB represents the upper bound of the decision variable and LB is the lower bound of the decision variable.

  2. 2.

    Calculate the dimensions of the juniors and seniors individuals in each stage using:

    $$\begin{aligned} {D}_{J}=&D*{(({G}_{\max }-G)/{G}_{\max })}^{k} \end{aligned}$$
    (10)

    where \(D_{J}\) denotes the number of dimensions of junior phase and D is the total number of dimensions, \({G}_{\max }\) and G are the maximum number of function evaluations and the number of function evaluations consumed by the algorithm respectively, k is a positive number that determines the rate at which the person moves from junior stage to senior stage. Note that \(D_{J}\) is calculated for each person, due to each person has a different rate k value. The dimension for senior stage is calculated as:

    $$\begin{aligned} D_{S} = D - D_{J} \end{aligned}$$
    (11)
  3. 3.

    Junior phase: individuals gain from their small social network and then share their knowledge with others. Individuals are sorted in ascending order regards to their objective function values. For each individual in the population \(x_{i}\) \((i = 1, 2,\ldots , N \! P)\), the nearest best neighbor (\(x_{i-1}\)) and the worst neighbor (\(x_{i+1}\)) is chosen for gaining knowledge, as well randomly selecting \((x_r)\) for knowledge sharing then updating the individual using the following at \(f(x_{i}) > f(x_{r})\):

    $$\begin{aligned} x_{i} = x_{i} + k_{f} *(x_{i-1}-x_{i+1})+(x_{r}-x_{i}) \end{aligned}$$
    (12)

    Else, at \(f(x_{i}) < f(x_{r})\):

    $$\begin{aligned} x_{i}= x_{i} + k_{f} *(x_{i-1}-x_{i+1})+(x_{i}-x_{r}) \end{aligned}$$
    (13)
  4. 4.

    Senior phase: Individuals could be updated in the following ways: There are three types of candidates in the population, (best people, middle people, and worse people) The ratio of best class and worst class is calculated by a factor p, after sorting all individuals in ascending order based on their objective function values. Each individual is updated according to the following at \(f(x_{i}) > f(x_{m})\):

    $$\begin{aligned} x_{i} = x_{i} + k_{f} *(x_{p-b}-x_{p-w})+(x_{m}-x_{i}) \end{aligned}$$
    (14)

    Else, at \(f(x_{i}) < f(x_{m})\):

    $$\begin{aligned} x_{i} = x_{i} + k_{f} *(x_{p-b}-x_{p-w})+(x_{i}-x_{m}) \end{aligned}$$
    (15)
Fig. 3
figure 3

Flow chart of the GSK [23]

The mathematical description of the aforementioned concept of gaining–sharing knowledge is presented. Let \(x_i,i=1,2,3,\ldots ,N\) denote the individuals of a specific population, i.e., this population has N individuals, and each individual xi is defined by \(x_{i,j} = (x_{i1},x_{i2},\ldots ,x_{iD})\), where D denotes the number of fields (i.e., branches of knowledge) assigned to a person, which define the dimensions of a person, and \(fit_i,i = 1,2,\ldots ,N\) denotes their fitness values. As a result, it is evident to deduce from Fig. 4 that the main idea is that throughout the junior gaining and sharing stage, the number of dimensions of each vector that are modified by other values using the junior gaining–sharing scheme is greater than the number of updated dimensions using the senior gaining and sharing scheme, i.e. the number of updated dimensions using the junior gaining and sharing rule is greater than the number of updated dimensions using the senior gaining and sharing scheme.

Fig. 4
figure 4

Descriptions for junior and senior Gaining–Sharing Knowledge stages

As a result, for each vector at the start of the search, the desired number of dimensions that will be changed (using junior scheme) and the other number of dimensions that will be updated (using senior scheme) during generations must be determined. The number of dimensions D is calculated using the non-linear decreasing and increasing formula based on the fundamental concept of gaining–sharing knowledge. It’s important to note that the number of dimensions that will be updated using the junior scheme will decrease over time, while the number of dimensions that will be updated using the senior scheme will increase as follows:

$$\begin{aligned} D_{J}= S_{\textrm{problem}} \times \left( 1 - \frac{G}{G_{\max }}\right) ^k \end{aligned}$$
(16)

where \(S_{\textrm{problem}}\) is the problem size and k is knowledge rate which is integer number and controls the experience rate for each individual through generations, G is generation number and \(G_{\max }\) is the maximum number of generations:

$$\begin{aligned} D_{S}=S_{\textrm{problem}}- D_{J} \end{aligned}$$
(17)

The number of gained and shared dimensions for each vector using both schemes will be defined during the initialization phase.

Results

In this paper, several experiments are conducted to generate efficient task schedules in two scenarios with two different datasets (two sensors and four sensors) based on the GSK algorithm and compare the results with the state-of-the-art FPA-based algorithm. In the optimal case for two sensor: the two sensors are desired to operate periodically once every two time slots to ensure continuous monitoring. For testing the GSK algorithm, we adopt the following parameter settings: 100 iterations, and the initial voltage across the supercapacitor \(V = 3.3 \, \hbox {V}\). By applying the GSK algorithm on the objective function for \(N_{\textrm{slots}} = 10\) time slots using the mentioned settings, the best achieved schedule is found to be \({\{3,0,3,0,3,2,3,1,0,1\}}_{\textrm{dec}}\) which is equivalent to \({\{11,00,11,00,11,10,11,01,00,01\}}\) in its binary representation. For more elaboration, the schedule is better off being represented in terms of sensor status (ON or OFF) as shown in Table 3. By looking at the schedule, we can notice that it is very close to the optimal solution \({\{3,0,3,0,3,0,3,0,3,0\}}_{\textrm{dec}}\) as there are not many violations which implies that the GSK algorithm is indicative of producing reliable solutions.

Table 3 Scheduling generated from GSK for different time slots

In this study, we focus on managing the energy consumption; hence, the target is maximizing the supercapacitors’ stored energy. Accordingly, the effect of operating the best schedule found by the GSK algorithm versus the optimal schedule is tackled in Fig. 5, where the voltage drop across the supercapacitor is plotted versus the time slots. We can notice that till the fifth time slot, the GSK best solution achieves the optimal operation. While for the remaining time slots, the operation of the GSK task schedule differs from the optimal schedule. However, the final voltages across the supercapacitor due to both schedules are not dramatically dissimilar which gives intuition that the GSK algorithm is capable of generating efficient solutions regardless of the huge search space of the different time slots.

Fig. 5
figure 5

The voltage drop across supercapacitor generated from GSK and optimal solution

To effectively evaluate the performance of GSK algorithm, several experiments are conducted on different time slots to investigate the behavior on various search space complexities. After conducting the experiments on \(N_{\textrm{slots}} = 5, 10,15,20\), the best solutions reached by GSK algorithm are summarized in Table 4 while the resultant voltage drops are depicted in Fig. 6. During these experiments, the initial voltage across the supercapacitor and the number of iterations remain the same.

Table 4 Task schedules generated by GSK for different time slots
Fig. 6
figure 6

The voltage drop across supercapacitor due to GSK solutions on different time slots

In general, the meta-heuristics are not guarantee to approach the desired optimal solutions even with adequate search space complexity and this is noticeable from experimenting GSK algorithm on different time slots. By tackling the effect of operating the schedule of \(N_{\textrm{slots}} =5\) found in the table, it is obvious that the temperature sensor operated just one time along the slots. Despite that this solution minimizes the voltage drop across the supercapacitor as shown in the figure, however, it hinders the required functionality. On other hand, when the number of time slots increased to 10, the GSK algorithm reached more reliable solution that fit the objective function in minimizing the voltage drop across the supercapacitor while maintaining the functionality by operating the two sensors frequently.

Nevertheless, to benchmark the performance of the GSK algorithm against state-of-the-art techniques, we test it versus the FPA algorithm, which is another nature-inspired algorithm used in a prior study [46]. These testing experiments are conducted by relying on the same parameter settings adopted while evaluating GSK to fairly estimate the potentiality of both algorithms on \(N_{\textrm{slots}} = 5\), 10, 15, 20, 50, and 100. Figures 7 and 8 displays the voltage drop across the supercapacitor for GSK and FPA solutions on the different time slots for two sensors and four sensors, respectively. For the different time slots, it is obvious that the GSK algorithm generates solutions with more tendency for minimizing the voltage drop across the supercapacitor and hence, maximizes the energy more throughout the wearable device. In all the cases shown in the figures, the plots qualitatively indicate that the GSK-based task scheduler outperforms the state-of-the-art FPA algorithm. This intuitively proves the reliable performance of the GSK algorithm on search spaces with different complexities. We obviously see that discharge of the voltage across the supercapacitor is increased in the case of using four sensors. It is normal, as we use a communication module that operates near continuously to send data to each sensor. It is evident that GSK Algorithm outperforms the state-of-the-art FPA in two scenarios. Furthermore, we need to investigate the performance of GSK versus FPA in terms of functionality, not only in terms of energy maximization. Therefore, it is important to comparatively present the overall voltage drop across the supercapacitor by operating the two sensors according to both GSK and FPA schedules against the optimal schedule.

Fig. 7
figure 7

The voltage drop across the supercapacitor for best solution result from GSK and FPA for different time slots for two sensors

Fig. 8
figure 8

The voltage drop across the supercapacitor for best solution result from GSK and FPA for different time slots for four sensors

Fig. 9
figure 9

The final voltage across the supercapacitor comparison between GSK, FPA, and optimal solution for different time slots in case of using two sensors

Figure 9 is constructed to show the final voltage across the supercapacitor in the cases of optimal, GSK, and FPA solutions for two sensors. By looking at this bar chart, it is noticeable that the GSK algorithm approaches the optimum solution with minimal voltage drop along nearly all the search space complexities (i.e., different time of slots). Figure 10 shows the final voltage across the supercapacitor in case of using four sensors, in the cases of optimal, GSK, and FPA solutions at different time slots.

Fig. 10
figure 10

The final voltage across the supercapacitor comparison between GSK, FPA, and optimal solution in case of using four sensors

It is also shown that the efficiency of the GSK algorithm becomes more considerable as the number of slots increases while that of FPA algorithm is reduced further away from optimality. To quantitatively present the comparative results between GSK and FPA, Tables 5 and 6 are constructed to show the final voltage across the supercapacitor due to GSK solution versus FPA solutions and the enhancement ratio of the GSK over FPA for two scenarios (two sensors and four sensors). In case of two sensor, by considering the initial voltage equal to 3.3 V. At \(N_{\textrm{slots}} =5\), the voltage drop approximately 0.0005 V for GSK in case of using two sensor, while in case of four sensors the voltage drop equal 0.036 V and 0.01 V for FPA in first scenario and equal 0.042 V for second scenario. While at \(N_{\textrm{slots}} = 20\), the voltage drop is approximately 0.015 V for the GSK and 0.037 V for the FPA, at \(N_{slots} = 50\) the voltage drop is approximately 0.04 V for the GSK and 0.066 V for the FPA.

And at \(N_{\textrm{slots}} = 100\) the voltage drop is approximately 0.117 V for the GSK and 0.158 V for the FPA. It is normal that the voltage drop increases as the value of \(N_{\textrm{slots}}\) increases.However, the solutions or task schedules generated by GSK algorithm achieves our goal of optimizing energy consumption throughout managing the activities of the sensors in two scenarios (two sensors and four sensors) by maximizing the energy stored in the supercapacitor. The last column of the table shows the improvement in minimizing the voltage drop done by the solutions of GSK algorithm along the different time slots.

Table 5 Performance of GSK against FPA for different time slots in case of using two sensors
Table 6 Performance of GSK against FPA for different time slots in case of using four sensors
Table 7 The computation time for GSK versus FPA for all time slots for two sensors
Table 8 The computation time for GSK versus FPA for all time slots for four sensors

To experimentally display the computation time for GSK and FPA, Tables 7 and 8 are created to compare the computation time between GSK and FPA for two cases of using two and four sensors. We are obvious that GSK outperforms FPA in terms of computation time.

In the context of energy saving, the solution that results in the highest final voltage across the supercapacitor is expected to be the best, which is happening in the case of using the GSK Algorithm. The results of the two scenarios show that the proposed GSK algorithm outperforms the state-of-the-art FPA algorithm in terms of energy management and computation time. In other words, using GSK as an optimum task scheduling technique for the energy in wearable medical devices based on the energy harvesting technology shows potential for further work.

Conclusion

Wearable medical devices have limited power. Thus, energy harvesting is a desirable energy source for wearable medical devices to prevent their operation from disturbance. In this paper, we produce a task scheduling technique for managing the activity of sensors within energy harvesting-based wearable medical devices. In this study, two scenarios are applied. the first one, temperature sensor and a heart rate sensor are both used. the second scenario, temperature sensor, heartrate sensor, glucose sensor, and communication module are used. By formulating the problem, we aim to optimize the energy consumption throughout the device by applying a new optimization technique, the GSK algorithm. The GSK has evidenced its ability to handle various optimization challenges, and its performance is much better than the state-of-the-art FPA for both scenarios in terms of energy managements (minimize the energy consumption and maximize the energy throughout) and computation time. The results demonstrate that task scheduling can be enhanced even more in future research using various optimization techniques and more sensors.