Abstract
Sensors are the main components in Cyber-Physical Systems (CPS), which transmit large amounts of physical values and big data to computing platforms for processing. On the other hand, the embedded processors (as edge devices in fog computing) spend most of their time reading the sensor signals as compared with computing time. The impact of sensors on the performance of fog computing is very great, thus, the enhancement of the reading time of sensors will positively affect the performance of fog computing, and solves the CPS challenges such as delay, timed precision, temporal behavior, energy, and cost. In this paper, we propose an algorithm based on the 1st derivative of the sensor signal to generate an adaptive sampling frequency. The proposed algorithm uses an adaptive frequency to capture the sudden and rapid change in sensor signal in the steady state. Finally, we realize and tested it using the Ptolemy II Modeling Environment.
1 Introduction
Today's technology refers to the deep relation between the physical and computing worlds, the two worlds integrated and connected through sensors and actuators. This integration has appeared in several forms, such as the Internet of things (IoT), industrial 4.0, the Industrial Internet, machine-to-machine (M2M), Internet of Everything, the Smarter Planet, TSensors (Trillion Sensors), and The Fog computing environment. All previous systems are Cyber-Physical Systems (CPS) which are an integration of computation with physical processes [1, 2]. CPS systems face challenges like complex structure, poorly defined safety properties, interaction with complex and stochastic environments that are difficult to model, and the interactions between the system and environment exposed to failure [3, 4]. The interaction between physical processes and devices (embedded processors) in a Fog computing environment is influenced by the sampling rate, delays, jitters, packet losses, and resource contention. The sampling rate, delays, and time requirements are the main constraints in CPS systems, and they are traded off with other parameters like power saving and performance. The time requirements in CPS systems are determined by the following constraints: frequency, chronological order, simultaneity, latency, and temporal assurance or time predictive, which are related to safety and reliability [5–7].
The stochastic physical environments behave in a non-known manner, which is difficult to predict. In a Fog computing environment, the execution within the worst case time (WCET) or achieving the Nyquist condition in the sampling process (
This paper focuses on the sensor signal, which passes through two states in general, the transient state (1) which is the sensor output that goes from the initial value (zero) to the system's working value, and the steady state (2), where the system works at its systematic values. Figure 1 shows the supposed states of the signal
As mentioned above, the sampling rate must be able to capture and predict the temporal behavior of sensors at the system edge, on the other hand, processor utilization, performance, and energy saving are important design issues, especially when the processor implements more than one function. To achieve these issues, an adaptive sampling rate is taken into account in this paper. A higher sampling rate gives higher accuracy and better response time, and a lower sampling rate only saves processor time without reducing the noise and jitter.
No fixed sampling frequency for all applications, a good frequency is one that combines experiment and mathematical analysis of the sensor signal. There are several systematic approaches to determining the sampling frequency, the characteristics of the sensor used in the application, the noise, and the highest and lowest sampling rate of the processor [11].
On the other hand, the sampled time varies depending on some parameters, including processor performance and utilization, processor energy, signal behavior, Nyquist condition, WCET and other issues depending on the application.
To optimally use the embedded processor and improve its performance, we proposed an adaptive sampling algorithm based on the first derivative of the sensor signal, to capture the sudden changes of the signal in a steady state.
The main contributions of the paper are listed as follows:
The paper proposes a lightweight adaptive sampling algorithm for IoT devices (embedded processors) in CPS systems.
The proposed algorithm is based on the first derivative of the sensor signal, which can capture the sudden changes of the signal in early time.
The proposed algorithm enhances processor utilization and performance in the CPS system.
The paper presents a mathematical model of the sampling frequency, which can be enhanced in future works depending on the application.
The rest of this paper is organized as follows. Section 2 illustrates some important related works. In Section 3, the proposed adaptive sampling algorithm is presented. The simulation results and discussion are illustrated in Section 4. The conclusion is presented in Section 5.
2 Related works
In the following, we summarize some studies that presented different ideas for obtaining an adaptive sampling rate.
Rieger and Taylor propose a low-power analog system, which adjusts the converter clock rate to perform a peak-picking algorithm on the second derivative of the input signal, and establish Adaptive sampling as a practical method to reduce the sample data volume [12]. Feng et al. exploit a strong correlation of radar echo pulses to introduce a compressive sampling (CS) method to implement analog-to-information conversion (AIC) for sub-Nyquist radar target detection [13]. Qaisar et al. use an adaptive rate ADC which is based on the Cross-Level Sampling Scheme (LCSS), which can adapt its conversion activity according to the input signal local variations [14]. Mishali and Eldar propose a modulated wideband converter, which multiplies the analog signal by a bank of periodic waveforms, and the product is low-pass filtered and sampled uniformly at a low rate [15]. Jaraczewski et al. discuss the methods of measuring electrical quantities by devices with low computational efficiency and a low sampling frequency up to 1 kHz. The main advantage of this new method is that it achieves a balance between processing power and accuracy in calculating the most important electrical signal indicators (such as power, RMS, and THD) [16]. Koutsoubelias et al. propose a protocol based on the Kalman filter following the dynamic changes in the sensor data generation rate [17]. Homjakovs proposed an adaptive sampling approach in which analog signal samples are taken depending on their activity [18]. Alexandru and Dragotti investigate the problem of timing-based sampling of non-bandlimited signals within the Finite Rate of Innovation (FRI) setting and show how it can nonuniformly sample these signals using a compact-support kernel that satisfies the generalized Strang-Fix conditions [19]. Bhandari et al. introduce the concept of “Unlimited Sampling”, and in addition to [15] they use Self-Reset ADCs (SR-ADCs), which allow for sensing modulo samples [20]. Liu and Feng introduced an adaptive dead band-triggered communication scheme for sampled-data systems [21].
Tadokoro et al. propose two adaptive frequency estimation methods using variable sampling processing. One of them is a synchronous addition and subtraction method and the other is a notch filter method [22]. Wang and Wan present a group of local time domain theorems for sampling differentiable continuous analog signals through Lagrange interpolation and show how to use them for adaptive control of the sampling rate [23]. Petkovski et al. explore Chaikin's algorithm for the generation of arbitrary curves to reconstruct non-uniformly sampled signals. The sampling is adapted to the signal shape [24]. Li et al. present a technique for adaptive ocean sampling based on a maximum differential algorithm (MDA) using ocean sampling platforms equipped with multiple sensors [25]. Czaczkowska et al. propose adaptive nonuniform sampling algorithms [26]. Fox et al. introduces and investigates signal reconstruction algorithms that are given MSVR sampling conditions for vehicular CPS applications [27].
Corso et al. in [3] summered importance sampling algorithms for estimating the probability of failure in the CPS system, including the cross-entropy method, multilevel splitting, classification-based importance sampling, and state-dependent importance sampling. Termehchi and Rasti in [5] used self-triggered methods to determine the next maximum acceptable sampling moment and to allocate resources in the network subsystem, aiming to minimize power consumption in the industrial CPS. Jazayeri et al. in [7] used Deep Reinforcement Learning (DRL) algorithm to find the fast response and improve the network delay as well as reducing the energy consumption in the mobile, Fog Devices and Cloud. Ghobaei-Arani et al. in [28] presented a task scheduling algorithm based on moth-flame optimization algorithm to assign an optimal set of tasks to fog nodes to meet the satisfaction of quality of service requirements of CPS applications in such a way that the total execution time of tasks is minimized. Shahidinejad et al. in [29] proposed a lightweight authentication protocol for IoT devices using a three-layer scheme, Including IoT device layer, trust center at the edge layer, and cloud service providers.
In [30], the authors proposed an Adaptive Stochastic Gradient Descent Algorithm to evaluate the risk of fetal abnormality, the findings of this work suggest that proposed innovative method can successfully classify the anomalies linked with nuchal translucency thickening. In [2], the authors proposed an AI-enabled IoT-CPS Algorithm which doctors can utilise to discover diseases in patients based on AI. The experimental results demonstrate that the proposed algorithm is more efficiently compared with existing algorithms. In [31], a decentralized OFSD control strategy was proposed, to handle the global output feedback sampled-data (OFSD) control problem for cyber-physical systems (CPSs) described by nonstrict-feedback large-scale nonlinear systems with denial-of-service attacks. The authors in [32] presented an effective micro-genetic algorithm in order to choose suitable destinations between physical hosts for VMs. The researcher in [4] proposed a new routing protocol with the cluster structure for IoT networks using blockchain-based architecture for software-defined networking (SDN) controller.
3 Proposed adaptive sampling algorithm
We design a proposed algorithm in several stages, starting with analyzing the sensor signal, then calculating the sampling frequency corresponding to the signal changes, and finally the algorithm formulation.
3.1 Analytic study of a sensor signal
Let
As we show in Fig. 2a, the second-order change is a sequence of two first-order changes, so any order of change is a combination of a set of first-order changes. The changing rate might be slow (slow rate) and might be fast rate. Also, it is associated with the change of horizon angle as shown in Fig. 2b. The value of the angle is associated with the speed of change, as the changing rate is faster as the angle is larger, and vice versa. Therefore, determining the angle will help to determine the sampling frequency. To capture all signal changes, the sampling rate must be increasing with signal frequency.
Based on the above, we propose a
The curve of signal changes slowly in the region where
3.2 Calculation of the parameter
3.3 Calculation of the sampling frequency
In state2, the sampling frequency increases in a nonlinear manner from
3.4 Algorithm realization
The proposed algorithm consist of four steps, step 1 initializing the data, step 2 reading the frequency
The time complexity of the proposed algorithm on general constant O(1) for one calculation cycle, because the used statement is “If-then-else". The time complexity for the life cycle of the sensor signal is linear O(n) depending on the sampled frequency
4 Simulation and results
The algorithm was implemented and tested as a hybrid model using Ptolemy II (Version 11.0.1_20180619) [34], which is a Java-based software that studies modeling, simulation, and design of concurrent, real-time, embedded systems. It focuses on assembly of concurrent components and uses well-defined models of computation that govern the interactions between components. A major problem area being addressed is the use of heterogeneous mixtures of models of computation. The Ptolemy project includes a number of support packages, such as graph, providing graph-theoretic manipulations, math, providing matrix and vector math and signal processing functions, plot, and providing visual display of data. Also, it has C Code generator and can generate code for some models. It is suitable for designing and testing various types of models and algorithms.
The computer that runs the Ptolemy program has the following resources (CPU: Intel(R) Core(TM) i5-4300U CPU @ 1.90 GHz 2.50 GHz, RAM: 4.00 GB, GPU: GeForce GT 720M). The proposed embedded processor is ATmega328, which works at clock frequency 16 MHz. ATmega328 is a microcontroller with multi-uses, it is used in small and medium applications and the results it gives can be applied to other embedded processors, it provides a
Figure 9 shows the components used to execute the algorithm. The first component is used to generate sampling frequency
4.1 Simulation
The algorithm has been tested and the result is shown in Figs 10 and 11. In Fig. 10, the signal we applied is still stable until
Figure 10D shows the sampling density, it is clear that the density of samples increases with sampling frequency. Another test is shown in Fig. 11, where the sampling frequency increases and crosses
From the results, it is clear that the increasing sampling frequency when the signal begins in change, is the same as the sampling rate. Also, the linear relation between
Finally, and from the previous results, we can conclude the relationship between sampling frequency and the slope of the signal (the angle
5 Conclusions
In Cyber-Physical Systems, neither the worst-case time nor achieving the Nyquist condition in the sampling process are the main goals. The most important thing is the ability to predict the time and the temporal behavior of the system variables, which is the basic requirement for embedded processors or Precision Timed (PRET) Machines in CPS. The sensors are the main source of non-estimated temporal behavior, and with these Trillion Sensors, the matter becomes more complicated.
To improve the CPS's performance, the usability of computing platforms and a good estimate of time are required. An adaptive sampling algorithm for cyber-physical system (embedded processors) has been proposed in this paper, where the sampling frequency is based on the 1st derivative of the sensor signal. The results showed how sampling frequency
The proposed algorithm has many applications in the real world, like monitoring human health, especially in those who suffer from diseases such as heart, blood pressure, and diabetes, and need permanent monitoring. Also in electrical networks, monitoring cooling water in nuclear plants, remote childcaree, mentoring oxygen pressure in hospitals, monitoring the temperature and pressure during chemical reactions, and other precision industrial applications. In all previous applications, the physical quantities are constant during normal operation, except in some cases a sudden change happens. These kinds of application need a lightweight adaptive algorithm with a little overhead, like the proposed algorithm that can capture these sudden changes.
References
- [1]↑
E. Lee and S. Seshia, Introduction to Embedded Systems - A Cyber-Physical Systems Approach, 2nd ed. MIT Press, 2017.
- [2]↑
L. Ramasamy, F. Khan, M. Shah, B. V. V. S. Prasad, C. Iwendi, and C. Biamba, Secure Smart Wearable Computing through Artificial Intelligence-Enabled Internet of Things and Cyber-Physical Systems for Health Monitoring. MDPI/sensors, 2022.
- [3]↑
A. Corso, R. Moss, M. Koren, R. Lee, and M. Kochenderfer, “A survey of algorithms for black-box safety validation of cyber-physical systems,” J. Artif. Intell. Res., vol. 72, pp. 377–428, 2021.
- [4]↑
S. A. Latif, F. Wen, C. Iwendi, and F. Li-Li, “AI-empowered, blockchain and SDN integrated security architecture for IoT network of cyber physical systems,” Elsevier, vol. 181, pp. 274–283, 2022.
- [5]↑
A. Termehchi and M. Rasti, Joint Sampling Time and Resource Allocation for Power-Efficiency in Industrial Cyber Physical Systems. IEEE, 2020.
- [6]
F. Farahbakhsh, A. Shahidinejad, and M. Ghobaei‐Arani, Mulituser Context-Aware Computation Offloading in Mobile Edge Computing Based on Bayesian Learning Automata. Wiley, 2020.
- [7]↑
F. Jazayeri, A. Shahidinejad, and M. Ghobaei-Arani, Autonomous Computation Offloading and Auto-Scaling the in the Mobile Fog Computing: A Deep Reinforcement Learning-Based Approach. Springer, 2020.
- [8]↑
A. Shrivastava, P. Derler, Y. Baboud, K. Stanton, M. Khayatian, H. Andrade, M. Weiss, J. Eidson, and S. Chandhoke, Time in Cyber-Physical Systems. Berkeley: University of California, 2016.
- [9]
E. Lee and S. Edwards, Precision Timed (PRET) Computation in CyberPhysical Systems; High Confidence Software Platforms for Cyber-Physical Systems, 2007.
- [10]
P. Marwedel, Embedded Systems/Foundations of Cyber-Physical Systems, and the Internet of Things, 3d ed. Springer, 2018.
- [12]↑
R. Rieger and J. Taylor, An Adaptive Sampling System for Sensor Nodes in Body Area Networks. IEEE, 2009.
- [13]↑
Q. Feng, J. Huang, S. Liang, and L. Kang, A pulse Repetition Rate Compressive Sampler for Radar Target Detection. IEEE Sensors Letters, 2020.
- [14]↑
S. Qaisar, R. Yahiaoui, and T. Gharbi, An Efficient Signal Acquisition with an Adaptive Rate A/D Conversion. IEEE, 2013.
- [15]↑
M. Mishali and Y. Eldar, From Theory to Practice: Sub-nyquist Sampling of Sparse Wideband Analog Signals. IEEE, 2010.
- [16]↑
M. Jaraczewski, R. Mielnik, T. Gębarowski, and M. Sułowicz, Low-frequency Signal Sampling Method Implemented in a PLC Controller Dedicated to Applications in the Monitoring of Selected Electrical Devices. Electronics, 2021.
- [17]↑
M. Koutsoubelias, A. Argyriou, and S. Lalis, Scalable and Adaptive Polling Protocol for Concurrent Wireless Sensor Data Flows. IEEE, 2018.
- [19]↑
R. Alexandru and P. Dragotti, Time-Based Sampling and Reconstruction of Non-bandlimited Signals. IEEE, ICASSP, 2019.
- [20]↑
A. Bhandari, F. Krahmer, and R. Raskar, Unlimited Sampling of Sparse Signals. IEEE, ICASSP, 2018.
- [21]↑
Y. Liu and L. Feng, Stability Analysis and Stabilization for Sampled-Data Systems Based on Adaptive Deadband-Triggered Communication Scheme. IEEE, 2019.
- [22]↑
Y. Tadokoro, K. Noguchi, and N. Kudoh, New Adaptive Frequency Estimation Methods Using Variable Sampling Processing. IEEE, 2000.
- [23]↑
X. Wang and Y. Wan, Adaptive Analog Signal Sampling through Lagrange Interpolation. IEEE, 2017.
- [24]↑
M. Petkovski, S. Bogdanova, and M. Bogdanov, An Example of Adaptive Sampling and Reconstruction of Signals, Application of Chaikin’s Algorithm. IEEE, 2007.
- [25]↑
Q. Li, J. Gao, S. Guan, B. Zhang, and Z. Leng, The Application of Maximum Differential Algorithm in Adaptive Ocean Sampling. IEEE, 2013.
- [26]↑
J. Czaczkowska, M. Kondratiuk, and E. Pawluszewicz, Control System with Adaptive Nonuniform Sampling Switch Algorithms. IEEE, 2016.
- [27]↑
A. Fox, B. Kumar, and F. Bai, Multi-source Variable-Rate Sampled Signal Reconstructions in Vehicular CPS. IEEE, 2016.
- [28]↑
M. Ghobaei‐Arani, A. Souri, F. Safara, and M. Norouzi, An Efficient Task Scheduling Approach Using Moth-Flame Optimization Algorithm for Cyber-Physical System Applications in Fog Computing. Wiley, 2019.
- [29]↑
A. Shahidinejad, M. Ghobaei-Arani, A. Souri, M. Shojafar, and S Kumari, Light-Edge A Lightweight Authentication Protocol for IoT Devices in an Edge-Cloud Environment. IEEE, 2021.
- [30]↑
D. Verma, S. Agrawal, C. Iwendi, B. Sharma, S. Bhatia, and S. Basheer, A Novel Framework for Abnormal Risk Classification over Fetal Nuchal Translucency Using Adaptive Stochastic Gradient Descent Algorithm. MDPI/Diagnostics, 2022.
- [31]↑
S. Li, C. Ahn, and Z. Xiang, Decentralized Sampled-Data Control for Cyber-Physical Systems Subject to DoS Attacks. IEEE, 2020.
- [32]↑
M. Tarahomi, M. Izadi, and M. Ghobaei-Arani, An Efficient Power-Aware VM Allocation Mechanism in Cloud Data Centers: a Micro Genetic-Based Approach. Springer, 2020.
- [34]↑
C. Ptolemaeus, System Design, Modeling, and Simulation Using Ptolemy II. Berkeley, 2014. https://ptolemy.org/systems.
- [35]↑
M. Heymann, F. Lin, G. Meyer, and S. Resmerita, Analysis of Zeno Behaviors in a Class of Hybrid Systems, vol. 50. IEEE, 2005.