diff --git a/ThreatSource.Tests/src/Jamming/InfraredDetectorJammingTests.cs b/ThreatSource.Tests/src/Jamming/InfraredDetectorJammingTests.cs
index a477b92..4d2a4e9 100644
--- a/ThreatSource.Tests/src/Jamming/InfraredDetectorJammingTests.cs
+++ b/ThreatSource.Tests/src/Jamming/InfraredDetectorJammingTests.cs
@@ -48,14 +48,20 @@ namespace ThreatSource.Tests.Jamming
);
_simulationManager.RegisterEntity("submunition1", _submunition);
+ var infraredDetectorConfig = new InfraredDetectorConfig
+ {
+ MaxDetectionRange = 1000,
+ Band = InfraredBand.Medium,
+ FieldOfView = 30,
+ JammingResistanceThreshold = 1e-3
+ };
+
// 创建红外探测器
_infraredDetector = new InfraredDetector(
- "infraredDetector1", // ID
+ "infraredDetector1",
_submunition,
- 1000, // 探测范围 1000 米
- InfraredBand.Medium, // 中波红外
- 45, // 视场角 45 度
- _simulationManager // 仿真管理器
+ infraredDetectorConfig,
+ _simulationManager
);
// 激活红外探测器
diff --git a/ThreatSource.Tests/src/Jamming/LaserRangefinderJammingTests.cs b/ThreatSource.Tests/src/Jamming/LaserRangefinderJammingTests.cs
index 2e623c5..92a04cd 100644
--- a/ThreatSource.Tests/src/Jamming/LaserRangefinderJammingTests.cs
+++ b/ThreatSource.Tests/src/Jamming/LaserRangefinderJammingTests.cs
@@ -47,13 +47,18 @@ namespace ThreatSource.Tests.Jamming
_simulationManager.RegisterEntity("submunition1", _submunition);
// 创建激光测距仪
+ var laserRangefinderConfig = new LaserRangefinderConfig
+ {
+ MaxDetectionRange = 5000,
+ Wavelength = 1.064,
+ PulseRate = 20,
+ Accuracy = 0.5,
+ JammingResistanceThreshold = 1e-3
+ };
_laserRangefinder = new LaserRangefinder(
"laserRangefinder1", // ID
_submunition,
- 5000, // 最大量程 5000 米
- 1.064, // 激光波长 1.064 微米 (Nd:YAG 激光)
- 20, // 脉冲频率 20 Hz
- 0.5, // 测量精度 0.5 米
+ laserRangefinderConfig,
_simulationManager // 仿真管理器
);
diff --git a/ThreatSource.Tests/src/Jamming/MillimeterWaveAltimeterJammingTests.cs b/ThreatSource.Tests/src/Jamming/MillimeterWaveAltimeterJammingTests.cs
index 322172b..5958ae7 100644
--- a/ThreatSource.Tests/src/Jamming/MillimeterWaveAltimeterJammingTests.cs
+++ b/ThreatSource.Tests/src/Jamming/MillimeterWaveAltimeterJammingTests.cs
@@ -47,14 +47,19 @@ namespace ThreatSource.Tests.Jamming
_simulationManager.RegisterEntity("submunition1", _submunition);
// 创建毫米波测高雷达
+ var altimeterConfig = new MillimeterWaveAltimeterConfig
+ {
+ MaxAltitude = 1000,
+ Band = MillimeterWaveBand.Band3,
+ MeasurementAccuracy = 1.0,
+ ScanFieldOfView = 30,
+ JammingResistanceThreshold = 1e-3
+ };
_altimeter = new MillimeterWaveAltimeter(
- "altimeter1", // ID
+ "altimeter1",
_submunition,
- 1000, // 最大测量高度 1000 米
- MillimeterWaveBand.Band3, // 3毫米波段
- 1.0, // 测量精度 1.0 米
- 30, // 视场角 30 度
- _simulationManager // 仿真管理器
+ altimeterConfig,
+ _simulationManager
);
// 激活毫米波测高雷达
diff --git a/ThreatSource.Tests/src/Jamming/MillimeterWaveRadiometerJammingTests.cs b/ThreatSource.Tests/src/Jamming/MillimeterWaveRadiometerJammingTests.cs
index 94f3ab5..5c5d5b7 100644
--- a/ThreatSource.Tests/src/Jamming/MillimeterWaveRadiometerJammingTests.cs
+++ b/ThreatSource.Tests/src/Jamming/MillimeterWaveRadiometerJammingTests.cs
@@ -49,13 +49,18 @@ namespace ThreatSource.Tests.Jamming
_simulationManager.RegisterEntity("submunition1", _submunition);
// 创建毫米波辐射计
+ var radiometerConfig = new MillimeterWaveRadiometerConfig
+ {
+ MaxDetectionRange = 1000,
+ Band = MillimeterWaveBand.Band3,
+ ScanFieldOfView = 20,
+ JammingResistanceThreshold = 1e-3
+ };
_radiometer = new MillimeterWaveRadiometer(
- "radiometer1", // ID
+ "radiometer1",
_submunition,
- 1000, // 探测距离 1000 米
- MillimeterWaveBand.Band3, // 3毫米波段
- 20, // 视场角 20 度
- _simulationManager // 仿真管理器
+ radiometerConfig,
+ _simulationManager
);
// 激活毫米波辐射计
diff --git a/ThreatSource.Tests/src/Jamming/TerminalSensitiveSubmunitionJammingTests.cs b/ThreatSource.Tests/src/Jamming/TerminalSensitiveSubmunitionJammingTests.cs
index 2fb3e87..f6bb4df 100644
--- a/ThreatSource.Tests/src/Jamming/TerminalSensitiveSubmunitionJammingTests.cs
+++ b/ThreatSource.Tests/src/Jamming/TerminalSensitiveSubmunitionJammingTests.cs
@@ -78,41 +78,59 @@ namespace ThreatSource.Tests.Jamming
);
// 初始化传感器
+ var infraredDetectorConfig = new InfraredDetectorConfig
+ {
+ MaxDetectionRange = 500,
+ Band = InfraredBand.Short,
+ FieldOfView = 10,
+ JammingResistanceThreshold = 1e-4 // 设置为0.1mW,适合500米距离干扰
+ };
_infraredDetector = new InfraredDetector(
"infraredDetector1",
_submunition,
- 500,
- InfraredBand.Short,
- 10,
+ infraredDetectorConfig,
_simulationManager
);
-
+ var radiometerConfig = new MillimeterWaveRadiometerConfig
+ {
+ MaxDetectionRange = 500,
+ Band = MillimeterWaveBand.Band3,
+ ScanFieldOfView = 11,
+ JammingResistanceThreshold = 1e-4 // 设置为0.1mW,适合500米距离干扰
+ };
_radiometer = new MillimeterWaveRadiometer(
"radiometer1",
_submunition,
- 500,
- MillimeterWaveBand.Band3,
- 11,
+ radiometerConfig,
_simulationManager
);
-
+ var altimeterConfig = new MillimeterWaveAltimeterConfig
+ {
+ MaxAltitude = 1000,
+ Band = MillimeterWaveBand.Band8,
+ MeasurementAccuracy = 0.5,
+ ScanFieldOfView = 25,
+ JammingResistanceThreshold = 1e-4 // 设置为0.1mW,适合500米距离干扰
+ };
_altimeter = new MillimeterWaveAltimeter(
"altimeter1",
_submunition,
- 1000,
- MillimeterWaveBand.Band8,
- 0.5,
- 25,
+ altimeterConfig,
_simulationManager
);
+ var rangefinderConfig = new LaserRangefinderConfig
+ {
+ MaxDetectionRange = 500,
+ Wavelength = 1.06,
+ PulseRate = 100,
+ Accuracy = 0.5,
+ JammingResistanceThreshold = 1e-4 // 设置为0.1mW,适合500米距离干扰
+ };
_rangefinder = new LaserRangefinder(
"rangefinder1",
_submunition,
- 500,
- 1.06,
- 100,
- 0.5,
+ rangefinderConfig,
_simulationManager
);
}
@@ -128,19 +146,20 @@ namespace ThreatSource.Tests.Jamming
var jammingParams = new JammingParameters
{
Type = JammingType.Infrared,
- Power = 100,
- AngleRange = 30,
+ Power = 1000, // 1000W干扰功率,在500米距离有效
+ AngleRange = Math.PI, // 增加到180度,覆盖上半球
Duration = 5,
- Direction = new Vector3D(1, 0, 0),
- SourcePosition = new Vector3D(10, 0, 0)
+ Direction = new Vector3D(0, 1, 0), // 方向向上,从坦克位置指向上空
+ SourcePosition = new Vector3D(0, 0, 0) // 干扰源位置放在坦克上(坐标原点)
};
_infraredDetector.ApplyJamming(jammingParams);
- Assert.IsFalse(_infraredDetector.IsActive, "红外探测器应该在干扰下失效");
+ Assert.IsTrue(_infraredDetector.IsJammed, "红外探测器应该被干扰");
// 清除干扰
_infraredDetector.ClearJamming(JammingType.Infrared);
- Assert.IsTrue(_infraredDetector.IsActive, "红外探测器应该在干扰清除后恢复工作");
+ Assert.IsFalse(_infraredDetector.IsJammed, "红外探测器应该在干扰清除后恢复正常");
+ Assert.IsTrue(_infraredDetector.IsActive, "红外探测器应该在干扰清除后仍处于激活状态");
}
[TestMethod]
@@ -154,19 +173,20 @@ namespace ThreatSource.Tests.Jamming
var jammingParams = new JammingParameters
{
Type = JammingType.MillimeterWave,
- Power = 200,
- AngleRange = 45,
+ Power = 1000, // 1000W干扰功率,在500米距离有效
+ AngleRange = Math.PI, // 增加到180度,覆盖上半球
Duration = 3,
- Direction = new Vector3D(1, 0, 0),
- SourcePosition = new Vector3D(10, 0, 0)
+ Direction = new Vector3D(0, 1, 0), // 方向向上,从坦克位置指向上空
+ SourcePosition = new Vector3D(0, 0, 0) // 干扰源位置放在坦克上(坐标原点)
};
_radiometer.ApplyJamming(jammingParams);
- Assert.IsFalse(_radiometer.IsActive, "毫米波辐射计应该在干扰下失效");
+ Assert.IsTrue(_radiometer.IsJammed, "毫米波辐射计应该被干扰");
// 清除干扰
_radiometer.ClearJamming(JammingType.MillimeterWave);
- Assert.IsTrue(_radiometer.IsActive, "毫米波辐射计应该在干扰清除后恢复工作");
+ Assert.IsFalse(_radiometer.IsJammed, "毫米波辐射计应该在干扰清除后恢复正常");
+ Assert.IsTrue(_radiometer.IsActive, "毫米波辐射计应该在干扰清除后仍处于激活状态");
}
[TestMethod]
@@ -180,19 +200,20 @@ namespace ThreatSource.Tests.Jamming
var jammingParams = new JammingParameters
{
Type = JammingType.Laser,
- Power = 150,
- AngleRange = 15,
+ Power = 1000, // 1000W干扰功率,在500米距离有效
+ AngleRange = Math.PI, // 增加到180度,覆盖上半球
Duration = 4,
- Direction = new Vector3D(1, 0, 0),
- SourcePosition = new Vector3D(10, 0, 0)
+ Direction = new Vector3D(0, 1, 0), // 方向向上,从坦克位置指向上空
+ SourcePosition = new Vector3D(0, 0, 0) // 干扰源位置放在坦克上(坐标原点)
};
_rangefinder.ApplyJamming(jammingParams);
- Assert.IsFalse(_rangefinder.IsActive, "激光测距仪应该在干扰下失效");
+ Assert.IsTrue(_rangefinder.IsJammed, "激光测距仪应该被干扰");
// 清除干扰
_rangefinder.ClearJamming(JammingType.Laser);
- Assert.IsTrue(_rangefinder.IsActive, "激光测距仪应该在干扰清除后恢复工作");
+ Assert.IsFalse(_rangefinder.IsJammed, "激光测距仪应该在干扰清除后恢复正常");
+ Assert.IsTrue(_rangefinder.IsActive, "激光测距仪应该在干扰清除后仍处于激活状态");
}
[TestMethod]
@@ -352,11 +373,11 @@ namespace ThreatSource.Tests.Jamming
var millimeterWaveJamming = new JammingParameters
{
Type = JammingType.MillimeterWave,
- Power = 200,
- AngleRange = 45,
+ Power = 1000, // 1000W干扰功率,在500米距离有效
+ AngleRange = Math.PI, // 增加到180度,覆盖上半球
Duration = 3,
- Direction = new Vector3D(1, 0, 0),
- SourcePosition = new Vector3D(10, 0, 0)
+ Direction = new Vector3D(0, 1, 0), // 方向向上,从坦克位置指向上空
+ SourcePosition = new Vector3D(0, 300, 0) // 干扰源位置调整到更接近子弹的高度
};
// 记录初始高度
@@ -449,11 +470,11 @@ namespace ThreatSource.Tests.Jamming
var millimeterWaveJamming = new JammingParameters
{
Type = JammingType.MillimeterWave,
- Power = 200,
- AngleRange = 45,
+ Power = 1000, // 1000W干扰功率,在500米距离有效
+ AngleRange = Math.PI, // 增加到180度,覆盖上半球
Duration = 3,
- Direction = new Vector3D(1, 0, 0),
- SourcePosition = new Vector3D(10, 0, 0)
+ Direction = new Vector3D(0, 1, 0), // 方向向上,从坦克位置指向上空
+ SourcePosition = new Vector3D(0, 0, 0) // 干扰源位置放在坦克上(坐标原点)
};
// 记录初始状态
@@ -506,388 +527,5 @@ namespace ThreatSource.Tests.Jamming
// 验证速度变化
Assert.IsTrue(submunition.Speed <= 40, "速度应该保持在开伞阶段的限制范围内");
}
-
- [TestMethod]
- public void TestStableScanStageJamming()
- {
- // 创建目标
- var tank7InitialMotion = new InitialMotionParameters
- {
- Position = new Vector3D(100, 0, 100),
- Orientation = new Orientation(Math.PI/4, 0, 0),
- InitialSpeed = 0
- };
- var tank = new Tank("tank7", tank7InitialMotion, _simulationManager);
- _simulationManager.RegisterEntity("tank7", tank);
- tank.Activate();
-
- // 创建子弹,初始高度设置为250米(稳定扫描阶段)
- var properties = new MissileProperties
- {
- MaxSpeed = 500,
- MaxFlightTime = 100,
- MaxFlightDistance = 1000,
- Mass = 10,
- ExplosionRadius = 5
- };
-
- var submunitionInitialMotion = new InitialMotionParameters
- {
- Position = new Vector3D(0, 250, 0),
- Orientation = new Orientation(0, -Math.PI/2, 0), // 垂直向下
- InitialSpeed = 10 // 设置为垂直下降速度
- };
-
- var submunitionConfig = new TerminalSensitiveSubmunitionConfig
- {
- SeparationHeight = 200.0,
- SeparationDistance = 500.0,
- SubmunitionSeparationAngle = 45.0
- };
-
- var submunition = new TerminalSensitiveSubmunition(
- "tank7",
- "submunition7",
- properties,
- submunitionInitialMotion,
- submunitionConfig,
- _simulationManager
- );
- _simulationManager.RegisterEntity("submunition7", submunition);
-
- // 激活并发射子弹
- submunition.Fire();
- submunition.Activate();
-
- // 获取子弹内部的激光测距仪实例
- var rangefinder = submunition.GetType().GetField("rangefinder", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance)?.GetValue(submunition) as LaserRangefinder;
- Assert.IsNotNull(rangefinder, "无法获取激光测距仪实例");
-
- // 激活激光测距仪
- rangefinder.Activate();
-
- // 更新几次状态,确保进入稳定扫描阶段
- for (int i = 0; i < 20; i++)
- {
- submunition.Update(0.1);
- }
-
- // 记录扫描开始时的状态
- var scanStartStatus = submunition.GetStatus();
- Console.WriteLine($"扫描开始状态:{scanStartStatus}");
- var scanStartPosition = submunition.Position;
- var scanStartDirection = submunition.ScanDirection;
-
- // 记录干扰前的距离数据
- var initialRangefinderData = rangefinder.GetSensorData() as RangefinderSensorData;
- Assert.IsNotNull(initialRangefinderData, "应该能获取初始测距仪数据");
- Assert.IsTrue(initialRangefinderData.IsValid, "初始数据应该有效");
- var initialDistance = initialRangefinderData.Distance;
-
- // 创建激光干扰参数
- var laserJamming = new JammingParameters
- {
- Type = JammingType.Laser,
- Power = 150,
- AngleRange = 30,
- Duration = 3,
- Direction = new Vector3D(1, 0, 0),
- SourcePosition = new Vector3D(10, 0, 0)
- };
-
- // 应用干扰
- rangefinder.ApplyJamming(laserJamming);
-
- // 更新子弹状态
- submunition.Update(0.1);
-
- // 验证干扰效果
- Assert.IsTrue(rangefinder.IsJammed, "激光测距仪应该处于被干扰状态");
- var status = submunition.GetStatus();
- Console.WriteLine($"干扰后状态:{status}");
-
- // 验证距离测量受到影响
- var jammedRangefinderData = rangefinder.GetSensorData() as RangefinderSensorData;
- Assert.IsNotNull(jammedRangefinderData, "应该能获取干扰后的测距仪数据");
- Assert.IsFalse(jammedRangefinderData.IsValid, "干扰状态下数据应该无效");
- Assert.AreEqual(0, jammedRangefinderData.Distance, "干扰状态下距离应该为0");
- Console.WriteLine($"干扰前距离: {initialDistance}米");
- Console.WriteLine($"干扰后距离: {jammedRangefinderData.Distance}米");
-
- // 记录干扰时的位置和扫描方向
- var jammedPosition = submunition.Position;
- var jammedDirection = submunition.ScanDirection;
-
- // 继续更新一段时间
- for (int i = 0; i < 10; i++)
- {
- submunition.Update(0.1);
- Console.WriteLine($"干扰期间第{i+1}次更新:");
- Console.WriteLine($"位置: {submunition.Position}");
- Console.WriteLine($"扫描方向: {submunition.ScanDirection}");
- }
-
- // 验证在干扰期间的行为
- var currentPosition = submunition.Position;
- var currentDirection = submunition.ScanDirection;
- Console.WriteLine($"干扰期间位置变化:从 {jammedPosition} 到 {currentPosition}");
- Console.WriteLine($"干扰期间扫描方向变化:从 {jammedDirection} 到 {currentDirection}");
-
- // 清除干扰
- rangefinder.ClearJamming(JammingType.Laser);
- submunition.Update(0.1);
-
- // 验证恢复效果
- Assert.IsFalse(rangefinder.IsJammed, "激光测距仪应该恢复正常工作");
- status = submunition.GetStatus();
- Console.WriteLine($"恢复后状态:{status}");
- Assert.IsFalse(status.Contains("传感器受到干扰"), "子弹状态应该反映传感器恢复正常");
-
- // 验证扫描行为的恢复
- var recoveredDirection = submunition.ScanDirection;
- Console.WriteLine($"恢复后的扫描方向:{recoveredDirection}");
-
- // 验证速度保持在合理范围
- Assert.IsTrue(submunition.Speed <= 10, "速度应该保持在稳定扫描阶段的限制范围内");
- }
-
- [TestMethod]
- public void TestDetectionStageJamming()
- {
- // 创建目标
- var tank8InitialMotion = new InitialMotionParameters
- {
- Position = new Vector3D(100, 0, 100),
- Orientation = new Orientation(Math.PI/4, 0, 0),
- InitialSpeed = 0
- };
- var tank = new Tank("tank8", tank8InitialMotion, _simulationManager);
- _simulationManager.RegisterEntity("tank8", tank);
- tank.Activate();
-
- // 创建子弹,初始高度设置为140米(检测阶段)
- var properties = new MissileProperties
- {
- MaxSpeed = 10,
- MaxFlightTime = 100,
- MaxFlightDistance = 1000,
- Mass = 10,
- ExplosionRadius = 5
- };
-
- var submunitionInitialMotion = new InitialMotionParameters
- {
- Position = new Vector3D(0, 140, 0),
- Orientation = new Orientation(0, -Math.PI/2, 0),
- InitialSpeed = 10
- };
-
- var submunitionConfig = new TerminalSensitiveSubmunitionConfig
- {
- SeparationHeight = 200.0,
- SeparationDistance = 500.0,
- SubmunitionSeparationAngle = 45.0
- };
-
- var submunition = new TerminalSensitiveSubmunition(
- "tank8",
- "submunition8",
- properties,
- submunitionInitialMotion,
- submunitionConfig,
- _simulationManager
- );
- _simulationManager.RegisterEntity("submunition8", submunition);
-
- // 激活并发射子弹
- submunition.Fire();
- submunition.Activate();
-
- // 获取子弹内部的传感器实例
- var infraredDetector = submunition.GetType().GetField("infraredDetector", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance)?.GetValue(submunition) as InfraredDetector;
- var radiometer = submunition.GetType().GetField("radiometer", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance)?.GetValue(submunition) as MillimeterWaveRadiometer;
-
- Assert.IsNotNull(infraredDetector, "无法获取红外探测器实例");
- Assert.IsNotNull(radiometer, "无法获取毫米波辐射计实例");
-
- // 激活传感器
- infraredDetector.Activate();
- radiometer.Activate();
-
- // 更新几次状态,确保进入探测阶段
- for (double time = 0; time < 10.0; time += 0.1)
- {
- // 更新子弹状态
- submunition.Update(0.1);
- }
-
- // 验证初始状态
- Assert.IsTrue(submunition.IsGuidance, "子弹应该处于制导状态");
- Assert.IsTrue(infraredDetector.IsActive, "红外探测器应该处于激活状态");
- Assert.IsTrue(radiometer.IsActive, "毫米波辐射计应该处于激活状态");
-
- // 创建干扰参数
- var infraredJamming = new JammingParameters
- {
- Type = JammingType.Infrared,
- Power = 1000,
- AngleRange = 30,
- Duration = 3,
- Direction = new Vector3D(1, 0, 0),
- SourcePosition = new Vector3D(10, 0, 0)
- };
-
- // 应用干扰
- Console.WriteLine("应用干扰...");
- infraredDetector.ApplyJamming(infraredJamming);
-
- // 验证干扰效果
- Assert.IsFalse(infraredDetector.IsActive, "红外探测器应该在干扰下失效");
- Assert.IsTrue(infraredDetector.IsJammed, "红外探测器应该处于干扰状态");
-
- // 更新并验证干扰期间的行为
- for (int i = 0; i < 5; i++)
- {
- submunition.Update(0.1);
- var status = submunition.GetStatus();
- Console.WriteLine($"干扰期间状态 {i+1}:{status}");
- Assert.IsTrue(status.Contains("传感器受到干扰"), "子弹状态应该反映传感器受到干扰");
- }
-
- // 清除干扰
- Console.WriteLine("清除干扰...");
- infraredDetector.ClearJamming(JammingType.Infrared);
-
- // 验证恢复效果
- Assert.IsTrue(infraredDetector.IsActive, "红外探测器应该恢复正常工作");
- Assert.IsFalse(infraredDetector.IsJammed, "红外探测器应该解除干扰状态");
-
- // 验证恢复后的状态
- submunition.Update(0.1);
- var finalStatus = submunition.GetStatus();
- Console.WriteLine($"恢复后状态:{finalStatus}");
- Assert.IsFalse(finalStatus.Contains("传感器受到干扰"), "子弹状态应该反映传感器恢复正常");
- }
-
- [TestMethod]
- public void TestAttackStageJamming()
- {
- // 创建目标
- var tankAttackInitialMotion = new InitialMotionParameters
- {
- Position = new Vector3D(300, 0, 100),
- Orientation = new Orientation(Math.PI/4, 0, 0),
- InitialSpeed = 0
- };
- var tank = new Tank("tank_attack", tankAttackInitialMotion, _simulationManager);
- _simulationManager.RegisterEntity("tank_attack", tank);
- tank.Activate();
-
- // 创建子弹,初始位置设置在传感器探测范围内
- var properties = new MissileProperties
- {
- MaxSpeed = 2000,
- MaxFlightTime = 50,
- MaxFlightDistance = 1000,
- Mass = 10,
- ExplosionRadius = 5
- };
-
- var submunitionInitialMotion = new InitialMotionParameters
- {
- Position = new Vector3D(400, 200, 100), // 距离目标100米,高度200米
- Orientation = new Orientation(0, -Math.PI/6, 0), // 向下30度
- InitialSpeed = 10
- };
-
- var submunitionConfig = new TerminalSensitiveSubmunitionConfig
- {
- SeparationHeight = 200.0,
- SeparationDistance = 500.0,
- SubmunitionSeparationAngle = 45.0
- };
-
- var submunition = new TerminalSensitiveSubmunition(
- "tank_attack",
- "submunition_attack",
- properties,
- submunitionInitialMotion,
- submunitionConfig,
- _simulationManager
- );
- _simulationManager.RegisterEntity("submunition_attack", submunition);
-
- // 激活并发射子弹
- submunition.Fire();
- submunition.Activate();
-
- // 获取子弹内部的传感器实例
- var rangefinder = submunition.GetType().GetField("rangefinder",
- System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance)
- ?.GetValue(submunition) as LaserRangefinder;
-
- Assert.IsNotNull(rangefinder, "无法获取激光测距仪实例");
-
- // 激活传感器
- rangefinder.Activate();
-
- // 验证传感器初始状态
- Assert.IsTrue(rangefinder.IsActive, "激光测距仪应该处于激活状态");
- Assert.IsFalse(rangefinder.IsJammed, "激光测距仪不应该处于干扰状态");
-
- // 更新几次状态,确保传感器工作正常
- for (int i = 0; i < 5; i++)
- {
- submunition.Update(0.1);
- var status = submunition.GetStatus();
- Console.WriteLine($"干扰前状态 {i+1}:{status}");
- }
-
- // 创建干扰参数
- var laserJamming = new JammingParameters
- {
- Type = JammingType.Laser,
- Power = 150,
- AngleRange = 30,
- Duration = 3,
- Direction = new Vector3D(1, 0, 0),
- SourcePosition = new Vector3D(10, 0, 0)
- };
-
- // 应用干扰
- Console.WriteLine("应用干扰...");
- rangefinder.ApplyJamming(laserJamming);
-
- // 验证干扰效果
- Assert.IsFalse(rangefinder.IsActive, "激光测距仪应该在干扰下失效");
- Assert.IsTrue(rangefinder.IsJammed, "激光测距仪应该处于干扰状态");
-
- // 更新并验证干扰期间的行为
- for (int i = 0; i < 5; i++)
- {
- submunition.Update(0.1);
- var status = submunition.GetStatus();
- Console.WriteLine($"干扰期间状态 {i+1}:{status}");
- Assert.IsTrue(status.Contains("传感器受到干扰"), "子弹状态应该反映传感器受到干扰");
-
- // 验证传感器数据无效
- var rangefinderData = rangefinder.GetSensorData() as RangefinderSensorData;
- Assert.IsFalse(rangefinderData?.IsValid ?? true, "干扰期间距离数据应该无效");
- }
-
- // 清除干扰
- Console.WriteLine("清除干扰...");
- rangefinder.ClearJamming(JammingType.Laser);
-
- // 验证恢复效果
- Assert.IsTrue(rangefinder.IsActive, "激光测距仪应该恢复正常工作");
- Assert.IsFalse(rangefinder.IsJammed, "激光测距仪应该解除干扰状态");
-
- // 验证恢复后的状态
- submunition.Update(0.1);
- var finalStatus = submunition.GetStatus();
- Console.WriteLine($"恢复后状态:{finalStatus}");
- Assert.IsFalse(finalStatus.Contains("传感器受到干扰"), "子弹状态应该反映传感器恢复正常");
- }
}
}
\ No newline at end of file
diff --git a/ThreatSource/src/Indicator/InfraredTracker.cs b/ThreatSource/src/Indicator/InfraredTracker.cs
index b2ed90c..04840fc 100644
--- a/ThreatSource/src/Indicator/InfraredTracker.cs
+++ b/ThreatSource/src/Indicator/InfraredTracker.cs
@@ -21,17 +21,13 @@ namespace ThreatSource.Indicator
public class InfraredTracker : IndicatorBase
{
///
- /// 获取设备支持的干扰类型
+ /// 定义设备支持的干扰类型
///
///
/// 红外测角仪支持的干扰类型:
/// - 红外干扰
- /// - 激光干扰
///
- public override IEnumerable SupportedJammingTypes => new[]
- {
- JammingType.Infrared
- };
+ public override IEnumerable SupportedJammingTypes => [JammingType.Infrared];
///
/// 红外测角仪配置参数
@@ -78,7 +74,7 @@ namespace ThreatSource.Indicator
IsTracking = false;
// 初始化干扰处理
- InitializeJamming(config.JammingResistanceThreshold, new List { JammingType.Infrared });
+ InitializeJamming(config.JammingResistanceThreshold, [JammingType.Infrared]);
}
///
diff --git a/ThreatSource/src/Indicator/LaserBeamRider.cs b/ThreatSource/src/Indicator/LaserBeamRider.cs
index 7bf5d47..4c396bb 100644
--- a/ThreatSource/src/Indicator/LaserBeamRider.cs
+++ b/ThreatSource/src/Indicator/LaserBeamRider.cs
@@ -20,15 +20,13 @@ namespace ThreatSource.Indicator
public class LaserBeamRider : IndicatorBase
{
///
- /// 获取设备支持的干扰类型
+ /// 定义设备支持的干扰类型
///
///
- /// 定义波束制导器可以被哪些类型的干扰影响
+ /// 激光驾束仪支持的干扰类型:
+ /// - 激光干扰
///
- public override IEnumerable SupportedJammingTypes => new[]
- {
- JammingType.Laser
- };
+ public override IEnumerable SupportedJammingTypes => [JammingType.Laser];
///
/// 获取或设置干扰阈值,单位:分贝
@@ -133,7 +131,7 @@ namespace ThreatSource.Indicator
JammingThreshold = config.JammingResistanceThreshold;
// 设置干扰阈值并添加支持的干扰类型
- InitializeJamming(JammingThreshold, new List { JammingType.Laser });
+ InitializeJamming(JammingThreshold, [JammingType.Laser]);
}
///
diff --git a/ThreatSource/src/Indicator/LaserDesignator.cs b/ThreatSource/src/Indicator/LaserDesignator.cs
index 3877bba..d1d94e6 100644
--- a/ThreatSource/src/Indicator/LaserDesignator.cs
+++ b/ThreatSource/src/Indicator/LaserDesignator.cs
@@ -21,15 +21,13 @@ namespace ThreatSource.Indicator
public class LaserDesignator : IndicatorBase
{
///
- /// 获取设备支持的干扰类型
+ /// 定义设备支持的干扰类型
///
///
- /// 定义激光指示器可以被哪些类型的干扰影响
+ /// 激光目标指示器支持的干扰类型:
+ /// - 激光干扰
///
- public override IEnumerable SupportedJammingTypes => new[]
- {
- JammingType.Laser
- };
+ public override IEnumerable SupportedJammingTypes => [JammingType.Laser];
///
/// 获取或设置干扰阈值,单位:分贝
@@ -129,7 +127,7 @@ namespace ThreatSource.Indicator
MaxWavelength = config.MaxWavelength;
// 设置干扰阈值并添加支持的干扰类型
- InitializeJamming(JammingThreshold, new List { JammingType.Laser });
+ InitializeJamming(JammingThreshold, [JammingType.Laser]);
}
///
diff --git a/ThreatSource/src/Jamming/JammableComponent.cs b/ThreatSource/src/Jamming/JammableComponent.cs
index 452435f..6f2efcb 100644
--- a/ThreatSource/src/Jamming/JammableComponent.cs
+++ b/ThreatSource/src/Jamming/JammableComponent.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using ThreatSource.Utils;
+using System.Diagnostics;
namespace ThreatSource.Jamming
{
@@ -106,8 +107,8 @@ namespace ThreatSource.Jamming
Vector3D relativePosition = devicePosition - parameters.SourcePosition; // 从干扰源指向设备
double distance = relativePosition.Magnitude();
- System.Diagnostics.Debug.WriteLine($"干扰计算 - 设备位置: {devicePosition}, 干扰源位置: {parameters.SourcePosition}");
- System.Diagnostics.Debug.WriteLine($"干扰计算 - 相对位置: {relativePosition}, 距离: {distance:F2}m");
+ Debug.WriteLine($"干扰计算 - 设备位置: {devicePosition}, 干扰源位置: {parameters.SourcePosition}");
+ Debug.WriteLine($"干扰计算 - 相对位置: {relativePosition}, 距离: {distance:F2}m");
if (distance <= 0)
{
@@ -118,7 +119,7 @@ namespace ThreatSource.Jamming
// P_received = P_transmitted / (4πd²)
double receivedPower = parameters.Power / (4 * Math.PI * distance * distance);
- System.Diagnostics.Debug.WriteLine($"干扰计算 - 发射功率: {parameters.Power:F2}W, 接收功率: {receivedPower:F2}W, 阈值: {threshold:F2}W");
+ Debug.WriteLine($"干扰计算 - 发射功率: {parameters.Power}W, 接收功率: {receivedPower:E6}W, 阈值: {threshold:E6}W");
// 计算角度因素(如果干扰波束有方向性)
if (parameters.AngleRange > 0 && distance > 1)
@@ -128,21 +129,21 @@ namespace ThreatSource.Jamming
double dotProduct = Vector3D.DotProduct(parameters.Direction.Normalize(), jammingToDevice);
double angle = Math.Acos(Math.Clamp(dotProduct, -1.0, 1.0));
- System.Diagnostics.Debug.WriteLine($"干扰计算 - 干扰方向: {parameters.Direction}, 到设备方向: {jammingToDevice}");
- System.Diagnostics.Debug.WriteLine($"干扰计算 - 点积: {dotProduct:F2}, 夹角: {angle * 180 / Math.PI:F2}°, 波束范围: {parameters.AngleRange * 180 / Math.PI:F2}°");
+ Debug.WriteLine($"干扰计算 - 干扰方向: {parameters.Direction}, 到设备方向: {jammingToDevice}");
+ Debug.WriteLine($"干扰计算 - 点积: {dotProduct:F2}, 夹角: {angle * 180 / Math.PI:F2}°, 波束范围: {parameters.AngleRange * 180 / Math.PI:F2}°");
// 如果夹角超出干扰波束范围,降低接收功率
if (angle > parameters.AngleRange / 2)
{
// 简化模型:角度衰减,超出波束范围接收功率迅速降低
receivedPower *= 0.01; // 更严格的衰减以确保干扰无效
- System.Diagnostics.Debug.WriteLine($"干扰计算 - 超出波束范围,功率衰减: {receivedPower:F2}W");
+ Debug.WriteLine($"干扰计算 - 超出波束范围,功率衰减: {receivedPower:F2}W");
}
}
// 比较接收功率与阈值
bool isEffective = receivedPower >= threshold;
- System.Diagnostics.Debug.WriteLine($"干扰计算 - 最终结果: {(isEffective ? "有效" : "无效")}");
+ Debug.WriteLine($"干扰计算 - 最终结果: {(isEffective ? "有效" : "无效")}");
return isEffective;
}
diff --git a/ThreatSource/src/MIssile/TerminalSensitiveSubmunition.cs b/ThreatSource/src/MIssile/TerminalSensitiveSubmunition.cs
index c25e82b..8df8c2e 100644
--- a/ThreatSource/src/MIssile/TerminalSensitiveSubmunition.cs
+++ b/ThreatSource/src/MIssile/TerminalSensitiveSubmunition.cs
@@ -198,10 +198,40 @@ namespace ThreatSource.Missile
scanDirection = new Vector3D(0, 0, 1).Normalize();
// 初始化传感器
- infraredDetector = new InfraredDetector(this.Id+"_IR", this, 500, InfraredBand.Short, 1, manager); // 红外探测器,探测距离 500 米,近红外,视场角20度
- radiometer = new MillimeterWaveRadiometer(this.Id+"_MW", this, 500, MillimeterWaveBand.Band3, 1, manager); // 毫米波辐射计,探测距离500米,工作波段3mm,扫描视场角20度
- altimeter = new MillimeterWaveAltimeter(this.Id+"_MW_ALT", this, 1000, MillimeterWaveBand.Band8, 0.5, 25, manager); // 毫米波测高仪,测量精度0.5米
- rangefinder = new LaserRangefinder(this.Id+"_LASER", this, 500, 1.06, 100, 0.5, manager); // 激光测距仪,测量距离500米,波长1.06µm,测量频率100Hz,测量精度0.5米
+ var infraredDetectorConfig = new InfraredDetectorConfig
+ {
+ MaxDetectionRange = 1000,
+ Band = InfraredBand.Short,
+ FieldOfView = 1,
+ JammingResistanceThreshold = 1e-4
+ };
+ infraredDetector = new InfraredDetector(this.Id+"_IR", this, infraredDetectorConfig, manager);
+ var radiometerConfig = new MillimeterWaveRadiometerConfig
+ {
+ MaxDetectionRange = 1000,
+ Band = MillimeterWaveBand.Band3,
+ ScanFieldOfView = 1,
+ JammingResistanceThreshold = 1e-4
+ };
+ radiometer = new MillimeterWaveRadiometer(this.Id+"_MW", this, radiometerConfig, manager);
+ var altimeterConfig = new MillimeterWaveAltimeterConfig
+ {
+ MaxAltitude = 1000,
+ Band = MillimeterWaveBand.Band8,
+ MeasurementAccuracy = 0.5,
+ ScanFieldOfView = 25,
+ JammingResistanceThreshold = 1e-4
+ };
+ altimeter = new MillimeterWaveAltimeter(this.Id+"_MW_ALT", this, altimeterConfig, manager);
+ var rangefinderConfig = new LaserRangefinderConfig
+ {
+ MaxDetectionRange = 1000,
+ Wavelength = 1.06,
+ PulseRate = 100,
+ Accuracy = 0.5,
+ JammingResistanceThreshold = 1e-4
+ };
+ rangefinder = new LaserRangefinder(this.Id+"_LASER", this, rangefinderConfig, manager);
}
///
@@ -299,6 +329,7 @@ namespace ThreatSource.Missile
{
// 激活毫米波测高雷达
altimeter.Activate();
+ altimeter.Update(deltaTime);
}
// 减速减旋,垂直速度减小
@@ -312,15 +343,9 @@ namespace ThreatSource.Missile
GuidanceAcceleration = Vector3D.Zero;
}
- if(IsSensorsJammed())
- {
- // 如果传感器受到干扰,则高度计无法工作
- Debug.WriteLine("减速阶段:传感器受到干扰,无法进行高度测量");
- return;
- }
-
- // 检查高度是否小于等于开伞高度
- if(((AltimeterSensorData)altimeter.GetSensorData()).Altitude <= config.ParachuteDeploymentHeight)
+ // 检查高度计数据有效,且高度是否小于等于开伞高度
+ AltimeterSensorData altimeterData = (AltimeterSensorData)altimeter.GetSensorData();
+ if(altimeterData.IsValid && altimeterData.Altitude <= config.ParachuteDeploymentHeight)
{
// 如果是,则进入降落伞打开阶段
currentStage = SubmunitionStage.ParachuteDeployment;
@@ -328,7 +353,7 @@ namespace ThreatSource.Missile
//垂直速度设为减速阶段末速
Velocity = new Vector3D(Velocity.X, -config.DecelerationEndSpeed, Velocity.Z);
GuidanceAcceleration = Vector3D.Zero;
- }
+ }
}
///
@@ -371,17 +396,13 @@ namespace ThreatSource.Missile
// 清除制导加速度
GuidanceAcceleration = Vector3D.Zero;
- if(IsSensorsJammed())
- {
- // 如果传感器受到干扰,则高度计无法工作
- Debug.WriteLine("开伞阶段:传感器受到干扰,无法进行高度测量");
- return;
- }
-
- if (((AltimeterSensorData)altimeter.GetSensorData()).Altitude <= config.StableScanHeight)
+ AltimeterSensorData altimeterData = (AltimeterSensorData)altimeter.GetSensorData();
+ // 检查高度计数据有效,且高度是否小于等于稳定扫描高度
+ if(altimeterData.IsValid && altimeterData.Altitude <= config.StableScanHeight)
{
+ // 如果是,则进入稳定扫描阶段
currentStage = SubmunitionStage.StableScan;
- }
+ }
}
///
@@ -401,13 +422,7 @@ namespace ThreatSource.Missile
{
// 激活激光测距仪
rangefinder.Activate();
- }
-
- // 检查传感器干扰状态
- if (IsSensorsJammed())
- {
- Debug.WriteLine("稳定扫描阶段:传感器受到干扰,无法进行距离测量");
- return;
+ rangefinder.Update(deltaTime);
}
// 更新螺旋角度(顺时针旋转,标准方位角)
@@ -425,7 +440,8 @@ namespace ThreatSource.Missile
).Normalize();
// 如果距离小于等于目标探测距离,则进入目标探测阶段
- if (((RangefinderSensorData)rangefinder.GetSensorData()).Distance <= config.TargetDetectionDistance)
+ RangefinderSensorData rangefinderData = (RangefinderSensorData)rangefinder.GetSensorData();
+ if (rangefinderData.IsValid && rangefinderData.Distance <= config.TargetDetectionDistance)
{
currentStage = SubmunitionStage.Detection;
}
@@ -448,14 +464,16 @@ namespace ThreatSource.Missile
if(!radiometer.IsActive)
{
radiometer.Activate();
+ radiometer.Update(deltaTime);
}
if(!infraredDetector.IsActive)
{
infraredDetector.Activate();
+ infraredDetector.Update(deltaTime);
}
// 更新扫描角度(顺时针旋转)
- spiralAngle = (spiralAngle + config.SpiralRotationSpeed * deltaTime); // 顺时针角度增加
+ spiralAngle += config.SpiralRotationSpeed * deltaTime; // 顺时针角度增加
while (spiralAngle >= 2 * Math.PI)
{
spiralAngle -= 2 * Math.PI;
@@ -468,68 +486,34 @@ namespace ThreatSource.Missile
Math.Cos(spiralAngle) * Math.Sin(config.ScanAngleInRadians)
).Normalize();
- // 检查传感器干扰状态
- if (IsSensorsJammed())
- {
- Debug.WriteLine("探测阶段:传感器受到干扰,无法进行目标探测");
- return; // 此时返回不会影响扫描角度的更新
- }
-
// 获取传感器数据
- RadiometerSensorData? radiometerData = null;
- InfraredSensorData? infraredData = null;
-
- if (radiometer.GetSensorData() is RadiometerSensorData rd)
- {
- radiometerData = rd;
- }
- if (infraredDetector.GetSensorData() is InfraredSensorData id)
- {
- infraredData = id;
- }
+ RadiometerSensorData radiometerData = (RadiometerSensorData)radiometer.GetSensorData();
+ InfraredSensorData infraredData = (InfraredSensorData)infraredDetector.GetSensorData();
- bool isRadiationDetected = radiometerData?.IsTargetDetected ?? false;
- bool isInfraredDetected = infraredData?.IsTargetDetected ?? false;
+ bool isRadiometerDetected = radiometerData.IsValid && radiometerData.IsTargetDetected;
+ bool isInfraredDetected = infraredData.IsValid && infraredData.IsTargetDetected;
// 目标探测逻辑
if (!isTargetDetected)
{
- if (isRadiationDetected || isInfraredDetected)
- {
- // 获取传感器的角度数据
- double? radiometerAngle = radiometerData?.TargetAngle;
- double? infraredAngle = infraredData?.TargetAngle;
-
- // 使用有效的角度数据
- if (radiometerAngle.HasValue || infraredAngle.HasValue)
- {
- // 计算目标方位角
- double targetAngle;
- if (radiometerAngle.HasValue && infraredAngle.HasValue)
- {
- targetAngle = (radiometerAngle.Value + infraredAngle.Value) / 2;
- }
- else if (radiometerAngle.HasValue)
- {
- targetAngle = radiometerAngle.Value;
- }
- else if (infraredAngle.HasValue)
- {
- targetAngle = infraredAngle.Value;
- }
- else
- {
- // 如果两个角度都为null,设置一个默认值或抛出异常
- targetAngle = 0;
- Debug.WriteLine("警告:红外和毫米波探测器都未返回有效角度");
- }
+ double? targetAngle = null;
- // 记录首次探测信息
- isTargetDetected = true;
- lastDetectionTime = FlightTime;
- firstDetectionAngle = targetAngle;
- Debug.WriteLine($"首次探测到目标,方位角: {firstDetectionAngle.Value * 180 / Math.PI:F2}°");
- }
+ if (isRadiometerDetected && radiometerData.TargetAngle.HasValue)
+ {
+ targetAngle = radiometerData.TargetAngle.Value;
+ }
+ else if (isInfraredDetected && infraredData.TargetAngle.HasValue)
+ {
+ targetAngle = infraredData.TargetAngle.Value;
+ }
+
+ // 记录首次探测信息
+ if (targetAngle.HasValue)
+ {
+ isTargetDetected = true;
+ lastDetectionTime = FlightTime;
+ firstDetectionAngle = targetAngle.Value;
+ Debug.WriteLine($"首次探测到目标,方位角: {firstDetectionAngle.Value * 180 / Math.PI:F2}°");
}
}
else // 已经探测到目标,等待转过一圈进行二次确认
@@ -555,7 +539,7 @@ namespace ThreatSource.Missile
double allowedError = deltaTime * config.SpiralRotationSpeed / 2;
if (angleDiff <= allowedError)
{
- if (isRadiationDetected || isInfraredDetected)
+ if (isRadiometerDetected || isInfraredDetected)
{
// 二次确认成功,进入攻击阶段
Debug.WriteLine($"二次确认成功,进入攻击阶段,当前角度: {spiralAngle * 180 / Math.PI:F2}°");
diff --git a/ThreatSource/src/Sensor/InfraredDetector.cs b/ThreatSource/src/Sensor/InfraredDetector.cs
index 0082a09..a67323d 100644
--- a/ThreatSource/src/Sensor/InfraredDetector.cs
+++ b/ThreatSource/src/Sensor/InfraredDetector.cs
@@ -19,6 +19,15 @@ namespace ThreatSource.Sensor
///
public class InfraredDetector : Sensor
{
+ ///
+ /// 定义设备支持的干扰类型
+ ///
+ ///
+ /// 红外探测器支持的干扰类型:
+ /// - 红外干扰
+ ///
+ public override IEnumerable SupportedJammingTypes => [JammingType.Infrared];
+
///
/// 探测辐射强度阈值,单位:瓦特/球面度
///
@@ -36,7 +45,7 @@ namespace ThreatSource.Sensor
/// 定义了探测器的最大作用距离
/// 影响目标探测的有效范围
///
- public double DetectionRange { get; set; }
+ public double MaxDetectionRange { get; set; }
///
/// 获取或设置红外波段
@@ -75,9 +84,7 @@ namespace ThreatSource.Sensor
///
/// 红外探测器的ID
/// 末敏子弹实例
- /// 探测范围,单位:米
- ///
- /// 视场角,单位:度
+ /// 红外探测器配置
/// 仿真管理器实例
///
/// 构造过程:
@@ -86,17 +93,17 @@ namespace ThreatSource.Sensor
/// - 初始化传感器数据
/// - 继承基类位置和姿态
///
- public InfraredDetector(string id, TerminalSensitiveSubmunition submunition, double detectionRange, InfraredBand band, double fieldOfView, ISimulationManager simulationManager)
+ public InfraredDetector(string id, TerminalSensitiveSubmunition submunition, InfraredDetectorConfig config, ISimulationManager simulationManager)
: base(id, submunition.Position, submunition.Orientation, simulationManager)
{
- DetectionRange = detectionRange;
- FieldOfView = fieldOfView;
- Band = band;
+ MaxDetectionRange = config.MaxDetectionRange;
+ FieldOfView = config.FieldOfView;
+ Band = config.Band;
this.submunition = submunition;
sensorData = new InfraredSensorData();
// 初始化干扰处理,设置干扰抗性阈值和支持的干扰类型
- InitializeJamming(1e-3, [JammingType.Infrared]);
+ InitializeJamming(config.JammingResistanceThreshold, [JammingType.Infrared]);
}
///
@@ -237,16 +244,9 @@ namespace ThreatSource.Sensor
///
public override SensorData GetSensorData()
{
- // 返回红外探测器的数据
return sensorData;
}
- ///
- /// 获取支持的干扰类型集合
- ///
- public override IEnumerable SupportedJammingTypes =>
- [JammingType.Infrared];
-
///
/// 处理红外干扰应用
///
@@ -256,9 +256,7 @@ namespace ThreatSource.Sensor
if (parameters.Type == JammingType.Infrared)
{
Debug.WriteLine($"红外探测器受到干扰,功率:{parameters.Power}瓦特");
- // 红外传感器数据类中没有IsJammed字段,可以通过修改其他属性表示干扰状态
- // 例如,将IsTargetDetected设为false
- sensorData.IsTargetDetected = false;
+ sensorData.IsValid = false;
}
}
@@ -271,7 +269,7 @@ namespace ThreatSource.Sensor
if (type == JammingType.Infrared)
{
Debug.WriteLine("红外探测器干扰已清除");
- // 干扰清除后,在下一次Update时会自动更新IsTargetDetected
+ sensorData.IsValid = true;
}
}
}
diff --git a/ThreatSource/src/Sensor/LaserRangefinder.cs b/ThreatSource/src/Sensor/LaserRangefinder.cs
index 88868f4..a7790c3 100644
--- a/ThreatSource/src/Sensor/LaserRangefinder.cs
+++ b/ThreatSource/src/Sensor/LaserRangefinder.cs
@@ -19,6 +19,20 @@ namespace ThreatSource.Sensor
///
public class LaserRangefinder : Sensor
{
+ ///
+ /// 定义设备支持的干扰类型
+ ///
+ ///
+ /// 激光测距仪支持的干扰类型:
+ /// - 激光干扰
+ ///
+ public override IEnumerable SupportedJammingTypes => [JammingType.Laser];
+
+ ///
+ /// 激光测距仪数据
+ ///
+ private RangefinderSensorData sensorData;
+
///
/// 当前测量距离,单位:米
///
@@ -44,7 +58,7 @@ namespace ThreatSource.Sensor
/// 超出此距离的测量可能不准确
/// 受大气条件和目标反射率影响
///
- public double MaxRange { get; set; }
+ public double MaxDetectionRange { get; set; }
///
/// 获取或设置工作波长,单位:微米
@@ -80,10 +94,7 @@ namespace ThreatSource.Sensor
///
/// 激光测距仪的ID
/// 末敏子弹实例
- /// 最大测量距离,单位:米
- /// 工作波段,单位:毫米
- /// 脉冲频率,单位:赫兹
- /// 测量精度,单位:米
+ /// 激光测距仪配置
/// 仿真管理器实例
///
/// 构造过程:
@@ -91,18 +102,19 @@ namespace ThreatSource.Sensor
/// - 配置测量参数
/// - 初始化工作状态
///
- public LaserRangefinder(string id, TerminalSensitiveSubmunition submunition, double maxRange, double waveLength, double pulseRate, double accuracy, ISimulationManager simulationManager)
+ public LaserRangefinder(string id, TerminalSensitiveSubmunition submunition, LaserRangefinderConfig config, ISimulationManager simulationManager)
: base(id, submunition.Position, submunition.Orientation, simulationManager)
{
this.submunition = submunition;
- MaxRange = maxRange;
- Wavelength = waveLength;
- PulseRate = pulseRate;
- Accuracy = accuracy;
+ MaxDetectionRange = config.MaxDetectionRange;
+ Wavelength = config.Wavelength;
+ PulseRate = config.PulseRate;
+ Accuracy = config.Accuracy;
currentDistance = 0;
+ sensorData = new RangefinderSensorData();
// 初始化干扰处理,设置干扰抗性阈值和支持的干扰类型
- InitializeJamming(1e-3, [JammingType.Laser]);
+ InitializeJamming(config.JammingResistanceThreshold, [JammingType.Laser]);
}
///
@@ -129,6 +141,7 @@ namespace ThreatSource.Sensor
// 执行距离测量
currentDistance = GetTargetDistance();
+ sensorData.Distance = currentDistance;
}
///
@@ -141,19 +154,9 @@ namespace ThreatSource.Sensor
///
public override SensorData GetSensorData()
{
- return new RangefinderSensorData
- {
- Distance = IsJammed ? 0 : currentDistance,
- IsValid = !IsJammed && IsActive
- };
+ return sensorData;
}
- ///
- /// 获取支持的干扰类型集合
- ///
- public override IEnumerable SupportedJammingTypes =>
- [JammingType.Laser];
-
///
/// 激活激光测距仪
///
@@ -183,7 +186,7 @@ namespace ThreatSource.Sensor
if (!isWavelengthCompatible)
{
- System.Diagnostics.Debug.WriteLine($"激光干扰波长 {evt.Wavelength}um 与激光测距仪波段 {Wavelength}um 不匹配,忽略干扰");
+ Debug.WriteLine($"激光干扰波长 {evt.Wavelength}um 与激光测距仪波段 {Wavelength}um 不匹配,忽略干扰");
return;
}
@@ -223,7 +226,7 @@ namespace ThreatSource.Sensor
if (parameters.Type == JammingType.Laser)
{
Debug.WriteLine($"激光测距仪受到干扰,功率:{parameters.Power}瓦特");
- // 可以在这里添加特定于激光测距仪的干扰效果
+ sensorData.IsValid = false;
}
}
@@ -236,7 +239,7 @@ namespace ThreatSource.Sensor
if (type == JammingType.Laser)
{
Debug.WriteLine("激光测距仪干扰已清除");
- // 可以在这里添加特定于激光测距仪的干扰清除后的恢复逻辑
+ sensorData.IsValid = true;
}
}
diff --git a/ThreatSource/src/Sensor/MillimeterWaveAltimeter.cs b/ThreatSource/src/Sensor/MillimeterWaveAltimeter.cs
index d86f0b9..a074eea 100644
--- a/ThreatSource/src/Sensor/MillimeterWaveAltimeter.cs
+++ b/ThreatSource/src/Sensor/MillimeterWaveAltimeter.cs
@@ -19,6 +19,20 @@ namespace ThreatSource.Sensor
///
public class MillimeterWaveAltimeter : Sensor
{
+ ///
+ /// 定义设备支持的干扰类型
+ ///
+ ///
+ /// 毫米波测高雷达支持的干扰类型:
+ /// - 毫米波干扰
+ ///
+ public override IEnumerable SupportedJammingTypes => [JammingType.MillimeterWave];
+
+ ///
+ /// 毫米波测高雷达数据
+ ///
+ private AltimeterSensorData sensorData;
+
///
/// 当前测量高度,单位:米
///
@@ -74,10 +88,7 @@ namespace ThreatSource.Sensor
///
/// 毫米波测高雷达的ID
/// 末敏子弹实例
- /// 最大测量高度,单位:米
- /// 工作波段,枚举
- /// 测量精度,单位:米
- /// 视场角,单位:度
+ /// 毫米波测高雷达配置
/// 仿真管理器实例
///
/// 构造过程:
@@ -85,18 +96,18 @@ namespace ThreatSource.Sensor
/// - 初始化高度记录
/// - 继承基类位置和姿态
///
- public MillimeterWaveAltimeter(string id, TerminalSensitiveSubmunition submunition, double maxAltitude, MillimeterWaveBand band, double accuracy, double fieldOfView, ISimulationManager simulationManager)
+ public MillimeterWaveAltimeter(string id, TerminalSensitiveSubmunition submunition, MillimeterWaveAltimeterConfig config, ISimulationManager simulationManager)
: base(id, submunition.Position, submunition.Orientation, simulationManager)
{
- MaxAltitude = maxAltitude;
- Accuracy = accuracy;
- Band = band;
- FieldOfView = fieldOfView;
+ MaxAltitude = config.MaxAltitude;
+ Accuracy = config.MeasurementAccuracy;
+ Band = config.Band;
+ FieldOfView = config.ScanFieldOfView;
currentAltitude = submunition.Position.Y;
this.submunition = submunition;
-
+ sensorData = new AltimeterSensorData();
// 初始化干扰处理
- InitializeJamming(1e-3, [JammingType.MillimeterWave]);
+ InitializeJamming(config.JammingResistanceThreshold, [JammingType.MillimeterWave]);
}
///
@@ -128,6 +139,7 @@ namespace ThreatSource.Sensor
// 更新当前高度,考虑测量精度
currentAltitude = submunition.Position.Y + (2 * new Random().NextDouble() - 1) * Accuracy;
+ sensorData.Altitude = currentAltitude;
}
///
@@ -141,19 +153,9 @@ namespace ThreatSource.Sensor
public override SensorData GetSensorData()
{
// 返回毫米波测高雷达的数据
- AltimeterSensorData altimeterSensorData = new()
- {
- Altitude = currentAltitude
- };
- return altimeterSensorData;
+ return sensorData;
}
- ///
- /// 获取支持的干扰类型集合
- ///
- public override IEnumerable SupportedJammingTypes =>
- [JammingType.MillimeterWave];
-
///
/// 激活毫米波测高雷达
///
@@ -227,8 +229,7 @@ namespace ThreatSource.Sensor
if (parameters.Type == JammingType.MillimeterWave)
{
Debug.WriteLine($"毫米波测高雷达受到干扰,功率:{parameters.Power}瓦特");
- // 在干扰状态下,将当前高度设置为0
- currentAltitude = 0;
+ sensorData.IsValid = false;
}
}
@@ -241,7 +242,7 @@ namespace ThreatSource.Sensor
if (type == JammingType.MillimeterWave)
{
Debug.WriteLine("毫米波测高雷达干扰已清除");
- // 干扰清除后,在下一次Update时会自动更新高度
+ sensorData.IsValid = true;
}
}
}
diff --git a/ThreatSource/src/Sensor/MillimeterWaveRadiometer.cs b/ThreatSource/src/Sensor/MillimeterWaveRadiometer.cs
index eeb8435..5b5baf9 100644
--- a/ThreatSource/src/Sensor/MillimeterWaveRadiometer.cs
+++ b/ThreatSource/src/Sensor/MillimeterWaveRadiometer.cs
@@ -19,6 +19,15 @@ namespace ThreatSource.Sensor
///
public class MillimeterWaveRadiometer : Sensor
{
+ ///
+ /// 定义设备支持的干扰类型
+ ///
+ ///
+ /// 毫米波辐射计支持的干扰类型:
+ /// - 毫米波干扰
+ ///
+ public override IEnumerable SupportedJammingTypes => [JammingType.MillimeterWave];
+
///
/// 获取或设置探测距离,单位:米
///
@@ -26,7 +35,7 @@ namespace ThreatSource.Sensor
/// 定义了辐射计的探测范围
/// 影响目标探测的可靠性和稳定性
///
- public double DetectionDistance { get; set; }
+ public double MaxDetectionRange { get; set; }
///
/// 获取或设置工作波段,枚举
@@ -96,9 +105,7 @@ namespace ThreatSource.Sensor
///
/// 毫米波辐射计的ID
/// 末敏子弹实例
- /// 探测距离,单位:米
- /// 工作波段,枚举
- /// 视场角,单位:度
+ /// 毫米波辐射计配置
/// 仿真管理器实例
///
/// 构造过程:
@@ -107,12 +114,12 @@ namespace ThreatSource.Sensor
/// - 创建传感器数据
/// - 继承基类位置和姿态
///
- public MillimeterWaveRadiometer(string id, TerminalSensitiveSubmunition submunition, double detectionDistance, MillimeterWaveBand band, double fieldOfView, ISimulationManager simulationManager)
+ public MillimeterWaveRadiometer(string id, TerminalSensitiveSubmunition submunition, MillimeterWaveRadiometerConfig config, ISimulationManager simulationManager)
: base(id, submunition.Position, submunition.Orientation, simulationManager)
{
- DetectionDistance = detectionDistance;
- Band = band;
- FieldOfView = fieldOfView;
+ MaxDetectionRange = config.MaxDetectionRange;
+ Band = config.Band;
+ FieldOfView = config.ScanFieldOfView;
lastDetectionTemperature = 0;
sensorData = new RadiometerSensorData();
this.submunition = submunition;
@@ -207,12 +214,6 @@ namespace ThreatSource.Sensor
// 返回毫米波辐射计的数据
return sensorData;
}
-
- ///
- /// 获取支持的干扰类型集合
- ///
- public override IEnumerable SupportedJammingTypes =>
- [JammingType.MillimeterWave];
///
/// 激活毫米波辐射计
@@ -287,8 +288,7 @@ namespace ThreatSource.Sensor
if (parameters.Type == JammingType.MillimeterWave)
{
Debug.WriteLine($"毫米波辐射计受到干扰,功率:{parameters.Power}瓦特");
- // 更新传感器数据
- sensorData.IsTargetDetected = false;
+ sensorData.IsValid = false;
}
}
@@ -301,7 +301,7 @@ namespace ThreatSource.Sensor
if (type == JammingType.MillimeterWave)
{
Debug.WriteLine("毫米波辐射计干扰已清除");
- // 干扰清除后,在下一次Update时会自动更新IsTargetDetected
+ sensorData.IsValid = true;
}
}
}
diff --git a/ThreatSource/src/Sensor/SensorData.cs b/ThreatSource/src/Sensor/SensorData.cs
index 8e61620..3b6c0f2 100644
--- a/ThreatSource/src/Sensor/SensorData.cs
+++ b/ThreatSource/src/Sensor/SensorData.cs
@@ -12,6 +12,11 @@ namespace ThreatSource.Sensor
///
public abstract class SensorData
{
+ ///
+ /// 获取或设置数据是否有效
+ ///
+ public bool IsValid { get; set; } = true;
+
///
/// 获取或设置数据采集的时间戳
///
@@ -19,7 +24,7 @@ namespace ThreatSource.Sensor
/// 记录传感器数据的采集时间
/// 用于数据时序分析和同步处理
///
- public DateTime Timestamp { get; set; }
+ public DateTime Timestamp { get; set; } = DateTime.Now;
}
///
@@ -40,7 +45,7 @@ namespace ThreatSource.Sensor
/// 记录目标的红外辐射温度
/// 用于目标特征识别和状态评估
///
- public double Temperature { get; set; }
+ public double Temperature { get; set; } = 0;
///
/// 获取或设置是否检测到目标
@@ -50,7 +55,7 @@ namespace ThreatSource.Sensor
/// false表示未探测到目标
/// 用于目标存在性判断
///
- public bool IsTargetDetected { get; set; }
+ public bool IsTargetDetected { get; set; } = false;
///
/// 获取或设置目标的方位角,单位:弧度
@@ -60,7 +65,7 @@ namespace ThreatSource.Sensor
/// 用于目标定位和跟踪
/// 当未检测到目标时为null
///
- public double? TargetAngle { get; set; }
+ public double? TargetAngle { get; set; } = null;
}
///
@@ -81,7 +86,7 @@ namespace ThreatSource.Sensor
/// 记录目标的毫米波辐射强度
/// 用于目标特征分析和识别判断
///
- public double RadiationIntensity { get; set; }
+ public double RadiationIntensity { get; set; } = 0;
///
/// 获取或设置是否检测到目标
@@ -91,7 +96,7 @@ namespace ThreatSource.Sensor
/// false表示未探测到目标
/// 用于目标存在性判断
///
- public bool IsTargetDetected { get; set; }
+ public bool IsTargetDetected { get; set; } = false;
///
/// 获取或设置目标的方位角,单位:弧度
@@ -101,7 +106,7 @@ namespace ThreatSource.Sensor
/// 用于目标定位和跟踪
/// 当未检测到目标时为null
///
- public double? TargetAngle { get; set; }
+ public double? TargetAngle { get; set; } = null;
}
///
@@ -121,7 +126,7 @@ namespace ThreatSource.Sensor
/// 记录当前对地高度
/// 用于高度保持和地形跟随
///
- public double Altitude { get; set; }
+ public double Altitude { get; set; } = 0;
}
///
@@ -141,11 +146,6 @@ namespace ThreatSource.Sensor
/// 记录到目标的直线距离
/// 用于目标定位和制导控制
///
- public double Distance { get; set; }
-
- ///
- /// 获取或设置数据是否有效
- ///
- public bool IsValid { get; set; }
+ public double Distance { get; set; } = 0;
}
}
diff --git a/ThreatSource/src/Simulation/SimulationConfig.cs b/ThreatSource/src/Simulation/SimulationConfig.cs
index e2904f7..6e115a1 100644
--- a/ThreatSource/src/Simulation/SimulationConfig.cs
+++ b/ThreatSource/src/Simulation/SimulationConfig.cs
@@ -32,7 +32,7 @@ namespace ThreatSource.Simulation
///
/// 包含编码类型和编码值等基本信息
///
- public LaserCode Code { get; set; }
+ public LaserCode Code { get; set; } = new LaserCode();
///
/// 获取或设置是否启用编码
@@ -41,7 +41,7 @@ namespace ThreatSource.Simulation
/// true表示使用编码
/// false表示不使用编码
///
- public bool IsCodeEnabled { get; set; }
+ public bool IsCodeEnabled { get; set; } = true;
///
/// 获取或设置是否要求编码匹配
@@ -50,7 +50,7 @@ namespace ThreatSource.Simulation
/// true表示必须匹配编码
/// false表示不要求匹配
///
- public bool IsCodeMatchRequired { get; set; }
+ public bool IsCodeMatchRequired { get; set; } = true;
///
/// 检查当前激光编码配置是否与目标配置匹配
@@ -81,22 +81,6 @@ namespace ThreatSource.Simulation
// 检查编码是否匹配
return Code.Matches(other.Code);
}
-
- ///
- /// 初始化激光编码配置的新实例
- ///
- ///
- /// 设置默认值:
- /// - 新的LaserCode实例
- /// - 启用编码
- /// - 要求编码匹配
- ///
- public LaserCodeConfig()
- {
- Code = new LaserCode();
- IsCodeEnabled = true;
- IsCodeMatchRequired = true;
- }
}
///
@@ -119,7 +103,7 @@ namespace ThreatSource.Simulation
/// 单位:瓦特
/// 影响激光照射的有效距离和目标反射强度
///
- public double LaserPower { get; set; }
+ public double LaserPower { get; set; } = 0;
///
/// 获取或设置激光发散角
@@ -128,7 +112,7 @@ namespace ThreatSource.Simulation
/// 单位:弧度
/// 影响激光束的扩散特性和照射面积
///
- public double LaserDivergenceAngle { get; set; }
+ public double LaserDivergenceAngle { get; set; } = 0;
///
/// 获取或设置激光编码配置
@@ -137,7 +121,7 @@ namespace ThreatSource.Simulation
/// 定义激光信号的编码参数
/// 用于抗干扰和安全识别
///
- public LaserCodeConfig LaserCodeConfig { get; set; }
+ public LaserCodeConfig LaserCodeConfig { get; set; } = new LaserCodeConfig();
///
/// 获取或设置干扰抗性阈值
@@ -147,7 +131,7 @@ namespace ThreatSource.Simulation
/// 定义了抵抗干扰所需的最小功率阈值
/// 干扰功率超过此阈值时会影响指示器工作
///
- public double JammingResistanceThreshold { get; set; }
+ public double JammingResistanceThreshold { get; set; } = 1.0;
///
/// 获取或设置最小工作波长
@@ -157,7 +141,7 @@ namespace ThreatSource.Simulation
/// 激光指示器工作的最小波长
/// 影响激光干扰的匹配判断
///
- public double MinWavelength { get; set; }
+ public double MinWavelength { get; set; } = 1.0;
///
/// 获取或设置最大工作波长
@@ -167,28 +151,7 @@ namespace ThreatSource.Simulation
/// 激光指示器工作的最大波长
/// 影响激光干扰的匹配判断
///
- public double MaxWavelength { get; set; }
-
- ///
- /// 初始化激光指示器配置的新实例
- ///
- ///
- /// 设置默认值:
- /// - ID为空字符串
- /// - 初始位置为原点(0,0,0)
- /// - 激光功率为0瓦特
- /// - 发散角为0弧度
- /// - 默认激光编码配置
- ///
- public LaserDesignatorConfig()
- {
- LaserPower = 0;
- LaserDivergenceAngle = 0;
- LaserCodeConfig = new LaserCodeConfig();
- JammingResistanceThreshold = 1.0; // 默认抗干扰阈值为1瓦特
- MinWavelength = 1.0; // 默认最小波长为1.0微米
- MaxWavelength = 1.1; // 默认最大波长为1.1微米
- }
+ public double MaxWavelength { get; set; } = 1.1;
}
///
@@ -212,7 +175,7 @@ namespace ThreatSource.Simulation
/// 单位:瓦特
/// 影响制导波束的有效距离和导引精度
///
- public double LaserPower { get; set; }
+ public double LaserPower { get; set; } = 0;
///
/// 获取或设置控制场直径
@@ -221,7 +184,7 @@ namespace ThreatSource.Simulation
/// 单位:米
/// 定义了导弹可以接收制导信号的横向范围
///
- public double ControlFieldDiameter { get; set; }
+ public double ControlFieldDiameter { get; set; } = 0;
///
/// 获取或设置最大导引距离
@@ -230,7 +193,7 @@ namespace ThreatSource.Simulation
/// 单位:米
/// 定义了驾束仪的最大有效工作距离
///
- public double MaxGuidanceDistance { get; set; }
+ public double MaxGuidanceDistance { get; set; } = 0;
///
/// 获取或设置激光编码配置
@@ -239,7 +202,7 @@ namespace ThreatSource.Simulation
/// 定义激光信号的编码参数
/// 用于抗干扰和安全识别
///
- public LaserCodeConfig LaserCodeConfig { get; set; }
+ public LaserCodeConfig LaserCodeConfig { get; set; } = new LaserCodeConfig();
///
/// 获取或设置干扰抗性阈值
@@ -249,28 +212,7 @@ namespace ThreatSource.Simulation
/// 定义了抵抗干扰所需的最小功率阈值
/// 干扰功率超过此阈值时会影响制导系统
///
- public double JammingResistanceThreshold { get; set; }
-
- ///
- /// 初始化激光驾束仪配置的新实例
- ///
- ///
- /// 设置默认值:
- /// - ID为空字符串
- /// - 初始位置为原点(0,0,0)
- /// - 激光功率为0瓦特
- /// - 控制场直径为0米
- /// - 最大导引距离为0米
- /// - 默认激光编码配置
- ///
- public LaserBeamRiderConfig()
- {
- LaserPower = 0;
- ControlFieldDiameter = 0;
- MaxGuidanceDistance = 0;
- LaserCodeConfig = new LaserCodeConfig();
- JammingResistanceThreshold = 1.0; // 默认抗干扰阈值为1瓦特
- }
+ public double JammingResistanceThreshold { get; set; } = 1.0;
}
///
@@ -293,7 +235,7 @@ namespace ThreatSource.Simulation
/// 单位:瓦特/平方米
/// 当接收到的激光功率密度超过此阈值时触发告警
///
- public double SensitivityThreshold { get; set; }
+ public double SensitivityThreshold { get; set; } = 0;
///
/// 获取或设置警报持续时间
@@ -302,7 +244,7 @@ namespace ThreatSource.Simulation
/// 单位:秒
/// 定义了每次告警的持续时间
///
- public double AlarmDuration { get; set; }
+ public double AlarmDuration { get; set; } = 5.0;
///
/// 获取或设置最小探测波长
@@ -311,7 +253,7 @@ namespace ThreatSource.Simulation
/// 单位:纳米
/// 定义了告警器可以探测的最短波长
///
- public double WavelengthMin { get; set; }
+ public double WavelengthMin { get; set; } = 0;
///
/// 获取或设置最大探测波长
@@ -320,25 +262,7 @@ namespace ThreatSource.Simulation
/// 单位:纳米
/// 定义了告警器可以探测的最长波长
///
- public double WavelengthMax { get; set; }
-
- ///
- /// 初始化激光告警器配置的新实例
- ///
- ///
- /// 设置默认值:
- /// - ID为空字符串
- /// - 灵敏度阈值为0
- /// - 警报持续时间为5秒
- /// - 波长范围为0-0纳米
- ///
- public LaserWarnerConfig()
- {
- SensitivityThreshold = 0;
- AlarmDuration = 5.0; // 默认警报持续5秒
- WavelengthMin = 0;
- WavelengthMax = 0;
- }
+ public double WavelengthMax { get; set; } = 0;
}
///
@@ -361,7 +285,7 @@ namespace ThreatSource.Simulation
/// 单位:瓦特/平方米
/// 当接收到的紫外辐射强度超过此阈值时触发告警
///
- public double SensitivityThreshold { get; set; }
+ public double SensitivityThreshold { get; set; } = 0;
///
/// 获取或设置警报持续时间
@@ -370,7 +294,7 @@ namespace ThreatSource.Simulation
/// 单位:秒
/// 定义了每次告警的持续时间
///
- public double AlarmDuration { get; set; }
+ public double AlarmDuration { get; set; } = 5.0;
///
/// 获取或设置最小探测波长
@@ -379,7 +303,7 @@ namespace ThreatSource.Simulation
/// 单位:纳米
/// 定义了告警器可以探测的最短紫外波长
///
- public double WavelengthMin { get; set; }
+ public double WavelengthMin { get; set; } = 0;
///
/// 获取或设置最大探测波长
@@ -388,25 +312,7 @@ namespace ThreatSource.Simulation
/// 单位:纳米
/// 定义了告警器可以探测的最长紫外波长
///
- public double WavelengthMax { get; set; }
-
- ///
- /// 初始化紫外告警器配置的新实例
- ///
- ///
- /// 设置默认值:
- /// - ID为空字符串
- /// - 灵敏度阈值为0
- /// - 警报持续时间为5秒
- /// - 波长范围为0-0纳米
- ///
- public UltravioletWarnerConfig()
- {
- SensitivityThreshold = 0;
- AlarmDuration = 5.0; // 默认警报持续5秒
- WavelengthMin = 0;
- WavelengthMax = 0;
- }
+ public double WavelengthMax { get; set; } = 0;
}
///
@@ -429,7 +335,7 @@ namespace ThreatSource.Simulation
/// 单位:瓦特/平方米
/// 当接收到的红外辐射强度超过此阈值时触发告警
///
- public double SensitivityThreshold { get; set; }
+ public double SensitivityThreshold { get; set; } = 0;
///
/// 获取或设置警报持续时间
@@ -438,7 +344,7 @@ namespace ThreatSource.Simulation
/// 单位:秒
/// 定义了每次告警的持续时间
///
- public double AlarmDuration { get; set; }
+ public double AlarmDuration { get; set; } = 5.0;
///
/// 获取或设置最小探测波长
@@ -447,7 +353,7 @@ namespace ThreatSource.Simulation
/// 单位:纳米
/// 定义了告警器可以探测的最短红外波长
///
- public double WavelengthMin { get; set; }
+ public double WavelengthMin { get; set; } = 0;
///
/// 获取或设置最大探测波长
@@ -456,25 +362,7 @@ namespace ThreatSource.Simulation
/// 单位:纳米
/// 定义了告警器可以探测的最长红外波长
///
- public double WavelengthMax { get; set; }
-
- ///
- /// 初始化红外告警器配置的新实例
- ///
- ///
- /// 设置默认值:
- /// - ID为空字符串
- /// - 灵敏度阈值为0
- /// - 警报持续时间为5秒
- /// - 波长范围为0-0纳米
- ///
- public InfraredWarnerConfig()
- {
- SensitivityThreshold = 0;
- AlarmDuration = 5.0; // 默认警报持续5秒
- WavelengthMin = 0;
- WavelengthMax = 0;
- }
+ public double WavelengthMax { get; set; } = 0;
}
///
@@ -497,7 +385,7 @@ namespace ThreatSource.Simulation
/// 单位:瓦特/平方米
/// 当接收到的毫米波辐射强度超过此阈值时触发告警
///
- public double SensitivityThreshold { get; set; }
+ public double SensitivityThreshold { get; set; } = 0;
///
/// 获取或设置警报持续时间
@@ -506,7 +394,7 @@ namespace ThreatSource.Simulation
/// 单位:秒
/// 定义了每次告警的持续时间
///
- public double AlarmDuration { get; set; }
+ public double AlarmDuration { get; set; } = 5.0;
///
/// 获取或设置最小探测波长
@@ -515,7 +403,7 @@ namespace ThreatSource.Simulation
/// 单位:纳米
/// 定义了告警器可以探测的最短毫米波波长
///
- public double WavelengthMin { get; set; }
+ public double WavelengthMin { get; set; } = 0;
///
/// 获取或设置最大探测波长
@@ -524,25 +412,7 @@ namespace ThreatSource.Simulation
/// 单位:纳米
/// 定义了告警器可以探测的最长毫米波波长
///
- public double WavelengthMax { get; set; }
-
- ///
- /// 初始化毫米波告警器配置的新实例
- ///
- ///
- /// 设置默认值:
- /// - ID为空字符串
- /// - 灵敏度阈值为0
- /// - 警报持续时间为5秒
- /// - 波长范围为0-0纳米
- ///
- public MillimeterWaveWarnerConfig()
- {
- SensitivityThreshold = 0;
- AlarmDuration = 5.0; // 默认警报持续5秒
- WavelengthMin = 0;
- WavelengthMax = 0;
- }
+ public double WavelengthMax { get; set; } = 0;
}
///
@@ -553,33 +423,22 @@ namespace ThreatSource.Simulation
///
/// 最大干扰冷却时间(秒)
///
- public double MaxJammingCooldown { get; set; }
+ public double MaxJammingCooldown { get; set; } = 5.0;
///
/// 最大干扰功率(瓦特)
///
- public double MaxJammingPower { get; set; }
+ public double MaxJammingPower { get; set; } = 10000.0;
///
/// 初始干扰功率(瓦特)
///
- public double InitialJammingPower { get; set; }
+ public double InitialJammingPower { get; set; } = 4000.0;
///
/// 功率增加速率(瓦特/秒)
///
- public double PowerIncreaseRate { get; set; }
-
- ///
- /// 构造函数,设置默认值
- ///
- public LaserJammerConfig()
- {
- MaxJammingCooldown = 5.0;
- MaxJammingPower = 10000.0;
- InitialJammingPower = 4000.0;
- PowerIncreaseRate = 2000.0; // 每秒增加的功率
- }
+ public double PowerIncreaseRate { get; set; } = 2000.0;
}
///
@@ -590,22 +449,22 @@ namespace ThreatSource.Simulation
///
/// 最大跟踪距离(米)
///
- public double MaxTrackingRange { get; set; }
+ public double MaxTrackingRange { get; set; } = 10000;
///
/// 视场角(弧度)
///
- public double FieldOfView { get; set; }
+ public double FieldOfView { get; set; } = Math.PI / 3;
///
/// 角度测量精度(弧度)
///
- public double AngleMeasurementAccuracy { get; set; }
+ public double AngleMeasurementAccuracy { get; set; } = 0.001;
///
/// 更新频率(赫兹)
///
- public double UpdateFrequency { get; set; }
+ public double UpdateFrequency { get; set; } = 10;
///
/// 干扰抗性阈值(瓦特)
@@ -614,19 +473,7 @@ namespace ThreatSource.Simulation
/// 定义了红外测角仪抵抗干扰的能力
/// 当实际干扰功率超过此阈值时,测角仪将受到干扰
///
- public double JammingResistanceThreshold { get; set; }
-
- ///
- /// 构造函数,设置默认值
- ///
- public InfraredTrackerConfig()
- {
- MaxTrackingRange = 10000; // 10公里
- FieldOfView = Math.PI / 3; // 60度
- AngleMeasurementAccuracy = 0.001; // 0.001弧度 (约0.057度)
- UpdateFrequency = 10; // 10赫兹
- JammingResistanceThreshold = 50; // 50瓦特
- }
+ public double JammingResistanceThreshold { get; set; } = 50;
}
///
@@ -637,33 +484,22 @@ namespace ThreatSource.Simulation
///
/// 最大干扰功率(瓦特)
///
- public double MaxJammingPower { get; set; }
+ public double MaxJammingPower { get; set; } = 1000;
///
/// 初始干扰功率(瓦特)
///
- public double InitialJammingPower { get; set; }
+ public double InitialJammingPower { get; set; } = 400;
///
/// 功率增长率(瓦特/秒)
///
- public double PowerIncreaseRate { get; set; }
+ public double PowerIncreaseRate { get; set; } = 200;
///
/// 最大冷却时间(秒)
///
- public double MaxJammingCooldown { get; set; }
-
- ///
- /// 构造函数
- ///
- public MillimeterWaveJammerConfig()
- {
- MaxJammingPower = 1000;
- InitialJammingPower = 400;
- PowerIncreaseRate = 200;
- MaxJammingCooldown = 5;
- }
+ public double MaxJammingCooldown { get; set; } = 5;
}
///
@@ -683,14 +519,16 @@ namespace ThreatSource.Simulation
}
///
- /// 红外成像导引系统配置类
+ /// 红外成像导引配置类
///
///
- /// 存储红外成像导引系统的特定参数:
- /// - 视场角配置
- /// - 图像传感器配置
- /// - 目标识别配置
- /// - 时间参数配置
+ /// 该类定义了红外成像导引系统的关键参数:
+ /// - 搜索视场角:12度
+ /// - 跟踪视场角:3度
+ /// - 图像分辨率:640x512
+ /// - 背景辐射:0.01 W/sr
+ /// - 识别概率阈值:0.6/0.8
+ /// - 时间参数:0.2s/0.3s
///
public class InfraredImagingGuidanceConfig
{
@@ -773,14 +611,18 @@ namespace ThreatSource.Simulation
}
///
- /// 激光半主动导引系统配置类
+ /// 激光半主动导引配置类
///
///
- /// 该类定义了激光半主动导引系统的关键参数:
- /// - 光学系统参数(视场角、镜头直径等)
- /// - 目标特性参数(反射系数、有效反射面积)
- /// - 系统性能参数(锁定阈值、灵敏度)
- /// 这些参数决定了导引系统的探测能力和跟踪性能
+ /// 该类定义了激光半主动导引的关键参数:
+ /// - 视场角:30度
+ /// - 镜头直径:0.1米
+ /// - 传感器直径:0.03米
+ /// - 光斑直径:0.006米
+ /// - 反射系数:0.2
+ /// - 反射面积:1.0平方米
+ /// - 锁定阈值:1e-12瓦特
+ /// - 灵敏度:0.5
///
public class LaserSemiActiveGuidanceConfig
{
@@ -918,7 +760,13 @@ namespace ThreatSource.Simulation
/// - 降落伞阶段参数(开伞高度、减速度)
/// - 扫描阶段参数(扫描高度、下降速度、扫描角度)
/// - 探测阶段参数(探测距离、自毁高度、攻击速度)
- /// 这些参数决定了子弹药的整体性能和打击效果
+ ///
+ /// 默认值:
+ /// - 分离参数:高度1000米,距离1000米,角度45度,触发距离50米
+ /// - 减速参数:加速度250米/秒²,末速度50米/秒
+ /// - 降落伞参数:开伞高度400米,减速度140米/秒²
+ /// - 扫描参数:高度200米,下降速度10米/秒,旋转速度8π弧度/秒,扫描角30度
+ /// - 探测参数:探测距离150米,自毁高度20米,攻击速度200米/秒
///
public class TerminalSensitiveSubmunitionConfig
{
@@ -1112,6 +960,15 @@ namespace ThreatSource.Simulation
/// - 控制参数(控制场直径、PID参数)
/// - 制导参数(最大加速度、非线性增益)
/// - 滤波参数(低通滤波系数)
+ ///
+ /// 默认值:
+ /// - 最小可探测功率:1mW
+ /// - 探测器直径:0.1米
+ /// - 控制场直径:20米
+ /// - PID参数:Kp=30, Ki=0.05, Kd=5
+ /// - 非线性增益:0.5
+ /// - 最大加速度:50 m/s²
+ /// - 滤波系数:0.2
///
public class LaserBeamRiderGuidanceSystemConfig
{
@@ -1233,7 +1090,31 @@ namespace ThreatSource.Simulation
/// - 探测参数(最大探测距离、视场角)
/// - 雷达参数(工作频率、脉冲持续时间)
/// - 目标识别参数(识别概率、信噪比阈值)
- /// 这些参数决定了导引系统的探测和跟踪性能
+ ///
+ /// 默认值:
+ /// - 最大探测范围:3000米
+ /// - 视场角:45度
+ /// - 目标识别概率:0.95
+ /// - 工作频率:94GHz
+ /// - 脉冲持续时间:1微秒
+ /// - 搜索波束宽度:4度
+ /// - 跟踪波束宽度:2度
+ /// - 锁定波束宽度:1度
+ /// - 扫描角速度:360度/秒
+ /// - 扫描半径增长率:22.5度/秒
+ /// - 识别目标SNR阈值:-30dB
+ /// - 锁定目标SNR阈值:3dB
+ /// - 时间参数:0.2s/0.5s
+ /// - 脉冲重复频率:10kHz
+ /// - 发射功率:0.3W
+ /// - 多普勒参数:速度分辨率1米/秒,最大可测速度1000米/秒
+ /// - 天线增益:23dB
+ /// - 噪声系数:7dB
+ /// - 系统损耗:6dB
+ /// - 单脉冲灵敏度:0.002弧度/误差单位
+ /// - 偏航通道控制增益:1.2
+ /// - 俯仰通道控制增益:1.0
+ /// - 单脉冲跟踪滤波器参数:ProcessNoise=0.1, MeasurementNoise=0.01, InitialEstimateError=1.0
///
public class MillimeterWaveGuidanceConfig
{
@@ -1532,4 +1413,145 @@ namespace ThreatSource.Simulation
///
public double InitialEstimateError { get; set; } = 1.0;
}
+
+ ///
+ /// 红外探测器配置类
+ ///
+ ///
+ /// 默认值:
+ /// - 探测范围:1000米
+ /// - 视场角:30度
+ /// - 波段:长波
+ /// - 干扰抗性阈值:1e-3瓦特
+ ///
+ public class InfraredDetectorConfig
+ {
+ ///
+ /// 最大探测距离,单位:米
+ ///
+ public double MaxDetectionRange { get; set; } = 1000.0;
+
+ ///
+ /// 视场角,单位:度
+ ///
+ public double FieldOfView { get; set; } = 1.0;
+
+ ///
+ /// 红外波段
+ ///
+ public InfraredBand Band { get; set; } = InfraredBand.Short;
+
+ ///
+ /// 干扰抗性阈值,单位:瓦特
+ ///
+ public double JammingResistanceThreshold { get; set; } = 1e-3;
+ }
+
+ ///
+ /// 激光测距仪配置类
+ ///
+ ///
+ /// 默认值:
+ /// - 最大测距:1000米
+ /// - 波长:1.0微米
+ /// - 脉冲率:1.0脉冲/秒
+ /// - 精度:0.1米
+ /// - 干扰抗性阈值:1e-3瓦特
+ ///
+ public class LaserRangefinderConfig
+ {
+ ///
+ /// 最大测距,单位:米
+ ///
+ public double MaxDetectionRange { get; set; } = 1000.0;
+
+ ///
+ /// 波长,单位:微米
+ ///
+ public double Wavelength { get; set; } = 1.06;
+
+ ///
+ /// 脉冲率,单位:脉冲/秒
+ ///
+ public double PulseRate { get; set; } = 100.0;
+
+ ///
+ /// 精度,单位:米
+ ///
+ public double Accuracy { get; set; } = 0.1;
+
+ ///
+ /// 干扰抗性阈值,单位:瓦特
+ ///
+ public double JammingResistanceThreshold { get; set; } = 1e-3;
+ }
+
+ ///
+ /// 毫米波辐射计配置类
+ ///
+ ///
+ /// 默认值:
+ /// - 最大探测距离:1000米
+ /// - 波段:8毫米
+ /// - 干扰抗性阈值:1e-3瓦特
+ ///
+ public class MillimeterWaveRadiometerConfig
+ {
+ ///
+ /// 最大探测距离,单位:米
+ ///
+ public double MaxDetectionRange { get; set; } = 1000.0;
+
+ ///
+ /// 波段
+ ///
+ public MillimeterWaveBand Band { get; set; } = MillimeterWaveBand.Band3;
+
+ ///
+ /// 扫描视场角,单位:度
+ ///
+ public double ScanFieldOfView { get; set; } = 1.0;
+
+ ///
+ /// 干扰抗性阈值,单位:瓦特
+ ///
+ public double JammingResistanceThreshold { get; set; } = 1e-3;
+ }
+
+ ///
+ /// 毫米波测高仪配置类
+ ///
+ ///
+ /// 默认值:
+ /// - 最大探测距离:1000米
+ /// - 波段:8毫米
+ /// - 干扰抗性阈值:1e-3瓦特
+ ///
+ public class MillimeterWaveAltimeterConfig
+ {
+ ///
+ /// 最大探测距离,单位:米
+ ///
+ public double MaxAltitude { get; set; } = 1000.0;
+
+ ///
+ /// 波段
+ ///
+ public MillimeterWaveBand Band { get; set; } = MillimeterWaveBand.Band8;
+
+ ///
+ /// 测量精度,单位:米
+ ///
+ public double MeasurementAccuracy { get; set; } = 0.5;
+
+ ///
+ /// 扫描视场角,单位:度
+ ///
+ public double ScanFieldOfView { get; set; } = 30.0;
+
+ ///
+ /// 干扰抗性阈值,单位:瓦特
+ ///
+ public double JammingResistanceThreshold { get; set; } = 1e-3;
+ }
}
diff --git a/tools/ComprehensiveMissileSimulator.cs b/tools/ComprehensiveMissileSimulator.cs
index 34ef386..31d8e6a 100644
--- a/tools/ComprehensiveMissileSimulator.cs
+++ b/tools/ComprehensiveMissileSimulator.cs
@@ -326,7 +326,8 @@ namespace ThreatSource.Tools.MissileSimulation
Type = type,
Power = power,
Duration = duration,
- Direction = new Vector3D(1, 0, 0)
+ Direction = new Vector3D(1, 0, 0),
+ SourcePosition = position
};
foreach (var missile in missiles.Values)
@@ -366,7 +367,8 @@ namespace ThreatSource.Tools.MissileSimulation
Type = type,
Power = 0,
Duration = 0,
- Direction = new Vector3D(1, 0, 0)
+ Direction = new Vector3D(1, 0, 0),
+ SourcePosition = new Vector3D(0, 0, 0)
};
foreach (var missile in missiles.Values)