我想在 IntelliJ IDEA 中设置网络模拟。为此,我尝试将 IDE 配置为使用包中包含的 2-node-network.groovy 脚本。我可以运行模拟脚本并通过 Web 界面访问调制解调器,但某些 shell 命令(例如“tell”、“host”等)将不起作用。
到目前为止我采取的步骤:
在IDE中配置一个环境变量指向Unetstack主目录(unet_home=.../unet-3.0.0/)
在 IDE 中使用从 2-node-network.groovy 脚本复制的代码进行了新的运行配置,但更改了 home 变量:
import org.arl.fjage.RealTimePlatform
def unet_home = System.getenv("unet_home");
println(unet_home)
println '''
2-node network
--------------
Stack:
Node A: tcp://localhost:1101, http://localhost:8081/
Node B: tcp://localhost:1102, http://localhost:8082/
'''
platform = RealTimePlatform // use real-time mode
// run the simulation forever
simulate {
node 'A', location: [ 0.km, 0.km, -15.m], web: 8081, api: 1101, stack: "$unet_home/etc/setup"
node 'B', location: [ 1.km, 0.km, -15.m], web: 8082, api: 1102, stack: "$unet_home/etc/setup"
}
网页外壳输出:
> mac
<<< CSMA >>>
[org.arl.unet.mac.CSMAParam]
maxBackoff = 30.0
minBackoff = 0.5
phy = phy
reservationsPending = 0
[org.arl.unet.mac.MacParam]
ackPayloadSize = 0
channelBusy = false
maxReservationDuration = 600.0
recommendedReservationDuration = 15.0
reservationPayloadSize = 0
> tell host('A'), "Hello"
Unknown method: host(...)
> tell
Unknown command or property: tell
>