完善了各组件的干扰处理,修改了部分组件干扰相关参数
This commit is contained in:
parent
92caff5268
commit
75cbcaa104
@ -17,6 +17,8 @@
|
||||
- 双模、多模制导
|
||||
- 各组件返回当前状态信息
|
||||
- Orientation 坐标系的调整(前向方向从 X 轴改为 Z 轴)
|
||||
- 将 getRunningState 提取到 SimulationElement 基类中
|
||||
- 末敏弹各探测组件的干扰处理
|
||||
|
||||
## [0.2.13] - 2025-04-23
|
||||
- 增加了烟幕弹对激光目标指示器、激光驾束仪、红外测角仪的干扰处理
|
||||
|
||||
@ -23,7 +23,7 @@ namespace ThreatSource.Tests.Indicator
|
||||
|
||||
_config = new LaserBeamRiderConfig
|
||||
{
|
||||
LaserPower = 1000,
|
||||
Power = 1000,
|
||||
ControlFieldDiameter = 5.0,
|
||||
MaxGuidanceDistance = 5000
|
||||
};
|
||||
@ -69,7 +69,7 @@ namespace ThreatSource.Tests.Indicator
|
||||
Assert.Equal("beamRider1", _laserBeamRider.Id);
|
||||
Assert.Equal("missile1", _laserBeamRider.MissileId);
|
||||
Assert.Equal("target1", _laserBeamRider.TargetId);
|
||||
Assert.Equal(1000, _laserBeamRider.config.LaserPower);
|
||||
Assert.Equal(1000, _laserBeamRider.config.Power);
|
||||
Assert.Equal(5.0, _laserBeamRider.config.ControlFieldDiameter);
|
||||
Assert.Equal(5000, _laserBeamRider.config.MaxGuidanceDistance);
|
||||
Assert.False(_laserBeamRider.IsActive);
|
||||
|
||||
@ -23,8 +23,8 @@ namespace ThreatSource.Tests.Indicator
|
||||
|
||||
_config = new LaserDesignatorConfig
|
||||
{
|
||||
LaserPower = 1000,
|
||||
LaserDivergenceAngle = 0.001
|
||||
Power = 1000,
|
||||
DivergenceAngle = 0.001
|
||||
};
|
||||
|
||||
var tankInitialMotion = new MotionParameters
|
||||
|
||||
@ -24,10 +24,10 @@ namespace ThreatSource.Tests.Indicator
|
||||
|
||||
_config = new LaserDesignatorConfig
|
||||
{
|
||||
LaserPower = 1000,
|
||||
LaserDivergenceAngle = 0.001,
|
||||
Power = 1000,
|
||||
DivergenceAngle = 0.001,
|
||||
JammingResistanceThreshold = 1.0,
|
||||
LaserWavelength = 1.06
|
||||
Wavelength = 1.06
|
||||
};
|
||||
|
||||
var tankInitialMotion = new MotionParameters
|
||||
@ -71,8 +71,8 @@ namespace ThreatSource.Tests.Indicator
|
||||
Assert.Equal("laser1", _laserDesignator.Id);
|
||||
Assert.Equal("target1", _laserDesignator.TargetId);
|
||||
Assert.Equal("missile1", _laserDesignator.MissileId);
|
||||
Assert.Equal(1000, _laserDesignator.config.LaserPower);
|
||||
Assert.Equal(0.001, _laserDesignator.config.LaserDivergenceAngle);
|
||||
Assert.Equal(1000, _laserDesignator.config.Power);
|
||||
Assert.Equal(0.001, _laserDesignator.config.DivergenceAngle);
|
||||
Assert.False(_laserDesignator.IsActive);
|
||||
Assert.False(_laserDesignator.IsIlluminationOn);
|
||||
Assert.False(_laserDesignator.IsJammed);
|
||||
@ -119,7 +119,7 @@ namespace ThreatSource.Tests.Indicator
|
||||
Wavelength = 1.06,
|
||||
SourcePosition = new Vector3D(0, 10, 0),
|
||||
Direction = new Vector3D(0, 1, 0),
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Mode = JammingMode.Blocking,
|
||||
Type = JammingType.Laser,
|
||||
Duration = null
|
||||
|
||||
@ -79,7 +79,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Wavelength = 4,
|
||||
SourcePosition = new Vector3D(10, 10, 0), // 更靠近探测器,且角度更小
|
||||
Direction = new Vector3D(0, 1, 0), // 45度角指向探测器
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Mode = JammingMode.Blocking,
|
||||
Duration = null,
|
||||
Type = JammingType.Infrared
|
||||
@ -107,7 +107,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Wavelength = 4,
|
||||
SourcePosition = new Vector3D(0, 150, 0), // 位于上方
|
||||
Direction = new Vector3D(0, 0, 1), // 指向前方,不是指向探测器
|
||||
AngleRange = 0.1, // 很小的角度范围
|
||||
AngleRange = 1, // 很小的角度范围
|
||||
Mode = JammingMode.Blocking,
|
||||
Type = JammingType.Infrared
|
||||
}
|
||||
@ -134,7 +134,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Wavelength = 4,
|
||||
SourcePosition = new Vector3D(50, 100, 0),
|
||||
Direction = new Vector3D(-1, 0, 0),
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Mode = JammingMode.Blocking,
|
||||
Type = JammingType.Infrared
|
||||
}
|
||||
@ -161,7 +161,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Wavelength = 4,
|
||||
SourcePosition = new Vector3D(10, 10, 0),
|
||||
Direction = new Vector3D(0, 1, 0),
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Mode = JammingMode.Blocking,
|
||||
Duration = 0.5,
|
||||
Type = JammingType.Infrared
|
||||
@ -198,7 +198,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Wavelength = 4,
|
||||
SourcePosition = new Vector3D(10, 10, 0),
|
||||
Direction = new Vector3D(0, 1, 0),
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Mode = JammingMode.Blocking,
|
||||
Duration = null,
|
||||
Type = JammingType.Infrared
|
||||
@ -254,7 +254,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Wavelength = 4,
|
||||
SourcePosition = new Vector3D(50, 100, 0),
|
||||
Direction = new Vector3D(-1, 0, 0),
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Mode = JammingMode.Blocking,
|
||||
Type = JammingType.Infrared
|
||||
}
|
||||
|
||||
@ -106,7 +106,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Power = 2000, // 修改为2000瓦特,与激光指示器一致
|
||||
SourcePosition = new Vector3D(50, 0, 0), // 修改为50米,与激光指示器一致
|
||||
Direction = new Vector3D(1, 0, 0), // 修改为(1,0,0),指向设备的方向
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Mode = JammingMode.Blocking,
|
||||
Duration = null,
|
||||
Type = JammingType.Infrared
|
||||
@ -147,7 +147,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Power = 500, // 保持不变
|
||||
SourcePosition = new Vector3D(0, 50, 0),
|
||||
Direction = new Vector3D(1, 0, 0),
|
||||
AngleRange = 0.1,
|
||||
AngleRange = 1,
|
||||
Mode = JammingMode.Blocking,
|
||||
Type = JammingType.Infrared
|
||||
}
|
||||
@ -183,7 +183,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Power = 10, // 保持不变
|
||||
SourcePosition = new Vector3D(50, 0, 0),
|
||||
Direction = new Vector3D(1, 0, 0),
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Mode = JammingMode.Blocking,
|
||||
Type = JammingType.Infrared
|
||||
}
|
||||
@ -219,7 +219,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Power = 2000, // 修改为2000瓦特,与激光指示器一致
|
||||
SourcePosition = new Vector3D(50, 0, 0), // 修改为50米,与激光指示器一致
|
||||
Direction = new Vector3D(1, 0, 0), // 修改为(1,0,0),指向设备的方向
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Mode = JammingMode.Blocking,
|
||||
Duration = 0.5,
|
||||
Type = JammingType.Infrared
|
||||
@ -266,7 +266,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Power = 2000, // 修改为2000瓦特,与激光指示器一致
|
||||
SourcePosition = new Vector3D(50, 0, 0), // 修改为50米,与激光指示器一致
|
||||
Direction = new Vector3D(1, 0, 0), // 修改为(1,0,0),指向设备的方向
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Mode = JammingMode.Blocking,
|
||||
Duration = null,
|
||||
Type = JammingType.Infrared
|
||||
@ -310,7 +310,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Power = 2000, // 修改为2000瓦特,与激光指示器一致
|
||||
SourcePosition = new Vector3D(50, 0, 0), // 修改为50米,与激光指示器一致
|
||||
Direction = new Vector3D(1, 0, 0), // 修改为(1,0,0),指向设备的方向
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Mode = JammingMode.Blocking,
|
||||
Duration = null,
|
||||
Type = JammingType.Infrared
|
||||
|
||||
@ -69,7 +69,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Wavelength = 4,
|
||||
SourcePosition = new Vector3D(50, 0, 0),
|
||||
Direction = new Vector3D(-1, 0, 0), // 指向跟踪器
|
||||
AngleRange = Math.PI / 4, // 45度角
|
||||
AngleRange = 45, // 45度角
|
||||
Mode = JammingMode.Blocking,
|
||||
Duration = null // 持续干扰
|
||||
}
|
||||
@ -100,7 +100,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Wavelength = 4,
|
||||
SourcePosition = new Vector3D(0, 50, 0), // 位于上方
|
||||
Direction = new Vector3D(0, 0, 1), // 指向前方,不是指向跟踪器
|
||||
AngleRange = 0.1, // 很小的角度范围
|
||||
AngleRange = 1, // 很小的角度范围
|
||||
Mode = JammingMode.Blocking
|
||||
}
|
||||
};
|
||||
@ -130,7 +130,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Wavelength = 4,
|
||||
SourcePosition = new Vector3D(50, 0, 0),
|
||||
Direction = new Vector3D(-1, 0, 0),
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Mode = JammingMode.Blocking
|
||||
}
|
||||
};
|
||||
@ -158,7 +158,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Wavelength = 6, // 不在3-5μm或8-14μm范围
|
||||
SourcePosition = new Vector3D(50, 0, 0),
|
||||
Direction = new Vector3D(-1, 0, 0),
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Mode = JammingMode.Blocking
|
||||
}
|
||||
};
|
||||
@ -186,7 +186,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Wavelength = 4,
|
||||
SourcePosition = new Vector3D(50, 0, 0),
|
||||
Direction = new Vector3D(-1, 0, 0),
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Mode = JammingMode.Blocking
|
||||
}
|
||||
};
|
||||
@ -214,7 +214,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Wavelength = 4,
|
||||
SourcePosition = new Vector3D(50, 0, 0),
|
||||
Direction = new Vector3D(-1, 0, 0),
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Mode = JammingMode.Blocking,
|
||||
Duration = 0.5 // 0.5秒后过期
|
||||
}
|
||||
@ -255,7 +255,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Wavelength = 4,
|
||||
SourcePosition = new Vector3D(50, 0, 0),
|
||||
Direction = new Vector3D(-1, 0, 0),
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Mode = JammingMode.Blocking,
|
||||
Duration = null // 持续干扰
|
||||
}
|
||||
@ -294,7 +294,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Wavelength = 4,
|
||||
SourcePosition = new Vector3D(50, 0, 0),
|
||||
Direction = new Vector3D(-1, 0, 0),
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Mode = JammingMode.Blocking
|
||||
}
|
||||
};
|
||||
|
||||
@ -36,6 +36,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
NonlinearGain = 5.0,
|
||||
MaxGuidanceAcceleration = 100.0,
|
||||
LowPassFilterCoefficient = 0.7,
|
||||
Wavelength = 1.06, // 激光波长
|
||||
JammingResistanceThreshold = 1e-4 // 与红外成像引导系统一致
|
||||
};
|
||||
|
||||
@ -124,7 +125,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Power = 2000, // 2000瓦特
|
||||
SourcePosition = new Vector3D(50, 0, 0), // 50米
|
||||
Direction = new Vector3D(1, 0, 0), // 指向设备的方向
|
||||
AngleRange = Math.PI / 4, // 45度
|
||||
AngleRange = 45, // 45度
|
||||
Mode = JammingMode.Blocking,
|
||||
Duration = null,
|
||||
Wavelength = 1.06,
|
||||
@ -173,7 +174,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Power = 500, // 500瓦特
|
||||
SourcePosition = new Vector3D(0, 50, 0), // 从Y轴方向
|
||||
Direction = new Vector3D(1, 0, 0), // 指向X轴方向
|
||||
AngleRange = 0.1, // 约5.7度
|
||||
AngleRange = 1,
|
||||
Mode = JammingMode.Blocking,
|
||||
Type = JammingType.Laser
|
||||
}
|
||||
@ -216,7 +217,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Power = 10, // 10瓦特
|
||||
SourcePosition = new Vector3D(50, 0, 0),
|
||||
Direction = new Vector3D(1, 0, 0),
|
||||
AngleRange = Math.PI / 4, // 45度
|
||||
AngleRange = 45, // 45度
|
||||
Mode = JammingMode.Blocking,
|
||||
Type = JammingType.Laser
|
||||
}
|
||||
@ -259,7 +260,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Power = 2000, // 2000瓦特
|
||||
SourcePosition = new Vector3D(50, 0, 0),
|
||||
Direction = new Vector3D(1, 0, 0),
|
||||
AngleRange = Math.PI / 4, // 45度
|
||||
AngleRange = 45, // 45度
|
||||
Mode = JammingMode.Blocking,
|
||||
Duration = 0.5, // 0.5秒
|
||||
Wavelength = 1.06,
|
||||
@ -314,7 +315,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Power = 2000, // 2000瓦特
|
||||
SourcePosition = new Vector3D(50, 0, 0),
|
||||
Direction = new Vector3D(1, 0, 0),
|
||||
AngleRange = Math.PI / 4, // 45度
|
||||
AngleRange = 45, // 45度
|
||||
Mode = JammingMode.Blocking,
|
||||
Duration = null,
|
||||
Wavelength = 1.06,
|
||||
@ -366,7 +367,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Power = 2000, // 2000瓦特
|
||||
SourcePosition = new Vector3D(50, 0, 0),
|
||||
Direction = new Vector3D(1, 0, 0),
|
||||
AngleRange = Math.PI / 4, // 45度
|
||||
AngleRange = 45, // 45度
|
||||
Mode = JammingMode.Blocking,
|
||||
Duration = null,
|
||||
Wavelength = 1.06,
|
||||
|
||||
@ -26,8 +26,8 @@ namespace ThreatSource.Tests.Jamming
|
||||
// 创建激光驾束仪配置
|
||||
var config = new LaserBeamRiderConfig
|
||||
{
|
||||
LaserPower = 100,
|
||||
LaserWavelength = 1.06,
|
||||
Power = 100,
|
||||
Wavelength = 1.06,
|
||||
ControlFieldDiameter = 5.0,
|
||||
MaxGuidanceDistance = 5000,
|
||||
JammingResistanceThreshold = 0.05 // 设置干扰抗性阈值为50mW
|
||||
@ -87,7 +87,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Wavelength = 1.06,
|
||||
SourcePosition = new Vector3D(50, 0, 0),
|
||||
Direction = new Vector3D(-1, 0, 0), // 指向激光驾束仪
|
||||
AngleRange = Math.PI / 4, // 45度角
|
||||
AngleRange = 45, // 45度角
|
||||
Mode = JammingMode.Blocking,
|
||||
Type = JammingType.Laser
|
||||
}
|
||||
@ -122,7 +122,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Wavelength = 1.06,
|
||||
SourcePosition = new Vector3D(50, 0, 0),
|
||||
Direction = new Vector3D(-1, 0, 0),
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Mode = JammingMode.Blocking,
|
||||
Duration = null,
|
||||
Type = JammingType.Laser
|
||||
@ -170,7 +170,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Wavelength = 1.06,
|
||||
SourcePosition = new Vector3D(50, 0, 0),
|
||||
Direction = new Vector3D(-1, 0, 0),
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Mode = JammingMode.Blocking,
|
||||
Duration = 0.5, // 0.5秒后过期
|
||||
Type = JammingType.Laser
|
||||
@ -212,7 +212,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Wavelength = 1.06,
|
||||
SourcePosition = new Vector3D(50, 0, 0),
|
||||
Direction = new Vector3D(-1, 0, 0),
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Mode = JammingMode.Blocking,
|
||||
Duration = null, // 持续干扰
|
||||
Type = JammingType.Laser
|
||||
@ -251,7 +251,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Wavelength = 1.06,
|
||||
SourcePosition = new Vector3D(50, 0, 0),
|
||||
Direction = new Vector3D(-1, 0, 0),
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Duration = null,
|
||||
Mode = JammingMode.Blocking,
|
||||
Type = JammingType.Laser
|
||||
|
||||
@ -223,8 +223,8 @@ namespace ThreatSource.Tests.Jamming
|
||||
// 创建激光指示器配置 - 使用更高功率
|
||||
var designatorConfig = new LaserDesignatorConfig
|
||||
{
|
||||
LaserPower = 500, // 高功率,便于锁定
|
||||
LaserDivergenceAngle = 0.0005,
|
||||
Power = 500, // 高功率,便于锁定
|
||||
DivergenceAngle = 0.0005,
|
||||
LaserCodeConfig = new LaserCodeConfig
|
||||
{
|
||||
Code = new LaserCode
|
||||
@ -234,7 +234,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
}
|
||||
},
|
||||
JammingResistanceThreshold = 1.0,
|
||||
LaserWavelength = 1.06
|
||||
Wavelength = 1.06
|
||||
};
|
||||
|
||||
// 创建虚拟激光指示器并注册 - 更靠近目标
|
||||
@ -271,8 +271,8 @@ namespace ThreatSource.Tests.Jamming
|
||||
updateLaserDesignatorMethod.Invoke(_guidanceSystem, new object[] {
|
||||
designatorPosition,
|
||||
targetPosition,
|
||||
designatorConfig.LaserPower,
|
||||
designatorConfig.LaserDivergenceAngle
|
||||
designatorConfig.Power,
|
||||
designatorConfig.DivergenceAngle
|
||||
});
|
||||
}
|
||||
|
||||
@ -359,8 +359,8 @@ namespace ThreatSource.Tests.Jamming
|
||||
// 创建激光指示器配置
|
||||
var designatorConfig = new LaserDesignatorConfig
|
||||
{
|
||||
LaserPower = 200, // 中等功率
|
||||
LaserDivergenceAngle = 0.0005,
|
||||
Power = 200, // 中等功率
|
||||
DivergenceAngle = 0.0005,
|
||||
LaserCodeConfig = new LaserCodeConfig
|
||||
{
|
||||
Code = new LaserCode
|
||||
@ -370,7 +370,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
}
|
||||
},
|
||||
JammingResistanceThreshold = 1.0,
|
||||
LaserWavelength = 1.06
|
||||
Wavelength = 1.06
|
||||
};
|
||||
|
||||
// 创建虚拟激光指示器并注册
|
||||
@ -407,8 +407,8 @@ namespace ThreatSource.Tests.Jamming
|
||||
updateLaserDesignatorMethod.Invoke(_guidanceSystem, new object[] {
|
||||
designatorPosition,
|
||||
targetPosition,
|
||||
designatorConfig.LaserPower,
|
||||
designatorConfig.LaserDivergenceAngle
|
||||
designatorConfig.Power,
|
||||
designatorConfig.DivergenceAngle
|
||||
});
|
||||
}
|
||||
|
||||
@ -484,8 +484,8 @@ namespace ThreatSource.Tests.Jamming
|
||||
// 创建激光指示器配置
|
||||
var designatorConfig = new LaserDesignatorConfig
|
||||
{
|
||||
LaserPower = 500,
|
||||
LaserDivergenceAngle = 0.0005,
|
||||
Power = 500,
|
||||
DivergenceAngle = 0.0005,
|
||||
LaserCodeConfig = new LaserCodeConfig
|
||||
{
|
||||
Code = new LaserCode
|
||||
@ -495,7 +495,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
}
|
||||
},
|
||||
JammingResistanceThreshold = 1.0,
|
||||
LaserWavelength = 1.06
|
||||
Wavelength = 1.06
|
||||
};
|
||||
|
||||
// 创建虚拟激光指示器并注册
|
||||
@ -532,8 +532,8 @@ namespace ThreatSource.Tests.Jamming
|
||||
updateLaserDesignatorMethod.Invoke(_guidanceSystem, new object[] {
|
||||
designatorPosition,
|
||||
targetPosition,
|
||||
designatorConfig.LaserPower,
|
||||
designatorConfig.LaserDivergenceAngle
|
||||
designatorConfig.Power,
|
||||
designatorConfig.DivergenceAngle
|
||||
});
|
||||
}
|
||||
|
||||
@ -625,8 +625,8 @@ namespace ThreatSource.Tests.Jamming
|
||||
// 创建激光指示器配置
|
||||
var designatorConfig = new LaserDesignatorConfig
|
||||
{
|
||||
LaserPower = 100, // 真实目标的激光功率
|
||||
LaserDivergenceAngle = 0.001, // 激光发散角设为0.001弧度,约0.057度
|
||||
Power = 100, // 真实目标的激光功率
|
||||
DivergenceAngle = 0.001, // 激光发散角设为0.001弧度,约0.057度
|
||||
LaserCodeConfig = new LaserCodeConfig
|
||||
{
|
||||
Code = new LaserCode
|
||||
@ -636,7 +636,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
}
|
||||
},
|
||||
JammingResistanceThreshold = 1.0,
|
||||
LaserWavelength = 1.06
|
||||
Wavelength = 1.06
|
||||
};
|
||||
|
||||
// 创建虚拟激光指示器并注册
|
||||
@ -650,7 +650,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
// 计算真实指示器到目标的实际距离
|
||||
double actualDesignatorDistance = (designatorMotion.Position - (_target?.Position ?? Vector3D.Zero)).Magnitude();
|
||||
Debug.WriteLine($"激光指示器到目标的实际距离: {actualDesignatorDistance}米");
|
||||
Debug.WriteLine($"激光指示器功率: {designatorConfig.LaserPower}W, 发散角: {designatorConfig.LaserDivergenceAngle}弧度");
|
||||
Debug.WriteLine($"激光指示器功率: {designatorConfig.Power}W, 发散角: {designatorConfig.DivergenceAngle}弧度");
|
||||
|
||||
var designator = new LaserDesignator(
|
||||
"designator1",
|
||||
@ -688,8 +688,8 @@ namespace ThreatSource.Tests.Jamming
|
||||
updateLaserDesignatorMethod.Invoke(_guidanceSystem, new object[] {
|
||||
designatorPosition,
|
||||
realTargetPosition,
|
||||
designatorConfig.LaserPower,
|
||||
designatorConfig.LaserDivergenceAngle
|
||||
designatorConfig.Power,
|
||||
designatorConfig.DivergenceAngle
|
||||
});
|
||||
}
|
||||
|
||||
@ -804,9 +804,9 @@ namespace ThreatSource.Tests.Jamming
|
||||
if (calculateReceivedPowerMethod != null && _guidanceSystem != null)
|
||||
{
|
||||
double realReceivedPower = Convert.ToDouble(calculateReceivedPowerMethod.Invoke(_guidanceSystem,
|
||||
new object[] { designatorPosition, realTargetPosition, designatorConfig.LaserPower, designatorConfig.LaserDivergenceAngle }));
|
||||
new object[] { designatorPosition, realTargetPosition, designatorConfig.Power, designatorConfig.DivergenceAngle }));
|
||||
double decoyReceivedPower = Convert.ToDouble(calculateReceivedPowerMethod.Invoke(_guidanceSystem,
|
||||
new object[] { decoySourcePosition, decoyPosition, decoyPower, designatorConfig.LaserDivergenceAngle }));
|
||||
new object[] { decoySourcePosition, decoyPosition, decoyPower, designatorConfig.DivergenceAngle }));
|
||||
Debug.WriteLine($"接收到的真实目标功率: {realReceivedPower}W");
|
||||
Debug.WriteLine($"接收到的诱偏目标功率: {decoyReceivedPower}W");
|
||||
|
||||
@ -861,8 +861,8 @@ namespace ThreatSource.Tests.Jamming
|
||||
// 创建激光指示器配置 - 使用与真实场景一致的参数
|
||||
var designatorConfig = new LaserDesignatorConfig
|
||||
{
|
||||
LaserPower = 100, // 真实激光指示器功率100W
|
||||
LaserDivergenceAngle = 0.001, // 激光发散角0.001弧度
|
||||
Power = 100, // 真实激光指示器功率100W
|
||||
DivergenceAngle = 0.001, // 激光发散角0.001弧度
|
||||
LaserCodeConfig = new LaserCodeConfig
|
||||
{
|
||||
Code = new LaserCode
|
||||
@ -872,7 +872,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
}
|
||||
},
|
||||
JammingResistanceThreshold = 1.0,
|
||||
LaserWavelength = 1.06
|
||||
Wavelength = 1.06
|
||||
};
|
||||
|
||||
// 创建虚拟激光指示器并注册 - 距离目标2000米
|
||||
@ -886,7 +886,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
// 计算真实指示器到目标的实际距离
|
||||
double actualDesignatorDistance = (designatorMotion.Position - (_target?.Position ?? Vector3D.Zero)).Magnitude();
|
||||
Debug.WriteLine($"激光指示器到目标的实际距离: {actualDesignatorDistance}米");
|
||||
Debug.WriteLine($"激光指示器功率: {designatorConfig.LaserPower}W, 发散角: {designatorConfig.LaserDivergenceAngle}弧度");
|
||||
Debug.WriteLine($"激光指示器功率: {designatorConfig.Power}W, 发散角: {designatorConfig.DivergenceAngle}弧度");
|
||||
|
||||
var designator = new LaserDesignator(
|
||||
"designator1",
|
||||
@ -924,8 +924,8 @@ namespace ThreatSource.Tests.Jamming
|
||||
updateLaserDesignatorMethod.Invoke(_guidanceSystem, new object[] {
|
||||
designatorPosition,
|
||||
realTargetPosition,
|
||||
designatorConfig.LaserPower,
|
||||
designatorConfig.LaserDivergenceAngle
|
||||
designatorConfig.Power,
|
||||
designatorConfig.DivergenceAngle
|
||||
});
|
||||
}
|
||||
|
||||
@ -988,7 +988,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
if (calculateReceivedPowerMethod != null && _guidanceSystem != null)
|
||||
{
|
||||
realReceivedPower = Convert.ToDouble(calculateReceivedPowerMethod.Invoke(_guidanceSystem,
|
||||
new object[] { designatorPosition, realTargetPosition, designatorConfig.LaserPower, designatorConfig.LaserDivergenceAngle }));
|
||||
new object[] { designatorPosition, realTargetPosition, designatorConfig.Power, designatorConfig.DivergenceAngle }));
|
||||
Debug.WriteLine($"接收到的真实目标功率: {realReceivedPower}W");
|
||||
}
|
||||
|
||||
|
||||
@ -26,10 +26,10 @@ namespace ThreatSource.Tests.Jamming
|
||||
// 创建激光指示器配置
|
||||
var config = new LaserDesignatorConfig
|
||||
{
|
||||
LaserPower = 100,
|
||||
LaserDivergenceAngle = 0.001,
|
||||
Power = 100,
|
||||
DivergenceAngle = 0.001,
|
||||
JammingResistanceThreshold = 0.05, // 干扰阈值50mW
|
||||
LaserWavelength = 1.06 // 工作波长1.06μm
|
||||
Wavelength = 1.06 // 工作波长1.06μm
|
||||
};
|
||||
|
||||
// 初始化激光指示器
|
||||
@ -86,7 +86,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Wavelength = 1.06, // 匹配波长1.06μm
|
||||
SourcePosition = new Vector3D(5, 0, 0),
|
||||
Direction = new Vector3D(-1, 0, 0),
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Mode = JammingMode.Blocking,
|
||||
Duration = null,
|
||||
Type = JammingType.Laser
|
||||
@ -118,7 +118,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Wavelength = 1.06,
|
||||
SourcePosition = new Vector3D(0, 50, 0), // 位于上方
|
||||
Direction = new Vector3D(0, 0, 1), // 指向前方,不是指向指示器
|
||||
AngleRange = 0.1, // 很小的角度范围
|
||||
AngleRange = 1, // 很小的角度范围
|
||||
Mode = JammingMode.Blocking,
|
||||
Duration = null,
|
||||
Type = JammingType.Laser
|
||||
@ -150,7 +150,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Wavelength = 1.06,
|
||||
SourcePosition = new Vector3D(50, 0, 0),
|
||||
Direction = new Vector3D(-1, 0, 0),
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Mode = JammingMode.Blocking,
|
||||
Duration = null,
|
||||
Type = JammingType.Laser
|
||||
@ -180,7 +180,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Wavelength = 2.5, // 不在1.0-1.1μm范围
|
||||
SourcePosition = new Vector3D(50, 0, 0),
|
||||
Direction = new Vector3D(-1, 0, 0),
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Mode = JammingMode.Blocking,
|
||||
Duration = null,
|
||||
Type = JammingType.Laser
|
||||
@ -210,7 +210,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Wavelength = 1.06, // 匹配波长1.06μm
|
||||
SourcePosition = new Vector3D(5, 0, 0),
|
||||
Direction = new Vector3D(-1, 0, 0),
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Mode = JammingMode.Blocking,
|
||||
Duration = 0.5,
|
||||
Type = JammingType.Laser
|
||||
@ -250,7 +250,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Wavelength = 1.06, // 匹配波长1.06μm
|
||||
SourcePosition = new Vector3D(5, 0, 0),
|
||||
Direction = new Vector3D(-1, 0, 0),
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Mode = JammingMode.Blocking,
|
||||
Duration = null,
|
||||
Type = JammingType.Laser
|
||||
@ -290,7 +290,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Wavelength = 1.06, // 匹配波长1.06μm
|
||||
SourcePosition = new Vector3D(5, 0, 0),
|
||||
Direction = new Vector3D(-1, 0, 0),
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Mode = JammingMode.Blocking,
|
||||
Duration = null,
|
||||
Type = JammingType.Laser
|
||||
@ -326,7 +326,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Wavelength = 1.06, // 匹配波长1.06μm
|
||||
SourcePosition = new Vector3D(50, 0, 0),
|
||||
Direction = new Vector3D(-1, 0, 0),
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Mode = JammingMode.Blocking,
|
||||
Duration = null,
|
||||
Type = JammingType.Laser
|
||||
@ -351,7 +351,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Wavelength = 1.56,
|
||||
SourcePosition = new Vector3D(50, 0, 0),
|
||||
Direction = new Vector3D(-1, 0, 0),
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Mode = JammingMode.Blocking,
|
||||
Duration = null,
|
||||
Type = JammingType.Laser
|
||||
|
||||
@ -79,7 +79,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Wavelength = 1.06,
|
||||
SourcePosition = new Vector3D(0, 10, 0),
|
||||
Direction = new Vector3D(0, 1, 0),
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Mode = JammingMode.Blocking,
|
||||
Type = JammingType.Laser
|
||||
}
|
||||
@ -106,7 +106,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Wavelength = 1.06,
|
||||
SourcePosition = new Vector3D(0, 150, 0), // 位于上方
|
||||
Direction = new Vector3D(0, 0, 1), // 指向前方,不是指向测距仪
|
||||
AngleRange = 0.1, // 很小的角度范围
|
||||
AngleRange = 1, // 很小的角度范围
|
||||
Mode = JammingMode.Blocking,
|
||||
Type = JammingType.Laser
|
||||
}
|
||||
@ -133,7 +133,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Wavelength = 1.06,
|
||||
SourcePosition = new Vector3D(0, 10, 0),
|
||||
Direction = new Vector3D(0, 1, 0),
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Mode = JammingMode.Blocking,
|
||||
Type = JammingType.Laser
|
||||
}
|
||||
@ -160,7 +160,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Wavelength = 1.06,
|
||||
SourcePosition = new Vector3D(0, 10, 0),
|
||||
Direction = new Vector3D(0, 1, 0),
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Mode = JammingMode.Blocking,
|
||||
Duration = 0.5,
|
||||
Type = JammingType.Laser
|
||||
@ -197,7 +197,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Wavelength = 1.06,
|
||||
SourcePosition = new Vector3D(0, 10, 0),
|
||||
Direction = new Vector3D(0, 1, 0),
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Mode = JammingMode.Blocking,
|
||||
Type = JammingType.Laser
|
||||
}
|
||||
@ -236,7 +236,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Wavelength = 1.06,
|
||||
SourcePosition = new Vector3D(0, 10, 0),
|
||||
Direction = new Vector3D(0, 1, 0),
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Mode = JammingMode.Blocking,
|
||||
Type = JammingType.Laser
|
||||
}
|
||||
|
||||
@ -35,6 +35,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
TargetReflectiveArea = 1.0, // 目标反射面积
|
||||
ReflectionCoefficient = 0.5, // 反射系数
|
||||
LensDiameter = 0.05, // 镜头直径
|
||||
Wavelength = 1.06, // 激光波长
|
||||
JammingResistanceThreshold = 1e-4 // 干扰抗性阈值
|
||||
};
|
||||
|
||||
@ -114,7 +115,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Power = 2000,
|
||||
SourcePosition = new Vector3D(50, 0, 0),
|
||||
Direction = new Vector3D(1, 0, 0),
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Mode = JammingMode.Blocking,
|
||||
Duration = null,
|
||||
Wavelength = 1.06,
|
||||
@ -156,7 +157,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Power = 500,
|
||||
SourcePosition = new Vector3D(0, 50, 0),
|
||||
Direction = new Vector3D(1, 0, 0),
|
||||
AngleRange = 0.1,
|
||||
AngleRange = 1,
|
||||
Mode = JammingMode.Blocking,
|
||||
Type = JammingType.Laser,
|
||||
Wavelength = 1.06,
|
||||
@ -194,7 +195,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Power = 10,
|
||||
SourcePosition = new Vector3D(50, 0, 0),
|
||||
Direction = new Vector3D(1, 0, 0),
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Mode = JammingMode.Blocking,
|
||||
Type = JammingType.Laser,
|
||||
Wavelength = 1.06,
|
||||
@ -232,7 +233,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Power = 2000,
|
||||
SourcePosition = new Vector3D(50, 0, 0),
|
||||
Direction = new Vector3D(1, 0, 0),
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Mode = JammingMode.Blocking,
|
||||
Duration = 0.5,
|
||||
Type = JammingType.Laser,
|
||||
@ -280,7 +281,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Power = 2000,
|
||||
SourcePosition = new Vector3D(50, 0, 0),
|
||||
Direction = new Vector3D(1, 0, 0),
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Mode = JammingMode.Blocking,
|
||||
Duration = null,
|
||||
Wavelength = 1.06,
|
||||
@ -325,7 +326,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Power = 2000,
|
||||
SourcePosition = new Vector3D(50, 0, 0),
|
||||
Direction = new Vector3D(1, 0, 0),
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Mode = JammingMode.Blocking,
|
||||
Duration = null,
|
||||
Type = JammingType.Laser,
|
||||
|
||||
@ -79,7 +79,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Wavelength = 3.0,
|
||||
SourcePosition = new Vector3D(0, 10, 0),
|
||||
Direction = new Vector3D(0, 1, 0),
|
||||
AngleRange = Math.PI / 6,
|
||||
AngleRange = 30,
|
||||
Mode = JammingMode.Blocking,
|
||||
Type = JammingType.MillimeterWave
|
||||
}
|
||||
@ -106,7 +106,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Wavelength = 3.0,
|
||||
SourcePosition = new Vector3D(0, 150, 0), // 位于上方
|
||||
Direction = new Vector3D(0, 0, 1), // 指向前方,不是指向测高雷达
|
||||
AngleRange = 0.1, // 很小的角度范围
|
||||
AngleRange = 1, // 很小的角度范围
|
||||
Mode = JammingMode.Blocking,
|
||||
Type = JammingType.MillimeterWave
|
||||
}
|
||||
@ -133,7 +133,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Wavelength = 3.0,
|
||||
SourcePosition = new Vector3D(50, 100, 0),
|
||||
Direction = new Vector3D(-1, 0, 0),
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Mode = JammingMode.Blocking,
|
||||
Type = JammingType.MillimeterWave
|
||||
}
|
||||
@ -160,7 +160,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Wavelength = 8.0, // 与测高雷达波段不匹配
|
||||
SourcePosition = new Vector3D(0, 10, 0),
|
||||
Direction = new Vector3D(0, 1, 0),
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Mode = JammingMode.Blocking,
|
||||
Type = JammingType.MillimeterWave
|
||||
}
|
||||
@ -187,7 +187,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Wavelength = 3.0, // 设置为3mm波段的波长
|
||||
SourcePosition = new Vector3D(0, 120, 0),
|
||||
Direction = new Vector3D(0, -1, 0),
|
||||
AngleRange = Math.PI / 6,
|
||||
AngleRange = 30,
|
||||
Mode = JammingMode.Blocking,
|
||||
Duration = 0.5, // 0.5秒后过期
|
||||
Type = JammingType.MillimeterWave
|
||||
@ -224,7 +224,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Wavelength = 3.0, // 设置为3mm波段的波长
|
||||
SourcePosition = new Vector3D(0, 10, 0),
|
||||
Direction = new Vector3D(0, 1, 0),
|
||||
AngleRange = Math.PI / 6,
|
||||
AngleRange = 30,
|
||||
Mode = JammingMode.Blocking,
|
||||
Type = JammingType.MillimeterWave
|
||||
}
|
||||
@ -263,7 +263,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Wavelength = 3.0,
|
||||
SourcePosition = new Vector3D(0, 10, 0),
|
||||
Direction = new Vector3D(0, 1, 0),
|
||||
AngleRange = Math.PI / 6,
|
||||
AngleRange = 30,
|
||||
Mode = JammingMode.Blocking,
|
||||
Type = JammingType.MillimeterWave
|
||||
}
|
||||
|
||||
@ -112,7 +112,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Power = 2000,
|
||||
SourcePosition = new Vector3D(50, 0, 0),
|
||||
Direction = new Vector3D(1, 0, 0),
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Mode = JammingMode.Blocking,
|
||||
Duration = null,
|
||||
Wavelength = 3.19,
|
||||
@ -154,7 +154,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Power = 500,
|
||||
SourcePosition = new Vector3D(0, 50, 0),
|
||||
Direction = new Vector3D(1, 0, 0),
|
||||
AngleRange = 0.1,
|
||||
AngleRange = 1,
|
||||
Mode = JammingMode.Blocking,
|
||||
Type = JammingType.MillimeterWave,
|
||||
Wavelength = 3.19
|
||||
@ -191,7 +191,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Power = 10,
|
||||
SourcePosition = new Vector3D(50, 0, 0),
|
||||
Direction = new Vector3D(1, 0, 0),
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Mode = JammingMode.Blocking
|
||||
}
|
||||
};
|
||||
@ -226,7 +226,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Power = 2000,
|
||||
SourcePosition = new Vector3D(50, 0, 0),
|
||||
Direction = new Vector3D(1, 0, 0),
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Mode = JammingMode.Blocking,
|
||||
Duration = 0.5,
|
||||
Type = JammingType.MillimeterWave,
|
||||
@ -274,7 +274,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Power = 2000,
|
||||
SourcePosition = new Vector3D(50, 0, 0),
|
||||
Direction = new Vector3D(1, 0, 0),
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Mode = JammingMode.Blocking,
|
||||
Duration = null,
|
||||
Wavelength = 3.19,
|
||||
@ -319,7 +319,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Power = 2000,
|
||||
SourcePosition = new Vector3D(50, 0, 0),
|
||||
Direction = new Vector3D(1, 0, 0),
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Mode = JammingMode.Blocking,
|
||||
Duration = null,
|
||||
Wavelength = 3.19,
|
||||
|
||||
@ -78,7 +78,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Wavelength = 3.0,
|
||||
SourcePosition = new Vector3D(10, 10, 0),
|
||||
Direction = new Vector3D(0, 1, 0),
|
||||
AngleRange = Math.PI / 4, // 45度角
|
||||
AngleRange = 45, // 45度角
|
||||
Mode = JammingMode.Blocking,
|
||||
Duration = null, // 持续干扰
|
||||
Type = JammingType.MillimeterWave
|
||||
@ -106,7 +106,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Wavelength = 3.0,
|
||||
SourcePosition = new Vector3D(0, 150, 0), // 位于上方
|
||||
Direction = new Vector3D(0, 1, 0), // 指向上方,与辐射计方向完全相反
|
||||
AngleRange = 0.01, // 极小的角度范围
|
||||
AngleRange = 1, // 极小的角度范围
|
||||
Mode = JammingMode.Blocking,
|
||||
Type = JammingType.MillimeterWave
|
||||
}
|
||||
@ -133,7 +133,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Wavelength = 3.0,
|
||||
SourcePosition = new Vector3D(10, 10, 0),
|
||||
Direction = new Vector3D(0, 1, 0),
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Mode = JammingMode.Blocking,
|
||||
Type = JammingType.MillimeterWave
|
||||
}
|
||||
@ -160,7 +160,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Wavelength = 8.0, // 与辐射计波段不匹配
|
||||
SourcePosition = new Vector3D(0, 10, 0),
|
||||
Direction = new Vector3D(0, 1, 0),
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Mode = JammingMode.Blocking,
|
||||
Type = JammingType.MillimeterWave
|
||||
}
|
||||
@ -187,7 +187,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Wavelength = 3.0, // 3mm波段
|
||||
SourcePosition = new Vector3D(10, 10, 0),
|
||||
Direction = new Vector3D(0, 1, 0),
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Mode = JammingMode.Blocking,
|
||||
Duration = 0.5,
|
||||
Type = JammingType.MillimeterWave
|
||||
@ -224,7 +224,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Wavelength = 3.0, // 3mm波段
|
||||
SourcePosition = new Vector3D(10, 10, 0),
|
||||
Direction = new Vector3D(0, 1, 0),
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Mode = JammingMode.Blocking,
|
||||
Type = JammingType.MillimeterWave
|
||||
}
|
||||
@ -279,7 +279,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Wavelength = 3.0, // 3mm波段
|
||||
SourcePosition = new Vector3D(0, 10, 0),
|
||||
Direction = new Vector3D(0, 1, 0),
|
||||
AngleRange = Math.PI / 4,
|
||||
AngleRange = 45,
|
||||
Mode = JammingMode.Blocking,
|
||||
Type = JammingType.MillimeterWave
|
||||
}
|
||||
|
||||
@ -153,7 +153,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
{
|
||||
Type = JammingType.Infrared,
|
||||
Power = 1000, // 1000W干扰功率,在500米距离有效
|
||||
AngleRange = Math.PI, // 增加到180度,覆盖上半球
|
||||
AngleRange = 180, // 增加到180度,覆盖上半球
|
||||
Duration = 5,
|
||||
Direction = new Vector3D(0, 1, 0), // 方向向上,从坦克位置指向上空
|
||||
SourcePosition = new Vector3D(0, 0, 0) // 干扰源位置放在坦克上(坐标原点)
|
||||
@ -180,7 +180,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
{
|
||||
Type = JammingType.MillimeterWave,
|
||||
Power = 1000, // 1000W干扰功率,在500米距离有效
|
||||
AngleRange = Math.PI, // 增加到180度,覆盖上半球
|
||||
AngleRange = 180, // 增加到180度,覆盖上半球
|
||||
Duration = 3,
|
||||
Direction = new Vector3D(0, 1, 0), // 方向向上,从坦克位置指向上空
|
||||
SourcePosition = new Vector3D(0, 0, 0) // 干扰源位置放在坦克上(坐标原点)
|
||||
@ -207,7 +207,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
{
|
||||
Type = JammingType.Laser,
|
||||
Power = 1000, // 1000W干扰功率,在500米距离有效
|
||||
AngleRange = Math.PI, // 增加到180度,覆盖上半球
|
||||
AngleRange = 180, // 增加到180度,覆盖上半球
|
||||
Duration = 4,
|
||||
Direction = new Vector3D(0, 1, 0), // 方向向上,从坦克位置指向上空
|
||||
SourcePosition = new Vector3D(0, 0, 0) // 干扰源位置放在坦克上(坐标原点)
|
||||
@ -398,7 +398,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
Wavelength = 8.0, // 设置为3mm波段的波长
|
||||
SourcePosition = new Vector3D(0, 10, 0),
|
||||
Direction = new Vector3D(0, 1, 0),
|
||||
AngleRange = Math.PI/2,
|
||||
AngleRange = 90,
|
||||
Mode = JammingMode.Blocking,
|
||||
Duration = 10,
|
||||
Type = JammingType.MillimeterWave
|
||||
@ -503,7 +503,7 @@ namespace ThreatSource.Tests.Jamming
|
||||
{
|
||||
Type = JammingType.MillimeterWave,
|
||||
Power = 1000, // 1000W干扰功率,在500米距离有效
|
||||
AngleRange = Math.PI, // 增加到180度,覆盖上半球
|
||||
AngleRange = 180, // 增加到180度,覆盖上半球
|
||||
Duration = 3,
|
||||
Direction = new Vector3D(0, 1, 0), // 方向向上,从坦克位置指向上空
|
||||
SourcePosition = new Vector3D(0, 0, 0) // 干扰源位置放在坦克上(坐标原点)
|
||||
|
||||
@ -48,7 +48,7 @@ namespace ThreatSource.Tests.Missile
|
||||
// 创建并注册模拟的激光指示器,位置在导弹后方100米处
|
||||
_laserDesignator = new MockLaserDesignator("laser1", _simulationManager);
|
||||
_laserDesignator.Position = new Vector3D(-100, 0, 0);
|
||||
_laserDesignator.config.LaserPower = 100; // 设置足够高的激光功率
|
||||
_laserDesignator.config.Power = 100; // 设置足够高的激光功率
|
||||
_testAdapter.AddTestEntity("laser1", _laserDesignator);
|
||||
|
||||
// 创建并注册模拟的目标,位置在导弹前方1000米处
|
||||
@ -94,9 +94,9 @@ namespace ThreatSource.Tests.Missile
|
||||
public MockLaserDesignator(string id, ISimulationManager simulationManager)
|
||||
: base(id, "target1", "missile1", new LaserDesignatorConfig
|
||||
{
|
||||
LaserPower = 100,
|
||||
LaserDivergenceAngle = 0.001,
|
||||
LaserWavelength = 1.06
|
||||
Power = 100,
|
||||
DivergenceAngle = 0.001,
|
||||
Wavelength = 1.06
|
||||
}, new MotionParameters
|
||||
{
|
||||
Position = new Vector3D(100, 0, 0),
|
||||
@ -236,7 +236,7 @@ namespace ThreatSource.Tests.Missile
|
||||
// 设置激光指示器和目标位置,确保在视场角内
|
||||
_laserDesignator.Position = new Vector3D(-100, 0, 0);
|
||||
_target.Position = new Vector3D(1000, 0, 0);
|
||||
_laserDesignator.config.LaserPower = 100; // 设置足够高的激光功率
|
||||
_laserDesignator.config.Power = 100; // 设置足够高的激光功率
|
||||
|
||||
// Act - Send illumination with disabled code
|
||||
var illuminationEvent = new LaserIlluminationUpdateEvent
|
||||
@ -278,7 +278,7 @@ namespace ThreatSource.Tests.Missile
|
||||
// 设置激光指示器和目标位置,确保在视场角内
|
||||
_laserDesignator.Position = new Vector3D(-100, 0, 0);
|
||||
_target.Position = new Vector3D(1000, 0, 0);
|
||||
_laserDesignator.config.LaserPower = 100; // 设置足够高的激光功率
|
||||
_laserDesignator.config.Power = 100; // 设置足够高的激光功率
|
||||
|
||||
// First enable guidance with matching code
|
||||
var startEvent = new LaserIlluminationUpdateEvent
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
"maxTrackingRange": 10000.0,
|
||||
"fieldOfView": 0.2,
|
||||
"angleMeasurementAccuracy": 0.001,
|
||||
"updateFrequency": 10.0
|
||||
"updateFrequency": 10.0,
|
||||
"jammingResistanceThreshold": 1e-5
|
||||
}
|
||||
}
|
||||
@ -5,8 +5,9 @@
|
||||
},
|
||||
"type": "LaserBeamRider",
|
||||
"beamRiderConfig": {
|
||||
"laserPower": 1000,
|
||||
"laserWavelength": 1.06,
|
||||
"power": 1000,
|
||||
"wavelength": 1.06,
|
||||
"jammingResistanceThreshold": 1e-5,
|
||||
"controlFieldDiameter": 6.0,
|
||||
"laserCodeConfig": {
|
||||
"code": {
|
||||
|
||||
@ -5,9 +5,10 @@
|
||||
},
|
||||
"type": "LaserDesignator",
|
||||
"designatorConfig": {
|
||||
"laserPower": 5000,
|
||||
"laserWavelength": 1.06,
|
||||
"laserDivergenceAngle": 0.0003,
|
||||
"power": 5000,
|
||||
"wavelength": 1.06,
|
||||
"divergenceAngle": 0.0003,
|
||||
"jammingResistanceThreshold": 1e-5,
|
||||
"laserCodeConfig": {
|
||||
"code": {
|
||||
"codeType": "PRF",
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
},
|
||||
"type": "Infrared",
|
||||
"InfraredJammerConfig": {
|
||||
"Power": 1000,
|
||||
"Power": 2000,
|
||||
"Wavelength": 5,
|
||||
"AngleRange": 10,
|
||||
"Mode": "Blocking",
|
||||
|
||||
@ -5,9 +5,9 @@
|
||||
},
|
||||
"type": "Laser",
|
||||
"LaserJammerConfig": {
|
||||
"Power": 1000,
|
||||
"Wavelength": 1.06,
|
||||
"AngleRange": 10,
|
||||
"Power": 2000,
|
||||
"wavelength": 1.06,
|
||||
"angleRange": 10,
|
||||
"Mode": "Blocking",
|
||||
"Duration": 60
|
||||
}
|
||||
|
||||
@ -5,8 +5,8 @@
|
||||
},
|
||||
"type": "MillimeterWave",
|
||||
"MillimeterWaveJammerConfig": {
|
||||
"Power": 1000,
|
||||
"Wavelength": 3.16,
|
||||
"Power": 2000,
|
||||
"Wavelength": 3.19,
|
||||
"AngleRange": 10,
|
||||
"Mode": "Blocking",
|
||||
"Duration": 60
|
||||
|
||||
@ -22,6 +22,6 @@
|
||||
"irSignature": null
|
||||
},
|
||||
"infraredCommandGuidanceConfig": {
|
||||
"jammingResistanceThreshold": 1e-3
|
||||
"jammingResistanceThreshold": 1e-5
|
||||
}
|
||||
}
|
||||
@ -29,7 +29,7 @@
|
||||
"trackRecognitionProbability": 0.8,
|
||||
"targetLostTolerance": 0.2,
|
||||
"lockConfirmationTime": 0.3,
|
||||
"jammingResistanceThreshold": 1e-3,
|
||||
"jammingResistanceThreshold": 1e-5,
|
||||
"waveLength": 3.0
|
||||
}
|
||||
}
|
||||
@ -36,6 +36,7 @@
|
||||
"nonlinearGain": 0.5,
|
||||
"maxGuidanceAcceleration": 50.0,
|
||||
"lowPassFilterCoefficient": 0.2,
|
||||
"jammingResistanceThreshold": 1e-3
|
||||
"wavelength": 1.06,
|
||||
"jammingResistanceThreshold": 1e-5
|
||||
}
|
||||
}
|
||||
@ -35,9 +35,9 @@
|
||||
"targetReflectiveArea": 1.0,
|
||||
"lockThreshold": 1e-10,
|
||||
"spotOffsetSensitivity": 0.05,
|
||||
"jammingResistanceThreshold": 1e-3,
|
||||
"jammingResistanceThreshold": 1e-5,
|
||||
"transmitterEfficiency": 0.85,
|
||||
"receiverEfficiency": 0.8,
|
||||
"laserWavelength": 1.06
|
||||
"wavelength": 1.06
|
||||
}
|
||||
}
|
||||
@ -51,6 +51,6 @@
|
||||
|
||||
"yawControlEffectiveness": 120.0,
|
||||
"pitchControlEffectiveness": 150.0,
|
||||
"jammingResistanceThreshold": 1e-3
|
||||
"jammingResistanceThreshold": 1e-5
|
||||
}
|
||||
}
|
||||
@ -19,7 +19,7 @@ namespace ThreatSource.Guidance
|
||||
/// - 事件发布
|
||||
/// 是其他具体制导系统的基类
|
||||
/// </remarks>
|
||||
public class BaseGuidanceSystem : SimulationElement, IGuidanceSystem, IJammable
|
||||
public abstract class BaseGuidanceSystem : SimulationElement, IGuidanceSystem, IJammable
|
||||
{
|
||||
/// <summary>
|
||||
/// 干扰处理组件
|
||||
@ -29,7 +29,12 @@ namespace ThreatSource.Guidance
|
||||
/// <summary>
|
||||
/// 获取设备支持的干扰类型
|
||||
/// </summary>
|
||||
public IEnumerable<JammingType> SupportedJammingTypes => _jammingComponent.SupportedJammingTypes;
|
||||
public abstract IEnumerable<JammingType> SupportedJammingTypes { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取设备支持的阻塞干扰类型
|
||||
/// </summary>
|
||||
public abstract IEnumerable<JammingType> SupportedBlockingJammingTypes { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取设备当前是否处于被干扰状态
|
||||
@ -287,10 +292,19 @@ namespace ThreatSource.Guidance
|
||||
/// 添加支持的干扰类型
|
||||
/// </summary>
|
||||
/// <param name="type">干扰类型</param>
|
||||
/// <param name="threshold">干扰阈值(单位:瓦特)</param>
|
||||
protected void AddSupportedJammingType(JammingType type, double threshold)
|
||||
protected void AddSupportedJammingType(JammingType type)
|
||||
{
|
||||
_jammingComponent.AddSupportedJammingType(type, threshold);
|
||||
_jammingComponent.AddSupportedJammingType(type);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加支持的阻塞干扰类型
|
||||
/// </summary>
|
||||
/// <param name="type">干扰类型</param>
|
||||
/// <param name="threshold">干扰阈值(单位:瓦特)</param>
|
||||
protected void AddSupportedBlockingJammingType(JammingType type, double threshold)
|
||||
{
|
||||
_jammingComponent.AddSupportedBlockingJammingType(type, threshold);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -354,15 +368,20 @@ namespace ThreatSource.Guidance
|
||||
/// </summary>
|
||||
/// <param name="jammingResistanceThreshold">干扰抗性阈值,单位:瓦特</param>
|
||||
/// <param name="supportedTypes">支持的干扰类型</param>
|
||||
/// <param name="supportedBlockingTypes">支持的阻塞干扰类型</param>
|
||||
/// <remarks>
|
||||
/// 使用此方法初始化指示器的干扰处理参数:
|
||||
/// - 设置干扰抗性阈值
|
||||
/// - 配置支持的干扰类型
|
||||
/// 子类应在构造函数中调用此方法
|
||||
/// </remarks>
|
||||
protected void InitializeJamming(double jammingResistanceThreshold, IEnumerable<JammingType> supportedTypes)
|
||||
protected void InitializeJamming(double jammingResistanceThreshold, IEnumerable<JammingType> supportedTypes, IEnumerable<JammingType> supportedBlockingTypes)
|
||||
{
|
||||
_jammingComponent.LoadJammingConfigFromThreshold(jammingResistanceThreshold, supportedTypes);
|
||||
foreach (var type in supportedTypes)
|
||||
{
|
||||
_jammingComponent.AddSupportedJammingType(type);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,6 +17,16 @@ namespace ThreatSource.Guidance
|
||||
/// </remarks>
|
||||
public class InfraredCommandGuidanceSystem : BaseGuidanceSystem
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取设备支持的阻塞干扰类型
|
||||
/// </summary>
|
||||
public override IEnumerable<JammingType> SupportedBlockingJammingTypes => [JammingType.Infrared];
|
||||
|
||||
/// <summary>
|
||||
/// 获取设备支持的干扰类型
|
||||
/// </summary>
|
||||
public override IEnumerable<JammingType> SupportedJammingTypes => [JammingType.Infrared];
|
||||
|
||||
/// <summary>
|
||||
/// 跟踪器到导弹的方向向量 (使用可空类型)
|
||||
/// </summary>
|
||||
@ -91,7 +101,7 @@ namespace ThreatSource.Guidance
|
||||
: base(id, maxAcceleration, guidanceCoefficient, simulationManager)
|
||||
{
|
||||
turnRate = 0;
|
||||
InitializeJamming(guidanceConfig.JammingResistanceThreshold, [JammingType.Infrared]);
|
||||
InitializeJamming(guidanceConfig.JammingResistanceThreshold, SupportedJammingTypes, SupportedBlockingJammingTypes);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -204,19 +204,40 @@ namespace ThreatSource.Guidance
|
||||
var (smokeCenterX, smokeCenterY) = AngleToPixel(angleX, angleY);
|
||||
|
||||
// 检查投影中心是否大致在图像内 (允许部分超出)
|
||||
// if (smokeCenterX < -imageWidth/2 || smokeCenterX >= imageWidth*1.5 || smokeCenterY < -imageHeight/2 || smokeCenterY >= imageHeight*1.5) continue;
|
||||
// More robust check needed? For now, let's proceed if center is roughly projectable.
|
||||
if (smokeCenterX < -imageWidth/4 || smokeCenterX >= imageWidth*1.25 ||
|
||||
smokeCenterY < -imageHeight/4 || smokeCenterY >= imageHeight*1.25)
|
||||
{
|
||||
Console.WriteLine($"烟幕 {smoke.Id} 投影中心 ({smokeCenterX}, {smokeCenterY}) 远离图像范围,跳过");
|
||||
continue;
|
||||
}
|
||||
|
||||
// 根据烟幕类型计算尺寸并填充 - 通过 config 访问
|
||||
switch (smoke.config.SmokeType)
|
||||
{
|
||||
|
||||
case SmokeScreenType.Wall:
|
||||
// 墙状烟幕,近似为水平矩形
|
||||
double wallWidth = smoke.config.WallWidth; // 通过 config 访问
|
||||
double wallHeight = smoke.config.WallHeight; // 通过 config 访问
|
||||
int pixelWidth = (int)Math.Max(minPixelSize, (wallWidth / distance) * imageWidth / fieldOfView);
|
||||
int pixelHeight = (int)Math.Max(minPixelSize, (wallHeight / distance) * imageHeight / fieldOfView); // Use imageHeight for vertical FOV estimate
|
||||
// 墙状烟幕,考虑其朝向
|
||||
// 获取烟幕墙朝向(法线方向)与视线方向的夹角
|
||||
Vector3D smokeForward = smoke.Orientation.ToVector().Normalize(); // 烟幕墙的朝向(法线方向)
|
||||
double angleToViewLine = Math.Acos(Math.Abs(Vector3D.DotProduct(smokeForward, forward)));
|
||||
|
||||
// 计算墙在视线方向的有效投影尺寸
|
||||
// 墙宽度在Z轴方向,需要结合墙的朝向计算在视线中的投影
|
||||
double wallWidth = smoke.config.WallWidth; // Z轴上的宽度
|
||||
double wallHeight = smoke.config.WallHeight; // Y轴上的高度
|
||||
double wallThickness = smoke.config.Thickness; // X轴上的厚度
|
||||
|
||||
Console.WriteLine($"烟幕墙朝向: {smokeForward}, 与视线夹角: {angleToViewLine * 180 / Math.PI:F2}度");
|
||||
|
||||
// 计算墙面的有效投影宽度(考虑朝向)
|
||||
// 当墙面垂直于视线时,宽度投影最大;平行时,宽度投影最小
|
||||
double effectiveWidth = Math.Abs(wallWidth * Math.Sin(angleToViewLine)) + Math.Abs(wallThickness * Math.Cos(angleToViewLine));
|
||||
|
||||
// 计算像素尺寸(投影到图像平面)
|
||||
int pixelWidth = (int)Math.Max(minPixelSize, (effectiveWidth / distance) * imageWidth / fieldOfView);
|
||||
int pixelHeight = (int)Math.Max(minPixelSize, (wallHeight / distance) * imageHeight / fieldOfView);
|
||||
|
||||
Console.WriteLine($"烟幕墙实际宽度: {wallWidth}m, 有效投影宽度: {effectiveWidth:F2}m");
|
||||
|
||||
int halfPixelWidth = pixelWidth / 2;
|
||||
int halfPixelHeight = pixelHeight / 2;
|
||||
@ -277,8 +298,9 @@ namespace ThreatSource.Guidance
|
||||
/// <param name="missilePosition">导弹位置</param>
|
||||
/// <param name="smokeAttenuation">衰减型烟幕透过率</param>
|
||||
/// <param name="simulationManager">仿真管理器实例</param>
|
||||
/// <param name="smokeGrenadeOverlapRatios">已计算的烟幕覆盖率字典,键为烟幕ID,值为覆盖率</param>
|
||||
/// <returns>红外图像</returns>
|
||||
public InfraredImage GenerateImage(BaseEquipment target, Vector3D missilePosition, double smokeAttenuation, ISimulationManager simulationManager)
|
||||
public InfraredImage GenerateImage(BaseEquipment target, Vector3D missilePosition, double smokeAttenuation, ISimulationManager simulationManager, Dictionary<string, double> smokeGrenadeOverlapRatios = null)
|
||||
{
|
||||
// 更新视线坐标系
|
||||
UpdateLineOfSightFrame(missilePosition, target.Position);
|
||||
@ -302,7 +324,7 @@ namespace ThreatSource.Guidance
|
||||
{
|
||||
for (int x = 0; x < imageWidth; x++)
|
||||
{
|
||||
smokeCoverageMask[y, x] = (smokeIntensityLayer[y, x] >= 0); // >= 0 表示被覆盖
|
||||
smokeCoverageMask[y, x] = smokeIntensityLayer[y, x] >= 0; // >= 0 表示被覆盖
|
||||
}
|
||||
}
|
||||
// --- 结束新增 ---
|
||||
@ -331,7 +353,7 @@ namespace ThreatSource.Guidance
|
||||
|
||||
// 计算大气和衰减型烟幕的总透过率
|
||||
double transmittance = CalculateAtmosphericTransmittance(distance, simulationManager.CurrentWeather, smokeAttenuation);
|
||||
Console.WriteLine($"大气及衰减烟幕透过率: {transmittance}");
|
||||
Console.WriteLine($"大气及衰减烟幕透过率: {transmittance},烟幕衰减: {smokeAttenuation}");
|
||||
|
||||
// 生成目标图像强度,考虑遮蔽烟幕覆盖
|
||||
GenerateTargetIntensity(image, smokeIntensityLayer, centerX, centerY, pixelLength, pixelWidth, target, distance, transmittance);
|
||||
@ -379,16 +401,55 @@ namespace ThreatSource.Guidance
|
||||
int halfWidth = pixelWidth / 2;
|
||||
int pixelsSet = 0;
|
||||
double maxSetIntensity = 0;
|
||||
|
||||
// 计算目标像素总数和烟幕覆盖的像素数
|
||||
int totalTargetPixels = 0;
|
||||
int smokeCoveredPixels = 0;
|
||||
|
||||
// 确保映射的分母不为零
|
||||
double patternPixelWidth = Math.Max(1.0, (double)pixelWidth / 3.0);
|
||||
double patternPixelHeight = Math.Max(1.0, (double)pixelLength / 3.0); // Assuming Length maps to Cols (Height of pattern grid)
|
||||
|
||||
// 第一遍:计算烟幕覆盖率
|
||||
// 遍历目标在图像中的包围盒,计算有多少像素被烟幕覆盖
|
||||
for (int dy = -halfWidth; dy <= halfWidth; dy++)
|
||||
{
|
||||
int y = centerY + dy;
|
||||
if (y < 0 || y >= image.Height) continue;
|
||||
|
||||
for (int dx = -halfLength; dx <= halfLength; dx++)
|
||||
{
|
||||
int x = centerX + dx;
|
||||
if (x < 0 || x >= image.Width) continue;
|
||||
|
||||
// 只统计在目标有效区域内的像素
|
||||
// 简化为椭圆形区域检查
|
||||
double normalizedX = (double)dx / halfLength;
|
||||
double normalizedY = (double)dy / halfWidth;
|
||||
double distanceFromCenter = Math.Sqrt(normalizedX * normalizedX + normalizedY * normalizedY);
|
||||
|
||||
if (distanceFromCenter <= 1.0) // 在目标椭圆内
|
||||
{
|
||||
totalTargetPixels++;
|
||||
|
||||
if (smokeIntensityLayer[y, x] >= 0) // 被烟幕覆盖
|
||||
{
|
||||
smokeCoveredPixels++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 计算烟幕覆盖率
|
||||
double smokeCoverageRatio = totalTargetPixels > 0 ? (double)smokeCoveredPixels / totalTargetPixels : 0.0;
|
||||
Console.WriteLine($"Blob {target.Id} 烟幕覆盖率: {smokeCoverageRatio:P2} ({smokeCoveredPixels}/{totalTargetPixels})");
|
||||
|
||||
// 第二遍:根据覆盖率调整目标亮度
|
||||
// 遍历目标在图像中的包围盒
|
||||
for (int dy = -halfWidth; dy <= halfWidth; dy++)
|
||||
{
|
||||
int y = centerY + dy;
|
||||
if (y < 0 || y < 0 || y >= image.Height) continue; // Corrected y boundary check
|
||||
if (y < 0 || y >= image.Height) continue;
|
||||
|
||||
for (int dx = -halfLength; dx <= halfLength; dx++)
|
||||
{
|
||||
@ -400,14 +461,12 @@ namespace ThreatSource.Guidance
|
||||
|
||||
if (smokeIntensity >= 0) // 检查此像素是否被遮蔽烟幕覆盖
|
||||
{
|
||||
// 直接使用烟幕强度
|
||||
finalIntensity = smokeIntensity;
|
||||
}
|
||||
else // 未被烟幕覆盖,基于 ThermalPattern 计算强度
|
||||
{
|
||||
// 1. 将像素坐标映射到 3x3 热成像模式的索引
|
||||
// Map offset relative to top-left of bbox to [0, width/height-1] then divide
|
||||
// Map dy from [-halfWidth, +halfWidth] to [0, pixelWidth-1]
|
||||
// Map dx from [-halfLength, +halfLength] to [0, pixelLength-1]
|
||||
int pixelYInBox = dy + halfWidth;
|
||||
int pixelXInBox = dx + halfLength;
|
||||
|
||||
@ -426,15 +485,18 @@ namespace ThreatSource.Guidance
|
||||
double tempKelvin = tempCelsius + KELVIN_OFFSET;
|
||||
|
||||
// 4. 使用简化的 T^4 定律计算基础强度 (W/sr)
|
||||
// Ensure tempKelvin is positive before power calculation
|
||||
double pixelBaseIntensity = tempKelvin > 0 ? TEMPERATURE_TO_INTENSITY_FACTOR * Math.Pow(tempKelvin, 4) : 0;
|
||||
|
||||
|
||||
// 5. 应用大气透过率和距离衰减 (使用 distance^2)
|
||||
// Avoid division by zero distance
|
||||
finalIntensity = (distance > 1e-6) ? (pixelBaseIntensity * transmittance / (distance * distance)) : pixelBaseIntensity * transmittance;
|
||||
|
||||
|
||||
|
||||
// 6. 根据整体烟幕覆盖率调整非覆盖像素的亮度
|
||||
// 烟幕覆盖率越高,剩余部分的可见度也应越低(烟雾散射效应)
|
||||
if (smokeCoverageRatio > 0.3) // 超过30%覆盖时开始衰减
|
||||
{
|
||||
double visibilityFactor = 1.0 - (smokeCoverageRatio - 0.3) * 0.5; // 线性衰减,最多降低50%
|
||||
finalIntensity *= Math.Max(0.5, visibilityFactor);
|
||||
}
|
||||
}
|
||||
|
||||
// 设置最终计算出的强度到图像
|
||||
|
||||
@ -5,6 +5,7 @@ using ThreatSource.Utils;
|
||||
using ThreatSource.Jammer;
|
||||
using System.Diagnostics;
|
||||
using AirTransmission; // 添加引用
|
||||
using System.Linq;
|
||||
|
||||
namespace ThreatSource.Guidance
|
||||
{
|
||||
@ -42,6 +43,16 @@ namespace ThreatSource.Guidance
|
||||
/// </summary>
|
||||
private WorkMode currentMode = WorkMode.Search;
|
||||
|
||||
/// <summary>
|
||||
/// 获取设备支持的阻塞干扰类型
|
||||
/// </summary>
|
||||
public override IEnumerable<JammingType> SupportedBlockingJammingTypes => [JammingType.Infrared];
|
||||
|
||||
/// <summary>
|
||||
/// 获取设备支持的干扰类型
|
||||
/// </summary>
|
||||
public override IEnumerable<JammingType> SupportedJammingTypes => [JammingType.Infrared, JammingType.SmokeGrenade];
|
||||
|
||||
/// <summary>
|
||||
/// 是否已探测到目标
|
||||
/// </summary>
|
||||
@ -133,9 +144,9 @@ namespace ThreatSource.Guidance
|
||||
imageHeight: guidanceConfig.ImageHeight,
|
||||
fieldOfView: guidanceConfig.SearchFieldOfView,
|
||||
backgroundIntensity: guidanceConfig.BackgroundIntensity,
|
||||
wavelength: guidanceConfig.WaveLength
|
||||
wavelength: guidanceConfig.Wavelength
|
||||
);
|
||||
InitializeJamming(guidanceConfig.JammingResistanceThreshold, [JammingType.Infrared, JammingType.SmokeGrenade]);
|
||||
InitializeJamming(guidanceConfig.JammingResistanceThreshold, SupportedJammingTypes, SupportedBlockingJammingTypes);
|
||||
SwitchToSearchMode(); // 初始化为搜索模式
|
||||
}
|
||||
|
||||
@ -163,18 +174,18 @@ namespace ThreatSource.Guidance
|
||||
{
|
||||
if (SimulationManager.GetEntityById(parameters.JammerId) is SmokeGrenade smokeGrenade)
|
||||
{
|
||||
// Check lastTargetPosition != null before using it
|
||||
// TODO:这里需要根据目标位置计算烟幕衰减,没有发现目标时,要根据当前方向,用一个假定目标位置来计算烟幕衰减
|
||||
if (lastTargetPosition != null)
|
||||
{
|
||||
// 计算烟幕衰减 (这里存储衰减系数,1.0表示无衰减)
|
||||
SmokeAttenuation = smokeGrenade.GetSmokeTransmittanceOnLine(Position, lastTargetPosition, config.WaveLength);
|
||||
Debug.WriteLine($"[烟幕干扰应用 IR] 视线透过率/衰减系数: {SmokeAttenuation:F3}");
|
||||
SmokeAttenuation = smokeGrenade.GetSmokeTransmittanceOnLine(Position, lastTargetPosition, config.Wavelength);
|
||||
Console.WriteLine($"[烟幕干扰应用 IR] 视线透过率/衰减系数: {SmokeAttenuation:F3}");
|
||||
}
|
||||
else
|
||||
{
|
||||
// 目标尚未有效跟踪,无法计算特定视线衰减,假定无衰减
|
||||
SmokeAttenuation = 1.0;
|
||||
Debug.WriteLine("[烟幕干扰应用 IR] 目标位置无效,暂不计算烟幕衰减。");
|
||||
// 目标尚未有效跟踪,无法计算特定视线衰减,假定一个默认值
|
||||
SmokeAttenuation = 0.4;
|
||||
Console.WriteLine("[烟幕干扰应用 IR] 没有发现目标位置,暂不计算烟幕衰减。");
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -326,7 +337,7 @@ namespace ThreatSource.Guidance
|
||||
imageHeight: config.ImageHeight,
|
||||
fieldOfView: config.SearchFieldOfView,
|
||||
backgroundIntensity: config.BackgroundIntensity,
|
||||
wavelength: config.WaveLength
|
||||
wavelength: config.Wavelength
|
||||
);
|
||||
Console.WriteLine($"切换到搜索模式, 视场角: {config.SearchFieldOfView * 180 / Math.PI} 度");
|
||||
}
|
||||
@ -351,7 +362,7 @@ namespace ThreatSource.Guidance
|
||||
imageHeight: config.ImageHeight,
|
||||
fieldOfView: config.TrackFieldOfView,
|
||||
backgroundIntensity: config.BackgroundIntensity,
|
||||
wavelength: config.WaveLength
|
||||
wavelength: config.Wavelength
|
||||
);
|
||||
Console.WriteLine($"切换到跟踪模式, 视场角: {config.TrackFieldOfView * 180 / Math.PI} 度");
|
||||
}
|
||||
@ -408,9 +419,19 @@ namespace ThreatSource.Guidance
|
||||
{
|
||||
// 检查视线角条件
|
||||
double angle = Math.Acos(Vector3D.DotProduct(toTarget.Normalize(), missileVelocity.Normalize()));
|
||||
Console.WriteLine($"[红外成像制导系统] 目标 {target.Id} 视线角: {angle * 180 / Math.PI} 度, 视场角范围: {currentFov * 180 / Math.PI} 度");
|
||||
if (angle <= currentFov / 2)
|
||||
{
|
||||
// 在生成红外图像前,检查目标是否被烟幕遮挡
|
||||
bool isTargetObscuredBySmoke = CheckIfTargetObscuredBySmoke(missilePosition, target);
|
||||
if (isTargetObscuredBySmoke)
|
||||
{
|
||||
Console.WriteLine($"[红外成像制导系统] 目标 {target.Id} 被烟幕完全遮挡,跳过图像生成");
|
||||
continue; // 如果目标被完全遮挡,跳过此目标
|
||||
}
|
||||
|
||||
// 生成红外图像
|
||||
Console.WriteLine($"[红外成像制导系统] 生成红外图像,目标类型: {target.GetType().Name}, 烟幕衰减: {SmokeAttenuation}");
|
||||
var image = imageGenerator.GenerateImage(target, missilePosition, SmokeAttenuation, SimulationManager);
|
||||
|
||||
switch (currentMode)
|
||||
@ -488,6 +509,69 @@ namespace ThreatSource.Guidance
|
||||
return foundTarget;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检查目标是否被烟幕完全遮挡
|
||||
/// </summary>
|
||||
/// <param name="observerPosition">观察者位置(导弹)</param>
|
||||
/// <param name="target">目标</param>
|
||||
/// <returns>如果目标被烟幕遮挡超过阈值,返回true</returns>
|
||||
private bool CheckIfTargetObscuredBySmoke(Vector3D observerPosition, BaseEquipment target)
|
||||
{
|
||||
// 获取所有活动的烟幕弹
|
||||
var smokeGrenades = SimulationManager.GetEntitiesByType<SmokeGrenade>()
|
||||
.Where(sg => sg.IsActive && sg.config != null)
|
||||
.ToList();
|
||||
|
||||
if (smokeGrenades.Count == 0)
|
||||
{
|
||||
return false; // 没有活动的烟幕
|
||||
}
|
||||
|
||||
const double ObscurationThreshold = 0.8; // 80%遮挡视为完全遮挡
|
||||
Vector3D targetCenter = target.Position;
|
||||
Orientation targetOrient = target.Orientation;
|
||||
Vector3D targetDims = new Vector3D(target.Properties.Width, target.Properties.Height, target.Properties.Length);
|
||||
|
||||
foreach (var smoke in smokeGrenades)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 对于墙状烟幕,定义其尺寸和方向
|
||||
Vector3D smokeDims;
|
||||
if (smoke.config.SmokeType == SmokeScreenType.Cloud)
|
||||
{
|
||||
smokeDims = new Vector3D(smoke.config.CloudDiameter, smoke.config.Thickness, smoke.config.CloudDiameter);
|
||||
}
|
||||
else // Wall
|
||||
{
|
||||
smokeDims = new Vector3D(smoke.config.Thickness, smoke.config.WallHeight, smoke.config.WallWidth);
|
||||
}
|
||||
|
||||
// 使用ObscurationUtils计算烟幕对目标的遮挡比例
|
||||
double overlapRatio = ObscurationUtils.CalculateProjectedOverlapRatio(
|
||||
observerPosition, // 观察者位置(导弹)
|
||||
smoke.Position, smokeDims, smoke.Orientation, // 烟幕数据(前景)
|
||||
targetCenter, targetDims, targetOrient // 目标数据(背景)
|
||||
);
|
||||
|
||||
Console.WriteLine($"[红外成像制导系统] 目标 {target.Id} 被烟幕 {smoke.Id} 遮挡比例: {overlapRatio:P2}");
|
||||
|
||||
// 如果任何一个烟幕的遮挡比例超过阈值,则认为目标被遮挡
|
||||
if (overlapRatio >= ObscurationThreshold)
|
||||
{
|
||||
Console.WriteLine($"[红外成像制导系统] 目标 {target.Id} 被烟幕 {smoke.Id} 遮挡超过阈值 {ObscurationThreshold:P0},视为完全遮挡");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"[红外成像制导系统] 计算烟幕遮挡时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
return false; // 没有烟幕能有效遮挡目标
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取制导系统的详细状态信息
|
||||
/// </summary>
|
||||
|
||||
@ -19,6 +19,16 @@ namespace ThreatSource.Guidance
|
||||
/// </remarks>
|
||||
public class LaserBeamRiderGuidanceSystem : BaseGuidanceSystem
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取设备支持的阻塞干扰类型
|
||||
/// </summary>
|
||||
public override IEnumerable<JammingType> SupportedBlockingJammingTypes => [JammingType.Laser];
|
||||
|
||||
/// <summary>
|
||||
/// 获取设备支持的干扰类型
|
||||
/// </summary>
|
||||
public override IEnumerable<JammingType> SupportedJammingTypes => [JammingType.Laser];
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置激光源位置 (使用可空类型)
|
||||
/// </summary>
|
||||
@ -108,12 +118,12 @@ namespace ThreatSource.Guidance
|
||||
/// 定义导弹支持的编码类型
|
||||
/// 默认支持PRF、PPM和PWM编码
|
||||
/// </remarks>
|
||||
private List<LaserCodeType> supportedCodeTypes = new List<LaserCodeType>
|
||||
{
|
||||
private readonly List<LaserCodeType> supportedCodeTypes =
|
||||
[
|
||||
LaserCodeType.PRF,
|
||||
LaserCodeType.PPM,
|
||||
LaserCodeType.PWM
|
||||
};
|
||||
];
|
||||
|
||||
/// <summary>
|
||||
/// 系统配置参数
|
||||
@ -162,7 +172,7 @@ namespace ThreatSource.Guidance
|
||||
IsCodeEnabled = true,
|
||||
IsCodeMatchRequired = true
|
||||
};
|
||||
InitializeJamming(guidanceConfig.JammingResistanceThreshold, [JammingType.Laser]);
|
||||
InitializeJamming(guidanceConfig.JammingResistanceThreshold, SupportedJammingTypes, SupportedBlockingJammingTypes);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -445,7 +455,7 @@ namespace ThreatSource.Guidance
|
||||
atmosphericTransmittance = AtmosphereDllWrapper.CalculateTransmittance(
|
||||
distance,
|
||||
RadiationType.Laser,
|
||||
config.LaserWavelength,
|
||||
config.Wavelength,
|
||||
SimulationManager.CurrentWeather);
|
||||
}
|
||||
|
||||
@ -554,9 +564,9 @@ namespace ThreatSource.Guidance
|
||||
|
||||
if (parameters.Type == JammingType.Laser)
|
||||
{
|
||||
if (Math.Abs((parameters.Wavelength ?? 0) - config.LaserWavelength) > 1e-6)
|
||||
if (Math.Abs((parameters.Wavelength ?? 0) - config.Wavelength) > 1e-6)
|
||||
{
|
||||
Debug.WriteLine($"[LASER_BEAM_RIDER] {Id} 忽略激光干扰:波长 {parameters.Wavelength}um 与期望波长 {config.LaserWavelength}um 不匹配。", "Jamming");
|
||||
Debug.WriteLine($"[LASER_BEAM_RIDER] {Id} 忽略激光干扰:波长 {parameters.Wavelength}um 与期望波长 {config.Wavelength}um 不匹配。", "Jamming");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -24,6 +24,16 @@ namespace ThreatSource.Guidance
|
||||
{
|
||||
private readonly LaserSemiActiveGuidanceConfig config;
|
||||
|
||||
/// <summary>
|
||||
/// 获取设备支持的阻塞干扰类型
|
||||
/// </summary>
|
||||
public override IEnumerable<JammingType> SupportedBlockingJammingTypes => [JammingType.Laser];
|
||||
|
||||
/// <summary>
|
||||
/// 获取设备支持的干扰类型
|
||||
/// </summary>
|
||||
public override IEnumerable<JammingType> SupportedJammingTypes => [JammingType.Laser, JammingType.SmokeGrenade, JammingType.LaserDecoy];
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置目标位置 (使用可空类型)
|
||||
/// </summary>
|
||||
@ -166,7 +176,7 @@ namespace ThreatSource.Guidance
|
||||
// 初始化加速度平滑处理
|
||||
PreviousGuidanceAcceleration = Vector3D.Zero;
|
||||
|
||||
InitializeJamming(guidanceConfig.JammingResistanceThreshold, [JammingType.Laser, JammingType.SmokeGrenade, JammingType.LaserDecoy]);
|
||||
InitializeJamming(guidanceConfig.JammingResistanceThreshold, SupportedJammingTypes, SupportedBlockingJammingTypes);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -358,9 +368,9 @@ namespace ThreatSource.Guidance
|
||||
if (parameters.Type == JammingType.Laser)
|
||||
{
|
||||
// 1. 检查波长
|
||||
if (Math.Abs((parameters.Wavelength ?? 0) - config.LaserWavelength) > 1e-6)
|
||||
if (Math.Abs((parameters.Wavelength ?? 0) - config.Wavelength) > 1e-6)
|
||||
{
|
||||
Debug.WriteLine($"[LASER_SEMI_ACTIVE] {Id} 忽略激光干扰:波长 {parameters.Wavelength}um 与期望波长 {config.LaserWavelength}um 不匹配。", "Jamming");
|
||||
Debug.WriteLine($"[LASER_SEMI_ACTIVE] {Id} 忽略激光干扰:波长 {parameters.Wavelength}um 与期望波长 {config.Wavelength}um 不匹配。", "Jamming");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -451,7 +461,7 @@ namespace ThreatSource.Guidance
|
||||
else if (target.Source is LaserDesignator laserDesignator)
|
||||
{
|
||||
// 计算接收功率
|
||||
receivedPower = CalculateReceivedPower(target.Source.Position, target.SpotPosition, laserDesignator.config.LaserPower, laserDesignator.config.LaserDivergenceAngle);
|
||||
receivedPower = CalculateReceivedPower(target.Source.Position, target.SpotPosition, laserDesignator.config.Power, laserDesignator.config.DivergenceAngle);
|
||||
Console.WriteLine($"处理激光信号: 真实目标接收功率={receivedPower:E}W, 真实目标ID: {target.Target.Id}, 真实目标位置: {target.SpotPosition}");
|
||||
}
|
||||
|
||||
@ -515,13 +525,13 @@ namespace ThreatSource.Guidance
|
||||
atmosphericTransmittanceToTarget = SmokeAttenuation * AtmosphereDllWrapper.CalculateTransmittance(
|
||||
distanceDesignatorToTarget,
|
||||
RadiationType.Laser,
|
||||
config.LaserWavelength,
|
||||
config.Wavelength,
|
||||
SimulationManager.CurrentWeather);
|
||||
|
||||
atmosphericTransmittanceToMissile = SmokeAttenuation * AtmosphereDllWrapper.CalculateTransmittance(
|
||||
distanceMissileToTarget,
|
||||
RadiationType.Laser,
|
||||
config.LaserWavelength,
|
||||
config.Wavelength,
|
||||
SimulationManager.CurrentWeather);
|
||||
}
|
||||
|
||||
@ -872,12 +882,12 @@ namespace ThreatSource.Guidance
|
||||
|
||||
// 使用 AtmosphereDllWrapper 计算烟幕透过率
|
||||
double transmittance = AtmosphereDllWrapper.CalculateSmokeScreenTransmittance(
|
||||
config.LaserWavelength, // 激光波长(微米)
|
||||
config.Wavelength, // 激光波长(微米)
|
||||
concentration, // 烟幕浓度(g/m³)
|
||||
effectiveThickness // 烟幕厚度(米)
|
||||
);
|
||||
|
||||
Debug.WriteLine($"烟幕衰减计算 - 波长: {config.LaserWavelength:F2}um, 浓度: {concentration}g/m³, 厚度: {effectiveThickness}m, 透过率: {transmittance:P2}");
|
||||
Debug.WriteLine($"烟幕衰减计算 - 波长: {config.Wavelength:F2}um, 浓度: {concentration}g/m³, 厚度: {effectiveThickness}m, 透过率: {transmittance:P2}");
|
||||
|
||||
return transmittance;
|
||||
}
|
||||
|
||||
@ -31,6 +31,16 @@ namespace ThreatSource.Guidance
|
||||
Lock // 锁定模式
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取设备支持的阻塞干扰类型
|
||||
/// </summary>
|
||||
public override IEnumerable<JammingType> SupportedBlockingJammingTypes => [JammingType.MillimeterWave];
|
||||
|
||||
/// <summary>
|
||||
/// 获取设备支持的干扰类型
|
||||
/// </summary>
|
||||
public override IEnumerable<JammingType> SupportedJammingTypes => [JammingType.MillimeterWave, JammingType.SmokeGrenade];
|
||||
|
||||
/// <summary>
|
||||
/// 毫米波导引系统配置
|
||||
/// </summary>
|
||||
@ -146,7 +156,7 @@ namespace ThreatSource.Guidance
|
||||
: base(id, maxAcceleration, guidanceCoefficient, simulationManager)
|
||||
{
|
||||
this.config = config;
|
||||
InitializeJamming(config.JammingResistanceThreshold, [JammingType.MillimeterWave, JammingType.SmokeGrenade]);
|
||||
InitializeJamming(config.JammingResistanceThreshold, SupportedJammingTypes, SupportedBlockingJammingTypes);
|
||||
SwitchToSearchMode(); // 初始化为搜索模式
|
||||
}
|
||||
|
||||
|
||||
@ -53,6 +53,11 @@ namespace ThreatSource.Indicator
|
||||
/// </remarks>
|
||||
public abstract IEnumerable<JammingType> SupportedJammingTypes { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取设备支持的阻塞干扰类型
|
||||
/// </summary>
|
||||
public abstract IEnumerable<JammingType> SupportedBlockingJammingTypes { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取设备当前是否处于被干扰状态
|
||||
/// </summary>
|
||||
@ -100,15 +105,20 @@ namespace ThreatSource.Indicator
|
||||
/// </summary>
|
||||
/// <param name="jammingResistanceThreshold">干扰抗性阈值,单位:瓦特</param>
|
||||
/// <param name="supportedTypes">支持的干扰类型</param>
|
||||
/// <param name="supportedBlockingTypes">支持的阻塞干扰类型</param>
|
||||
/// <remarks>
|
||||
/// 使用此方法初始化指示器的干扰处理参数:
|
||||
/// - 设置干扰抗性阈值
|
||||
/// - 配置支持的干扰类型
|
||||
/// 子类应在构造函数中调用此方法
|
||||
/// </remarks>
|
||||
protected void InitializeJamming(double jammingResistanceThreshold, IEnumerable<JammingType> supportedTypes)
|
||||
protected void InitializeJamming(double jammingResistanceThreshold, IEnumerable<JammingType> supportedTypes, IEnumerable<JammingType> supportedBlockingTypes)
|
||||
{
|
||||
_jammingComponent.LoadJammingConfigFromThreshold(jammingResistanceThreshold, supportedTypes);
|
||||
_jammingComponent.LoadJammingConfigFromThreshold(jammingResistanceThreshold, supportedBlockingTypes);
|
||||
foreach (var type in supportedTypes)
|
||||
{
|
||||
_jammingComponent.AddSupportedJammingType(type);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -167,7 +177,7 @@ namespace ThreatSource.Indicator
|
||||
if (parameters.Type == JammingType.SmokeGrenade)
|
||||
{
|
||||
RecalculateObscurationStatus();
|
||||
Debug.WriteLine($"[BaseIndicator] 烟幕状态更新,IsTargetObscured: {IsTargetObscured}", "Jamming");
|
||||
Debug.WriteLine($"[BaseIndicator] 烟幕状态更新,IsTargetObscured: {IsTargetObscured}", "Jamming");
|
||||
}
|
||||
else // 其他干扰类型打印通用消息
|
||||
{
|
||||
@ -186,12 +196,10 @@ namespace ThreatSource.Indicator
|
||||
IsActive = true;
|
||||
// 统一订阅 JammingEvent
|
||||
SimulationManager.SubscribeToEvent<JammingEvent>(HandleJammingEvent);
|
||||
// 子类仍需在此处订阅其他特定事件(如导弹热源事件)
|
||||
SimulationManager.SubscribeToEvent<JammingStoppedEvent>(HandleJammingStoppedEvent);
|
||||
}
|
||||
base.Activate(); // 调用 SimulationElement 的基类 Activate
|
||||
// 子类需要在此之后调用 base.Activate() 并订阅烟幕事件 <--- 旧注释,移除或更新
|
||||
// 现在基类处理通用 JammingEvent,子类只需要处理非干扰事件
|
||||
RecalculateObscurationStatus(); // 激活时检查一次初始遮挡状态
|
||||
base.Activate();
|
||||
RecalculateObscurationStatus(); // 激活时检查一次初始遮挡状态
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -202,16 +210,15 @@ namespace ThreatSource.Indicator
|
||||
if (IsActive)
|
||||
{
|
||||
IsActive = false;
|
||||
// 统一取消订阅 JammingEvent
|
||||
SimulationManager.UnsubscribeFromEvent<JammingEvent>(HandleJammingEvent);
|
||||
// 子类仍需在此处取消订阅其他特定事件
|
||||
// 统一取消订阅 JammingEvent
|
||||
SimulationManager.UnsubscribeFromEvent<JammingEvent>(HandleJammingEvent);
|
||||
SimulationManager.UnsubscribeFromEvent<JammingStoppedEvent>(HandleJammingStoppedEvent);
|
||||
}
|
||||
// 子类需要在此之前取消订阅烟幕事件 <--- 旧注释,移除或更新
|
||||
IsTargetObscured = false;
|
||||
// 重置最后目标状态
|
||||
_lastKnownTargetPosition = null;
|
||||
_lastKnownTargetOrientation = null;
|
||||
base.Deactivate(); // 调用 SimulationElement 的基类 Deactivate
|
||||
base.Deactivate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -312,7 +319,7 @@ namespace ThreatSource.Indicator
|
||||
.Where(sg => sg != null && sg.IsActive)
|
||||
.ToList(); // 获取列表以便检查是否为空
|
||||
|
||||
if (!activeSmokeGrenades.Any())
|
||||
if (activeSmokeGrenades.Count == 0)
|
||||
{
|
||||
return false; // 没有活动的烟幕,视为未遮挡
|
||||
}
|
||||
@ -371,12 +378,12 @@ namespace ThreatSource.Indicator
|
||||
/// <param name="evt">干扰事件</param>
|
||||
protected virtual void HandleJammingEvent(JammingEvent evt)
|
||||
{
|
||||
Console.WriteLine($"[BaseIndicator] 处理干扰事件: {evt.Parameters.Type}");
|
||||
if (evt == null) return;
|
||||
|
||||
// 在应用干扰前检查是否应该处理此干扰
|
||||
if (!ShouldHandleJamming(evt.Parameters))
|
||||
{
|
||||
// Debug.WriteLine($"[BaseIndicator] {Id} 忽略干扰事件,类型: {evt.Parameters.Type}");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -384,6 +391,18 @@ namespace ThreatSource.Indicator
|
||||
ApplyJamming(evt.Parameters);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 处理干扰停止事件
|
||||
/// </summary>
|
||||
/// <param name="evt">干扰停止事件</param>
|
||||
protected virtual void HandleJammingStoppedEvent(JammingStoppedEvent evt)
|
||||
{
|
||||
if (evt != null)
|
||||
{
|
||||
ClearJamming(evt.Parameters);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断是否应该处理传入的干扰参数(可被子类重写以添加特定检查)
|
||||
/// </summary>
|
||||
@ -391,14 +410,9 @@ namespace ThreatSource.Indicator
|
||||
/// <returns>如果应该处理则返回 true,否则返回 false</returns>
|
||||
protected virtual bool ShouldHandleJamming(JammingParameters parameters)
|
||||
{
|
||||
// 基类默认处理所有受支持类型的干扰 (包括烟幕)
|
||||
// 子类可以重写此方法添加额外检查,如波段匹配
|
||||
// 注意:烟幕干扰虽然通过这里,但主要效果通过 IsTargetObscured 和 RecalculateObscurationStatus 体现
|
||||
bool supported = SupportedJammingTypes.Contains(parameters.Type);
|
||||
// if(!supported) Debug.WriteLine($"[BaseIndicator] {Id} 不支持干扰类型: {parameters.Type}");
|
||||
return supported;
|
||||
return true;
|
||||
}
|
||||
|
||||
// --- 结束新增干扰事件处理逻辑 ---
|
||||
}
|
||||
}
|
||||
@ -30,6 +30,11 @@ namespace ThreatSource.Indicator
|
||||
/// </remarks>
|
||||
public override IEnumerable<JammingType> SupportedJammingTypes => [JammingType.Infrared, JammingType.SmokeGrenade];
|
||||
|
||||
/// <summary>
|
||||
/// 获取设备支持的阻塞干扰类型
|
||||
/// </summary>
|
||||
public override IEnumerable<JammingType> SupportedBlockingJammingTypes => [JammingType.Infrared];
|
||||
|
||||
/// <summary>
|
||||
/// 红外测角仪配置参数
|
||||
/// </summary>
|
||||
@ -75,7 +80,7 @@ namespace ThreatSource.Indicator
|
||||
IsTracking = false;
|
||||
|
||||
// 初始化干扰处理
|
||||
InitializeJamming(config.JammingResistanceThreshold, SupportedJammingTypes);
|
||||
InitializeJamming(config.JammingResistanceThreshold, SupportedJammingTypes, SupportedBlockingJammingTypes);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -272,14 +277,11 @@ namespace ThreatSource.Indicator
|
||||
{
|
||||
if (!IsActive)
|
||||
{
|
||||
base.Activate(); // Handles IsActive and subscribes HandleJammingEvent
|
||||
// Removed JammingEvent subscriptions for OnInfraredJamming and HandleSmokeEvent
|
||||
base.Activate();
|
||||
|
||||
// Subscribe to missile-specific events (KEEP THESE)
|
||||
SimulationManager.SubscribeToEvent<InfraredGuidanceMissileLightEvent>(OnInfraredGuidanceMissileLight);
|
||||
SimulationManager.SubscribeToEvent<InfraredGuidanceMissileLightOffEvent>(OnInfraredGuidanceMissileLightOff);
|
||||
|
||||
// 子类特定的激活逻辑
|
||||
Debug.WriteLine($"红外测角仪 {Id} 已激活");
|
||||
}
|
||||
}
|
||||
@ -297,16 +299,13 @@ namespace ThreatSource.Indicator
|
||||
{
|
||||
if (IsActive)
|
||||
{
|
||||
// 子类特定的停用逻辑
|
||||
StopTracking(); // 停止跟踪
|
||||
|
||||
// Unsubscribe from missile-specific events (KEEP THESE)
|
||||
SimulationManager.UnsubscribeFromEvent<InfraredGuidanceMissileLightEvent>(OnInfraredGuidanceMissileLight);
|
||||
SimulationManager.UnsubscribeFromEvent<InfraredGuidanceMissileLightOffEvent>(OnInfraredGuidanceMissileLightOff);
|
||||
|
||||
// Removed JammingEvent subscriptions for OnInfraredJamming and HandleSmokeEvent
|
||||
Debug.WriteLine($"红外测角仪 {Id} 已停用");
|
||||
base.Deactivate(); // Handles IsActive and unsubscribes HandleJammingEvent
|
||||
base.Deactivate();
|
||||
}
|
||||
}
|
||||
|
||||
@ -384,8 +383,17 @@ namespace ThreatSource.Indicator
|
||||
public override string GetStatus()
|
||||
{
|
||||
string jammingStatusString = "正常";
|
||||
if (IsJammed) jammingStatusString = "受红外干扰";
|
||||
if (IsTargetObscured) jammingStatusString = IsJammed ? "受红外干扰和烟幕遮挡" : "目标被烟幕遮挡";
|
||||
if (IsJammed)
|
||||
{
|
||||
if (IsTargetObscured)
|
||||
{
|
||||
jammingStatusString = "目标被烟幕遮挡";
|
||||
}
|
||||
else
|
||||
{
|
||||
jammingStatusString = "受红外干扰";
|
||||
}
|
||||
}
|
||||
|
||||
return base.GetStatus() + "\n" +
|
||||
$" 位置: {Position}\n" +
|
||||
|
||||
@ -27,6 +27,11 @@ namespace ThreatSource.Indicator
|
||||
/// </remarks>
|
||||
public override IEnumerable<JammingType> SupportedJammingTypes => [JammingType.Laser, JammingType.SmokeGrenade];
|
||||
|
||||
/// <summary>
|
||||
/// 获取设备支持的阻塞干扰类型
|
||||
/// </summary>
|
||||
public override IEnumerable<JammingType> SupportedBlockingJammingTypes => [JammingType.Laser];
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置干扰阈值,单位:分贝
|
||||
/// </summary>
|
||||
@ -87,7 +92,7 @@ namespace ThreatSource.Indicator
|
||||
JammingThreshold = config.JammingResistanceThreshold;
|
||||
|
||||
// 设置干扰阈值并添加支持的干扰类型
|
||||
InitializeJamming(JammingThreshold, SupportedJammingTypes);
|
||||
InitializeJamming(JammingThreshold, SupportedJammingTypes, SupportedBlockingJammingTypes);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -120,13 +125,6 @@ namespace ThreatSource.Indicator
|
||||
/// </remarks>
|
||||
protected override void UpdateIndicator(double deltaTime)
|
||||
{
|
||||
// 基类 Update 已经检查了 IsJammed
|
||||
// if (IsJammed)
|
||||
// {
|
||||
// StopBeamIllumination(); // This logic moved to HandleJammingApplied
|
||||
// return;
|
||||
// }
|
||||
|
||||
if (IsBeamOn)
|
||||
{
|
||||
// 检查目标是否被遮挡
|
||||
@ -210,9 +208,9 @@ namespace ThreatSource.Indicator
|
||||
if (parameters.Type == JammingType.Laser)
|
||||
{
|
||||
// 检查波长匹配 (单位: 微米)
|
||||
if (Math.Abs((parameters.Wavelength ?? 0) - config.LaserWavelength) > 1e-6) // 使用配置的波长
|
||||
if (Math.Abs((parameters.Wavelength ?? 0) - config.Wavelength) > 1e-6) // 使用配置的波长
|
||||
{
|
||||
Debug.WriteLine($"[LaserBeamRider] {Id} 忽略激光干扰:波长 {parameters.Wavelength}um 与工作波长 {config.LaserWavelength}um 不匹配。", "Jamming");
|
||||
Debug.WriteLine($"[LaserBeamRider] {Id} 忽略激光干扰:波长 {parameters.Wavelength}um 与工作波长 {config.Wavelength}um 不匹配。", "Jamming");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -334,8 +332,17 @@ namespace ThreatSource.Indicator
|
||||
public override string GetStatus()
|
||||
{
|
||||
string jammingStatusString = "正常";
|
||||
if (IsJammed) jammingStatusString = "受激光干扰";
|
||||
if (IsTargetObscured) jammingStatusString = IsJammed ? "受激光干扰和烟幕遮挡" : "目标被烟幕遮挡";
|
||||
if (IsJammed)
|
||||
{
|
||||
if (IsTargetObscured)
|
||||
{
|
||||
jammingStatusString = "目标被烟幕遮挡";
|
||||
}
|
||||
else
|
||||
{
|
||||
jammingStatusString = "受激光干扰";
|
||||
}
|
||||
}
|
||||
|
||||
return base.GetStatus() + "\n" +
|
||||
$" 位置: {Position}\n" +
|
||||
@ -343,8 +350,8 @@ namespace ThreatSource.Indicator
|
||||
$" 激活状态: {(IsActive ? "激活" : "未激活")}\n" +
|
||||
$" 激光束状态: {(IsBeamOn ? "开启" : "关闭")}\n" +
|
||||
$" 干扰/遮挡状态: {jammingStatusString}\n" +
|
||||
$" 激光功率: {config.LaserPower} W\n" +
|
||||
$" 激光波长: {config.LaserWavelength} μm\n" +
|
||||
$" 激光功率: {config.Power} W\n" +
|
||||
$" 激光波长: {config.Wavelength} μm\n" +
|
||||
$" 控制场直径: {config.ControlFieldDiameter} m\n";
|
||||
}
|
||||
|
||||
|
||||
@ -27,6 +27,11 @@ namespace ThreatSource.Indicator
|
||||
/// </remarks>
|
||||
public override IEnumerable<JammingType> SupportedJammingTypes => [JammingType.Laser, JammingType.SmokeGrenade];
|
||||
|
||||
/// <summary>
|
||||
/// 获取设备支持的阻塞干扰类型
|
||||
/// </summary>
|
||||
public override IEnumerable<JammingType> SupportedBlockingJammingTypes => [JammingType.Laser];
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置干扰阈值,单位:分贝
|
||||
/// </summary>
|
||||
@ -82,7 +87,7 @@ namespace ThreatSource.Indicator
|
||||
JammingThreshold = config.JammingResistanceThreshold;
|
||||
|
||||
// 设置干扰阈值并添加支持的干扰类型
|
||||
InitializeJamming(JammingThreshold, SupportedJammingTypes);
|
||||
InitializeJamming(JammingThreshold, SupportedJammingTypes, SupportedBlockingJammingTypes);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -185,7 +190,7 @@ namespace ThreatSource.Indicator
|
||||
// 实现激光指示器的干扰效果
|
||||
if (parameters.Type == JammingType.Laser)
|
||||
{
|
||||
Debug.WriteLine($"[LaserDesignator] {Id} 受到激光干扰,停止照射。", "Jamming");
|
||||
Console.WriteLine($"[LaserDesignator] {Id} 受到激光干扰,停止照射。", "Jamming");
|
||||
// 停止激光照射
|
||||
StopLaserIllumination();
|
||||
}
|
||||
@ -202,7 +207,7 @@ namespace ThreatSource.Indicator
|
||||
// 添加子类特定响应:如果是激光干扰清除,并且设备仍激活,尝试启动照射
|
||||
if (parameters.Type == JammingType.Laser)
|
||||
{
|
||||
Debug.WriteLine($"[LaserDesignator] {Id} 激光干扰已清除。", "Jamming");
|
||||
Console.WriteLine($"[LaserDesignator] {Id} 激光干扰已清除。", "Jamming");
|
||||
// 如果设备仍处于激活状态,并且没有其他干扰,恢复激光照射
|
||||
if (IsActive && !IsJammed)
|
||||
{
|
||||
@ -328,9 +333,9 @@ namespace ThreatSource.Indicator
|
||||
if (parameters.Type == JammingType.Laser)
|
||||
{
|
||||
// 检查波长匹配 (单位: 微米)
|
||||
if (Math.Abs((parameters.Wavelength ?? 0) - config.LaserWavelength) > 1e-6) // 使用配置的波长
|
||||
if (Math.Abs((parameters.Wavelength ?? 0) - config.Wavelength) > 1e-6) // 使用配置的波长
|
||||
{
|
||||
Debug.WriteLine($"[LaserDesignator] {Id} 忽略激光干扰:波长 {parameters.Wavelength}um 与工作波长 {config.LaserWavelength}um 不匹配。", "Jamming");
|
||||
Console.WriteLine($"[LaserDesignator] {Id} 忽略激光干扰:波长 {parameters.Wavelength}um 与工作波长 {config.Wavelength}um 不匹配。", "Jamming");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -382,8 +387,17 @@ namespace ThreatSource.Indicator
|
||||
public override string GetStatus()
|
||||
{
|
||||
string jammingStatusString = "正常";
|
||||
if (IsJammed) jammingStatusString = "受激光干扰";
|
||||
if (IsTargetObscured) jammingStatusString = IsJammed ? "受激光干扰和烟幕遮挡" : "目标被烟幕遮挡";
|
||||
if (IsJammed)
|
||||
{
|
||||
if (IsTargetObscured)
|
||||
{
|
||||
jammingStatusString = "目标被烟幕遮挡";
|
||||
}
|
||||
else
|
||||
{
|
||||
jammingStatusString = "受激光干扰";
|
||||
}
|
||||
}
|
||||
|
||||
return base.GetStatus() + "\n" +
|
||||
$" 位置: {Position}\n" +
|
||||
@ -394,7 +408,8 @@ namespace ThreatSource.Indicator
|
||||
$" 照射状态: {(IsIlluminationOn ? "正在照射" : "未照射")}\n" +
|
||||
$" 干扰/遮挡状态: {jammingStatusString}\n" +
|
||||
$" 编码状态: {(config.LaserCodeConfig != null ? "启用" : "禁用")}\n" +
|
||||
$" 激光功率: {config.LaserPower:E} W";
|
||||
$" 波长: {config.Wavelength}um\n" +
|
||||
$" 激光功率: {config.Power:E} W";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,7 +11,12 @@ namespace ThreatSource.Jammable
|
||||
/// 获取设备支持的干扰类型
|
||||
/// </summary>
|
||||
IEnumerable<JammingType> SupportedJammingTypes { get; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取设备支持的阻塞干扰类型
|
||||
/// </summary>
|
||||
IEnumerable<JammingType> SupportedBlockingJammingTypes { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取设备当前是否处于被干扰状态
|
||||
/// </summary>
|
||||
|
||||
@ -29,12 +29,17 @@ namespace ThreatSource.Jammable
|
||||
/// <summary>
|
||||
/// 干扰阈值字典
|
||||
/// </summary>
|
||||
private readonly Dictionary<JammingType, double> _jammingThresholds = new Dictionary<JammingType, double>();
|
||||
private readonly Dictionary<JammingType, double> _jammingThresholds = [];
|
||||
|
||||
/// <summary>
|
||||
/// 支持的干扰类型列表
|
||||
/// </summary>
|
||||
private readonly List<JammingType> _supportedJammingTypes = new List<JammingType>();
|
||||
private readonly List<JammingType> _supportedJammingTypes = [];
|
||||
|
||||
/// <summary>
|
||||
/// 支持的阻塞干扰类型列表
|
||||
/// </summary>
|
||||
private readonly List<JammingType> _supportedBlockingJammingTypes = [];
|
||||
|
||||
/// <summary>
|
||||
/// 位置提供委托,用于获取设备当前位置
|
||||
@ -55,6 +60,11 @@ namespace ThreatSource.Jammable
|
||||
/// 获取设备支持的干扰类型
|
||||
/// </summary>
|
||||
public IEnumerable<JammingType> SupportedJammingTypes => _supportedJammingTypes;
|
||||
|
||||
/// <summary>
|
||||
/// 获取设备支持的阻塞干扰类型
|
||||
/// </summary>
|
||||
public IEnumerable<JammingType> SupportedBlockingJammingTypes => _supportedBlockingJammingTypes;
|
||||
|
||||
/// <summary>
|
||||
/// 获取设备当前是否处于被干扰状态
|
||||
@ -98,12 +108,24 @@ namespace ThreatSource.Jammable
|
||||
/// 添加支持的干扰类型
|
||||
/// </summary>
|
||||
/// <param name="type">干扰类型</param>
|
||||
/// <param name="threshold">干扰阈值(单位:瓦特)</param>
|
||||
public void AddSupportedJammingType(JammingType type, double threshold)
|
||||
public void AddSupportedJammingType(JammingType type)
|
||||
{
|
||||
if (!_supportedJammingTypes.Contains(type))
|
||||
{
|
||||
_supportedJammingTypes.Add(type);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加支持的阻塞干扰类型
|
||||
/// </summary>
|
||||
/// <param name="type">干扰类型</param>
|
||||
/// <param name="threshold">干扰阈值(单位:瓦特)</param>
|
||||
public void AddSupportedBlockingJammingType(JammingType type, double threshold)
|
||||
{
|
||||
if (!_supportedBlockingJammingTypes.Contains(type))
|
||||
{
|
||||
_supportedBlockingJammingTypes.Add(type);
|
||||
SetJammingThreshold(type, threshold);
|
||||
}
|
||||
}
|
||||
@ -144,82 +166,80 @@ namespace ThreatSource.Jammable
|
||||
/// <returns>如果干扰有效返回true,否则返回false</returns>
|
||||
public bool IsJammingEffective(JammingParameters parameters)
|
||||
{
|
||||
// 检查是否支持该干扰类型且定义了阈值
|
||||
if (!_jammingThresholds.TryGetValue(parameters.Type, out double threshold))
|
||||
// 不支持的干扰类型总是无效
|
||||
if (!_supportedJammingTypes.Contains(parameters.Type))
|
||||
{
|
||||
// 也检查 _supportedJammingTypes 以保持一致性?如果 AddSupported 确保两者都存在,则冗余。
|
||||
if(!_supportedJammingTypes.Contains(parameters.Type))
|
||||
{
|
||||
Debug.WriteLine($"[干扰有效性检查] 不支持干扰类型 {parameters.Type}。");
|
||||
return false; // 不支持的类型
|
||||
}
|
||||
// 如果支持但不知何故没有阈值?默认为无效还是抛出异常?
|
||||
Debug.WriteLine($"[干扰有效性检查] 支持的类型 {parameters.Type} 未找到阈值。假设无效。");
|
||||
return false;
|
||||
Console.WriteLine($"[干扰有效性检查] 不支持的干扰类型: {parameters.Type}");
|
||||
return false;
|
||||
}
|
||||
|
||||
// 烟幕干扰总是有效,如果支持的话
|
||||
if (parameters.Type == JammingType.SmokeGrenade)
|
||||
// 非阻塞干扰总是有效,如果支持的话
|
||||
if (parameters.Mode != JammingMode.Blocking)
|
||||
{
|
||||
Debug.WriteLine($"[干扰有效性检查] 烟幕干扰有效。");
|
||||
Console.WriteLine($"[干扰有效性检查] 非阻塞干扰,有效。");
|
||||
return true;
|
||||
}
|
||||
|
||||
// 检查是否支持该干扰类型且定义了阻塞干扰的阈值
|
||||
if (!_jammingThresholds.TryGetValue(parameters.Type, out double threshold))
|
||||
{
|
||||
Console.WriteLine($"[干扰有效性检查] 支持的类型 {parameters.Type} 未找到阈值。假设无效。");
|
||||
return false;
|
||||
}
|
||||
|
||||
// 基于功率、距离、角度等计算有效性
|
||||
Vector3D devicePosition = _positionProvider();
|
||||
Vector3D relativePosition = devicePosition - parameters.SourcePosition; // 从干扰源指向设备的矢量
|
||||
double distance = relativePosition.Magnitude();
|
||||
|
||||
Debug.WriteLine($"干扰计算 - 设备位置: {devicePosition}, 干扰源位置: {parameters.SourcePosition}");
|
||||
Debug.WriteLine($"干扰计算 - 相对位置: {relativePosition}, 距离: {distance:F2}m");
|
||||
Console.WriteLine($"干扰计算 - 设备位置: {devicePosition}, 干扰源位置: {parameters.SourcePosition}");
|
||||
Console.WriteLine($"干扰计算 - 相对位置: {relativePosition}, 距离: {distance:F2}m");
|
||||
|
||||
// 恢复原始逻辑:避免除零错误
|
||||
// 避免除零错误
|
||||
if (distance <= 0)
|
||||
{
|
||||
distance = 0.1; // 设置最小距离
|
||||
Debug.WriteLine($"干扰计算 - 调整近零距离为 {distance}m");
|
||||
Console.WriteLine($"干扰计算 - 调整近零距离为 {distance}m");
|
||||
}
|
||||
|
||||
// 球面扩散损耗模型: P_received = P_transmitted / (4 * pi * d^2)
|
||||
double receivedPower = parameters.Power / (4 * Math.PI * distance * distance);
|
||||
|
||||
Debug.WriteLine($"干扰计算 - 发射功率: {parameters.Power}W, 接收功率: {receivedPower:E6}W, 阈值: {threshold:E6}W");
|
||||
Console.WriteLine($"干扰计算 - 发射功率: {parameters.Power}W, 接收功率: {receivedPower:E6}W, 阈值: {threshold:E6}W");
|
||||
|
||||
// 如果干扰源有方向性,则考虑角度因素 (恢复原始逻辑:仅在距离 > 1 时检查)
|
||||
// 如果干扰源有方向性,则考虑角度因素 (仅在距离 > 1 时检查)
|
||||
if (parameters.AngleRange > 0 && distance > 1)
|
||||
{
|
||||
// 恢复原始逻辑:直接计算方向和角度
|
||||
Vector3D jammerDirection = parameters.Direction.Normalize();
|
||||
Vector3D jammerToDeviceDirection = relativePosition.Normalize();
|
||||
|
||||
// 直接进行计算,不预先检查 IsZero
|
||||
double dotProduct = Vector3D.DotProduct(jammerDirection, jammerToDeviceDirection);
|
||||
// 钳制点积以避免 Acos 的参数超出 [-1, 1] 范围
|
||||
double angle = Math.Acos(Math.Clamp(dotProduct, -1.0, 1.0)); // 干扰波束方向与到设备方向之间的夹角
|
||||
|
||||
Debug.WriteLine($"干扰计算 - 干扰器方向: {jammerDirection}, 到设备方向: {jammerToDeviceDirection}");
|
||||
Debug.WriteLine($"干扰计算 - 点积: {dotProduct:F2}, 夹角: {angle * 180 / Math.PI:F2} 度, 波束范围: {parameters.AngleRange * 180 / Math.PI:F2} 度");
|
||||
Console.WriteLine($"干扰计算 - 干扰器方向: {jammerDirection}, 到设备方向: {jammerToDeviceDirection}");
|
||||
Console.WriteLine($"干扰计算 - 点积: {dotProduct:F2}, 夹角: {angle * 180 / Math.PI:F2} 度, 波束范围: {parameters.AngleRange:F2} 度");
|
||||
|
||||
// 如果到设备的角度超出了干扰器波束半角,则降低有效性 (恢复原始逻辑)
|
||||
if (angle > parameters.AngleRange / 2)
|
||||
if (angle > parameters.AngleRange * Math.PI / 360)
|
||||
{
|
||||
// 简化模型:如果超出波束范围,则大幅降低接收功率
|
||||
receivedPower *= 0.01; // 衰减因子 (与之前嵌套类中的逻辑一致)
|
||||
Debug.WriteLine($"干扰计算 - 超出波束角度。衰减后接收功率: {receivedPower:E6}W");
|
||||
Console.WriteLine($"干扰计算 - 超出波束角度。衰减后接收功率: {receivedPower:E6}W");
|
||||
}
|
||||
}
|
||||
|
||||
// 将接收功率与该干扰类型的阈值进行比较
|
||||
bool isEffective = receivedPower >= threshold;
|
||||
Debug.WriteLine($"干扰计算 - 最终结果: {(isEffective ? "有效" : "无效")}");
|
||||
Console.WriteLine($"干扰计算 - 最终结果: {(isEffective ? "有效" : "无效")}");
|
||||
return isEffective;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从配置中加载干扰阈值和支持的干扰类型
|
||||
/// 从配置中加载阻塞干扰阈值和支持的干扰类型
|
||||
/// </summary>
|
||||
/// <param name="jammingResistanceThreshold">配置中的干扰抗性阈值,单位:瓦特</param>
|
||||
/// <param name="supportedTypes">支持的干扰类型,默认为所有类型</param>
|
||||
/// <param name="jammingResistanceThreshold">配置中的阻塞干扰抗性阈值,单位:瓦特</param>
|
||||
/// <param name="supportedTypes">支持的阻塞干扰类型</param>
|
||||
public void LoadJammingConfigFromThreshold(double jammingResistanceThreshold,
|
||||
IEnumerable<JammingType>? supportedTypes = null)
|
||||
{
|
||||
@ -227,7 +247,7 @@ namespace ThreatSource.Jammable
|
||||
|
||||
foreach (JammingType jammingType in typesToSupport)
|
||||
{
|
||||
AddSupportedJammingType(jammingType, jammingResistanceThreshold);
|
||||
AddSupportedBlockingJammingType(jammingType, jammingResistanceThreshold);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -152,7 +152,7 @@ namespace ThreatSource.Jammer
|
||||
/// </summary>
|
||||
/// <param name="deltaTime">时间步长,单位:秒</param>
|
||||
public override void Update(double deltaTime)
|
||||
{
|
||||
{
|
||||
if (!IsActive || !IsJamming || CurrentParameters == null)
|
||||
{
|
||||
return;
|
||||
@ -187,9 +187,9 @@ namespace ThreatSource.Jammer
|
||||
/// </summary>
|
||||
protected void PublishJammingEvent(JammingParameters parameters)
|
||||
{
|
||||
Console.WriteLine($"干扰器 {Id} 发布干扰事件: {parameters}");
|
||||
var jammingEvent = new JammingEvent
|
||||
{
|
||||
SenderId = Id,
|
||||
Parameters = parameters
|
||||
};
|
||||
SimulationManager.PublishEvent(jammingEvent);
|
||||
@ -206,9 +206,9 @@ namespace ThreatSource.Jammer
|
||||
/// </summary>
|
||||
protected void PublishJammingStoppedEvent(JammingParameters parameters)
|
||||
{
|
||||
Console.WriteLine($"干扰器 {Id} 发布干扰结束事件: {parameters}");
|
||||
var stoppedEvent = new JammingStoppedEvent
|
||||
{
|
||||
SenderId = Id,
|
||||
Parameters = parameters
|
||||
};
|
||||
SimulationManager.PublishEvent(stoppedEvent);
|
||||
@ -220,7 +220,15 @@ namespace ThreatSource.Jammer
|
||||
/// <returns>干扰器状态信息</returns>
|
||||
public override string GetStatus()
|
||||
{
|
||||
return base.GetStatus() + $"干扰器状态:{State}, type: {JammingType}, isJamming: {IsJamming}\n";
|
||||
return base.GetStatus() + $"干扰器状态:{State}, type: {JammingType}, isJamming: {IsJamming}\n"
|
||||
+ $"干扰模式: {CurrentParameters?.Mode}\n"
|
||||
+ $"功率: {CurrentParameters?.Power}\n"
|
||||
+ $"波长: {CurrentParameters?.Wavelength}\n"
|
||||
+ $"方向: {CurrentParameters?.Direction}\n"
|
||||
+ $"位置: {CurrentParameters?.SourcePosition}\n"
|
||||
+ $"角度范围: {CurrentParameters?.AngleRange}\n"
|
||||
+ $"持续时间: {CurrentParameters?.Duration}\n"
|
||||
+ $"干扰类型: {CurrentParameters?.Type}\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -40,12 +40,12 @@ namespace ThreatSource.Jammer
|
||||
{
|
||||
return new JammingParameters
|
||||
{
|
||||
Type = Jammer.JammingType.Infrared,
|
||||
JammerId = base.Id,
|
||||
Type = JammingType.Infrared,
|
||||
JammerId = Id,
|
||||
Power = config.Power,
|
||||
Wavelength = config.Wavelength,
|
||||
Direction = base.Orientation.ToVector(),
|
||||
SourcePosition = base.Position,
|
||||
Direction = Orientation.ToVector(),
|
||||
SourcePosition = Position,
|
||||
AngleRange = config.AngleRange,
|
||||
Mode = config.Mode,
|
||||
Duration = config.Duration,
|
||||
|
||||
@ -51,15 +51,15 @@ namespace ThreatSource.Jammer
|
||||
|
||||
return new JammingParameters
|
||||
{
|
||||
Type = Jammer.JammingType.LaserDecoy,
|
||||
Type = JammingType.LaserDecoy,
|
||||
Mode = config.Mode,
|
||||
JammerId = base.Id,
|
||||
JammerId = Id,
|
||||
SourceId = SourceId,
|
||||
Power = config.Power,
|
||||
Wavelength = config.Wavelength,
|
||||
SourcePosition = sourcePosition,
|
||||
Direction = base.Orientation.ToVector(),
|
||||
DecoyPosition = base.Position,
|
||||
Direction = Orientation.ToVector(),
|
||||
DecoyPosition = Position,
|
||||
AngleRange = config.DivergenceAngle,
|
||||
Duration = config.Duration,
|
||||
ReflectiveArea = config.ReflectiveArea,
|
||||
|
||||
@ -1,7 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using ThreatSource.Simulation;
|
||||
using ThreatSource.Utils; // Assuming JammingParameters is here or in Jammer namespace
|
||||
|
||||
namespace ThreatSource.Jammer
|
||||
{
|
||||
@ -40,12 +37,13 @@ namespace ThreatSource.Jammer
|
||||
{
|
||||
return new JammingParameters
|
||||
{
|
||||
Type = Jammer.JammingType.Laser,
|
||||
JammerId = base.Id,
|
||||
Type = JammingType.Laser,
|
||||
JammerId = Id,
|
||||
Power = config.Power,
|
||||
Wavelength = config.Wavelength,
|
||||
Direction = base.Orientation.ToVector(),
|
||||
SourcePosition = base.Position,
|
||||
Direction = Orientation.ToVector(),
|
||||
AngleRange = config.AngleRange,
|
||||
SourcePosition = Position,
|
||||
Mode = config.Mode,
|
||||
Duration = config.Duration,
|
||||
StartTime = DateTime.UtcNow
|
||||
|
||||
@ -40,12 +40,13 @@ namespace ThreatSource.Jammer
|
||||
{
|
||||
return new JammingParameters
|
||||
{
|
||||
Type = Jammer.JammingType.MillimeterWave,
|
||||
JammerId = base.Id,
|
||||
Type = JammingType.MillimeterWave,
|
||||
JammerId = Id,
|
||||
Power = config.Power,
|
||||
Wavelength = config.Wavelength,
|
||||
Direction = base.Orientation.ToVector(),
|
||||
SourcePosition = base.Position,
|
||||
Direction = Orientation.ToVector(),
|
||||
AngleRange = config.AngleRange,
|
||||
SourcePosition = Position,
|
||||
Mode = config.Mode,
|
||||
Duration = config.Duration,
|
||||
StartTime = DateTime.UtcNow
|
||||
|
||||
@ -47,13 +47,13 @@ namespace ThreatSource.Jammer
|
||||
{
|
||||
return new JammingParameters
|
||||
{
|
||||
Type = Jammer.JammingType.SmokeGrenade,
|
||||
Type = JammingType.SmokeGrenade,
|
||||
Mode = config.Mode,
|
||||
JammerId = base.Id,
|
||||
JammerId = Id,
|
||||
Power = 0, // 烟幕不需要功率参数
|
||||
Direction = base.Orientation.ToVector(),
|
||||
SourcePosition = base.Position,
|
||||
AngleRange = 2 * Math.PI, // 烟幕为全方位效果
|
||||
Direction = Orientation.ToVector(),
|
||||
SourcePosition = Position,
|
||||
AngleRange = 180, // 烟幕影响正面
|
||||
Duration = config.Duration,
|
||||
StartTime = DateTime.UtcNow,
|
||||
SmokeType = config.SmokeType,
|
||||
|
||||
@ -469,34 +469,6 @@ namespace ThreatSource.Missile
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取导弹的状态信息字符串
|
||||
/// </summary>
|
||||
/// <returns>包含导弹状态的详细描述</returns>
|
||||
/// <remarks>
|
||||
/// 返回信息包括:
|
||||
/// - 导弹ID和类型
|
||||
/// - 位置和速度信息
|
||||
/// - 飞行时间和距离
|
||||
/// - 制导和发动机状态
|
||||
/// </remarks>
|
||||
public override string GetStatus()
|
||||
{
|
||||
MissileRunningState missileRunningState = GetRunningState();
|
||||
return $"导弹 {missileRunningState.Id}:\n" +
|
||||
$" 状态: {(missileRunningState.IsActive ? "激活" : "非激活")}\n" +
|
||||
$" 位置: {missileRunningState.Position}\n" +
|
||||
$" 速度: {missileRunningState.Speed:F2} m/s\n" +
|
||||
$" 速度分量: {missileRunningState.Velocity}\n" +
|
||||
$" 朝向: {missileRunningState.Orientation}\n" +
|
||||
$" 飞行时间: {missileRunningState.FlightTime:F2}/{Properties.MaxFlightTime:F2}\n" +
|
||||
$" 飞行距离: {missileRunningState.FlightDistance:F2}/{Properties.MaxFlightDistance:F2}\n" +
|
||||
$" 发动机工作时间: {missileRunningState.EngineBurnTime:F2}/{Properties.MaxEngineBurnTime:F2}\n" +
|
||||
$" 有引导: {(missileRunningState.IsGuidance ? "是" : "否")}\n" +
|
||||
$" 失去引导时间: {missileRunningState.LostGuidanceTime:F2}\n";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新导弹的制导状态
|
||||
/// </summary>
|
||||
@ -540,5 +512,32 @@ namespace ThreatSource.Missile
|
||||
GuidanceAcceleration = GuidanceAcceleration
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取导弹的状态信息字符串
|
||||
/// </summary>
|
||||
/// <returns>包含导弹状态的详细描述</returns>
|
||||
/// <remarks>
|
||||
/// 返回信息包括:
|
||||
/// - 导弹ID和类型
|
||||
/// - 位置和速度信息
|
||||
/// - 飞行时间和距离
|
||||
/// - 制导和发动机状态
|
||||
/// </remarks>
|
||||
public override string GetStatus()
|
||||
{
|
||||
MissileRunningState missileRunningState = GetRunningState();
|
||||
return $"导弹 {missileRunningState.Id}:\n" +
|
||||
$" 状态: {(missileRunningState.IsActive ? "激活" : "非激活")}\n" +
|
||||
$" 位置: {missileRunningState.Position}\n" +
|
||||
$" 速度: {missileRunningState.Speed:F2} m/s\n" +
|
||||
$" 速度分量: {missileRunningState.Velocity}\n" +
|
||||
$" 朝向: {missileRunningState.Orientation}\n" +
|
||||
$" 飞行时间: {missileRunningState.FlightTime:F2}/{Properties.MaxFlightTime:F2}\n" +
|
||||
$" 飞行距离: {missileRunningState.FlightDistance:F2}/{Properties.MaxFlightDistance:F2}\n" +
|
||||
$" 发动机工作时间: {missileRunningState.EngineBurnTime:F2}/{Properties.MaxEngineBurnTime:F2}\n" +
|
||||
$" 有引导: {(missileRunningState.IsGuidance ? "是" : "否")}\n" +
|
||||
$" 失去引导时间: {missileRunningState.LostGuidanceTime:F2}\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -166,9 +166,9 @@ namespace ThreatSource.Missile
|
||||
/// </remarks>
|
||||
private void UpdateCruiseStage(double deltaTime)
|
||||
{
|
||||
IsGuidance = true;
|
||||
guidanceSystem.Update(deltaTime, Position, Velocity);
|
||||
GuidanceAcceleration = guidanceSystem.GetGuidanceAcceleration();
|
||||
IsGuidance = guidanceSystem.HasGuidance;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -196,9 +196,9 @@ namespace ThreatSource.Missile
|
||||
/// </remarks>
|
||||
private void UpdateTerminalSearchStage(double deltaTime)
|
||||
{
|
||||
IsGuidance = true;
|
||||
guidanceSystem.Update(deltaTime, Position, Velocity);
|
||||
GuidanceAcceleration = guidanceSystem.GetGuidanceAcceleration();
|
||||
IsGuidance = guidanceSystem.HasGuidance;
|
||||
|
||||
// 如果发现并识别出目标,切换到跟踪阶段
|
||||
if (guidanceSystem.HasTarget)
|
||||
@ -220,9 +220,9 @@ namespace ThreatSource.Missile
|
||||
/// </remarks>
|
||||
private void UpdateTerminalTrackStage(double deltaTime)
|
||||
{
|
||||
IsGuidance = true;
|
||||
guidanceSystem.Update(deltaTime, Position, Velocity);
|
||||
GuidanceAcceleration = guidanceSystem.GetGuidanceAcceleration();
|
||||
IsGuidance = guidanceSystem.HasGuidance;
|
||||
|
||||
// 如果失去目标,切换回搜索阶段
|
||||
if (!guidanceSystem.HasTarget)
|
||||
@ -248,10 +248,9 @@ namespace ThreatSource.Missile
|
||||
/// </remarks>
|
||||
private void UpdateTerminalLockStage(double deltaTime)
|
||||
{
|
||||
IsGuidance = true;
|
||||
guidanceSystem.Update(deltaTime, Position, Velocity);
|
||||
GuidanceAcceleration = guidanceSystem.GetGuidanceAcceleration();
|
||||
|
||||
IsGuidance = guidanceSystem.HasGuidance;
|
||||
if (!guidanceSystem.HasTarget)
|
||||
{
|
||||
currentStage = IRTG_Stage.TerminalSearch;
|
||||
|
||||
@ -101,7 +101,7 @@ namespace ThreatSource.Missile
|
||||
if (evt?.LaserBeamRiderId != null)
|
||||
{
|
||||
LaserBeamRider laserBeamRider = SimulationManager.GetEntityById(evt.LaserBeamRiderId) as LaserBeamRider ?? throw new Exception("激光驾束仪不存在");
|
||||
guidanceSystem?.UpdateLaserBeamRider(laserBeamRider.Position, laserBeamRider.LaserDirection, laserBeamRider.config.LaserPower);
|
||||
guidanceSystem?.UpdateLaserBeamRider(laserBeamRider.Position, laserBeamRider.LaserDirection, laserBeamRider.config.Power);
|
||||
}
|
||||
}
|
||||
|
||||
@ -182,9 +182,9 @@ namespace ThreatSource.Missile
|
||||
private void UpdateCruiseStage(double deltaTime)
|
||||
{
|
||||
// 巡航阶段
|
||||
IsGuidance = true;
|
||||
guidanceSystem.Update(deltaTime, Position, Velocity);
|
||||
GuidanceAcceleration = guidanceSystem.GetGuidanceAcceleration();
|
||||
IsGuidance = guidanceSystem.HasGuidance;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -179,9 +179,9 @@ namespace ThreatSource.Missile
|
||||
/// </remarks>
|
||||
private void UpdateTerminalStage(double deltaTime)
|
||||
{
|
||||
IsGuidance = true;
|
||||
guidanceSystem.Update(deltaTime, Position, Velocity);
|
||||
GuidanceAcceleration = guidanceSystem.GetGuidanceAcceleration();
|
||||
IsGuidance = guidanceSystem.HasGuidance;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -19,6 +19,11 @@ namespace ThreatSource.Sensor
|
||||
/// </remarks>
|
||||
public class InfraredDetector : Sensor
|
||||
{
|
||||
/// <summary>
|
||||
/// 红外探测器配置
|
||||
/// </summary>
|
||||
public readonly InfraredDetectorConfig config;
|
||||
|
||||
/// <summary>
|
||||
/// 定义设备支持的干扰类型
|
||||
/// </summary>
|
||||
@ -28,6 +33,11 @@ namespace ThreatSource.Sensor
|
||||
/// </remarks>
|
||||
public override IEnumerable<JammingType> SupportedJammingTypes => [JammingType.Infrared];
|
||||
|
||||
/// <summary>
|
||||
/// 获取设备支持的阻塞干扰类型
|
||||
/// </summary>
|
||||
public override IEnumerable<JammingType> SupportedBlockingJammingTypes => [JammingType.Infrared];
|
||||
|
||||
/// <summary>
|
||||
/// 探测辐射强度阈值,单位:瓦特/球面度
|
||||
/// </summary>
|
||||
@ -38,29 +48,6 @@ namespace ThreatSource.Sensor
|
||||
/// </remarks>
|
||||
private const double DetectionRadiationIntensityThreshold = 50;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置探测范围,单位:米
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 定义了探测器的最大作用距离
|
||||
/// 影响目标探测的有效范围
|
||||
/// </remarks>
|
||||
public double MaxDetectionRange { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置红外波段
|
||||
/// </summary>
|
||||
public InfraredBand Band { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置视场角,单位:度
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 定义了探测器的视场范围
|
||||
/// 影响目标探测的空间覆盖
|
||||
/// </remarks>
|
||||
public double FieldOfView { get; set; } = 10;
|
||||
|
||||
/// <summary>
|
||||
/// 末敏子弹实例
|
||||
/// </summary>
|
||||
@ -96,14 +83,12 @@ namespace ThreatSource.Sensor
|
||||
public InfraredDetector(string id, TerminalSensitiveSubmunition submunition, InfraredDetectorConfig config, ISimulationManager simulationManager)
|
||||
: base(id, new MotionParameters(submunition.Position, submunition.Orientation, submunition.Speed), simulationManager)
|
||||
{
|
||||
MaxDetectionRange = config.MaxDetectionRange;
|
||||
FieldOfView = config.FieldOfView;
|
||||
Band = config.Band;
|
||||
this.config = config;
|
||||
this.submunition = submunition;
|
||||
sensorData = new InfraredSensorData();
|
||||
|
||||
// 初始化干扰处理,设置干扰抗性阈值和支持的干扰类型
|
||||
InitializeJamming(config.JammingResistanceThreshold, [JammingType.Infrared]);
|
||||
InitializeJamming(config.JammingResistanceThreshold, SupportedJammingTypes, SupportedBlockingJammingTypes);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -151,7 +136,7 @@ namespace ThreatSource.Sensor
|
||||
private double GetCurrentDirectionRadiationIntensity()
|
||||
{
|
||||
// 获取当前方向上的辐射强度,如果检测到目标,则返回目标的辐射强度,否则返回0
|
||||
var result = submunition.DetectTarget(FieldOfView);
|
||||
var result = submunition.DetectTarget(config.FieldOfView);
|
||||
if (result.Angle != null && result.Target != null)
|
||||
{
|
||||
sensorData.TargetAngle = result.Angle;
|
||||
@ -195,7 +180,7 @@ namespace ThreatSource.Sensor
|
||||
// 检查波长是否与工作波段匹配 (单位: 微米)
|
||||
if (!IsWavelengthCompatible(parameters.Wavelength ?? 0))
|
||||
{
|
||||
Debug.WriteLine($"[InfraredDetector] 忽略干扰:波长 {parameters.Wavelength}um 与工作波段 {Band} 不匹配。", "Jamming");
|
||||
Debug.WriteLine($"[InfraredDetector] 忽略干扰:波长 {parameters.Wavelength}um 与工作波段 {config.Band} 不匹配。", "Jamming");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -212,7 +197,7 @@ namespace ThreatSource.Sensor
|
||||
private bool IsWavelengthCompatible(double wavelength)
|
||||
{
|
||||
// 根据红外探测器的波段确定能接收的波长范围
|
||||
return Band switch
|
||||
return config.Band switch
|
||||
{
|
||||
InfraredBand.Long => wavelength >= 8 && wavelength <= 12,// 远红外波段(约8-12微米)
|
||||
InfraredBand.Medium => wavelength >= 3 && wavelength <= 5,// 中红外波段(约3-5微米)
|
||||
|
||||
@ -18,6 +18,11 @@ namespace ThreatSource.Sensor
|
||||
/// </remarks>
|
||||
public class LaserRangefinder : Sensor
|
||||
{
|
||||
/// <summary>
|
||||
/// 激光测距仪配置
|
||||
/// </summary>
|
||||
public readonly LaserRangefinderConfig config;
|
||||
|
||||
/// <summary>
|
||||
/// 定义设备支持的干扰类型
|
||||
/// </summary>
|
||||
@ -26,7 +31,12 @@ namespace ThreatSource.Sensor
|
||||
/// - 激光干扰
|
||||
/// </remarks>
|
||||
public override IEnumerable<JammingType> SupportedJammingTypes => [JammingType.Laser];
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取设备支持的阻塞干扰类型
|
||||
/// </summary>
|
||||
public override IEnumerable<JammingType> SupportedBlockingJammingTypes => [JammingType.Laser];
|
||||
|
||||
/// <summary>
|
||||
/// 激光测距仪数据
|
||||
/// </summary>
|
||||
@ -49,45 +59,6 @@ namespace ThreatSource.Sensor
|
||||
/// </remarks>
|
||||
private readonly TerminalSensitiveSubmunition submunition;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置最大测量距离,单位:米
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 定义了测距仪的量程上限
|
||||
/// 超出此距离的测量可能不准确
|
||||
/// 受大气条件和目标反射率影响
|
||||
/// </remarks>
|
||||
public double MaxDetectionRange { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置工作波长,单位:微米
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 定义了激光测距仪的工作波段
|
||||
/// 影响测量的准确性和可靠性
|
||||
/// </remarks>
|
||||
public double Wavelength { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置脉冲频率,单位:赫兹
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 定义了激光发射的重复频率
|
||||
/// 影响测量的更新速率和精度
|
||||
/// 需要根据目标运动特性选择
|
||||
/// </remarks>
|
||||
public double PulseRate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置测量精度,单位:米
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 定义了测距仪的测量误差范围
|
||||
/// 影响测量的可靠性和稳定性
|
||||
/// 需要根据应用场景选择合适的精度
|
||||
/// </remarks>
|
||||
public double Accuracy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 初始化激光测距仪的新实例
|
||||
/// </summary>
|
||||
@ -104,16 +75,13 @@ namespace ThreatSource.Sensor
|
||||
public LaserRangefinder(string id, TerminalSensitiveSubmunition submunition, LaserRangefinderConfig config, ISimulationManager simulationManager)
|
||||
: base(id, new MotionParameters(submunition.Position, submunition.Orientation, submunition.Speed), simulationManager)
|
||||
{
|
||||
this.config = config;
|
||||
this.submunition = submunition;
|
||||
MaxDetectionRange = config.MaxDetectionRange;
|
||||
Wavelength = config.Wavelength;
|
||||
PulseRate = config.PulseRate;
|
||||
Accuracy = config.Accuracy;
|
||||
currentDistance = 0;
|
||||
sensorData = new RangefinderSensorData();
|
||||
|
||||
// 初始化干扰处理,设置干扰抗性阈值和支持的干扰类型
|
||||
InitializeJamming(config.JammingResistanceThreshold, [JammingType.Laser]);
|
||||
InitializeJamming(config.JammingResistanceThreshold, SupportedJammingTypes, SupportedBlockingJammingTypes);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -175,7 +143,7 @@ namespace ThreatSource.Sensor
|
||||
// 检查波长是否与工作波长匹配 (单位: 微米)
|
||||
if (!IsWavelengthCompatible(parameters.Wavelength ?? 0))
|
||||
{
|
||||
Debug.WriteLine($"[LaserRangefinder] 忽略干扰:波长 {parameters.Wavelength}um 与工作波长 {Wavelength}um 不匹配。", "Jamming");
|
||||
Debug.WriteLine($"[LaserRangefinder] 忽略干扰:波长 {parameters.Wavelength}um 与工作波长 {config.Wavelength}um 不匹配。", "Jamming");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -193,7 +161,7 @@ namespace ThreatSource.Sensor
|
||||
{
|
||||
// 激光测距仪使用特定的激光波长,需要精确匹配
|
||||
// 允许小范围的偏差(±0.01μm)以适应现实中的波长漂移
|
||||
return Math.Abs(wavelength - Wavelength) <= 0.01;
|
||||
return Math.Abs(wavelength - config.Wavelength) <= 0.01;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -260,7 +228,7 @@ namespace ThreatSource.Sensor
|
||||
double slantRange = Math.Sqrt(verticalDistance * verticalDistance + horizontalDistance * horizontalDistance);
|
||||
|
||||
// 添加测量精度引入的随机误差
|
||||
return slantRange + (2 * new Random().NextDouble() - 1) * Accuracy;
|
||||
return slantRange + (2 * new Random().NextDouble() - 1) * config.Accuracy;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -19,6 +19,11 @@ namespace ThreatSource.Sensor
|
||||
/// </remarks>
|
||||
public class MillimeterWaveAltimeter : Sensor
|
||||
{
|
||||
/// <summary>
|
||||
/// 毫米波测高雷达配置
|
||||
/// </summary>
|
||||
public readonly MillimeterWaveAltimeterConfig config;
|
||||
|
||||
/// <summary>
|
||||
/// 定义设备支持的干扰类型
|
||||
/// </summary>
|
||||
@ -28,6 +33,11 @@ namespace ThreatSource.Sensor
|
||||
/// </remarks>
|
||||
public override IEnumerable<JammingType> SupportedJammingTypes => [JammingType.MillimeterWave];
|
||||
|
||||
/// <summary>
|
||||
/// 获取设备支持的阻塞干扰类型
|
||||
/// </summary>
|
||||
public override IEnumerable<JammingType> SupportedBlockingJammingTypes => [JammingType.MillimeterWave];
|
||||
|
||||
/// <summary>
|
||||
/// 毫米波测高雷达数据
|
||||
/// </summary>
|
||||
@ -51,38 +61,6 @@ namespace ThreatSource.Sensor
|
||||
/// </remarks>
|
||||
private readonly TerminalSensitiveSubmunition submunition;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置最大测量高度,单位:米
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 定义了测高雷达的量程上限
|
||||
/// 超出此高度的测量可能不准确
|
||||
/// </remarks>
|
||||
public double MaxAltitude { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置工作波段,枚举
|
||||
/// </summary>
|
||||
public MillimeterWaveBand Band { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置视场角,单位:度
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 定义了探测器的视场范围
|
||||
/// 影响目标探测的空间覆盖
|
||||
/// </remarks>
|
||||
public double FieldOfView { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置测量精度,单位:米
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 定义了高度测量的误差范围
|
||||
/// 实际测量值在真实高度±精度范围内
|
||||
/// </remarks>
|
||||
public double Accuracy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 初始化毫米波测高雷达的新实例
|
||||
/// </summary>
|
||||
@ -99,15 +77,12 @@ namespace ThreatSource.Sensor
|
||||
public MillimeterWaveAltimeter(string id, TerminalSensitiveSubmunition submunition, MillimeterWaveAltimeterConfig config, ISimulationManager simulationManager)
|
||||
: base(id, new MotionParameters(submunition.Position, submunition.Orientation, submunition.Speed), simulationManager)
|
||||
{
|
||||
MaxAltitude = config.MaxAltitude;
|
||||
Accuracy = config.MeasurementAccuracy;
|
||||
Band = config.Band;
|
||||
FieldOfView = config.ScanFieldOfView;
|
||||
this.config = config;
|
||||
currentAltitude = submunition.Position.Y;
|
||||
this.submunition = submunition;
|
||||
sensorData = new AltimeterSensorData();
|
||||
// 初始化干扰处理
|
||||
InitializeJamming(config.JammingResistanceThreshold, [JammingType.MillimeterWave]);
|
||||
InitializeJamming(config.JammingResistanceThreshold, SupportedJammingTypes, SupportedBlockingJammingTypes);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -129,7 +104,7 @@ namespace ThreatSource.Sensor
|
||||
// 检查波长是否与工作波段匹配
|
||||
if (!IsWavelengthCompatible(parameters.Wavelength ?? 0))
|
||||
{
|
||||
Debug.WriteLine($"[MillimeterWaveAltimeter] 忽略干扰:波长 {parameters.Wavelength}mm 与波段 {Band} 不匹配。", "Jamming");
|
||||
Debug.WriteLine($"[MillimeterWaveAltimeter] 忽略干扰:波长 {parameters.Wavelength}mm 与波段 {config.Band} 不匹配。", "Jamming");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -166,7 +141,7 @@ namespace ThreatSource.Sensor
|
||||
Orientation = submunition.Orientation;
|
||||
|
||||
// 更新当前高度,考虑测量精度
|
||||
currentAltitude = submunition.Position.Y + (2 * new Random().NextDouble() - 1) * Accuracy;
|
||||
currentAltitude = submunition.Position.Y + (2 * new Random().NextDouble() - 1) * config.MeasurementAccuracy;
|
||||
sensorData.Altitude = currentAltitude;
|
||||
}
|
||||
|
||||
@ -192,7 +167,7 @@ namespace ThreatSource.Sensor
|
||||
private bool IsWavelengthCompatible(double wavelength)
|
||||
{
|
||||
// 根据测高雷达的波段确定能接收的波长范围
|
||||
return Band switch
|
||||
return config.Band switch
|
||||
{
|
||||
MillimeterWaveBand.Band3 => wavelength >= 2.7 && wavelength <= 3.3, // 3毫米波段(约2.7-3.3毫米)
|
||||
MillimeterWaveBand.Band8 => wavelength >= 7.5 && wavelength <= 8.5, // 8毫米波段(约7.5-8.5毫米)
|
||||
|
||||
@ -19,6 +19,11 @@ namespace ThreatSource.Sensor
|
||||
/// </remarks>
|
||||
public class MillimeterWaveRadiometer : Sensor
|
||||
{
|
||||
/// <summary>
|
||||
/// 毫米波辐射计配置
|
||||
/// </summary>
|
||||
public readonly MillimeterWaveRadiometerConfig config;
|
||||
|
||||
/// <summary>
|
||||
/// 定义设备支持的干扰类型
|
||||
/// </summary>
|
||||
@ -29,32 +34,9 @@ namespace ThreatSource.Sensor
|
||||
public override IEnumerable<JammingType> SupportedJammingTypes => [JammingType.MillimeterWave];
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置探测距离,单位:米
|
||||
/// 获取设备支持的阻塞干扰类型
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 定义了辐射计的探测范围
|
||||
/// 影响目标探测的可靠性和稳定性
|
||||
/// </remarks>
|
||||
public double MaxDetectionRange { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置工作波段,枚举
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 可选波段:3mm 或 8mm
|
||||
/// 影响辐射计的探测性能和大气衰减
|
||||
/// </remarks>
|
||||
public MillimeterWaveBand Band { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 扫描视场角,单位:度
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 定义了辐射计的扫描范围
|
||||
/// 默认值为5度
|
||||
/// 影响目标探测的空间覆盖
|
||||
/// </remarks>
|
||||
private double FieldOfView;
|
||||
public override IEnumerable<JammingType> SupportedBlockingJammingTypes => [JammingType.MillimeterWave];
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置辐射温度差检测阈值,单位:开尔文
|
||||
@ -117,15 +99,14 @@ namespace ThreatSource.Sensor
|
||||
public MillimeterWaveRadiometer(string id, TerminalSensitiveSubmunition submunition, MillimeterWaveRadiometerConfig config, ISimulationManager simulationManager)
|
||||
: base(id, new MotionParameters(submunition.Position, submunition.Orientation, submunition.Speed), simulationManager)
|
||||
{
|
||||
MaxDetectionRange = config.MaxDetectionRange;
|
||||
Band = config.Band;
|
||||
FieldOfView = config.ScanFieldOfView;
|
||||
// 设置设备参数
|
||||
this.config = config;
|
||||
lastDetectionTemperature = 0;
|
||||
sensorData = new RadiometerSensorData();
|
||||
this.submunition = submunition;
|
||||
|
||||
// 初始化干扰处理
|
||||
InitializeJamming(1e-3, [JammingType.MillimeterWave]);
|
||||
InitializeJamming(config.JammingResistanceThreshold, SupportedJammingTypes, SupportedBlockingJammingTypes);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -189,7 +170,7 @@ namespace ThreatSource.Sensor
|
||||
private double GetCurrentDirectionRadiationTemperature()
|
||||
{
|
||||
// 获取当前方向上的辐射温度,如果检测到目标,则返回目标的辐射温度,否则返回地面温度
|
||||
var result = submunition.DetectTarget(FieldOfView);
|
||||
var result = submunition.DetectTarget(config.ScanFieldOfView);
|
||||
if (result.Angle != null && result.Target != null)
|
||||
{
|
||||
sensorData.TargetAngle = result.Angle;
|
||||
@ -234,7 +215,7 @@ namespace ThreatSource.Sensor
|
||||
// 检查波长是否与工作波段匹配
|
||||
if (!IsWavelengthCompatible(parameters.Wavelength ?? 0))
|
||||
{
|
||||
Debug.WriteLine($"[MillimeterWaveRadiometer] 忽略干扰:波长 {parameters.Wavelength}mm 与波段 {Band} 不匹配。", "Jamming");
|
||||
Debug.WriteLine($"[MillimeterWaveRadiometer] 忽略干扰:波长 {parameters.Wavelength}mm 与波段 {config.Band} 不匹配。", "Jamming");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -251,7 +232,7 @@ namespace ThreatSource.Sensor
|
||||
private bool IsWavelengthCompatible(double wavelength)
|
||||
{
|
||||
// 根据辐射计的波段确定能接收的波长范围
|
||||
return Band switch
|
||||
return config.Band switch
|
||||
{
|
||||
MillimeterWaveBand.Band3 => wavelength >= 2.7 && wavelength <= 3.3, // 3毫米波段(约2.7-3.3毫米)
|
||||
MillimeterWaveBand.Band8 => wavelength >= 7.5 && wavelength <= 8.5, // 8毫米波段(约7.5-8.5毫米)
|
||||
|
||||
@ -55,6 +55,11 @@ namespace ThreatSource.Sensor
|
||||
/// </remarks>
|
||||
public abstract IEnumerable<JammingType> SupportedJammingTypes { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取设备支持的阻塞干扰类型
|
||||
/// </summary>
|
||||
public abstract IEnumerable<JammingType> SupportedBlockingJammingTypes { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取设备当前是否处于被干扰状态
|
||||
/// </summary>
|
||||
@ -94,9 +99,14 @@ namespace ThreatSource.Sensor
|
||||
/// </summary>
|
||||
/// <param name="jammingResistanceThreshold">干扰抗性阈值,单位:瓦特</param>
|
||||
/// <param name="supportedTypes">支持的干扰类型</param>
|
||||
protected void InitializeJamming(double jammingResistanceThreshold, IEnumerable<JammingType> supportedTypes)
|
||||
/// <param name="supportedBlockingTypes">支持的阻塞干扰类型</param>
|
||||
protected void InitializeJamming(double jammingResistanceThreshold, IEnumerable<JammingType> supportedTypes, IEnumerable<JammingType> supportedBlockingTypes)
|
||||
{
|
||||
_jammingComponent.LoadJammingConfigFromThreshold(jammingResistanceThreshold, supportedTypes);
|
||||
_jammingComponent.LoadJammingConfigFromThreshold(jammingResistanceThreshold, supportedBlockingTypes);
|
||||
foreach (var type in supportedTypes)
|
||||
{
|
||||
_jammingComponent.AddSupportedJammingType(type);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -104,7 +104,7 @@ namespace ThreatSource.Simulation
|
||||
/// 单位:瓦特
|
||||
/// 影响激光照射的有效距离和目标反射强度
|
||||
/// </remarks>
|
||||
public double LaserPower { get; set; } = 0;
|
||||
public double Power { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置激光发散角
|
||||
@ -113,7 +113,7 @@ namespace ThreatSource.Simulation
|
||||
/// 单位:弧度
|
||||
/// 影响激光束的扩散特性和照射面积
|
||||
/// </remarks>
|
||||
public double LaserDivergenceAngle { get; set; } = 0;
|
||||
public double DivergenceAngle { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置激光编码配置
|
||||
@ -132,7 +132,7 @@ namespace ThreatSource.Simulation
|
||||
/// 定义了抵抗干扰所需的最小功率阈值
|
||||
/// 干扰功率超过此阈值时会影响指示器工作
|
||||
/// </remarks>
|
||||
public double JammingResistanceThreshold { get; set; } = 1.0;
|
||||
public double JammingResistanceThreshold { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置工作波长
|
||||
@ -142,7 +142,7 @@ namespace ThreatSource.Simulation
|
||||
/// 激光指示器工作的波长
|
||||
/// 影响激光干扰的匹配判断
|
||||
/// </remarks>
|
||||
public double LaserWavelength { get; set; } = 1.06;
|
||||
public double Wavelength { get; set; } = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -166,7 +166,7 @@ namespace ThreatSource.Simulation
|
||||
/// 单位:瓦特
|
||||
/// 影响制导波束的有效距离和导引精度
|
||||
/// </remarks>
|
||||
public double LaserPower { get; set; } = 0;
|
||||
public double Power { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置激光波长
|
||||
@ -175,7 +175,7 @@ namespace ThreatSource.Simulation
|
||||
/// 单位:微米
|
||||
/// 影响制导波束的波长特性
|
||||
/// </remarks>
|
||||
public double LaserWavelength { get; set; } = 1.06;
|
||||
public double Wavelength { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置控制场直径
|
||||
@ -212,7 +212,7 @@ namespace ThreatSource.Simulation
|
||||
/// 定义了抵抗干扰所需的最小功率阈值
|
||||
/// 干扰功率超过此阈值时会影响制导系统
|
||||
/// </remarks>
|
||||
public double JammingResistanceThreshold { get; set; } = 1.0;
|
||||
public double JammingResistanceThreshold { get; set; } = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -394,7 +394,7 @@ namespace ThreatSource.Simulation
|
||||
/// 单位:秒
|
||||
/// 定义了每次告警的持续时间
|
||||
/// </remarks>
|
||||
public double AlarmDuration { get; set; } = 5.0;
|
||||
public double AlarmDuration { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置最小探测波长
|
||||
@ -423,22 +423,22 @@ namespace ThreatSource.Simulation
|
||||
/// <summary>
|
||||
/// 最大跟踪距离(米)
|
||||
/// </summary>
|
||||
public double MaxTrackingRange { get; set; } = 10000;
|
||||
public double MaxTrackingRange { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 视场角(弧度)
|
||||
/// </summary>
|
||||
public double FieldOfView { get; set; } = Math.PI / 3;
|
||||
public double FieldOfView { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 角度测量精度(弧度)
|
||||
/// </summary>
|
||||
public double AngleMeasurementAccuracy { get; set; } = 0.001;
|
||||
public double AngleMeasurementAccuracy { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 更新频率(赫兹)
|
||||
/// </summary>
|
||||
public double UpdateFrequency { get; set; } = 10;
|
||||
public double UpdateFrequency { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 干扰抗性阈值(瓦特)
|
||||
@ -447,7 +447,7 @@ namespace ThreatSource.Simulation
|
||||
/// 定义了红外测角仪抵抗干扰的能力
|
||||
/// 当实际干扰功率超过此阈值时,测角仪将受到干扰
|
||||
/// </remarks>
|
||||
public double JammingResistanceThreshold { get; set; } = 50;
|
||||
public double JammingResistanceThreshold { get; set; } = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -463,7 +463,7 @@ namespace ThreatSource.Simulation
|
||||
/// 低于此值时认为无法有效制导
|
||||
/// 默认值为1e-3瓦特
|
||||
/// </remarks>
|
||||
public double JammingResistanceThreshold { get; set; } = 1e-3;
|
||||
public double JammingResistanceThreshold { get; set; } = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -538,12 +538,12 @@ namespace ThreatSource.Simulation
|
||||
/// 低于此值时认为无法有效制导
|
||||
/// 默认值为1e-3瓦特
|
||||
/// </remarks>
|
||||
public double JammingResistanceThreshold { get; set; } = 1e-3;
|
||||
public double JammingResistanceThreshold { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 波长,单位:微米
|
||||
/// </summary>
|
||||
public double WaveLength { get; set; } = 8.0;
|
||||
public double Wavelength { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 初始化红外成像导引配置的新实例
|
||||
@ -582,7 +582,7 @@ namespace ThreatSource.Simulation
|
||||
/// </remarks>
|
||||
public class LaserSemiActiveGuidanceConfig
|
||||
{
|
||||
private double fieldOfViewAngle = 30.0;
|
||||
private double fieldOfViewAngle = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 视场角,单位:度
|
||||
@ -714,7 +714,7 @@ namespace ThreatSource.Simulation
|
||||
/// 影响大气透过率和目标反射特性
|
||||
/// 默认值为1.06微米(Nd:YAG激光器)
|
||||
/// </remarks>
|
||||
public double LaserWavelength { get; set; } = 1.06;
|
||||
public double Wavelength { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 初始化激光半主动导引配置的新实例
|
||||
@ -968,7 +968,7 @@ namespace ThreatSource.Simulation
|
||||
/// 定义了探测器的灵敏度阈值
|
||||
/// 低于此值时无法有效探测
|
||||
/// </remarks>
|
||||
public double MinDetectablePower { get; set; } = 1e-3;
|
||||
public double MinDetectablePower { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 探测器直径,单位:米
|
||||
@ -986,7 +986,7 @@ namespace ThreatSource.Simulation
|
||||
/// 定义了有效制导范围
|
||||
/// 超出此范围将失去制导
|
||||
/// </remarks>
|
||||
public double ControlFieldDiameter { get; set; } = 20.0;
|
||||
public double ControlFieldDiameter { get; set; } = 6.0;
|
||||
|
||||
/// <summary>
|
||||
/// PID控制器比例系数
|
||||
@ -1031,7 +1031,7 @@ namespace ThreatSource.Simulation
|
||||
/// 限制制导系统输出的最大加速度
|
||||
/// 防止过大的机动指令
|
||||
/// </remarks>
|
||||
public double MaxGuidanceAcceleration { get; set; } = 50.0;
|
||||
public double MaxGuidanceAcceleration { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 低通滤波系数
|
||||
@ -1050,8 +1050,7 @@ namespace ThreatSource.Simulation
|
||||
/// 低于此值时认为无法有效制导
|
||||
/// 默认值为1e-3瓦特
|
||||
/// </remarks>
|
||||
public double JammingResistanceThreshold { get; set; } = 1e-3;
|
||||
|
||||
public double JammingResistanceThreshold { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 激光波长,单位:纳米
|
||||
@ -1061,7 +1060,7 @@ namespace ThreatSource.Simulation
|
||||
/// 影响激光的传输特性和探测性能
|
||||
/// 默认值为1.06纳米
|
||||
/// </remarks>
|
||||
public double LaserWavelength { get; set; } = 1.06;
|
||||
public double Wavelength { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 初始化激光驾束制导系统配置的新实例
|
||||
|
||||
@ -210,3 +210,36 @@
|
||||
**结果**:最小有效诱偏功率 = 2.5 × 1.0 × 1.0 × 1.6 × 1.0 = 4.0W
|
||||
|
||||
**最终建议**:对于标准军用系统,建议使用 4.0W × 2 = 8.0W 功率的诱偏源。
|
||||
|
||||
|
||||
## 激光诱偏实验记录(v0.2.13)
|
||||
|
||||
时间:2025-04-26 10:00:00
|
||||
版本:v0.2.13
|
||||
|
||||
```text
|
||||
处理激光信号: 激光目标数量=0
|
||||
导弹 LSGM_1 的加速度: (12.66, -0.13, -0.00), 制导加速度: (0.00, 0.00, 0.00), 推力加速度: (0.00, 0.00, 0.00), 空气阻力加速度(含风影响): (12.66, -0.13, -0.00)
|
||||
干扰器 LaserJammer_Designator 更新状态: IsActive: True, IsJamming: True, CurrentParameters: ThreatSource.Jammer.JammingParameters
|
||||
干扰器 LaserJammer_Designator 更新状态: CurrentParameters.Duration.HasValue: True
|
||||
干扰器 LaserJammer_Designator 发布干扰开始事件: ThreatSource.Jammer.JammingParameters
|
||||
[JammableComponent] ApplyJamming: Laser
|
||||
干扰计算 - 设备位置: (660.37, 14.40, 20.00), 干扰源位置: (0.00, 0.00, 0.00)
|
||||
干扰计算 - 相对位置: (660.37, 14.40, 20.00), 距离: 660.83m
|
||||
干扰计算 - 发射功率: 2000W, 接收功率: 3.644530E-004W, 阈值: 1.000000E-005W
|
||||
干扰计算 - 干扰器方向: (1.00, 0.00, 0.05), 到设备方向: (1.00, 0.02, 0.03)
|
||||
干扰计算 - 点积: 1.00, 夹角: 1.57 度, 波束范围: 572.96 度
|
||||
干扰计算 - 最终结果: 有效
|
||||
[BaseIndicator] 处理干扰事件: Laser
|
||||
[BaseIndicator] 应用干扰HandleJammingEvent: Laser
|
||||
[JammableComponent] ApplyJamming: Laser
|
||||
干扰计算 - 设备位置: (2100.00, 1.00, 100.00), 干扰源位置: (0.00, 0.00, 0.00)
|
||||
干扰计算 - 相对位置: (2100.00, 1.00, 100.00), 距离: 2102.38m
|
||||
干扰计算 - 发射功率: 2000W, 接收功率: 3.600790E-005W, 阈值: 1.000000E-005W
|
||||
干扰计算 - 干扰器方向: (1.00, 0.00, 0.05), 到设备方向: (1.00, 0.00, 0.05)
|
||||
干扰计算 - 点积: 1.00, 夹角: 0.00 度, 波束范围: 572.96 度
|
||||
干扰计算 - 最终结果: 有效
|
||||
[LaserDesignator] LD_1 受到激光干扰,停止照射。
|
||||
```
|
||||
|
||||
实验结论:当激光干扰器的发射功率是 2000W 时,距离 2000米时,如果激光指示器或导弹的阻塞干扰阈值是 1e-5W,干扰效果是有效的。
|
||||
@ -189,9 +189,9 @@ namespace ThreatSource.Tools.MissileSimulation
|
||||
{
|
||||
var motionParameters = new MotionParameters
|
||||
{
|
||||
Position = new Vector3D(0, 1.2, 0),
|
||||
Position = new Vector3D(0, 1.2, 20),
|
||||
Orientation = new Orientation(Math.PI/2, 0.0, 0.0),
|
||||
InitialSpeed = 2
|
||||
InitialSpeed = 1.0
|
||||
};
|
||||
string targetId = "Tank_1";
|
||||
var target = _threatSourceFactory.CreateTarget(targetId, "mbt_001", motionParameters);
|
||||
@ -643,29 +643,7 @@ namespace ThreatSource.Tools.MissileSimulation
|
||||
// 激活干扰器实例
|
||||
jammer.Activate();
|
||||
|
||||
// 创建干扰参数
|
||||
JammingParameters jammingParams = new JammingParameters
|
||||
{
|
||||
Type = type,
|
||||
Mode = mode.Equals("阻塞") ? JammingMode.Blocking :
|
||||
mode.Equals("欺骗") ? JammingMode.Deception :
|
||||
mode.Equals("噪声") ? JammingMode.Noise : JammingMode.Blocking,
|
||||
JammerId = jammerId,
|
||||
SourceId = jammer.Id,
|
||||
Power = 1000, // 设置高功率
|
||||
Direction = jammer.Orientation.ToVector(),
|
||||
SourcePosition = jammer.Position,
|
||||
StartTime = DateTime.UtcNow, // 设置为当前时间
|
||||
Duration = 600 // 设置为10分钟(600秒)
|
||||
};
|
||||
|
||||
// 调用StartJamming方法开始干扰行为
|
||||
jammer.StartJamming(jammingParams);
|
||||
|
||||
Console.WriteLine($"激活干扰器并开始干扰: {jammerId}: {displayName} (模式: {mode}, 作用: {target})");
|
||||
Console.WriteLine($"干扰器 {jammerId} 激活状态: {jammer.IsActive}, 干扰状态: {jammer.IsJamming}");
|
||||
Console.WriteLine($"干扰参数: 类型={type}, 模式={jammingParams.Mode}, 开始时间={jammingParams.StartTime}, 持续时间={jammingParams.Duration}秒");
|
||||
Console.WriteLine($"干扰器 {jammerId} 状态信息: {jammer.GetStatus()}");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1004,9 +982,7 @@ namespace ThreatSource.Tools.MissileSimulation
|
||||
/// 打印当前模拟状态
|
||||
/// </summary>
|
||||
private void PrintSimulationStatus()
|
||||
{
|
||||
Console.Clear();
|
||||
|
||||
{
|
||||
// 获取当前仿真时间
|
||||
double simulationTime = simulationManager.CurrentTime;
|
||||
var weather = simulationManager.CurrentWeather;
|
||||
@ -1065,20 +1041,6 @@ namespace ThreatSource.Tools.MissileSimulation
|
||||
{
|
||||
// 调用指示器的GetStatus方法
|
||||
Console.WriteLine(indicator.GetStatus());
|
||||
|
||||
// 如果是IIndicator接口,显示干扰状态信息
|
||||
if (indicator is IIndicator indInterface && indInterface.IsJammed)
|
||||
{
|
||||
Console.WriteLine($" 受干扰状态: 受到干扰");
|
||||
|
||||
// 尝试显示干扰类型
|
||||
if (indicator is LaserDesignator)
|
||||
Console.WriteLine($" 干扰类型: 激光干扰");
|
||||
else if (indicator is LaserBeamRider)
|
||||
Console.WriteLine($" 干扰类型: 激光干扰");
|
||||
else if (indicator is InfraredTracker)
|
||||
Console.WriteLine($" 干扰类型: 红外干扰");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1105,22 +1067,18 @@ namespace ThreatSource.Tools.MissileSimulation
|
||||
if (runningState.CurrentParameters != null)
|
||||
{
|
||||
var jammingParams = runningState.CurrentParameters;
|
||||
Console.WriteLine($" 干扰详情:");
|
||||
Console.WriteLine($" - 类型: {jammingParams.Type}");
|
||||
Console.WriteLine($" - 模式: {jammingParams.Mode}");
|
||||
Console.WriteLine($" - 功率: {jammingParams.Power:F1} W");
|
||||
|
||||
// 计算已干扰时间和剩余时间
|
||||
var jammingTimeSeconds = (DateTime.UtcNow.Ticks - jammingParams.StartTime.Ticks) / TimeSpan.TicksPerSecond;
|
||||
Console.WriteLine($" - 已干扰时间: {jammingTimeSeconds:F1} 秒");
|
||||
Console.WriteLine($"- 已干扰时间: {jammingTimeSeconds:F1} 秒");
|
||||
|
||||
if (jammingParams.Duration.HasValue)
|
||||
{
|
||||
var remainingTime = jammingParams.Duration.Value - jammingTimeSeconds;
|
||||
if (remainingTime > 0)
|
||||
Console.WriteLine($" - 剩余时间: {remainingTime:F1} 秒");
|
||||
Console.WriteLine($"- 剩余时间: {remainingTime:F1} 秒");
|
||||
else
|
||||
Console.WriteLine(" - 干扰即将结束");
|
||||
Console.WriteLine("- 干扰即将结束");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user