模拟出错 "groovy.lang.MissingPropertyException: No such property: ROUTING for class: org.arl.unet.sim.SimulationAgent"

Getting Error in simulation "groovy.lang.MissingPropertyException: No such property: ROUTING for class: org.arl.unet.sim.SimulationAgent"

我在模拟脚本中使用 node.startup ={} 通过在每个节点发送 routeDiscoveryNtf 来生成静态路由。我已经包括了所有 headers,但仍然无法识别 ROUTING 服务。

模拟脚本如下,所有节点启动功能相同

    //! Simulation: 5-node network
    import org.arl.fjage.*
    import org.arl.fjage.Agent.*
    import org.arl.fjage.RealTimePlatform
    import org.arl.unet.sim.*
    import org.arl.unet.sim.channels.*
    import org.arl.unet.phy.*
    import org.arl.unet.phy.Physical.*
    import org.arl.unet.net.*
    import org.arl.unet.*
    import org.arl.unet.DatagramReq
    import org.arl.unet.net.Router
    import org.arl.unet.Services

    platform = RealTimePlatform
    channel.model = ProtocolChannelModel
    channel.soundSpeed = 1500.mps           // c
    channel.communicationRange = 100.m     // Rc
    channel.detectionRange = 100.m         // Rd
    channel.interferenceRange = 100.m      // Ri
    channel.pDetection = 1                  // pd
    channel.pDecoding = 1                   // pc

    simulate {
      def n1 = node '1', address: 1, location: [0.m, 0.m, 0.m], shell: true, stack:"$home/etc/initrc-stack"
    n1.startup = {
        def router = agentForService ROUTING
    router.send new RouteDiscoveryNtf(to:4,nextHop:1)
    router.send new RouteDiscoveryNtf(to:2,nextHop:1)
    router.send new RouteDiscoveryNtf(to:3,nextHop:1)
    router.send new RouteDiscoveryNtf(to:5,nextHop:1)
      }
     def n2 =node '2', address: 2, location: [70.m, 0.m, 0.m], shell:5102, stack: "$home/etc/initrc-stack"
  n2.startup = {
    def router = agentForService ROUTING
    router.send new RouteDiscoveryNtf(to:4,nextHop:2)
    router.send new RouteDiscoveryNtf(to:1,nextHop:2)
    router.send new RouteDiscoveryNtf(to:5,nextHop:2)
    router.send new RouteDiscoveryNtf(to:3,nextHop:4)
    router.send new RouteDiscoveryNtf(to:3,nextHop:1)
    router.send new RouteDiscoveryNtf(to:1,nextHop:5)

  }
  def n3 = node '3', address: 3, location: [-70.m, 0.m, 0.m], shell: 5103, stack:"$home/etc/initrc-stack"
  n3.startup = {
    def router = agentForService ROUTING
    router.send new RouteDiscoveryNtf(to:4,nextHop:3)
    router.send new RouteDiscoveryNtf(to:1,nextHop:3)
    router.send new RouteDiscoveryNtf(to:5,nextHop:3)
    router.send new RouteDiscoveryNtf(to:2,nextHop:4)
    router.send new RouteDiscoveryNtf(to:2,nextHop:1)
    router.send new RouteDiscoveryNtf(to:2,nextHop:5)
  }
  def n4 = node '4', address: 4, location: [0.m, 70.m, 0.m], shell: 5104, stack:"$home/etc/initrc-stack"
  n4.startup = {
    def router = agentForService ROUTING
    router.send new RouteDiscoveryNtf(to:1,nextHop:4)
    router.send new RouteDiscoveryNtf(to:2,nextHop:4)
    router.send new RouteDiscoveryNtf(to:3,nextHop:4)
    router.send new RouteDiscoveryNtf(to:5,nextHop:1)
    router.send new RouteDiscoveryNtf(to:5,nextHop:2)
    router.send new RouteDiscoveryNtf(to:5,nextHop:3)
  }
  def n5 = node '5', address: 5, location: [0.m, -70.m, 0.m], shell: 5105, stack:"$home/etc/initrc-stack"
  n5.startup = {
    def router = agentForService ROUTING
    router.send new RouteDiscoveryNtf(to: 1 , nextHop:5)
    router.send new RouteDiscoveryNtf(to: 3 , nextHop:5)
    router.send new RouteDiscoveryNtf(to: 2 , nextHop:5)
    router.send new RouteDiscoveryNtf(to: 4 , nextHop:1)
    router.send new RouteDiscoveryNtf(to: 4 , nextHop:2)
    router.send new RouteDiscoveryNtf(to: 4 , nextHop:3)
  }
}

模拟错误如下:

SEVERE: <3> > Exception in agent: simulator
SEVERE: <4> > Exception in agent: simulator
SEVERE: <1> > Exception in agent: simulator
SEVERE: <5> > Exception in agent: simulator
SEVERE: <2> > Exception in agent: simulator

虽然堆栈正在加载到每个节点,但没有创建路由。

日志文件统计信息为:

1562654374493|SEVERE|<1>@36:run|Exception in agent: simulator
groovy.lang.MissingPropertyException: No such property: ROUTING for class: org.arl.unet.sim.SimulationAgent
Stack trace: ...
org.arl.unet.sim.SimulationAgent.propertyMissing(initrc.groovy:216) ...
org.arl.unet.sim.SimulationAgent.getProperty(initrc.groovy) ...
ping-sim2$_run_closure1$_closure2.doCall(ping-sim2.groovy:37)
ping-sim2$_run_closure1$_closure2.doCall(ping-sim2.groovy) ...
org.arl.unet.sim.SimulationAgent.this$dist$invoke(initrc.groovy)
org.arl.unet.sim.SimulationAgent.methodMissing(initrc.groovy) ...
org.arl.unet.sim.SimulationAgent.action(initrc.groovy:172)
org.arl.fjage.Agent.run(Agent.java:777) ...

我认为 ROUTING 服务的规范名称是 org.arl.unet.Services.ROUTING。因此,您可能必须使用该字符串而不仅仅是 ROUTING

def router = agentForService org.arl.unet.Services.ROUTING