A Logistics

— The progress in the economic society has driven the rapid development of the logistics industry. In the face of increasingly enormous and complicated logistics systems, it is of great practical significance to study how to effectively control the logistics process, minimize the labour cost and provide real-time monitoring data for users. For this purpose, this paper designs an active logistics status tracking (ALST) system platform based on Wireless sensor network (WSN). This paper, by fully integrating the characteristics of WSN, designs the system architecture based on the design philosophy of active logistics status tracking method; it also constructs and realizes the hardware function modules such as wireless sensor node, vehicle gateway, user terminal and backend server etc., and adopts the finite-state machine (FSM)-based active tracking model to maintain the logistics object status; and then it carries out programming of wireless sensor node active state tracking in TinyOS2.x, and finally performs system test under normal operation. The active logistics status tracking system can be widely applied in the logistics industry, to optimize the logistics process, reduce losses and improve logistics operation efficiency.


Introduction
With the increasingly complex logistics system nowadays, it is of great significance to study how to effectively control the logistics process, save labour costs and provide real-time monitoring data for users [1][2]. In the traditional logistics tracking method, the centralized control and optimization methods were often applied, which could optimize the operation of logistics system to some degree, but cannot satisfy the monitoring demands of the rapidly changing logistics system due to its technical limitations [3][4]. Now, in terms of information acquisition and network deployment, the WSN has been freed from the limitations of infrastructures in the traditional network, and can be customized to the demands of logistics operation. Compared with the traditional technology, it can not only collect and transmit data, but also perceive the status information of things and surrounding environment with certain computing capacity. In this paper, the author designs an active logistics status tracking (ALST) system by fully utilizing various advantages of the WSN technology.

2
Key Technologies for System Design

FSM-based active tracking model
Finite-state machine (FSM) means the finite state set, and the mathematical model of the behaviours between these states such as transfer and motion etc; the object only remains in a specific state at any time [5][6]. In any state, if some event occurs, it will select a method to solve it or determine whether to transfer it to the next state based on the difference between the current state and the input event.
M=( N, L, F, S, Z) is generally used: the state list N is a finite state set; the input event list L is the set of all received events in the system; the state shift function F defines the state transition logic; the initial state S is a special state of the system; and the termination state is a sub-set of N [7-9].

FSM-based active tracking system in logistics context
To apply FSM in managing the state of logistics object in logistics context and realize the ALST, the primary step is to determine the states and events of the objects and their relationships in the logistics process [10][11][12]. The possible states of every logistics object in the logistics process are given as follows: initial state (s), termination state (e), normal state (n), vehicle loading (o), unqualified environment indicator, delayed delivery (t), cargo loss (i), wrong loading (w), waiting process (ew), and exception handling.
In the logistics process, events means some possible changes of the objective environment condition, transport route and loading/unloading, e.g. loading onto the wrong vehicle, cargo loss or unqualified environment parameters. The FSM can describe the relationships between the logistics states and events for the object in the logistics process. Table 1 lists the possible events in the logistics process.
For a logistics object at the normal state n in the logistics process, suppose the given temperature threshold is 0°C-4°C during transport; if the environment temperature rises to 10°C, exceeding the given threshold value, the event ea will be triggered, and then the state of this logistics object transfers to a; at the same time, the alarm command will be sent to the related logistics staff, who will make relevant preparations to handle this event, and then the state of the logistics object transfers to ew; when exception handling starts, the state of logistics object will transfer to ep; after the exception handling, the state returns to n. The FSM-based active tracking model will keep working until this logistics object reaches the destination.

Rule-based event processing and decision-making
Describing the event processing and decision-making by rule can ensure the wireless sensor nodes will make the event processing and decision-making after collecting the original logistics data, and then the FSM will implement relevant state transition, for the purpose of active status tracking [13][14][15]. The rule-based event processing and decision-making module consists of a sensor, rule description, a rule interpreting engine, configuration, a commander interpreter, and a storage. The format of rule includes series number, type, logic condition, minimum value, maximum value and motion. Every rule states the decisive-making behaviour in a specific state upon the occurrence of a specific event.

Design philosophy
The ALST means that the logistics object can perform active tracking and management of its own transport state, and autonomously respond to the changes of the logistics environment, without having to passively receive the decision support of the backend server. Compared with the traditional centralized tracking method, it has such advantages as follows: Decentralized control and optimization: the ALST method has endowed the logistics object with certain intelligence; with the support of WSN, every logistics object can autonomously search for information and make decisions and determine the next motion before exiting the logistics process.
Local information processing: the ALST transfers the logistics logic task originally in the backend server to the wireless sensor nodes, makes use of the data processing ability of the wireless sensor nodes to process the logistics information and turns the backend server off.
Active decision execution: the ALST adopts active decision execution; after local information processing by the wireless sensor nodes, proper decisions can be made, effectively improving the instantaneity of decision execution.

3.2
System structure and function modules System structure. The system architecture is shown as below: The WSN-based active logistics state tracking system architecture consists of a warehouse gateway, a vehicle gateway, sensor nodes, an office terminal and a client terminal.
The back-end server is to provide the real-time cargo logistics data for the user, and communicate with the vehicle gateway; the client terminal can make real-time acquisition of the logistics data by connecting to the back-end server; the office terminal is to provide operation interfaces for the office staffs; the warehouse gateway is designed for the management and maintenance of all sensor nodes in the warehouse; and the vehicle gateway is to manage the sensor network. Function modules. Based on the system structure, different modules are designed, including the wireless sensor node function module, vehicle gateway function module, warehouse gateway function module and back-end server module. The first module, i.e. the wireless sensor node function module is described in detail below.
As the ultimate carrier of ALST, the wireless sensor nodes make use of their perceptual abilities to perceive the surrounding environment of the cargo, obtain logistics data such as related environmental parameters, etc., and then carry out relevant event processing and decision-making with their computing power, to further control the logistics transportation process of the object, and fulfil the ALST. The sub-modules of the wireless sensor node function module are shown below; finite state machine time processing and decision making wireless sensor node data collection data store data forwarding Finite state machine (FSM) sub-module: as the main control module, it manages the logistics state of the object in the whole logistics process; by describing the rela-tionship between event and state in the logistics process, with the occurrence of a specific event for the logistics object in a specific state, the wireless sensor node can skip to relevant state, so as to complete the state tracking of the logistic object in transport; this module also executes the control program.
Event processing and decision-making module: it makes event processing and decision execution of the logistics data collected by the data collecting sub-module. It returns the analytic results to the FSM sub-module, which then carries out state transition accordingly, in order to maintain the state of logistics object.
Data collection submodule: it collects data from various sensors such as temperature, humidity, vibration and infrared light sensors etc.; and then it goes back to main control submodule after data collection.
Data memory submodule: it carries out read-write operations in the flash storage for wireless sensor nodes.
Data transmission submodule: it controls the data communication between wireless sensor nodes and sensor gateway.  The warehouse gateway converts orders into binary data, and writes the data into the base node; through wireless communication, the base node transfers the data to the sensor node, which inputs the data into the Flash, and then completes the initialization; and then the sensor node enters the dormant state. 2. Vehicle loading: The sensor node in the dormant state is placed in the package and then loaded in the vehicle; after the vehicle gateway sends a message to the sensor node, the sensor node sends back the ACK to the vehicle gateway; then the registration is finished And the sensor node is ready to work. 3. Determine whether the object is loaded onto the wrong vehicle: Aroused by the vehicle gateway, the wireless sensor node communicates with vehicle gateway to acquire the vehicle information, and then compares the acquired information with that obtained at the initialization stage, checks whether the information is consistent, and determines whether the logistics object is loaded onto the wrong vehicle. 4. Periodic collection of logistics data: The wireless sensor node executes its logistics collection task, and with its perception ability, periodically perceives the surrounding environments such as temperature, humidity, geographical location and vehicle information, so as to obtain the logistics data. 5. Event processing: After data collection, the wireless sensor node makes relevant decision analysis and judgments on the collected logistics data, including the environment. 6. Decision Execution: End

System Implementation and Test
The wireless sensor node module is the key for system implementation. This paper puts emphasis on the implementation of the wireless sensor node in the TinyOS platform, and performs test on the system.

4.1
Wireless sensor node module Implementation environment. The development environment of the system is given in Table 2: In this paper, the author selected the IRIS intelligent node of Crossbow as the wireless sensor node, and also the MIB 520 programming of Crossbow, and adopted the TinyOS 2.x operation system for the wireless sensor node, and the XP operation system for the PC programming environment; nesC language was taken as the programming language, and the programme was transcribed into the IRIS node after being compiled by related commands.
Component-based program model. TinyOS consists of a dispatcher and a series of components; the TinyOS-based program model is shown as below: The node hardware, located in the bottom layer, is designed for implementing all hardware functions; the hardware abstraction layer (HAL) component is to encapsulate the bottom layer hardware; the system component is to execute the services provided to the components of the application layer; the library component provides the library function; the application component is used to implement specific functions; and the MAIN component is designed to initialize the hardware, start the task dispatcher, and execute the initialization of the user component.
ALST Program structure. During the programming of the wireless sensor node ALST in TinyOS2.x, some built-in components can be directly applied; besides, the modules, including DataAcuisition, FSM and Datatransmission etc., should be written separately. This paper emphasizes the workflow and codes of the FSM module, because it is the main control module of the whole program.
FSM, the infinite state machine module, can invoke other modules to serve the program; the workflow is given as follows: 1. Start the MainC module: start the control program; 2. Start the TimerMillic Timer: start the logistics task; and by starting the timer, start the periodic collection task; 3. Revoke the DataAcuisition Module: collect data from sensors, and then return various data; 4. Revoke the RuleManager module: perform data analysis and processing; 5. State transition: carry out state transition on the basis of processing results, and maintain the state of the wireless sensor node in the dynamic environment. 6. This paper captures the related codes in the FSM implementation process in the temperature collection period.

System test
System tests were conducted on the availability and performance of the ALST system based on WSN, to check whether the system could fulfil the initial design objective.
System functional test. The system functional test was mainly to check whether the wireless sensor node can actively track the logistics state of the object and help the logistics object complete the whole process. The test content included the tests on vehicle location information, real-time environmental data monitoring, event processing and decision making, and rule modification by commands. Take the real-time temperature monitoring test for example. The detailed description is shown below:

Homepage
Order manage Node manage Gateway manage Vehicle manage Client manage Logistics monitoring

!"#$%&'()*$+ #$"+ '+ #,#-+ '#.,"/$0*'+ 1+ #&2
Real-time monitoring of order temperature Pause Hide Real-time temperature of sensor node TEmperature( ) Fig. 6. Temperature change curve test diagram In this paper, a temperature sensor was adopted to test whether the wireless sensor node can make active tracking of the logistics object at different temperatures. In order to simulate the temperature variation in the real logistics environment, the temperature in the test environment was dynamically changed through manual control to test the response of the wireless sensor node. Fig 6 depicts the temperature data of the IRISA node over time, indicating that despite the dynamically changing temperature, the wireless sensor node could still stably transfer temperature data and collect data in real time, and provide real-time temperature data to the back-end server.
System performance test. The performance test was conducted to check whether the adopted active status tracking method had any improvement, compared with the centralized tracking method. It includes the tests of: received data quantity of the backend server, energy consumption of the wireless sensor node, decision response speed, and computing capacity of the wireless sensor node.
The computing capacity of the wireless sensor node was tested by analyzing the time taken by the wireless sensor nodes to calculate the delivery data of the logistics object; in the test, the calculation complexity could be adjusted by changing the number of logistics sites in the system. Fig 7 depicts the time changing curve with the number of logistics sites, which shows the computation time of wireless sensor nodes increased with the number of logistics sites increasing. When the number of sites reaches a certain threshold, the wireless sensor nodes cannot perform the calculation, because the limited RAM space in the IRIS nodes is not enough to store excessive site data. In this case, it is necessary to distribute some calculation tasks to the backend server or sensor gateway, so as to ensure the overall performance of the system. The results show that the active status tracking method can: 1. Effectively reduce the data traffic in the logistics system; 2. Improve the response speed of the system in decision-making; 3. In small-scale logistics systems with less computation amount of logistics tracking logic, this method can effectively improve the response speed of the system in decision-making.

Conclusion
This paper, by fully integrating the characteristics of WSN, designs the system architecture based on the design philosophy of the active logistics status tracking method.
It also constructs and realizes such hardware function modules as wireless sensor node, in-vehicle gateway, user terminal and backstage server etc.
It adopts the finite-state machine (FSM)-based active tracking model to maintain the logistics object; and then carries out programming of wireless sensor node active status tracking in TinyOS2. x.
Finally, this paper performs the system test under normal operation. The active logistics status tracking system can be widely applied in the logistics industry, so as to optimize the logistics process, reduce losses and improve logistics operation efficiency.