## 2 Architecture
### M2M Gateway Resource Control and Management
#### 2.2.2 Resource Mapping Mechanism
Then, through the mapping mechanism, the resource is mapped from abstract to concrete. The procedure is shown in Figure 3.  
As shown in Figure 3, the procedures to map the resources address are as follows:  
1. Extract the data containing the PLC model and the description used by the resource. Divide the abstract description of the resource into two parts, _i.e._, the storage area and the number. 2. According to the PLC model of the resource, load the corresponding mapping rule table. 3. If the mapping rule table fails to load, stop and return an error message. 4. After successful loading of the mapping rule table, use the extracted storage area and number to map the specific storage area. 5. If the mapping fails, stop and return an error message. \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Storage Area** & **Starting Number (Decimal)** & **Ending Number (Decimal)** & **Hex Number** & **Heading (Hex)** \\ \hline S & 0 & 1023 & 10 & 0000 \\ X & 0 & 377 & 8 & 0400 \\ Y & 0 & 377 & 8 & 0500 \\ T & 0 & 255 & 10 & 0600 \\ N & 0 & 4095 & 10 & 0800 \\ D & 0 & 4095 & 10 & 1000 \\ D & 4096 & 9999 & 10 & 9000 \\ \hline \hline \end{tabular}
\end{table} 
Table 11: Structure of the mapping rule table for a Delta PLC. Figure 3: Diagram of the process for resources address mapping. * If the mapping is successful, perform the address conversion through the appropriate algorithms. * Complete the resource mapping. The resource can be mapped from the description on the application layer to the description on the physical layer, and to extract the information specific to the sensors for that resource by searching the resource status description table, including the descriptive information of the sensor, the data protocol used by the sensor, and the communication protocol connected to the sensor. The detailed structure of the resource status description table is shown in Table 12.  
The structure shown in Table 12 illustrates that one communication module can connect multiple PLCs and that one PLC can connect multiple sensors. The data required by the system are the physical data collected by the sensor, which are stored in the storage area opposite to the PLC and connected through hard-wiring. The sensor has many characteristics, including the sensor number, the definition of the sensor data (e.g., temperature or pressure), the sensor data, and the data units. In addition, there is also the number of the PLC that connects to the sensor and the data protocol used by the PLC. The resource state description table describes the details of the resource information and resource approach in the access system. The interface description table contains the basic information for the terminal communication module connected to the gateway, including the number of the terminal communication module, the GPRS protocol employed, and the interface number used by the terminal communication module to connect the system. The interface description table depicts the M2M gateway and terminal communication module information. As the bridge, these communication modules provide the channel for data exchange between the bottom sensor and the server. The interface description table structure is shown in Table 13.