unetstack:找不到匹配的构造函数

时间:2019-05-22 05:52:10

标签: unetstack

我尝试模拟文档(https://www.unetstack.net/channels.html#extending-the-abstractacousticchannel)中给出的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 ]

1 个答案:

答案 0 :(得分:1)

import org.arl.unet.sim.channels.AbstractAcousticChannel class MyAcousticModel extends UrickAcousticModel { MyAcousticModel(AbstractAcousticChannel parent) { super(parent) } : : } 需要正确的构造函数。您可以将其添加到clas的定义中,例如:

{{1}}