1

我尝试模拟文档中给出的 AbstractAcousticChannel 示例(https://www.unetstack.net/channels.html#extending-the-abstractacousticchannel)我遇到了以下错误,

groovy.lang.GroovyRuntimeException: Could not find matching constructor for: MyAcousticModel(MyAcousticChannel)

渠道

import org.arl.unet.sim.channels.*
import org.arl.unet.sim.channels.UrickAcousticModel

class MyAcousticChannel extends AbstractAcousticChannel{
@Delegate UrickAcousticModel acoustics = new MyAcousticModel(this)
@Delegate BPSKFadingModel comms = new BPSKFadingModel(this)
 }

模型

import org.arl.unet.sim.channels.UrickAcousticModel

class MyAcousticModel extends UrickAcousticModel {

private final def noiseLevel = [ 0: 20, 1: 30, 2: 35, 3: 40, 4: 42, 5: 44, 6: 46 ]


float seaState = 2

double getNoisePower() {
return Math.pow(10, noiseLevel[seaState]/10) * model.bandwidth
}
}

并在模拟中

channel = [ model: MyAcousticChannel ]
4

1 回答 1

1

需要正确的MyAcousticModel构造函数。您可以将其添加到您的类定义中,例如:

import org.arl.unet.sim.channels.AbstractAcousticChannel

class MyAcousticModel extends UrickAcousticModel {

  MyAcousticModel(AbstractAcousticChannel parent) {
    super(parent)
  }

    :
    :

}
于 2019-05-24T07:31:40.017 回答