A Task Offloading Method for Smart Instruments Based on Edge Computing 1,2,3* 1,2,3 1 Yang Liu , Tianshi Zhang , Jinchao Xiao 1 Shenyang Institute of Automation, Chinese Academy of Sciences, Shenyang 110000, China; 2 Key Laboratory of Networked Control Systems, Chinese Academy of Sciences, Shenyang 110016, China; 3 Institutes for Robotics and Intelligent Manufacturing, Chinese Academy of Sciences, Shenyang 110169, China Abstract The development of edge computing technology has enabled the promotion of traditional industrial instruments to smart instruments with collaborative working capabilities. Smart instruments are widely distributed in industrial production sites and can monitor working conditions in real time. Implementing multi-instruments collaborative computing on the edge side will help improve the responsiveness of industrial systems and reduce instrument maintenance costs. This paper proposes a task offloading method for smart instruments based on edge computing. Firstly, the instrument capability is evaluated based on the characteristics of the smart instrument. Then, the task scheduling of smart instruments is optimized based on Lyapunov algorithm. Finally the simulation verification is carried out. The experimental results show that the algorithm in this paper has a significant effect on improving computing power and reducing resource occupancy. Keywords1 edge computing; smart instruments; task offloading; optimization; scheduling 1. Introduction Industrial instruments are instruments that detect, display, record or control process parameters in the process of industrial production. Industrial instruments first appeared in the 1990s and were used in continuous thermal production processes such as chemical industry, petroleum refining, thermal power and metallurgy. Therefore, It was called thermal instrument at that time [1]. Its structure is mainly mechanical or hydraulic, and the instrument is large in size, which can only realize on-site detection, recording and simple control. At the same time, industrial instruments currently require manual participation in recording readings. The disadvantages of high work intensity, high labor cost, poor immediacy, low efficiency and high error brought by manual recording can no longer meet the needs of modern industrial production and development [2]. With the development of computer technology, especially the emergence of microprocessors, it has played a revolutionary role in the development of industrial instruments, and intelligent instruments with microprocessors as the core were born; intelligent instruments are based on microprocessors as the central control. The unit can complete the functions of input and output of physical signals, signal conversion and computer control, and can communicate with the outside world. Compared with traditional industrial instruments, smart instruments have the advantages of strong development, high reliability, good performance, high precision and intelligence. Smart instruments can not only solve the problems that industrial instruments are difficult to solve or cannot solve, but also simplify the instrument circuit. The purpose of improving instrument reliability and accuracy. Therefore, smart instruments are the future development trend, but with the continuous development of the mobile Internet and the Internet of Things, there are higher timeliness and reliability requirements ISCIPT2022@7th International Conference on Computer and Information Processing Technology, August 5-7, 2022, Shenyang, China EMAIL: liuy@sia.cn (Yang Liu); zhangtianshi@sia.cn (Tianshi Zhang); Xiaojinchao@sia.cn (Jinchao Xiao) ORCID: 0000-0002-7282-6819 (Yang Liu); 0000-0001-5564-9665 (Tianshi Zhang); 0000-0002-8391-5075 (Jinchao Xiao) ©️ 2022 Copyright for this paper by its authors. Use permitted under Creative Commons License Attribution 4.0 International (CC BY 4.0). CEUR Workshop Proceedings (CEUR-WS.org) 13 for data collection, computing tasks and computing capabilities of smart instruments. On the other hand, due to the smart instruments themselves Due to limited volume, computing power, battery capacity, and storage space, it cannot handle high-energy-consuming, high-complexity computing tasks. Such tasks need to be offloaded and migrated. If part or all of the tasks are offloaded to the server in the cloud computing data center It needs to waste a lot of data flow and network burden, which will have a certain impact on some delay-sensitive services [4-5]. Therefore, the smart instruments are connected to edge computing to provide cloud computing capabilities [6] , and then offload the complex and energy- intensive tasks of the smart instrument to the server deployed at the edge of the network to localize the business of the smart instrument. This method greatly reduces the amount of data transmission and network transmission delay. The service quality of the instrument reduces the operating cost of the network[7]; although the computing tasks are offloaded to the edge server, the task computing requirements of the smart instrument can be alleviated to a certain extent, but the resources of the edge server are limited, which makes the network Insufficient flexibility, it is necessary to introduce resource allocation and task scheduling mechanisms to manage the edge network as a whole, thereby prolonging the life of the edge network. 2. Related work Intelligent instrumentation technology has penetrated into all walks of life. At present, it has been widely used in all aspects of people's production and life, and the industries involved include industry, agriculture, power industry, transportation industry, national defense, culture, education and health and many other fields. It greatly facilitates people's lives and promotes the development of the national economy. The instruments in the international market are technologically developing towards digitization, intelligence, networking and miniaturization, which can also be classified as scientific testing instruments. It is easy to form automatic test systems for different objects. It is difficult to realize networked large-scale scientific instruments. It develops in the direction of higher measurement accuracy, high reliability and environmental adaptability. The automation level of its use is continuously improved, and it generally has self-compensation, intelligent functions such as self- diagnosis and fault handling. At present, scholars at home and abroad focus on the direction of digitization, intelligence and networking. With the advent of Industry 4.0, the use of information technology to promote industrial transformation and improve the level of intelligence in the manufacturing industry will promote the transformation of human society from information technology. The era is moving towards the era of intelligence. It can be seen that the follow-up of smart instruments will continue to develop towards the level of intelligence and technology. The origin of edge computing can be traced back to the content distribution network CDN [8] proposed by Akamai in 1998. Through distributed deployment of cache servers, user access is directed to the latest server to improve service response speed. The European Telecommunications Standardization Institute ETSI proposed the concept of Mobile Edge Computing[9]. In 2016, the Edge Computing Industry Alliance (ECC) proposed the definition of edge computing: edge computing is a distributed open platform that integrates network, computing, storage, and application core capabilities at the edge of the network near the source of things or data; Different parties have differences in edge computing, but the core content is to sink computing, storage and bandwidth resources to the edge of the network, and deploy mobile edge gateways at the edge of the network; although the computing power of edge computing servers is lower than that of cloud servers, it is still Provide better QoE and lower latency for end users [10-11]. Reference [12] proposes a model architecture combining cloud computing and edge computing to reduce communication. Reference [13] aims to maximize long-term utility performance while considering reducing computing energy consumption and delay, and proposes a deep deterministic approach. A novel learning algorithm for policy gradients is proposed to address latency and performance issues. In recent years, with the explosive growth of mobile applications and data traffic, how to reasonably optimize the limited resources in the edge network to improve the overall performance is a hot research topic at present. The tasks of the terminal device can be offloaded to the edge server for processing; currently The mainstream task processing can be divided into partial offloading and full offloading [14]. The overall task offloading is aimed at some highly coupled task requirements, and its tasks cannot be 14 split, and can only be unloaded as a whole or processed locally. The model is inseparable and the research is relatively simple, most of which appeared in the early edge computing research [15], including a reinforcement learning-based task offloading scheme proposed[16], which enables the instrument to be able to understand the energy consumption system and The offloading strategy is optimized in the case of computational delay; optimal computational offloading is achieved by Markov decision process [17]. A low-complexity online algorithm is proposed[18] to achieve cost reduction. Partial offloading is to divide tasks according to the task execution process, thereby abstracting the entire task into a chain model. The model includes multiple nodes, each node represents a subtask, and each subtask has an independent offloading decision, which has great flexibility and optimization space [19]. The dynamic computation offloading algorithm based on Lyapunov optimization reduces the execution cost and the reference [20] adopts the Markov decision method to deal with the scheduling problem of computing tasks. These two kinds of delays are modeled[21], and a network delay estimation decision analysis is proposed. Reference[22] designed a greedy algorithm with a self-adjusting parameterization mechanism to solve the formulation problem; In the process of industrial production, with the development of science and technology, the exponential growth of data volume, and the increasingly complex production environment and process, the existing smart instruments cannot undertake intensive data collection and complex task calculation, and the edge computing can process tasks faster. The advantages of fast, high security, high scalability and high reliability are combined with smart instruments. Through task offloading and migration, the complex tasks of smart instruments are sent to the edge server for computing, so as to meet the needs of smart instruments for collaborative computing capabilities. It can greatly improve the task processing efficiency of smart instruments. The remainder of this paper is organized as follows. We first introduce application of edge computing in the field of smart instruments in Section 2. Then we design a smart instrument resource evaluation method in Section 3. Next, we design a task offloading method for smart instrument based on Lyapunov optimization. We make a experimental comparison in Section 4. Finally, we conclude the paper in Section 5. 3. Smart instrument resource evaluation method With the development of instrument technology, smart instruments usually adopt a dual- microprocessor architecture in addition to the perception transmission capability of traditional instruments, as shown in Figure 1. The purpose of adopting this architecture is to enhance the intelligence of the instrument itself. The addition of MCU B can provide the instrument with stronger capabilities for instrument system modeling, information acquisition, dynamic control, self-learning, and self-diagnosis. Therefore the opening of this capability will help support the processing capabilities of smart instruments and also provide important hardware support for performing edge instrument computing tasks on the edge side. Bus Bus interface 1 interface 2 Dpram Latch Latch MCU MCU A solid state storage B Dual MCU communication Figure 1: Overall design of Dual MCU for Edge instrument In edge computing, in order to enable smart instruments to execute more accurately and efficiently, it is necessary to evaluate the resource capability of each instrument, which is also an important basis for edge instrument task scheduling. It is an important method to improve the overall capability of edge instruments to allow instruments with stronger resource capabilities that are closer to the edge or terminal to undertake more critical computing tasks. Therefore, through the analysis of smart instrument resources, generally speaking, the capabilities of smart instrument resources can be divided into: --Computing power, generally refers to CPU performance; 15 --Storage capacity, generally refers to the capacity of disk, memory, etc. Special memory generally represents the ability to quickly store and read and write, and the disk adopts solid-state storage; --Transmission capability, generally refers to network performance, including network bandwidth, delay, etc. In order to evaluate the resource capacity of edge smart instruments, the performance of edge instruments is evaluated and defined. Let DS represent the performance parameters of a single instrument, without loss of generality, define DS = (𝑆𝑐 , π‘†π‘š , 𝑆𝑑 , 𝑆𝑛 ) (1) 𝑆𝑐 represents the processing capability parameter of the instrument, generally the product of the number of cores of the processor and the processing frequency can be used. π‘†π‘š represents the memory parameter of the instrument, usually refers to the capacity. 𝑆𝑑 represents the storage solid state storage parameter, generally refers to the capacity. 𝑆𝑛 represents Network performance generally refers to network bandwidth and delay. Defined π‘Š as a weighting factor 𝑀𝑐 , π‘€π‘š , 𝑀𝑑 , 𝑀𝑛 > 0, W = {(𝑀𝑐 , π‘€π‘š , 𝑀𝑑 , 𝑀𝑛 )| 𝑀𝑐 +π‘€π‘š + 𝑀𝑑 + 𝑀𝑛 = 1 } (2) 𝑀𝑐 , π‘€π‘š , 𝑀𝑑 , 𝑀𝑛 respectively represent the computing capacity weight, memory capacity weight, disk storage capacity weight and network capacity weight of the instrument. Based on the above instrument performance parameter definition πΌπ‘“π‘Žπ‘π‘‘π‘œπ‘Ÿ represents the efficiency score factor of the instrument. πΌπ‘“π‘Žπ‘π‘‘π‘œπ‘Ÿ = π‘Š ./ 𝐷𝑆 (3) 𝑀𝑐 π‘€π‘š 𝑀𝑑 𝑀𝑛 which is πΌπ‘“π‘Žπ‘π‘‘π‘œπ‘Ÿ = 𝑆 + 𝑆 + 𝑆 + 𝑆 𝑐 π‘š 𝑑 𝑛 In this way, defining the efficacy score for a single edge instrument πΌπ‘ π‘π‘œπ‘Ÿπ‘’ , 1 πΌπ‘ π‘π‘œπ‘Ÿπ‘’ = (4) πΌπ‘“π‘Žπ‘π‘‘π‘œπ‘Ÿ The above πΌπ‘ π‘π‘œπ‘Ÿπ‘’ is the basic performance score of the instrument, and it is necessary to characterize the dynamic resource capability of the instrument. Define πΌπ‘ π‘π‘œπ‘Ÿπ‘’ (𝑑) to represent the instrument performance score at the moment, and use πΌπ‘ π‘π‘œπ‘Ÿπ‘’ (𝑑) as the basis for subsequent instrument task scheduling. 4. Task offloading method for smart instrument based on Lyapunov optimization 4.1. Lyapunov optimization Lyapunov optimization refers to using the Lyapunov function to optimally control the dynamic system, as shown in formula (5). 1 𝐿(𝑑) = 2 βˆ‘π‘–=1 𝑁 𝑄𝑖 (𝑑) 2 (5) Among them, t represents discrete time points, and Q represents the state of the system at each time point. In this paper, Iscore (t) can be used to represent Q dynamically. On this basis, Lyapunov drift is defined as (6), βˆ†L(t) = L(t + 1) βˆ’ L(t) (6) Lyapunov functions are widely used in control theory to ensure different forms of system stability. The state of a system at a particular time is usually described by a multidimensional vector. The Lyapunov function is a non-negative scalar measure of this multidimensional state. Typically, a function is defined as getting bigger when the system moves to an undesired state. System stability can be achieved by taking control actions that drift the Lyapunov function towards negative zero. Assuming constant Ξ΅>0, B>=0, then for all t and Q, the following drift plus penalty conditions hold. 16 𝑖=1 𝐸[βˆ†πΏ(𝑑)|𝑄(𝑑)] ≀ 𝐡 βˆ’ πœ€ βˆ‘ 𝑄𝑖 (𝑑) (7) 𝑁 Then the average time queue in all t>0 networks satisfies: 𝜏=0 𝑖=1 1 𝐡 𝔼[𝐿(0)] βˆ‘ βˆ‘ 𝔼[𝑄𝑖 (𝜏) ≀ + ] (8) 𝑑 πœ€ πœ€π‘‘ π‘‘βˆ’1 𝑁 4.2. Dynamic offloading algorithm based on Lyapunov optimization In the migration of smart instrument computing for edge computing, the main cost is in computing and data transmission, so it is necessary to ensure the stability of the entire system to improve efficiency. The core idea of the algorithm is to minimize the upper boundary of βˆ†π‘‰ (𝐡̃𝑑 ) so that the performance of the edge device can be maintained in a stable state, and the operating efficiency of the edge device can be maximized. The core steps of the algorithm are shown in Algorithm 1: Algorithm 1:Dynamic offloading algorithm based on Lyapunov optimization Input: πœπ‘–π‘‘ , 𝐡̃𝑖𝑑 , 𝐸𝑖𝑑 , β„Žπ‘–,𝑗 𝑑 οΌŒπœπ‘–π‘‘ task sequence in time period t. 𝐡̃𝑖𝑑 task sequence length in time period t. 𝐸𝑖𝑑 total demand performance in time period t. β„Žπ‘–,𝑗 𝑑 available performance in time period t. Output: 𝐼 𝑑 , 𝑓 𝑑 , 𝑝𝑑 , 𝑒 𝑑 minimizes the value of the following formula, 𝐼 𝑑 the index of the calculation mode of the instrument device i in the time period t, 𝑓 𝑑 the operating frequency of each MCU in the time period t, 𝑝𝑑 the performance offloading of each device in the time period t, 𝑒 𝑑 the time period t performance within the requirements provided to each device Step: 1: min 𝐡̃𝑖𝑑 [𝑒 𝑑 βˆ’ πœ€(𝐼 𝑑 , 𝑓 𝑑 , 𝑝𝑑 )] + 𝑉[π’Ÿ(𝐼 𝑑 , 𝑓 𝑑 , 𝑝𝑑 )] + πœ™ βˆ™ 𝟏(𝜁 𝑑 = 1, 𝐼𝑑𝑑 = 1) (9) 𝐼𝑑 ,𝑓𝑑 ,𝑝𝑑 ,𝑒 𝑑 2 :According to the formula (10) 𝐡𝑑+1 = 𝐡𝑑 βˆ’ πœ€(𝐼 𝑑 , 𝑓 𝑑 , 𝑝𝑑 )+𝑒 𝑑 , 𝑑 ∈ 𝒯 (10) 3: Let t=t+1 4: Loop step 1 until the difference between the two steps is less than a certain threshold. 5. Experiment Result In this paper, a new intelligent instrument prototype with dual MCU structure is adopted, and the self-diagnosis, self-learning, self-decision and self-adjustment capabilities of the instrument are used as the computing tasks of the new instrument and the edge server to simulate the analysis of temperature, pressure, flow and gas. As well as the conventional sampling cycle in the field of liquid level and other fields, the resource performance parameters of each instrument under different functions are obtained respectively, which are used as the basis for the factor configuration of the weight factor under different conditions. Considering the application characteristics of industrial smart instruments, each instrument is connected and interacted with the designated edge server to realize the collaborative work of a single edge computing server and multiple users. Limited by the structure and configuration of the industrial instrument, the maximum length of the multi-task sequence per time slot is set to 32, and algorithm 1 is used to analyze the instrument task sequence (Figure 2). Figure 2 shows the dynamic change process of multitasking sequences in different time slots through formula (10) of Algorithm 1. 17 35 30 the length of mission queue B 25 20 15 10 5 0 0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 time slot Figure 2: Multitasking sequence number curve Figure 3 shows the average performance curve of the instrument required in the process of executing the dynamic task sequence. The horizontal axis represents the time slot, and the vertical axis represents the average performance required by the instrument to execute each task in the task sequence in the time slot. After algorithm 1, the average performance required by the system tends to be stable. Under the condition of stable performance requirements, the transmission interaction cost of the entire system will be greatly reduced, and the performance of the entire system will be improved. 5 4.5 4 3.5 Average Efficiency Value 3 2.5 2 1.5 1 0.5 0 0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 time slot Figure 3: Average Efficiency Curve of Smart instruments Based on Dynamic offloading Algorithm Figure 4 shows the experimental results of the dynamic offloading algorithm based on Lyapunov optimization in multiple edge computing instruments, where the horizontal axis represents time, and the vertical axis represents the total demand efficiency of all instruments in a certain period of time using the two instrument usage strategies Compared with the average ratio of the available efficiency, blue represents the conventional instrument usage strategy, and red represents the edge computing instrument usage strategy. Through comparison, it can be seen that the edge computing instrument can save a lot of efficiency, which is better than the traditional instrument usage strategy. 1 not using dynamic offloading algorithm 0.9 using dynamic offloading algorithm 0.8 average occupancy efficiency ratio 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 0 2000 4000 6000 8000 10000 time slot Figure 4: Smart instrument occupancy efficiency ratio of smart instrument 6. Conclusion In this paper, we propose an efficient edge computing-based task offloading method for smart instruments. First, according to the application characteristics and development trend of smart 18 instruments, we designed a capability evaluation model related to smart instruments and edge computing. Then, we introduce a dynamic offloading algorithm for smart instruments based on Lyapunov optimization. Finally, we tested the algorithm in this paper according to the designed smart instrument capability evaluation model and dynamic offloading algorithm. In future work, we will continue to explore other research on efficient edge computing offloading methods for smart instruments. 7. Acknowledgements This research was funded by the National Key R&D Program of China under Grant 2018YFB2003502, and National Natural Science Foundation of China 92067110, and the 2020 industrial Internet innovation and development projectβ€”Industrial Internet identification data interaction middleware and resource pool service platform project, Ministry of industry and information technology of the China. 8. References [1] Yang Jie. Design and Developments of EPA Interface For Industrial Field Instruments[D]. Zhejiang University, 2006 [2] He Pei Lin. Deep Learning-Based Recognition Algorithm For Industry Meters and Its Applications[D]. University of Electronic Science and Technology of China, 2020. [3] Lin Jie, Yu Wei, Zhang Nan, Yang Xinyu, Zhang Hanlin, Zhao Wei. A Survey on Internet of Things: Architecture, Enabling Technologies, Security and Privacy, and Applications[J] . IEEE Internet of Things Journal . 2017 (5) [4] Pavel Mach, Zdenek Becvar. Mobile Edge Computing: A Survey on Architecture and Computation Offloading.[J] . IEEE Communications Surveys and Tutorials . 2017 (3) [5] Yuyi Mao,Changsheng You, et al. A Survey on Mobile Edge Computing: The Communication Perspective.[J] . IEEE Communications Surveys and Tutorials . 2017,19 (4):2322-2358 [6] James Nightingale, Pablo Salva-Garcia, Jose M. 5G-QoE: QoE Modelling for Ultra-HD Video Streaming in 5G Networks.[J]. Alcaraz Calero, Qi Wang 0001. TBC . 2018 (2) [7] Min Ming-hui, Xiao Liang, Chen Ye, et al, Learning-Based Computation Offloading for IoT Devices With Energy Harvesting[J].IEEE Transactions on Vehicular Technology, 2009,68(2): 1930-1941. [8] George P, Athena V.Insight and perspectives for content delivery networks[J]. Communicaitons of the ACM. 2006(1) [9] HU Y C, PATEL M, SABELLA D, et al. Mobile Edge Computing-A Key Technology towards 5G[J]. ETSI White Paper, 2015, 11(11):1-16. [10] Islam Akhirul,Debnath Arindam,Ghose Manojit,Chakraborty Suchetana. A survey on task offloading in Multi-access Edge Computing[J] . Journal of Systems Architecture . 2021,118: 102225 [11] Hongchang Ke,Jian Wang,Lingyue Deng,Yuming Ge,Hui Wang. Deep Reinforcement Learning- based Adaptive Computation Offloading for MEC in Heterogeneous Vehicular Networks[J] . IEEE Transactions on Vehicular Technology . 2020 (99) [12] LI G S, WANG J P, WU J H, et al. Data processing delay opti-mization in mobile edge computing[J]. Wireless Communica-tions and Mobile Computing, 2018, 2018: 6897523. [13] ZHANG W X, DU Y W. Deep reinforcement learning-based optimization of lightweight task offloading for multi-user mobile computing[J]. Journal of Measurement Science and Instrumentation, 2020: 1-14. [14] Zhu Hong. Research on Joint Optimization of Task Offloading in Mobile Edge Computing[D]. Nanjing University of Posts and Telecommunications,2021 [15] Su Zhi. Research on Computing Offloading and Resource Allocation Algorithm Based on MEC[D]. Nanjing University of Posts and Telecommunications,2021 19 [16] Xianfu Chen, Honggang Zhang, Celimuge Wu, et al. Optimized Computation Offloading Performance in Virtual Edge Computing Systems Via Deep Reinforcement Learning[J] . IEEE Internet of Things Journal . 2019,6(2):4005-4018. [17] Mao Yuyi, Zhang, Jun, Letaief, Khaled B. Dynamic Computation Offloading for Mobile-Edge Computing With Energy Harvesting Devices[J].IEEE Journal on Selected Areas in Communications . 2016, 34(12): 3590-3605. [18] Islam Akhirul,Debnath Arindam,Ghose Manojit,Chakraborty Suchetana. A survey on task offloading in Multi-access Edge Computing[J]. Journal of Systems Architecture . 2021,118: 102225 [19] Yashwant Singh Patel,Manoj Reddy,Rajiv Misra. Energy and cost trade-off for computational tasks offloading in mobile multi-tenant clouds[J] . Cluster Computing . 2021 [20] LIU J, MAO Y Y, ZHANG J, et al. Delay-optimal computation task scheduling for mobile- edge computing systems[C], 2016 IEEE International Symposium on Information Theory (ISIT), 2016: 1451-1455. [21] LIU J, MAO Y Y, ZHANG J, et al. Delay-optimal computation task scheduling for mobile-edge computing systems[C], 2016 IEEE International Symposium on Information Theory (ISIT), 2016: 1451-1455. [22] YANG S R, TSENG Y J, HUANG C C, et al. Multi-access edge computing enhanced video streaming: proof-of-concept imple-mentation and prediction/QoE models[J]. IEEE Transactions on Vehicular Technology, 2019, 68(2): 1888-1902. 20