AKHILRAJ V GADAGKAR
AKHILRAJ V GADAGKAR

Reputation: 161

Is there a way to trasnmit and receive data between simulated and real modem in UnetStack

I am working on an attribute based routing protocol, where source node (Node A) collect attributes from two neighbor nodes (Node B and C) and based on ranking, Node A decides,to forward its data either to Node B or Node C

Now, I want to test this algorithm in test-bed with real UnetStack compatible modems,but there are only two real modems available,so if I create my topology with source node (Node A) running on laptop (using simulated modem) and neighbors(Node B and C) run using real modems. Is there a way that Node A can transmit and receive data from Node B and C. As Node B and C uses real modems.

Please let me know, how I can do this using only two real modems,also suggest if there is any other approach.

Upvotes: 1

Views: 134

Answers (1)

Mandar Chitre
Mandar Chitre

Reputation: 2280

When 2 modems are in water, they can communicate to each other using their PHYSICAL service agent (often named phy). Higher level agents such as uwlink then use phy to provide reliability, etc.

In a simulated environment, the PHYSICAL service is provided by the HalfDuplexModem agent (also named phy). This agent can talk to HalfDuplexModem agents on other simulated nodes, in the same way as modems underwater talk to each other. Higher level agents such as uwlink will use this phy for communication, and the application won't notice the difference.

However, the HalfDuplexModem in the simulated environment can't directly transmit a packet to a real modem in water, or receive a packet from it. Nodes in the simulated environment can only talk to each other, and the nodes in water can only talk to each other. So you can think of the simulated world as one subnet, and the real world as another subnet, even though both can be part of one Unet. To connect the subnets together, you need a gateway node that relays packets between the subnets.

To make things more concrete, let's say nodes B and C are in water subnet, and node A is in the simulation subnet. For node A to be able to talk to nodes B and C, you need at least one of node B or C to also be in the simulation subnet. To avoid multi-hop routing, let's say we prefer to have nodes B and C have presence in both subnets. The way to do this is to create a simulation with nodes A, B and C. Then, on nodes B and C, add in a new phy2 PHYSICAL agent that will be used by a new uwlink2 LINK service agent. The phy2 agent will be a proxy for the real modem, sending any TxFrameReq or DatagramReq to the modem via a UnetSocket, and passing on RxFrameNtf (and other notifications) from the modem. Then set up the router on nodes B and C to route packets to nodes B and C via uwlink2 and to node A via uwlink.

The agent setup on nodes B and C will look something like this:

|--------------------- Simulator -------------------------------|    |--- Modem ----|
[DatagramReq] --> router -A--> uwlink  --> phy (HalfDuplexModem)
                     \----BC-> uwlink2 --> phy2 -->  UnetSocket  --> phy (on modem)

with the overall network configuration:

    A -sim--- B ---(UnetSocket)--- modem B --\
     \                                    acoustic
      \-sim-- C ---(UnetSocket)--- modem C --/

The only agent you'd need to write is the proxy phy2. Fairly straightforward to write, as you need to send all messages to it via the socket to the modem, and send all notifications from the socket back on the notification topic for the proxy agent.

Upvotes: 1

Related Questions