## 2 Architecture of the Proposed SDAMs
### Software Architecture
#### 2.2.1 NS3 Networking Process  
The NS3 simulator [13] is a widely applied software simulation platform. Due to the high-performance AM5728 processor, we can run a complete NS3 program in a single ARM core. Further, the underwater-acoustic-network (UAN) module [14] developed by Washington University is embedded in NS3 as the basic for protocol development. At first, we port the NS3 simulator over the AM5728 ARM core process, and then the protocol modules of the NS3 and UAN are applied directly to build the stacks on the SDAM. Hence, the proposed SDAM can run the NS3 scripts and use the UAN's network protocol, including the original built-in protocols or our own designs.  
Generally, in NS3-based software simulations, when a packet transmission request is triggered by an application, no real information bit is generated, and the application layer sends an indication message to the transmission layer. When the packets are delivered layer by layer through the protocol stacks, real information bits are added to the packet header, but the data section remains empty to reduce the memory consumption during the simulation. In the proposed platform, the data packet will be transmitted through a real acoustic channel, hence the data section cannot be empty. In the proposed platform, a new application layer is developed to generate data and fill it into the proper content section of the data packets.  
The real information data for transmission can be randomly generated or collected from external sensors. The interface board provides interfaces to various peripherals such as USB, LAN, PCI, and HDMI; hence, the platform can be connected with various sensors. The processes for sensor data acquisition are embedded in the developed application layer module. Multiple application layer modules are defined to meet different application requirements; for example, the trigger timing of the packet sending in an application layer can be selected to regular trigger or random trigger.  
Since the whole NS3 simulator can be loaded in the ARM core, the existing protocols in the NS3 platform and UAN module can be directly applied. In the proposed framework, we apply the standard UDP protocol for the transmission layer. In the routing layer, we implement the static routing protocol  
Figure 5: Data flow between different processes and devices.  
as outlined in the previous demonstration. In the static routing protocol, the routing table is predefined and the relay node always knows the next hop for transmission. In the UAN modular, without acknowledgement, the Aloha protocol was applied in the MAC layer. In the proposed framework, we extend the Aloha protocol by employing the packet acknowledgement technique. Further, we develop a new physical-layer module in the UAN module and implement bidirectional processing between the NS3 process and the ARM-DSP interaction process. The details of the bidirectional processing are as follows. First, the ARM-DSP interaction process sends the packets received by DSP to the NS3 process via the local socket, and then the UAN physical-layer module generates a receiving event and transfers the packets up to the MAC layer. Second, when data is delivered up to the UAN physical-layer module via the NS3 process, the module sends the packets to the ARM-DSP interaction process via the local socket, which then passes the packets to the DSP core program. A new thread is created to listen to the socket to control the bidirectional data flow. The processing flow of the NS3 protocol process is shown in Figure 6.