我尝试模拟文档(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 ]发布于 2019-05-24 15:31:40
MyAcousticModel需要正确的构造函数。您可以将其添加到类定义中,如下所示:
import org.arl.unet.sim.channels.AbstractAcousticChannel
class MyAcousticModel extends UrickAcousticModel {
MyAcousticModel(AbstractAcousticChannel parent) {
super(parent)
}
:
:
}https://stackoverflow.com/questions/56250128
复制相似问题