Paper— Research and Application of the IOT Gateway Based on the Real-Time

— The Internet Of Things (IOT) gateway plays an important role in connecting the traditional information network and network aware, in view of the present people use outdated development ways to realize Internet gateway software proposed a scheme of using real-time Java technology. This paper uses ARM cortex-A57 architecture of AMD Opteron 1100 processor as the core to build IOT gateway system hardware platform, through the gateway to realize remote monitoring of underlying device. The IOT gateway adopts "Internet + Sensor Network / FieldBus Technology" network schemes to realize wired / wireless data exchange, and use the fully compatible Real-Time Specification for Java (RTSJ) of the WebSphere Real Time development platform to achieve the Internet gateway protocol conversion and the design of the two layers network communication software to ensure the IOT gateway security real-time communication. Finally, this paper gives the implementation technique and application of the gateway.


Introduction
With the development of sensor, wireless communication and embedded system technology. It has become a topic of great concern to people that how to fuse electronic devices, computers, and communications. Internet Of Things (IOT) is a sensing equipment which is by using sensor, the global positioning system and other information [1] . As the agreement it can make anything in the world connect to the Internet, and let people and objects, objects and objects have no barrier to inform and communicate. And then it can realize intelligent identification, tracking, positioning, monitoring and management and so on like these functional networks. The IOT has been widely used in warehousing and logistics, smart grid, public security, intelligent buildings and other fields. The IOT gateway plays a very important role in the Internet of things. It is a key equipment to integrate all kinds of things in the Internet of things. It not only can meet the access needs in local area short distance communication, implementation and public network connection, but also can complete forwarding and control, exchange signaling and encoding and decoding functions, and terminal management, authentication and other functions ensure the quality and safety of business networking [2] . With the emergence of new things, new function demand makes networking gateway design more and more complex, traditional development methods (C / C++) programming is too complex, low development efficiency, easy error and lack of safe has become hinder the development of the technology of Internet of things, because this needs of new development language and means to promote the development and application of the Internet of things technology [3] .
Fortunately, the characteristics of Java technology compensate for the above shortcomings, and SUN Company united IBM and Sun Microsystems Company developed Java language in real time extension of the standard according to the analysis of the demand of real-time extension platform, namely the real time specification for Java (RTSJ, JSR-001) [4] . After making up for the defects of the Java language in real-time applications, real-time Java not only inherits the characteristics of Java language itself but also provides a more reliable and predictable scheduling strategy, a variety of memory models, a better predicable threading and synchronization model, asynchronous processing and high resolution (high-resolution) time mechanism, to meet a variety of unique networking system real-time requirements. This paper will use the software design of real-time Java technology to complete networking gateway based on RTSJ, it not only simplifies the programming difficulty but also guarantees the real-time requirements of the system. To achieve the RTSJ standard, it needs the support from the underlying operating system, JRE and Java Library (Java Class Library, JCL) [5] . This paper is fully compatible with the RTSJ standard, and contains a number of new technologies, designing to improve the real-time system of WebSphere Real Time IBM development platform. The WebSphere Real Time's basis is IBM's cross platform J9 technology, introducing the new advance ahead of time (AOT) compilation technology and deterministic garbage collector metronome GC. It provides hard real-time performance for the system which is not suitable for the use of JIT compiler, and also ensures the high real-time performance of the Internet gateway [6] . Linux real-time operating system provides low latency and hard real-time applications with POSIX real-time specification of real-time services to support the RTSJ behavior. In this paper, the AMD Opteron 1100 processor which supports J9 technology is used as the hardware platform of the Internet of things gateway. It has strong data processing ability and control ability, which are very suitable for the application in the Internet of things gateway equipment.
In things Internet era, things are no longer just a matter of Internet connected, but with the mature development of the Internet combined, more fully aware of all aspects of people's lives. In this paper, to network technology development as the background, this paper puts forward the AMD Opteron A1100 processor and Linux operating system networking gateway design scheme based on; on this basis by "Internet (Internet/3G) + sensor network technology/field bus" to the network to achieve a variety of different communication technology standards of interoperability. The software design of the Internet Of Things gateway based on Java technology to realize the Internet of things to the Internet of things by using RTSJ as the reference.

2
The System Architecture of the IOT Gateway The IOT is an integrated network which is with overall sensing, reliable transmission and intelligent processing feature. A large number of sensor data acquisition nodes are connected into a unified whole through the field bus and sensor network technology [7] . The information will be collected for further processing, and connect to Internet/3G network to realize remote monitoring of networking equipment, as shown in Figure1. Because of the difference of the different things in the bottom region of the device and the communication protocol, the system uses field bus and wireless sensor network and some other multiple access technology to connect to the core network; it will also realize the remote transmission and data protocol conversion. In this paper, Internet of things uses the architecture of hierarchical communication system: The perception layer: including the sensing and controlling technology, it finishes the network control and physical access of sensing extension device, and matches various sensing network technologies to realize the access of different communication protocols [8] . In order to meet the diversification of the underlying equipment of the Internet of things, including smart home, smart communities and intelligent transportation and other industries, each module communicates with network layer through the wireless sensor network and field bus technology, so as to carry out centralized data collection and control [9] .
The network layer: a platform of managing Internet of things system [10] . Because of different uses of the underlying network and different technical standards, this paper bases on the idea of modularization by using Web Sphere Real time to the develop platform. It also uses real time Java technology to realize the diversified management function of the Internet of things gateway, such as Web service, the protocol conversion of different networks, as well as information aggregation and security applications, and some other gateway functions. In addition to the management function, another key technology of the network layer also includes the long-distance transmission of data.
The application layer: Application layer: the application of the Internet of things architecture and business management system, providing services directly to the application process of end users [11] . The user connects with internet of things management system platform by using browser or client software through Ethernet / 3G network. By using the perceptual data of analysis processing, the remote controlling computer and mobile terminal networking to realize the remote real-time monitoring of the bottom of the Internet of things with Web service.

The System Processor/Storage Module Design
In order to realize the basic functions of the networking gateway, at first, it's necessary to construct a minimum system of IOT gateway system hardware platform. Running embedded operating system is regarded as the basis of realizing the upper formation function. Then, the hardware communication module corresponding to communicating protocol should be extended, and then it can realize the data exchange between gateway and Internet as well as sensor network [12] . This system uses the AMD Opteron A1100, which is produced by AMD Company and has the high performance, low power and supporting the technology of J9, as the main control chip to realize the data processing in various aspects such as protocol conversion, management and security. A110 Opteron processor is a server processor which is based on the ARM Cortex-A57 64-bit architecture, SoC single chip design, and with a large capacity memory / storage. It also has rich peripheral interfaces and transceiver chips that can expand the data which access to the various protocols. And then it controls the transmission of all kinds of signals. The system memory Flash is used to store the Internet of things system, the operating system, the data resources of Web server and the file system needed to support all kinds of services. Memory is expanded by RDIMM DDR3 channel and the maximum can support 128GB. In this paper, the hardware platform is composed of external expansion memory, ZigBee/FielBus communication module, USB3.0 interface and network interface. The hardware platform of the Internet of things system is shown in Figure 2.

The System Network Interface Design
Internet communication module. Internet communication module makes the gateway connect to the wide area network, and this paper uses wired and wireless. The wired communication module uses RTL8111DP-GR control chip from the Realtek Semiconductor Corporate, which has the network real-time management function and completely conforms to the DASH long-distance network management technology standard. The module is connected with the processor through the PCI-E interface and gets communication with Internet by using TCP/IP embedded by Linux operating system, which reduces the difficulty of the design, and greatly improves the ability of the gateway processing data [13] . This system uses the TD-SCDMA module to realize the 3G wireless communications accessing to function. The TD-SCDMA module uses the LC6311 chip made by Core Technology Company. It is very simple to connect LC6311 and A1100 Opteron. They get connection through the standard USB interface. LC6311 is a wireless module of TD-SCDMA&GSM (GPRS) dual mode, whose internal can integrate TCP/IP protocol [14] . The module has SMS and high-speed data services and some other functions, and it can also be widely used in high-speed data transmission of the Internet of things.
Sensor network communication module. Physical network gateway system adopts to modular controlling. In this system, the data transmissions between each subsystem and control platform are realized through field bus and wireless sensor network technology. And it also realizes the protocol conversion between TCP/IP and different types of bottom network. During designing, it uses Philips's TJA1050 transceiver chip and ADM2483 Company's ADI transceiver chip passing through the bus coupler (BCU) to achieve the communication between the processor and the Can/RS-485 field. The FieldBus controller can realize the data communication between the RO/DI and UART0 of the universal asynchronous serial interface TXD/RXD, only by connecting the two signal lines. Meanwhile, the sensor node adopts to ZigBee module to realize the wireless sensor network. ZigBee module chooses the CC2430 chip of 2.4 System which is the first production in accordance with ZigBee technology of Chipcon Company. The chip completes the function of data short-distance transmitting and recepting by connecting with the processor through the UART1 interface [15] .

The IOT Gateway System Software Design
Gateway software in addition to the coordination of hardware to realize data collection and send function, it still needs to implement the data protocol parsing and storage, remote sensing and security access control, etc. In order to better according to the modular thought to realize these functions, the system will be divided into two parts of the embedded Web server gateway and protocol analysis program, the main unction: unified application data is extracted, in accordance with the TLV (Type, Length, Value) way to organize and encapsulate packets, data acquisition/transmission, data is stored in the database; 2) users can directly access gateway Web browser/client software, the real-time remote monitoring. The IOT gateway software design structure diagram is shown in figure 3.

The Sensor Network Communication Module Design
Sensor network module is to achieve the communication function between the gateway and the underlying perception extended network the sensor network data gathered here. Described in this article the Internet gateway uses the OSI reference model to complete two different protocol conversions at the transport layer ,and through Java multi-threading technology in real time to realize data transmission function at the same time, a thread is responsible for a transport protocol. Real-time Java technology provides real-time thread constructor, the constructor parameters of memory management to solve the impact of garbage collection in real-time, so as to ensure the real-time performance of IOT gateway design. The Web server or specially written client program can be accessed through TCP protocol and the underlying communication equipment data acquisition module, communication port to port 8088. Sensor network module is responsible for the operation of user by sending thread to each device, The receiving threads are receiving data from the sensing network and according to TCP/IP protocol format data packages, realization of the underlying device node protocol to TCP/IP protocol conversion, the latest data is stored in the local database, real-time refresh networking gateway database content, for other programs to deal with.
Real-Time thread of FieldBus devices through real-time threads class to create a thread object call FB_TX() and FB_RX() function to realize the field bus interface transmission operation. In order to complete conversion between the TCP/IP data and field data format real-time thread calls FB_TCP() and TCP_FB() function to realize data protocol conversion, the TCP/IP protocol communication data according to the field bus protocol format saved after encapsulation, sending it out by the field bus interface; ZigBee node set between the gateway and the AT instruction set complete ZigBee network communication agreement. In this paper, according to the modular thought, in the underlying equipment data acquisition module and IOT gateway interface control commands and data acquisition module only between interactive instruction, do not focus on specific network protocol, achieve network protocol independence. Because the gateway connected to a variety of different underlying devices, then the content of the data mapping relationship management is very important gateway. Hang the bottom of the equipment under this gateway for all possible input and output data format were analyzed, and then defines the underlying equipment respectively corresponding communication interface configuration. FieldBus thread part of the code is as follows: import javax.realtime.*; public class FBGateway{ scheduling = // Scheduling priority parameters of the object new Priorityparameters(PriorityShceduler.MIN_PRIORITY+20); memory = // Copy of a valid memory parameters structure thread new MemoryParameters(MemoryParametters.NO_MAX, 0); area = HeapMemory.instance(); //Thread object memory area, control of garbage collection ProcessingGroupParameters group = null; // Processing parameters control of periodic set of activities Runable logic = new MyThread();//Reference implementation Runable interface instance RealtimeThread FB_rt = new RealtimeThread(scheduling, memory, area, group, logic); };

The Internet Communication Module Design
Internet module by operating system internal TCP/IP protocol stack to communicate with each other between the gateway and the application layer, the user through the browser or client software access Internet service platform to realize remote monitoring of the underlying devices. In this paper, real-time Java and Socket technology is adopted to establish the software support platform, and to implement multithreaded server service, it can execute concurrently multiple commands [16] . In the server-side call WebSocket class constructors, initialize the server-side service program specified port. Server-side programs using WebSocket object call accept() method receives the client connection requests and returns a Socket class object, representative and client to establish a communication interface. The client to the server "connected" request for the server IP address, according to the IP address and initialize the port number to establish a client terminal communication interface configuration object, realize the command buffer pool method with the server for data transmission. When the communication after the operation, the two sides call close() function to release the Socket resources.
This article uses the Executor Service to create thread pool which contains multiple threads, and a thread is for a sensor network module. Each thread uses TaskHandler class to invoke the Run () method to perform, the relevant operation, this article uses the real-time Java technology to create real-time thread class that provides the Executors service, through real-time thread class, RealtimeThreadFactory promises realtime capability of common thread ThreadFactory. Usage of WebSphere Real Time development platform based on the Time schedule of the Metronome GC implementation within the JVM garbage collection behavior of certainty, low pause times, to ensure the high Real Time capability of the garbage collector [17] [18] . Server platform uses real-time Java mechanism to convert common thread for real-time thread part of the code is as follows:

The IOT Gateway System Application and Test
The article test Internet of Things to be based on the background of soot emission monitoring. Every time it detects a target, the system will automatically monitor data such as time, images, and blackness values in the data server. In the interface, the whole area is divided into monitoring image display area, monitoring target list and monitoring analysis drawing area, etc. as shown in figure 4. To query the target state as an example, input the name that needs to find in the box (support fuzzy queries), double-click the monitoring target list to control monitoring, the system automatically will be shot a preset to the monitoring target, corresponding to the preset will target image displayed in optics of the monitoring window. Corresponding digital monitor-ing target list all monitoring target, a preset, monitor target name, monitor, a recent monitoring of time and blackness values. Blackness values of yellow said generally excessive alarm, red said exceeds bid badly. When the monitoring value exceeds bid (greater than the alarm threshold), regulators can view real-time pollution data of the monitoring target.

Fig. 4. Carbon Monitoring System Test Pattern
In the process of Internet of things software implementation, this article uses fully compatible with the RTSJ WebSphere Real Time development platform to ensure real-time service gateway. As can be seen from the figure 5, real-time and the Metronome GC significantly improved the variability of operating time, each task has a good stability, a large number of operations are made within the time 11 ~ 20 milliseconds. Worst case of average operation time and operation time are very close, which full compliance with millisecond precision of real-time systems applications. For most developers, they provide a predictable performance and won't appear unpredictable GC delays Java server that is very attractive.
Monitor Image

Monitoring Analysis
The Monitor

Conclusion
In this paper uses AMD Opteron 1100 processor architected by the Cortex-A57 ARM and sensor network technology / field bus intelligent gateway hardware to design plan. And it develops a platform by fully compatible with WebSphere Real Time RTSJ to achieve the software design of wired / wireless gateway protocol conversion and networking three layers network communication. It can achieve the TCP protocol reliable communication with the Internet which is known transmission layer network upside. Downside, it completes the reliable connection of the bottom equipment and the home gateway and the remote monitoring and controlling of the network terminal.
It ensures the real time design of the Internet gateway that real time thread and JVM of low pause time garbage collection and some other new features provided by Java real time specification. And it has achieved to obtain the action instructions of accurate information on the bottom of the underlying device and the implementation of user through the Internet. It provides application designers with necessary tools to solve the uncertainty of traditional Java language that the leading of real time Java, and then it meets the quality of the home gateway service. For developers, there will be very big advantages leading the advantages of introducing Java language into the creation of the RT system. At the same time, the advantages it has greatly improved the designing difficulty of desktop software of embedded equipment. Developers can easily set up the web interface of embedded equipment and directly connect to the Internet/3G network transmission data. Real time Java provides a modern mainstream language designed for productivity to real time programmer. It is believed that the leading of real time Java technology will bring a great impact on the real time field.