# IoT Network for International Trade Cold Chain Logistics Tracking Based on Kalman Algorithm

Authors: Chao Zhang; Wei Wei
Journal: Computational Intelligence and Neuroscience
 (2022)

---

## Abstract

The application of Internet of Things technology in cold chain transportation can greatly strengthen the monitoring of all aspects of cold chain logistics, so as to promote the progress of cold chain logistics industry. In order to study this aspect, this paper chooses the key link of the Internet of Things as a breakthrough. By analyzing various aspects of the transportation process, an Internet of Things middleware framework serving cold chain transportation tracking is designed. The main products of logistics cold chain transportation are fresh agricultural products, so in order to further make the research fit the actual situation, this paper collects the logistics data and information of agricultural products through investigation and combines the core technology of agricultural products logistics with the Internet and the key technology of cold chain transportation to process the obtained information. The analytic hierarchy process and fuzzy comprehensive evaluation method are used in this process. The processing results prove the validity and rationality of the established index system. The purpose of developing the international trade management system is to enable the company to optimize its international trade management process, reduce some tedious and inconvenient manual operations, make the recording and statistics of international trade information very simple, improve work efficiency, and satisfy the information needs of various departments to enable enterprises to minimize costs, thereby enabling enterprises to obtain better economic benefits.


---

## Body

## 1. Introduction

The emergence of the Internet of Things platform has greatly facilitated our daily lives and has also greatly improved people’s work efficiency [1]. However, it must be noted that only by complying with the rules and standards of the Internet of Things platform at this stage can the corresponding technical equipment be fully connected. Cold chain transportation is the successful application of the Internet of Things technology in the logistics platform [2]. In this link, the widespread use of sensors has greatly promoted the development of cold chain transportation. This article mainly studies how to use various types and functions. The sensors provide better service for cold chain transportation [3]. The Internet of Things middleware in the cold chain transportation link is selected as the research object. By analyzing various aspects of the transportation process, an Internet of Things middleware framework serving cold chain transportation tracking is designed [4]. In addition, in order to better deal with the communication obstacles between different sensors, and, at the same time, to filter the useless and redundant data in the sensors, we adopted D-Bus technology and designed the communication means between different sensors [5]. The focus of this article is to prove that IoT technology can optimize and enhance China’s agricultural cold chain logistics. In view of this problem, the literature combined with the actual situation of the operation and development of agricultural cold chain logistics enterprises, in view of the problems existing in the enterprise process, the agricultural cold chain logistics mode starting from the enterprise was constructed [6]. The literature combines the previous research experience, uses the Internet technology, solves the practical problems in the development process of cold chain logistics, and upgrades and improves the existing logistics [7]. The international trade management system enables companies to minimize costs and better select suppliers, products, and customer information, thereby enabling companies to obtain better economic benefits [8].


## 2. Related Works

The literature has done in-depth research on cold chain logistics middleware; its purpose is to solve the problem of connection and data interaction between different sensor nodes in the cold chain tracking process in the Internet of Things environment, while ensuring the accuracy of data transmission. In the cold chain transportation link, data errors are not allowed [9]. This article adds a data processing module to the middleware of the Internet of Things, which improves the efficiency and accuracy of data collection by the middleware. The literature designed the cold chain logistics tracking middleware to solve a series of problems when collecting cold chain sensor data. The purpose of developing an international trade management system is to enable a limited company to optimize its international trade management process [10]. The international trade management system can reduce some tedious and inconvenient manual operations, make the recording and statistics of international trade information very simple, and improve work efficiency [11, 12]. The international trade management system can meet the information needs of various departments, so that companies can minimize costs and better select suppliers, products, and customer information, so that companies can obtain better economic benefits [13].In embedded devices, embedded devices usually have many sensor nodes. It should be noted that, in these sensor nodes, the memory of each sensor node is relatively small [14]. However, according to the current state of technological development, most operating systems on the market are equipped with large-capacity storage devices, and large-capacity storage devices can promote the increase in computing speed to a certain extent. Therefore, when comparing embedded devices with other operating systems on the market, the processing speed of the embedded operating systems is much lower than other large operating systems [15, 16]. In the following description in this article, nonembedded general-purpose computer devices are collectively referred to as general-purpose devices. In daily real-life use, the general-purpose device must support the data transmission function of the near-end network, and the data transmission function enables communication and data exchange between the sensor node and the general-purpose device [17]. D-Bus technology is an end-to-end communication technology, which is used for each sensor and general device in the near-end network to ensure that the communication and data transmission between the sensor node and the general device can be carried out normally [18].


## 3. Construction of IoT Sensor Network for Cold Chain Logistics Tracking

### 3.1. Overview of Related Technologies of IoT Middleware

REST refers to the state transfer of the presentation layer, which means that the relevant data of the resource network management center is transferred in a certain way or in a certain state. The main manifestations of the resource representative data are JSON, XML, etc., and the state change is through HTTP verb implementation.In a period when Internet technology and science and technology were not developed, there was a problem of low penetration rate of mobile device terminals. Therefore, in order to save resources and reduce expenses, the client and server are usually combined together. However, in recent years, science and technology have continued to develop, and the penetration rate of the Internet and the Internet of Things has been rising, and various types of Client service plug-ins have appeared. Therefore, REST can provide services for various types of platforms through related service plug-ins.In the process of REST providing services for various platforms, REST is always in the stateless constraint stage. Therefore, when the server and the client use the REST framework for interactive communication, the server does not need to know the usage status of the client. Moreover, in the process of interaction, there will be no information loss, and the server and the client can clearly identify and judge the received information.REST is in the stateless constrained stage. It means that when REST provides services, each web service in REST is in an independent state, and the server does not save the relevant state information of the client.The REST system conducts standard state interaction through its own resources. Therefore, when REST provides services, it does not require a specific interface as an intermediary.Four basic HTTP verbs are used in the REST system to interact with resources, as shown in Table1.Table 1
HTTP verbs in REST.
VerbOperatingGETRetrieve a specific resource or collection of resourcesPOSTCreate a new resourcePUTUpdate a specific resource (by id)DELETEDelete specific resources by idUsing the REST architecture can make full use of the various functions brought by the HTTP protocol and make the software architecture design clearer and maintainable.Hidden Markov model is a kind of probability model, which expresses the sequentiality of a set of random processes through probability description. In the hidden Markov model, the most important component is the Markov chain. In the actual application process of the hidden Markov model, the real state of the location is represented by the hidden Markov chain.(1)PXn=xX0,X1,X2,…Xn−1=PXnXn−1.Assume thatQ is the set of all states, and V is the set of all observed states.(2)Q=q1,q2,…,qN,V=v1,v2,…,vM.I is the state sequence of length T, and O is the corresponding observation sequence.(3)I=i1,i2,…,iT,V=o1,o2,…,oT.The state transition probability matrix is as follows:(4)A=aijN∗N.Among them,(5)aij=Pit+1=qjit=qi,1≤i,j≤N.The observation probability matrix is(6)B=bjkN∗M.Among them,(7)πi=Pi1=qi,1≤i≤N.The hidden Markov model is represented by a ternary symbol:(8)λ=A,B,π.The Kalman algorithm is the most commonly used estimation algorithm. The Kalman algorithm has the characteristics of small calculation requirements and good recursion in the actual application process. Therefore, since the Kalman algorithm was proposed, it has been widely used, and the Kalman algorithm has gradually developed into an optimal estimation algorithm. The typical use of Kalman algorithm is to smooth noisy data. Kalmar filter is an accurate reasoning algorithm, which is similar to Bayesian model, but there are certain differences between the two. The latent variable of Kalman filter is always in a continuous state in the state space.Kalman filter is mainly used in solving random linear discrete systems and parameter estimation. In the actual application process, the steps of using the Kalman filter are divided into estimation and correction. Estimation refers to constructing a priori estimation of the next state based on the current prior state value and then after a reasonable calculation. Correction refers to the use of parameter update equations to check the previously constructed prior estimates. The correction process is mainly a feedback process.The time update equation and state update equation of the discrete Kalman filter are as follows:(9)X^k−=AX^k−1+BU^k−1P^k−=AP^k−1AT+QKk=Pk−HTHPk−HT+R−2X^k=X^k−+KkZk−HX^k−Pk=I−KkHPk−.


### 3.2. IoT Middleware Architecture for Cold Chain Logistics Tracking

This article assumes that each node with middleware installed is peer-to-peer; that is, each node can be either a consumer or a producer. Consumers remotely call the near-end network to find the required nodes and obtain services, and the provider nodes have unique IDs to facilitate the calls of consumers. Figure1 describes how external devices access specific services required in a near-end network.Figure 1
Middleware remote access network architecture.Based on the design idea of this article, in the cold chain traceability environment, the IoT middleware needs to trace all the data in its environment and also provide services for each node of the sensor. The IoT middleware can schedule the location and location of sensor nodes in real time. The current data transmission method uses the above functions to complete data collection and data error correction. In summary, the detailed system architecture diagram of the IoT middleware is shown in Figure2.Figure 2
Middleware architecture block diagram.According to Figure2, the IoT middleware proposed in this article mainly does the following work:(1)
Access technology abstraction layer: when sensor nodes choose different transmission methods, there is no need to write communication code.(2)
Data processing: including filtering of redundant data and error correction of data with strict requirements.(3)
Remote call node service: the method executed by remote call runs in the remote node. Unlike local call, the remote node service runs in a different process. To communicate with it, the following problems need to be solved:(a)
ID mapping: because the function pointer cannot be used like a local call, the corresponding method in each node must have a corresponding ID to implement the corresponding method.(b)
Serialization and deserialization.(c)
Data transmission.(4)
Different node communication design: introduce D-Bus technology, connect each sensor node to the session bus, connect general equipment to the session bus and system bus, and then use the system bus daemon to communicate with the sensor nodes.In the process of cold chain traceability, a large number of sensor nodes are used, and these sensors will generate a large amount of real-time data. However, in actual use, due to various problems such as poor network quality, some error data will be generated, resulting in redundancy of data information; due to the existence of error data, the processing efficiency of the system is greatly reduced. Therefore, how to deal with these wrong data has become the focus of the next research. Because the cold chain link requires data to have high accuracy, data error correction is required, and unnecessary network expenses can be reduced through data error correction.


#### 3.2.1. Redundant Data Filtering

In the Bloom Filter-based filtering algorithm, the system adds a timestamp attribute to each data that reaches the data processing layer and sets the time threshold between two data receptions. When the time difference between two adjacent data received exceeds the threshold, or the time difference is less than the threshold, but the data is the same, it is determined as redundant data; otherwise, it is determined that the remaining data is nonredundant data.Set Terminal ID to represent the ID of the sensing device, which has unique properties, and Send Time represents the timestamp when data is sent to the data processing layer, and the set time interval between adjacent data is the Time Threshold. The specific schematic diagram is shown in Figure3.Figure 3
Bloom filter filtration diagram.Then, establish the following rules:(a)
Check the parity bit of the data to determine whether the data is distorted.(b)
After receiving the data, the data processing layer determines whether there is a terminal identification code in the sensor device information corresponding to the receiving time point.(c)
Judging whether the new data value of the same terminal identification code in rule (b) is the same: if they are the same, it is judged as duplicate data; if they are different, the original data is updated.(d)
The old data and the same data are judged as redundant data, and the redundant data is directly discarded.Therefore, when the data processing layer receives data, the system processing steps are as follows:(a1) Determine whether the data is distorted by the check bit, and discard it if distorted.(b1) If the received data is not distorted, judge whether there is a device ID in the sensor device information corresponding to the receiving time point. If not, directly add the data to the data structure; if there is, determine whether it is old data. If it is old data, discard it; if it is new data, go to step (c).(c1) Determine whether the added data is duplicate data; if it is duplicate data, discard it.Sensor data error correction: after the transmission data is obtained, due to the influence of factors such as environment and equipment, in the process of data display and processing using the obtained data, error data that obviously does not conform to the logic and the scene will be found. Therefore, a corresponding data error correction module needs to be added to the middleware of the Internet of Things. The data error correction is performed through the data error correction module, and the error data is eliminated, thereby improving the accuracy of the collected data.


#### 3.2.2. Design and Implementation of Middleware Remote Procedure Call

In the cold chain traceability link, users of sensor nodes and middleware can call the internal data of the system at any time and can provide users with corresponding service requirements by calling the data.(1) REST Interface Design. It is extremely important to design a unified style interface, which is also clear for later maintenance. The corresponding verbs and resource operations are shown in Table 2.Table 2
Verb resource operation table.
VerbOperatingGETGet resources (by id)POSTNew resource (by id)PUTUpdate resource (by id)DELETEDelete resource (by id)According to the above principles, the design of the cold chain link interface is as follows:(1)
GET: get the temperature of a specific node(2)
POST: update the temperature of the node (error correction operation, etc.)When using the local method for data processing, you only need to add the data to be processed to the relevant stack, and the local method can automatically call the relevant parameters to process the relevant data. In the method of using remote calls, the programming language used by the client and the server may be different, and the processing process may not be at the same stage. Therefore, the memory transfer method cannot be used for data processing. Therefore, the client needs to convert the parameters and data it wants to transmit into a binary byte stream and then send it to the server. Finally, the server converts the received binary byte stream into a coded form that it can read. In the above operations, the process of converting parameters and data into a binary byte stream is called serialization, and the process of converting a binary byte stream into a readable encoding form is called deserialization. In the actual application process, whether the client transmits parameters and data to the server, or the server transmits parameters and data to the client, both of them need to undergo the serialization and deserialization processes. The related schematic diagram is shown in Figure4.Figure 4
Serialization and deserialization diagram.In the actual application process, the programming languages used by different servers and different clients are not the same, and different programming languages will cause differences in data structures, and differences in data structures will lead to differences in the representation of binary structures. If different, the client and server need to specify some transmission protocols when performing serialization and deserialization operations. Currently, common transmission protocols include XML, JSON, and Thrift. However, the XML transfer protocol has certain disadvantages. Since the amount of information transmitted between the sensor node and the client is not large, the resulting byte stream will be lengthy and complicated when the XML protocol is used for serialization. In contrast, the JSON protocol is better in the process of use. Compared with the XML protocol, the JSON protocol uses the data processed by the JSON protocol to have a simpler data format, faster parsing density, and better readability. The most important point is that, after serialization using the JSON protocol, the resulting file size is smaller. Therefore, in actual applications, in order to ensure the conciseness of the obtained data, we often use the JSON protocol as an intermediate protocol when performing serialization and deserialization operations.In the actual use, you will find that the computing power of embedded devices will be affected by the memory of the sensor node. If the memory of a sensor node is larger, its computing power will be stronger. Similarly, if the memory of a sensor node is smaller, the computing power of the embedded device is smaller. Therefore, when the sensor node is in use, it is only introduced into the session bus to reduce expenses through such measures. General-purpose devices are different from sensor nodes because general-purpose devices need to serve the entire system at all times. Therefore, in the process of use, general-purpose devices are introduced into the system bus and the session bus. The system bus will automatically start when the general-purpose device is running and shut down when the general-purpose device is closed. In the system bus, the bus daemon can communicate with other processes in the system during the running process, and the sensor node is running. In the process, different sensors can use different session buses to access the system bus. Therefore, sensor nodes can send signals by using the session bus and then connect with each process. The specific steps are divided into the following: (1) the node first sends the target address to the general-purpose device to request access to the system bus. (2) The system bus processes the request information relayed by the general-purpose equipment and forwards the request information to the logo node. (3) The slogan node responds to the received information, and then the daemon sends the response information back to the node.Through the specific communication steps, it can be seen that the communication between the node and the system needs to pass through the daemon of the system bus, which means that when the sensor node communicates with the system, the daemon of the system can play an intermediary role, and at the same time, it can ensure the security of messages and the schematic diagram of communication between nodes, which are shown in Figure5.Figure 5
Schematic diagram of communication between near-end nodes.In summary, sensor nodes can communicate with general-purpose devices. In the process of connection and communication, the daemon acts as an intermediary to ensure the security of information in this way.


### 3.3. Research on Data Error Correction Technology of Cold Chain Logistics Middleware

The Kalman filter is suitable for the estimation of dynamic data. The optimal state is given by estimating the dynamic data. Because there is noise in the dynamic data, the data measured by the sensor is not accurate, so the Kalman filter is used to filter out the noise and estimate the true state value of the data.During data calculation, vector data such as temperature and humidity can be converted into scalar data.The predicted deviation of temperature type is(10)Tpe=Toe2+Tue2.In a cold chain vehicle, first assume that the temperature at timeK and at time K − 1 are the same. At this time, calculate the Kalman gain:(11)Kg=Tpe2Tpe2+Tse2.And estimate the temperature at timeK:(12)Tk=Tk−1+Kg∗Ts−Tk−1.Solve the optimal deviation at timeTk:(13)Toe=1−Kg∗Tpe2.Iteratively process the calculated temperature atTk+1 and the measured temperature to obtain more realistic temperature data.It should be noted that if the monitored data is very far away from the corresponding road section, it can be determined with a high probability that the detected location point is not on the road section. However, if the GPS signal has a large error, the above situation will also occur. Therefore, under this background, this article gives a related optimization plan, through which this kind of situation can be avoided, thereby improving the accuracy of trajectory correction. The relevant calculation formula is as follows:(14)pyxpx=pi.In the calculation process, taking into account the GPS noise during the transportation process, the value of the element in the observation probability matrix is set as(15)bi=pyxpx=pi=12πσeyx−pigc2σ2.Among them,σ is the standard deviation of GPS measurements. When solving the state transition probability function, there is no need to consider the positioning information relationship between the devices; only the information between the real positions is considered. If the distance between the two candidate real positions is shorter, the probability that the two candidates actually undergo a state transition is also greater. Based on the above situation, it can be seen that the state transition probability is proportional to the distance between candidate points.The relevant calculation formula is as follows:(16)aij=ppx+1=pjpx=pi∝e−βdij.The initial state probability of the vehicle trajectory model can be expressed as(17)py1p1=pi.The path solved by the Vibit algorithm will correspond to a hidden state sequence. Its iterative principle formula is as follows:(18)δt+1i=maxi1,i2,…,it−1Pit+1=i,it,…,i1,ot+1,…,o1λmax1≤j≤Nδtjajibiot+1,i=1,2,…N;t=1,2,…,T−1.Then, in timet, the maximum probability node of a single path is(19)Ψti=argmax1≤j≤Nδt−1jajibiot+1,i=1,2,…N.In the actual survey process, the original data was obtained through questionnaire surveys, and the corresponding weight judgment matrix was determined by comparing the importance of indicators. First-level index weight judgment matrix is shown in Table3. IOT organizational structure U1 weight judgment matrix is shown in Table 4. Secondary index score is shown in Table 5.(1)
Data that requires stable temperature and humidity:In the process of data processing, the temperature of the cold chain vehicle is set toT = 5°C, and then the values of Tpe, Kg, Tk, and Toe are calculated according to the smooth data error correction algorithm of Kalman filtering.(2)
Latitude and longitude:Table 3
First-level index weight judgment matrix.
First level indicatorU1U2U3U4Organizational structure of the internet of things U111/51/33IoT benefits u25137RFID technology U331/319GPS/GIS technology U41/31/71/91Table 4
IOT organizational structure U1 weight judgment matrix.
Organizational structure of the internet of things U1U11U12U13U14Internet of things U1111/61/51/3Internet of things technology U126132Talent U1351/313System flexibility U1431/21/31Table 5
Secondary index score.
Impact level\secondary index standardVery satisfiedQuite satisfiedGeneralNot so satisfiedVery dissatisfiedIoT devices0.20.30.30.10.1Internet of Things technology0.30.40.20.10.0Talent allocation0.10.20.40.20.1System flexibility0.20.40.20.10.1Business operations0.10.40.20.10.2Total operating cost0.10.50.20.10.1Service quality0.20.10.10.30.3Information processing level0.40.30.10.10.1Information collection0.20.50.20.10.1Agricultural product traceability0.30.40.10.10.1Temperature and humidity control0.40.30.20.10.0Information security0.20.30.20.20.1Distribution vehicle skeleton0.40.30.20.10.0Delivery vehicle positioning0.20.50.10.10.1Warehouse location setting0.30.30.20.20.0Comprehensive map query0.00.20.40.20.2Choose about 500 anchor points, and the time interval between each anchor point iss to obtain ten trajectory data sets. The time is stored in a unix timestamp format for convenience. Some data are shown in Table 6.Table 6
Partial data of trajectory data set.
Coordinate systemLongitudeLatitudePositioning time (unix timestamp)Speed (km/h)BD09118.943065784688532.117O51885385809154456948732.09BD09118.9433777853822832.1I619665702898154436949232.22BD09118.94353585 1989632.115779705285238154456949732.84BD09118.9458296680482532.115190979212808154456950236.26BD09118.9441687O73378432.11463515998318154456950738.61BD09118.9444154024771632.11411700783336154436951239.21BD09118.9447160241423832.11361997022351154456951740.09BD09118.945O6685865O4932.113045092045648154456952242.07BD09118.9453391471007132.11259178169525154436952741.83


## 3.1. Overview of Related Technologies of IoT Middleware

REST refers to the state transfer of the presentation layer, which means that the relevant data of the resource network management center is transferred in a certain way or in a certain state. The main manifestations of the resource representative data are JSON, XML, etc., and the state change is through HTTP verb implementation.In a period when Internet technology and science and technology were not developed, there was a problem of low penetration rate of mobile device terminals. Therefore, in order to save resources and reduce expenses, the client and server are usually combined together. However, in recent years, science and technology have continued to develop, and the penetration rate of the Internet and the Internet of Things has been rising, and various types of Client service plug-ins have appeared. Therefore, REST can provide services for various types of platforms through related service plug-ins.In the process of REST providing services for various platforms, REST is always in the stateless constraint stage. Therefore, when the server and the client use the REST framework for interactive communication, the server does not need to know the usage status of the client. Moreover, in the process of interaction, there will be no information loss, and the server and the client can clearly identify and judge the received information.REST is in the stateless constrained stage. It means that when REST provides services, each web service in REST is in an independent state, and the server does not save the relevant state information of the client.The REST system conducts standard state interaction through its own resources. Therefore, when REST provides services, it does not require a specific interface as an intermediary.Four basic HTTP verbs are used in the REST system to interact with resources, as shown in Table1.Table 1
HTTP verbs in REST.
VerbOperatingGETRetrieve a specific resource or collection of resourcesPOSTCreate a new resourcePUTUpdate a specific resource (by id)DELETEDelete specific resources by idUsing the REST architecture can make full use of the various functions brought by the HTTP protocol and make the software architecture design clearer and maintainable.Hidden Markov model is a kind of probability model, which expresses the sequentiality of a set of random processes through probability description. In the hidden Markov model, the most important component is the Markov chain. In the actual application process of the hidden Markov model, the real state of the location is represented by the hidden Markov chain.(1)PXn=xX0,X1,X2,…Xn−1=PXnXn−1.Assume thatQ is the set of all states, and V is the set of all observed states.(2)Q=q1,q2,…,qN,V=v1,v2,…,vM.I is the state sequence of length T, and O is the corresponding observation sequence.(3)I=i1,i2,…,iT,V=o1,o2,…,oT.The state transition probability matrix is as follows:(4)A=aijN∗N.Among them,(5)aij=Pit+1=qjit=qi,1≤i,j≤N.The observation probability matrix is(6)B=bjkN∗M.Among them,(7)πi=Pi1=qi,1≤i≤N.The hidden Markov model is represented by a ternary symbol:(8)λ=A,B,π.The Kalman algorithm is the most commonly used estimation algorithm. The Kalman algorithm has the characteristics of small calculation requirements and good recursion in the actual application process. Therefore, since the Kalman algorithm was proposed, it has been widely used, and the Kalman algorithm has gradually developed into an optimal estimation algorithm. The typical use of Kalman algorithm is to smooth noisy data. Kalmar filter is an accurate reasoning algorithm, which is similar to Bayesian model, but there are certain differences between the two. The latent variable of Kalman filter is always in a continuous state in the state space.Kalman filter is mainly used in solving random linear discrete systems and parameter estimation. In the actual application process, the steps of using the Kalman filter are divided into estimation and correction. Estimation refers to constructing a priori estimation of the next state based on the current prior state value and then after a reasonable calculation. Correction refers to the use of parameter update equations to check the previously constructed prior estimates. The correction process is mainly a feedback process.The time update equation and state update equation of the discrete Kalman filter are as follows:(9)X^k−=AX^k−1+BU^k−1P^k−=AP^k−1AT+QKk=Pk−HTHPk−HT+R−2X^k=X^k−+KkZk−HX^k−Pk=I−KkHPk−.


## 3.2. IoT Middleware Architecture for Cold Chain Logistics Tracking

This article assumes that each node with middleware installed is peer-to-peer; that is, each node can be either a consumer or a producer. Consumers remotely call the near-end network to find the required nodes and obtain services, and the provider nodes have unique IDs to facilitate the calls of consumers. Figure1 describes how external devices access specific services required in a near-end network.Figure 1
Middleware remote access network architecture.Based on the design idea of this article, in the cold chain traceability environment, the IoT middleware needs to trace all the data in its environment and also provide services for each node of the sensor. The IoT middleware can schedule the location and location of sensor nodes in real time. The current data transmission method uses the above functions to complete data collection and data error correction. In summary, the detailed system architecture diagram of the IoT middleware is shown in Figure2.Figure 2
Middleware architecture block diagram.According to Figure2, the IoT middleware proposed in this article mainly does the following work:(1)
Access technology abstraction layer: when sensor nodes choose different transmission methods, there is no need to write communication code.(2)
Data processing: including filtering of redundant data and error correction of data with strict requirements.(3)
Remote call node service: the method executed by remote call runs in the remote node. Unlike local call, the remote node service runs in a different process. To communicate with it, the following problems need to be solved:(a)
ID mapping: because the function pointer cannot be used like a local call, the corresponding method in each node must have a corresponding ID to implement the corresponding method.(b)
Serialization and deserialization.(c)
Data transmission.(4)
Different node communication design: introduce D-Bus technology, connect each sensor node to the session bus, connect general equipment to the session bus and system bus, and then use the system bus daemon to communicate with the sensor nodes.In the process of cold chain traceability, a large number of sensor nodes are used, and these sensors will generate a large amount of real-time data. However, in actual use, due to various problems such as poor network quality, some error data will be generated, resulting in redundancy of data information; due to the existence of error data, the processing efficiency of the system is greatly reduced. Therefore, how to deal with these wrong data has become the focus of the next research. Because the cold chain link requires data to have high accuracy, data error correction is required, and unnecessary network expenses can be reduced through data error correction.


### 3.2.1. Redundant Data Filtering

In the Bloom Filter-based filtering algorithm, the system adds a timestamp attribute to each data that reaches the data processing layer and sets the time threshold between two data receptions. When the time difference between two adjacent data received exceeds the threshold, or the time difference is less than the threshold, but the data is the same, it is determined as redundant data; otherwise, it is determined that the remaining data is nonredundant data.Set Terminal ID to represent the ID of the sensing device, which has unique properties, and Send Time represents the timestamp when data is sent to the data processing layer, and the set time interval between adjacent data is the Time Threshold. The specific schematic diagram is shown in Figure3.Figure 3
Bloom filter filtration diagram.Then, establish the following rules:(a)
Check the parity bit of the data to determine whether the data is distorted.(b)
After receiving the data, the data processing layer determines whether there is a terminal identification code in the sensor device information corresponding to the receiving time point.(c)
Judging whether the new data value of the same terminal identification code in rule (b) is the same: if they are the same, it is judged as duplicate data; if they are different, the original data is updated.(d)
The old data and the same data are judged as redundant data, and the redundant data is directly discarded.Therefore, when the data processing layer receives data, the system processing steps are as follows:(a1) Determine whether the data is distorted by the check bit, and discard it if distorted.(b1) If the received data is not distorted, judge whether there is a device ID in the sensor device information corresponding to the receiving time point. If not, directly add the data to the data structure; if there is, determine whether it is old data. If it is old data, discard it; if it is new data, go to step (c).(c1) Determine whether the added data is duplicate data; if it is duplicate data, discard it.Sensor data error correction: after the transmission data is obtained, due to the influence of factors such as environment and equipment, in the process of data display and processing using the obtained data, error data that obviously does not conform to the logic and the scene will be found. Therefore, a corresponding data error correction module needs to be added to the middleware of the Internet of Things. The data error correction is performed through the data error correction module, and the error data is eliminated, thereby improving the accuracy of the collected data.


### 3.2.2. Design and Implementation of Middleware Remote Procedure Call

In the cold chain traceability link, users of sensor nodes and middleware can call the internal data of the system at any time and can provide users with corresponding service requirements by calling the data.(1) REST Interface Design. It is extremely important to design a unified style interface, which is also clear for later maintenance. The corresponding verbs and resource operations are shown in Table 2.Table 2
Verb resource operation table.
VerbOperatingGETGet resources (by id)POSTNew resource (by id)PUTUpdate resource (by id)DELETEDelete resource (by id)According to the above principles, the design of the cold chain link interface is as follows:(1)
GET: get the temperature of a specific node(2)
POST: update the temperature of the node (error correction operation, etc.)When using the local method for data processing, you only need to add the data to be processed to the relevant stack, and the local method can automatically call the relevant parameters to process the relevant data. In the method of using remote calls, the programming language used by the client and the server may be different, and the processing process may not be at the same stage. Therefore, the memory transfer method cannot be used for data processing. Therefore, the client needs to convert the parameters and data it wants to transmit into a binary byte stream and then send it to the server. Finally, the server converts the received binary byte stream into a coded form that it can read. In the above operations, the process of converting parameters and data into a binary byte stream is called serialization, and the process of converting a binary byte stream into a readable encoding form is called deserialization. In the actual application process, whether the client transmits parameters and data to the server, or the server transmits parameters and data to the client, both of them need to undergo the serialization and deserialization processes. The related schematic diagram is shown in Figure4.Figure 4
Serialization and deserialization diagram.In the actual application process, the programming languages used by different servers and different clients are not the same, and different programming languages will cause differences in data structures, and differences in data structures will lead to differences in the representation of binary structures. If different, the client and server need to specify some transmission protocols when performing serialization and deserialization operations. Currently, common transmission protocols include XML, JSON, and Thrift. However, the XML transfer protocol has certain disadvantages. Since the amount of information transmitted between the sensor node and the client is not large, the resulting byte stream will be lengthy and complicated when the XML protocol is used for serialization. In contrast, the JSON protocol is better in the process of use. Compared with the XML protocol, the JSON protocol uses the data processed by the JSON protocol to have a simpler data format, faster parsing density, and better readability. The most important point is that, after serialization using the JSON protocol, the resulting file size is smaller. Therefore, in actual applications, in order to ensure the conciseness of the obtained data, we often use the JSON protocol as an intermediate protocol when performing serialization and deserialization operations.In the actual use, you will find that the computing power of embedded devices will be affected by the memory of the sensor node. If the memory of a sensor node is larger, its computing power will be stronger. Similarly, if the memory of a sensor node is smaller, the computing power of the embedded device is smaller. Therefore, when the sensor node is in use, it is only introduced into the session bus to reduce expenses through such measures. General-purpose devices are different from sensor nodes because general-purpose devices need to serve the entire system at all times. Therefore, in the process of use, general-purpose devices are introduced into the system bus and the session bus. The system bus will automatically start when the general-purpose device is running and shut down when the general-purpose device is closed. In the system bus, the bus daemon can communicate with other processes in the system during the running process, and the sensor node is running. In the process, different sensors can use different session buses to access the system bus. Therefore, sensor nodes can send signals by using the session bus and then connect with each process. The specific steps are divided into the following: (1) the node first sends the target address to the general-purpose device to request access to the system bus. (2) The system bus processes the request information relayed by the general-purpose equipment and forwards the request information to the logo node. (3) The slogan node responds to the received information, and then the daemon sends the response information back to the node.Through the specific communication steps, it can be seen that the communication between the node and the system needs to pass through the daemon of the system bus, which means that when the sensor node communicates with the system, the daemon of the system can play an intermediary role, and at the same time, it can ensure the security of messages and the schematic diagram of communication between nodes, which are shown in Figure5.Figure 5
Schematic diagram of communication between near-end nodes.In summary, sensor nodes can communicate with general-purpose devices. In the process of connection and communication, the daemon acts as an intermediary to ensure the security of information in this way.


## 3.2.1. Redundant Data Filtering

In the Bloom Filter-based filtering algorithm, the system adds a timestamp attribute to each data that reaches the data processing layer and sets the time threshold between two data receptions. When the time difference between two adjacent data received exceeds the threshold, or the time difference is less than the threshold, but the data is the same, it is determined as redundant data; otherwise, it is determined that the remaining data is nonredundant data.Set Terminal ID to represent the ID of the sensing device, which has unique properties, and Send Time represents the timestamp when data is sent to the data processing layer, and the set time interval between adjacent data is the Time Threshold. The specific schematic diagram is shown in Figure3.Figure 3
Bloom filter filtration diagram.Then, establish the following rules:(a)
Check the parity bit of the data to determine whether the data is distorted.(b)
After receiving the data, the data processing layer determines whether there is a terminal identification code in the sensor device information corresponding to the receiving time point.(c)
Judging whether the new data value of the same terminal identification code in rule (b) is the same: if they are the same, it is judged as duplicate data; if they are different, the original data is updated.(d)
The old data and the same data are judged as redundant data, and the redundant data is directly discarded.Therefore, when the data processing layer receives data, the system processing steps are as follows:(a1) Determine whether the data is distorted by the check bit, and discard it if distorted.(b1) If the received data is not distorted, judge whether there is a device ID in the sensor device information corresponding to the receiving time point. If not, directly add the data to the data structure; if there is, determine whether it is old data. If it is old data, discard it; if it is new data, go to step (c).(c1) Determine whether the added data is duplicate data; if it is duplicate data, discard it.Sensor data error correction: after the transmission data is obtained, due to the influence of factors such as environment and equipment, in the process of data display and processing using the obtained data, error data that obviously does not conform to the logic and the scene will be found. Therefore, a corresponding data error correction module needs to be added to the middleware of the Internet of Things. The data error correction is performed through the data error correction module, and the error data is eliminated, thereby improving the accuracy of the collected data.


## 3.2.2. Design and Implementation of Middleware Remote Procedure Call

In the cold chain traceability link, users of sensor nodes and middleware can call the internal data of the system at any time and can provide users with corresponding service requirements by calling the data.(1) REST Interface Design. It is extremely important to design a unified style interface, which is also clear for later maintenance. The corresponding verbs and resource operations are shown in Table 2.Table 2
Verb resource operation table.
VerbOperatingGETGet resources (by id)POSTNew resource (by id)PUTUpdate resource (by id)DELETEDelete resource (by id)According to the above principles, the design of the cold chain link interface is as follows:(1)
GET: get the temperature of a specific node(2)
POST: update the temperature of the node (error correction operation, etc.)When using the local method for data processing, you only need to add the data to be processed to the relevant stack, and the local method can automatically call the relevant parameters to process the relevant data. In the method of using remote calls, the programming language used by the client and the server may be different, and the processing process may not be at the same stage. Therefore, the memory transfer method cannot be used for data processing. Therefore, the client needs to convert the parameters and data it wants to transmit into a binary byte stream and then send it to the server. Finally, the server converts the received binary byte stream into a coded form that it can read. In the above operations, the process of converting parameters and data into a binary byte stream is called serialization, and the process of converting a binary byte stream into a readable encoding form is called deserialization. In the actual application process, whether the client transmits parameters and data to the server, or the server transmits parameters and data to the client, both of them need to undergo the serialization and deserialization processes. The related schematic diagram is shown in Figure4.Figure 4
Serialization and deserialization diagram.In the actual application process, the programming languages used by different servers and different clients are not the same, and different programming languages will cause differences in data structures, and differences in data structures will lead to differences in the representation of binary structures. If different, the client and server need to specify some transmission protocols when performing serialization and deserialization operations. Currently, common transmission protocols include XML, JSON, and Thrift. However, the XML transfer protocol has certain disadvantages. Since the amount of information transmitted between the sensor node and the client is not large, the resulting byte stream will be lengthy and complicated when the XML protocol is used for serialization. In contrast, the JSON protocol is better in the process of use. Compared with the XML protocol, the JSON protocol uses the data processed by the JSON protocol to have a simpler data format, faster parsing density, and better readability. The most important point is that, after serialization using the JSON protocol, the resulting file size is smaller. Therefore, in actual applications, in order to ensure the conciseness of the obtained data, we often use the JSON protocol as an intermediate protocol when performing serialization and deserialization operations.In the actual use, you will find that the computing power of embedded devices will be affected by the memory of the sensor node. If the memory of a sensor node is larger, its computing power will be stronger. Similarly, if the memory of a sensor node is smaller, the computing power of the embedded device is smaller. Therefore, when the sensor node is in use, it is only introduced into the session bus to reduce expenses through such measures. General-purpose devices are different from sensor nodes because general-purpose devices need to serve the entire system at all times. Therefore, in the process of use, general-purpose devices are introduced into the system bus and the session bus. The system bus will automatically start when the general-purpose device is running and shut down when the general-purpose device is closed. In the system bus, the bus daemon can communicate with other processes in the system during the running process, and the sensor node is running. In the process, different sensors can use different session buses to access the system bus. Therefore, sensor nodes can send signals by using the session bus and then connect with each process. The specific steps are divided into the following: (1) the node first sends the target address to the general-purpose device to request access to the system bus. (2) The system bus processes the request information relayed by the general-purpose equipment and forwards the request information to the logo node. (3) The slogan node responds to the received information, and then the daemon sends the response information back to the node.Through the specific communication steps, it can be seen that the communication between the node and the system needs to pass through the daemon of the system bus, which means that when the sensor node communicates with the system, the daemon of the system can play an intermediary role, and at the same time, it can ensure the security of messages and the schematic diagram of communication between nodes, which are shown in Figure5.Figure 5
Schematic diagram of communication between near-end nodes.In summary, sensor nodes can communicate with general-purpose devices. In the process of connection and communication, the daemon acts as an intermediary to ensure the security of information in this way.


## 3.3. Research on Data Error Correction Technology of Cold Chain Logistics Middleware

The Kalman filter is suitable for the estimation of dynamic data. The optimal state is given by estimating the dynamic data. Because there is noise in the dynamic data, the data measured by the sensor is not accurate, so the Kalman filter is used to filter out the noise and estimate the true state value of the data.During data calculation, vector data such as temperature and humidity can be converted into scalar data.The predicted deviation of temperature type is(10)Tpe=Toe2+Tue2.In a cold chain vehicle, first assume that the temperature at timeK and at time K − 1 are the same. At this time, calculate the Kalman gain:(11)Kg=Tpe2Tpe2+Tse2.And estimate the temperature at timeK:(12)Tk=Tk−1+Kg∗Ts−Tk−1.Solve the optimal deviation at timeTk:(13)Toe=1−Kg∗Tpe2.Iteratively process the calculated temperature atTk+1 and the measured temperature to obtain more realistic temperature data.It should be noted that if the monitored data is very far away from the corresponding road section, it can be determined with a high probability that the detected location point is not on the road section. However, if the GPS signal has a large error, the above situation will also occur. Therefore, under this background, this article gives a related optimization plan, through which this kind of situation can be avoided, thereby improving the accuracy of trajectory correction. The relevant calculation formula is as follows:(14)pyxpx=pi.In the calculation process, taking into account the GPS noise during the transportation process, the value of the element in the observation probability matrix is set as(15)bi=pyxpx=pi=12πσeyx−pigc2σ2.Among them,σ is the standard deviation of GPS measurements. When solving the state transition probability function, there is no need to consider the positioning information relationship between the devices; only the information between the real positions is considered. If the distance between the two candidate real positions is shorter, the probability that the two candidates actually undergo a state transition is also greater. Based on the above situation, it can be seen that the state transition probability is proportional to the distance between candidate points.The relevant calculation formula is as follows:(16)aij=ppx+1=pjpx=pi∝e−βdij.The initial state probability of the vehicle trajectory model can be expressed as(17)py1p1=pi.The path solved by the Vibit algorithm will correspond to a hidden state sequence. Its iterative principle formula is as follows:(18)δt+1i=maxi1,i2,…,it−1Pit+1=i,it,…,i1,ot+1,…,o1λmax1≤j≤Nδtjajibiot+1,i=1,2,…N;t=1,2,…,T−1.Then, in timet, the maximum probability node of a single path is(19)Ψti=argmax1≤j≤Nδt−1jajibiot+1,i=1,2,…N.In the actual survey process, the original data was obtained through questionnaire surveys, and the corresponding weight judgment matrix was determined by comparing the importance of indicators. First-level index weight judgment matrix is shown in Table3. IOT organizational structure U1 weight judgment matrix is shown in Table 4. Secondary index score is shown in Table 5.(1)
Data that requires stable temperature and humidity:In the process of data processing, the temperature of the cold chain vehicle is set toT = 5°C, and then the values of Tpe, Kg, Tk, and Toe are calculated according to the smooth data error correction algorithm of Kalman filtering.(2)
Latitude and longitude:Table 3
First-level index weight judgment matrix.
First level indicatorU1U2U3U4Organizational structure of the internet of things U111/51/33IoT benefits u25137RFID technology U331/319GPS/GIS technology U41/31/71/91Table 4
IOT organizational structure U1 weight judgment matrix.
Organizational structure of the internet of things U1U11U12U13U14Internet of things U1111/61/51/3Internet of things technology U126132Talent U1351/313System flexibility U1431/21/31Table 5
Secondary index score.
Impact level\secondary index standardVery satisfiedQuite satisfiedGeneralNot so satisfiedVery dissatisfiedIoT devices0.20.30.30.10.1Internet of Things technology0.30.40.20.10.0Talent allocation0.10.20.40.20.1System flexibility0.20.40.20.10.1Business operations0.10.40.20.10.2Total operating cost0.10.50.20.10.1Service quality0.20.10.10.30.3Information processing level0.40.30.10.10.1Information collection0.20.50.20.10.1Agricultural product traceability0.30.40.10.10.1Temperature and humidity control0.40.30.20.10.0Information security0.20.30.20.20.1Distribution vehicle skeleton0.40.30.20.10.0Delivery vehicle positioning0.20.50.10.10.1Warehouse location setting0.30.30.20.20.0Comprehensive map query0.00.20.40.20.2Choose about 500 anchor points, and the time interval between each anchor point iss to obtain ten trajectory data sets. The time is stored in a unix timestamp format for convenience. Some data are shown in Table 6.Table 6
Partial data of trajectory data set.
Coordinate systemLongitudeLatitudePositioning time (unix timestamp)Speed (km/h)BD09118.943065784688532.117O51885385809154456948732.09BD09118.9433777853822832.1I619665702898154436949232.22BD09118.94353585 1989632.115779705285238154456949732.84BD09118.9458296680482532.115190979212808154456950236.26BD09118.9441687O73378432.11463515998318154456950738.61BD09118.9444154024771632.11411700783336154436951239.21BD09118.9447160241423832.11361997022351154456951740.09BD09118.945O6685865O4932.113045092045648154456952242.07BD09118.9453391471007132.11259178169525154436952741.83


## 4. Demand Analysis and System Realization of International Trade Management

### 4.1. International Trade Management Demand Analysis

Through the LAMP trade management system, users can conveniently and quickly query relevant data and information, while also reducing management costs, making enterprise management systematized and accurate. The system management module is composed of many management subsystems, and the administrator manages the whole by manipulating the subsystems. The management system mainly provides managers with the following two aspects of help: first, manage employee information. Second, the system administrator can back up, restore, and manage the information in the database. At the same time, the system also restricts the administrator’s authority and functions to a certain extent to ensure the safety of the entire system, thereby providing convenience for international trade management activities.The purchasing management module of the system is usually controlled by purchasing personnel. The specific business process is as follows: first, the purchasing personnel determine the purchase list according to the actual situation, and the management and modification of the list are controlled by the purchasing personnel. After receiving the purchase list, the purchasing department confirms the content of the purchase order. The system combines the data and information of each supplier in the database to make a comprehensive judgment and gives the most cost-effective supplier information. The purchasing department conducts actual negotiation with the supplier based on the information provided by the system and then confirms the purchase.The inventory management module provides support for warehouse administrators in the following activities: product storage, product delivery, supplier information management, and product viewing. The data analysis module is solely responsible for the corporate accounting. The accountant can perform the following activities in the system data analysis module: manage loss information, manage financial information, and query out-of-stock information.


### 4.2. Implementation of an International Trade Management System

System management mainly includes four aspects: data security, administrator, user management, data backup and recovery, and authority management. The system has a strong ability to protect information. When the computer is running the system, if the user leaves in the middle, the system will automatically lock the computer to protect the important information from being read by others. At the same time, the system gives the administrator an important authority, which is to modify the login restrictions of ordinary users.The procurement management module is the most critical and core part of the entire system. This module is responsible for purchasing planning, expediting, checking, and receiving warehouse, settlement and payment, etc. At the same time, the procurement management module realizes a global material supply cycle. The main process of procurement management is as follows: the buyer determines the purchase list in the purchase interface according to the actual situation, the system sends the purchase information to the supplier, and then the supplier is responsible for transporting the purchased materials. After the materials arrive, the inspection department will proceed according to the purchase list acceptance. Therefore, the inventory management module must have three functions: inbound acceptance, outbound acceptance, and raw material inventory inquiry.Sales are inseparable from any commodity, so the sales management module is also an extremely important part of the system. The sales management module provides sales forecasts, sales plans, and sales contracts for corporate sales personnel, as well as a series of information about product sales to improve the core competitiveness of the company in the commercial field. The data analysis module uses a series of high-tech methods such as big data, the Internet, and intelligent algorithms to analyze the current operating conditions and competitive environment, while giving correct judgments. The data analysis module can truly understand the market and can respond to market changes in a timely and effective manner.


## 4.1. International Trade Management Demand Analysis

Through the LAMP trade management system, users can conveniently and quickly query relevant data and information, while also reducing management costs, making enterprise management systematized and accurate. The system management module is composed of many management subsystems, and the administrator manages the whole by manipulating the subsystems. The management system mainly provides managers with the following two aspects of help: first, manage employee information. Second, the system administrator can back up, restore, and manage the information in the database. At the same time, the system also restricts the administrator’s authority and functions to a certain extent to ensure the safety of the entire system, thereby providing convenience for international trade management activities.The purchasing management module of the system is usually controlled by purchasing personnel. The specific business process is as follows: first, the purchasing personnel determine the purchase list according to the actual situation, and the management and modification of the list are controlled by the purchasing personnel. After receiving the purchase list, the purchasing department confirms the content of the purchase order. The system combines the data and information of each supplier in the database to make a comprehensive judgment and gives the most cost-effective supplier information. The purchasing department conducts actual negotiation with the supplier based on the information provided by the system and then confirms the purchase.The inventory management module provides support for warehouse administrators in the following activities: product storage, product delivery, supplier information management, and product viewing. The data analysis module is solely responsible for the corporate accounting. The accountant can perform the following activities in the system data analysis module: manage loss information, manage financial information, and query out-of-stock information.


## 4.2. Implementation of an International Trade Management System

System management mainly includes four aspects: data security, administrator, user management, data backup and recovery, and authority management. The system has a strong ability to protect information. When the computer is running the system, if the user leaves in the middle, the system will automatically lock the computer to protect the important information from being read by others. At the same time, the system gives the administrator an important authority, which is to modify the login restrictions of ordinary users.The procurement management module is the most critical and core part of the entire system. This module is responsible for purchasing planning, expediting, checking, and receiving warehouse, settlement and payment, etc. At the same time, the procurement management module realizes a global material supply cycle. The main process of procurement management is as follows: the buyer determines the purchase list in the purchase interface according to the actual situation, the system sends the purchase information to the supplier, and then the supplier is responsible for transporting the purchased materials. After the materials arrive, the inspection department will proceed according to the purchase list acceptance. Therefore, the inventory management module must have three functions: inbound acceptance, outbound acceptance, and raw material inventory inquiry.Sales are inseparable from any commodity, so the sales management module is also an extremely important part of the system. The sales management module provides sales forecasts, sales plans, and sales contracts for corporate sales personnel, as well as a series of information about product sales to improve the core competitiveness of the company in the commercial field. The data analysis module uses a series of high-tech methods such as big data, the Internet, and intelligent algorithms to analyze the current operating conditions and competitive environment, while giving correct judgments. The data analysis module can truly understand the market and can respond to market changes in a timely and effective manner.


## 5. Conclusion

The rapid development of the Internet of Things technology makes the Internet of Things platform based on the Internet of Things technology spring up like mushrooms. The emergence of the Internet of Things platform has greatly facilitated our daily lives and has also greatly improved people’s work efficiency. However, at present, there are multiple communication standards and mechanisms in the Internet of Things platform. How to quickly and conveniently exchange information between different devices is a key issue that we must consider in the research process of Internet of Things middleware. The article selects the Internet of Things middleware in the cold chain transportation link as the research object and designs an Internet of Things middleware framework for cold chain transportation tracking by analyzing various aspects of the transportation process. In addition, in order to better deal with the communication obstacles between different sensors and filter the redundant data in the sensors, we adopted D-Bus technology and designed the communication means between different sensors. The development and utilization of the international trade management system can reduce some tedious and inconvenient manual operations, make the recording and statistics of international trade information very simple, improve work efficiency, and, at the same time, meet the information needs of various departments, so that enterprises can minimize cost and better select suppliers, products, and customer information, so that enterprises can obtain better economic benefits.



---

*Source: 1608167-2022-09-19.xml*