给传感器加上配置类,并修改传感器数据类,完善传感器的干扰下返回数据的逻辑

This commit is contained in:
Tian jianyong 2025-03-22 14:29:30 +08:00
parent dd13ff72b5
commit 5552d55940
17 changed files with 547 additions and 885 deletions

View File

@ -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
);
// 激活红外探测器

View File

@ -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 // 仿真管理器
);

View File

@ -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
);
// 激活毫米波测高雷达

View File

@ -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
);
// 激活毫米波辐射计

View File

@ -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("传感器受到干扰"), "子弹状态应该反映传感器恢复正常");
}
}
}

View File

@ -21,17 +21,13 @@ namespace ThreatSource.Indicator
public class InfraredTracker : IndicatorBase
{
/// <summary>
/// 获取设备支持的干扰类型
/// 定义设备支持的干扰类型
/// </summary>
/// <remarks>
/// 红外测角仪支持的干扰类型:
/// - 红外干扰
/// - 激光干扰
/// </remarks>
public override IEnumerable<JammingType> SupportedJammingTypes => new[]
{
JammingType.Infrared
};
public override IEnumerable<JammingType> SupportedJammingTypes => [JammingType.Infrared];
/// <summary>
/// 红外测角仪配置参数
@ -78,7 +74,7 @@ namespace ThreatSource.Indicator
IsTracking = false;
// 初始化干扰处理
InitializeJamming(config.JammingResistanceThreshold, new List<JammingType> { JammingType.Infrared });
InitializeJamming(config.JammingResistanceThreshold, [JammingType.Infrared]);
}
/// <summary>

View File

@ -20,15 +20,13 @@ namespace ThreatSource.Indicator
public class LaserBeamRider : IndicatorBase
{
/// <summary>
/// 获取设备支持的干扰类型
/// 定义设备支持的干扰类型
/// </summary>
/// <remarks>
/// 定义波束制导器可以被哪些类型的干扰影响
/// 激光驾束仪支持的干扰类型:
/// - 激光干扰
/// </remarks>
public override IEnumerable<JammingType> SupportedJammingTypes => new[]
{
JammingType.Laser
};
public override IEnumerable<JammingType> SupportedJammingTypes => [JammingType.Laser];
/// <summary>
/// 获取或设置干扰阈值,单位:分贝
@ -133,7 +131,7 @@ namespace ThreatSource.Indicator
JammingThreshold = config.JammingResistanceThreshold;
// 设置干扰阈值并添加支持的干扰类型
InitializeJamming(JammingThreshold, new List<JammingType> { JammingType.Laser });
InitializeJamming(JammingThreshold, [JammingType.Laser]);
}
/// <summary>

View File

@ -21,15 +21,13 @@ namespace ThreatSource.Indicator
public class LaserDesignator : IndicatorBase
{
/// <summary>
/// 获取设备支持的干扰类型
/// 定义设备支持的干扰类型
/// </summary>
/// <remarks>
/// 定义激光指示器可以被哪些类型的干扰影响
/// 激光目标指示器支持的干扰类型:
/// - 激光干扰
/// </remarks>
public override IEnumerable<JammingType> SupportedJammingTypes => new[]
{
JammingType.Laser
};
public override IEnumerable<JammingType> SupportedJammingTypes => [JammingType.Laser];
/// <summary>
/// 获取或设置干扰阈值,单位:分贝
@ -129,7 +127,7 @@ namespace ThreatSource.Indicator
MaxWavelength = config.MaxWavelength;
// 设置干扰阈值并添加支持的干扰类型
InitializeJamming(JammingThreshold, new List<JammingType> { JammingType.Laser });
InitializeJamming(JammingThreshold, [JammingType.Laser]);
}
/// <summary>

View File

@ -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;
}

View File

@ -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);
}
/// <summary>
@ -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;
}
}
}
/// <summary>
@ -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;
}
}
}
/// <summary>
@ -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}°");

View File

@ -19,6 +19,15 @@ namespace ThreatSource.Sensor
/// </remarks>
public class InfraredDetector : Sensor
{
/// <summary>
/// 定义设备支持的干扰类型
/// </summary>
/// <remarks>
/// 红外探测器支持的干扰类型:
/// - 红外干扰
/// </remarks>
public override IEnumerable<JammingType> SupportedJammingTypes => [JammingType.Infrared];
/// <summary>
/// 探测辐射强度阈值,单位:瓦特/球面度
/// </summary>
@ -36,7 +45,7 @@ namespace ThreatSource.Sensor
/// 定义了探测器的最大作用距离
/// 影响目标探测的有效范围
/// </remarks>
public double DetectionRange { get; set; }
public double MaxDetectionRange { get; set; }
/// <summary>
/// 获取或设置红外波段
@ -75,9 +84,7 @@ namespace ThreatSource.Sensor
/// </summary>
/// <param name="id">红外探测器的ID</param>
/// <param name="submunition">末敏子弹实例</param>
/// <param name="detectionRange">探测范围,单位:米</param>
/// <param name="band"></param>
/// <param name="fieldOfView">视场角,单位:度</param>
/// <param name="config">红外探测器配置</param>
/// <param name="simulationManager">仿真管理器实例</param>
/// <remarks>
/// 构造过程:
@ -86,17 +93,17 @@ namespace ThreatSource.Sensor
/// - 初始化传感器数据
/// - 继承基类位置和姿态
/// </remarks>
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]);
}
/// <summary>
@ -237,16 +244,9 @@ namespace ThreatSource.Sensor
/// </remarks>
public override SensorData GetSensorData()
{
// 返回红外探测器的数据
return sensorData;
}
/// <summary>
/// 获取支持的干扰类型集合
/// </summary>
public override IEnumerable<JammingType> SupportedJammingTypes =>
[JammingType.Infrared];
/// <summary>
/// 处理红外干扰应用
/// </summary>
@ -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;
}
}
}

View File

@ -19,6 +19,20 @@ namespace ThreatSource.Sensor
/// </remarks>
public class LaserRangefinder : Sensor
{
/// <summary>
/// 定义设备支持的干扰类型
/// </summary>
/// <remarks>
/// 激光测距仪支持的干扰类型:
/// - 激光干扰
/// </remarks>
public override IEnumerable<JammingType> SupportedJammingTypes => [JammingType.Laser];
/// <summary>
/// 激光测距仪数据
/// </summary>
private RangefinderSensorData sensorData;
/// <summary>
/// 当前测量距离,单位:米
/// </summary>
@ -44,7 +58,7 @@ namespace ThreatSource.Sensor
/// 超出此距离的测量可能不准确
/// 受大气条件和目标反射率影响
/// </remarks>
public double MaxRange { get; set; }
public double MaxDetectionRange { get; set; }
/// <summary>
/// 获取或设置工作波长,单位:微米
@ -80,10 +94,7 @@ namespace ThreatSource.Sensor
/// </summary>
/// <param name="id">激光测距仪的ID</param>
/// <param name="submunition">末敏子弹实例</param>
/// <param name="maxRange">最大测量距离,单位:米</param>
/// <param name="waveLength">工作波段,单位:毫米</param>
/// <param name="pulseRate">脉冲频率,单位:赫兹</param>
/// <param name="accuracy">测量精度,单位:米</param>
/// <param name="config">激光测距仪配置</param>
/// <param name="simulationManager">仿真管理器实例</param>
/// <remarks>
/// 构造过程:
@ -91,18 +102,19 @@ namespace ThreatSource.Sensor
/// - 配置测量参数
/// - 初始化工作状态
/// </remarks>
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]);
}
/// <summary>
@ -129,6 +141,7 @@ namespace ThreatSource.Sensor
// 执行距离测量
currentDistance = GetTargetDistance();
sensorData.Distance = currentDistance;
}
/// <summary>
@ -141,19 +154,9 @@ namespace ThreatSource.Sensor
/// </remarks>
public override SensorData GetSensorData()
{
return new RangefinderSensorData
{
Distance = IsJammed ? 0 : currentDistance,
IsValid = !IsJammed && IsActive
};
return sensorData;
}
/// <summary>
/// 获取支持的干扰类型集合
/// </summary>
public override IEnumerable<JammingType> SupportedJammingTypes =>
[JammingType.Laser];
/// <summary>
/// 激活激光测距仪
/// </summary>
@ -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;
}
}

View File

@ -19,6 +19,20 @@ namespace ThreatSource.Sensor
/// </remarks>
public class MillimeterWaveAltimeter : Sensor
{
/// <summary>
/// 定义设备支持的干扰类型
/// </summary>
/// <remarks>
/// 毫米波测高雷达支持的干扰类型:
/// - 毫米波干扰
/// </remarks>
public override IEnumerable<JammingType> SupportedJammingTypes => [JammingType.MillimeterWave];
/// <summary>
/// 毫米波测高雷达数据
/// </summary>
private AltimeterSensorData sensorData;
/// <summary>
/// 当前测量高度,单位:米
/// </summary>
@ -74,10 +88,7 @@ namespace ThreatSource.Sensor
/// </summary>
/// <param name="id">毫米波测高雷达的ID</param>
/// <param name="submunition">末敏子弹实例</param>
/// <param name="maxAltitude">最大测量高度,单位:米</param>
/// <param name="band">工作波段,枚举</param>
/// <param name="accuracy">测量精度,单位:米</param>
/// <param name="fieldOfView">视场角,单位:度</param>
/// <param name="config">毫米波测高雷达配置</param>
/// <param name="simulationManager">仿真管理器实例</param>
/// <remarks>
/// 构造过程:
@ -85,18 +96,18 @@ namespace ThreatSource.Sensor
/// - 初始化高度记录
/// - 继承基类位置和姿态
/// </remarks>
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]);
}
/// <summary>
@ -128,6 +139,7 @@ namespace ThreatSource.Sensor
// 更新当前高度,考虑测量精度
currentAltitude = submunition.Position.Y + (2 * new Random().NextDouble() - 1) * Accuracy;
sensorData.Altitude = currentAltitude;
}
/// <summary>
@ -141,19 +153,9 @@ namespace ThreatSource.Sensor
public override SensorData GetSensorData()
{
// 返回毫米波测高雷达的数据
AltimeterSensorData altimeterSensorData = new()
{
Altitude = currentAltitude
};
return altimeterSensorData;
return sensorData;
}
/// <summary>
/// 获取支持的干扰类型集合
/// </summary>
public override IEnumerable<JammingType> SupportedJammingTypes =>
[JammingType.MillimeterWave];
/// <summary>
/// 激活毫米波测高雷达
/// </summary>
@ -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;
}
}
}

View File

@ -19,6 +19,15 @@ namespace ThreatSource.Sensor
/// </remarks>
public class MillimeterWaveRadiometer : Sensor
{
/// <summary>
/// 定义设备支持的干扰类型
/// </summary>
/// <remarks>
/// 毫米波辐射计支持的干扰类型:
/// - 毫米波干扰
/// </remarks>
public override IEnumerable<JammingType> SupportedJammingTypes => [JammingType.MillimeterWave];
/// <summary>
/// 获取或设置探测距离,单位:米
/// </summary>
@ -26,7 +35,7 @@ namespace ThreatSource.Sensor
/// 定义了辐射计的探测范围
/// 影响目标探测的可靠性和稳定性
/// </remarks>
public double DetectionDistance { get; set; }
public double MaxDetectionRange { get; set; }
/// <summary>
/// 获取或设置工作波段,枚举
@ -96,9 +105,7 @@ namespace ThreatSource.Sensor
/// </summary>
/// <param name="id">毫米波辐射计的ID</param>
/// <param name="submunition">末敏子弹实例</param>
/// <param name="detectionDistance">探测距离,单位:米</param>
/// <param name="band">工作波段,枚举</param>
/// <param name="fieldOfView">视场角,单位:度</param>
/// <param name="config">毫米波辐射计配置</param>
/// <param name="simulationManager">仿真管理器实例</param>
/// <remarks>
/// 构造过程:
@ -107,12 +114,12 @@ namespace ThreatSource.Sensor
/// - 创建传感器数据
/// - 继承基类位置和姿态
/// </remarks>
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;
}
/// <summary>
/// 获取支持的干扰类型集合
/// </summary>
public override IEnumerable<JammingType> SupportedJammingTypes =>
[JammingType.MillimeterWave];
/// <summary>
/// 激活毫米波辐射计
@ -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;
}
}
}

View File

@ -12,6 +12,11 @@ namespace ThreatSource.Sensor
/// </remarks>
public abstract class SensorData
{
/// <summary>
/// 获取或设置数据是否有效
/// </summary>
public bool IsValid { get; set; } = true;
/// <summary>
/// 获取或设置数据采集的时间戳
/// </summary>
@ -19,7 +24,7 @@ namespace ThreatSource.Sensor
/// 记录传感器数据的采集时间
/// 用于数据时序分析和同步处理
/// </remarks>
public DateTime Timestamp { get; set; }
public DateTime Timestamp { get; set; } = DateTime.Now;
}
/// <summary>
@ -40,7 +45,7 @@ namespace ThreatSource.Sensor
/// 记录目标的红外辐射温度
/// 用于目标特征识别和状态评估
/// </remarks>
public double Temperature { get; set; }
public double Temperature { get; set; } = 0;
/// <summary>
/// 获取或设置是否检测到目标
@ -50,7 +55,7 @@ namespace ThreatSource.Sensor
/// false表示未探测到目标
/// 用于目标存在性判断
/// </remarks>
public bool IsTargetDetected { get; set; }
public bool IsTargetDetected { get; set; } = false;
/// <summary>
/// 获取或设置目标的方位角,单位:弧度
@ -60,7 +65,7 @@ namespace ThreatSource.Sensor
/// 用于目标定位和跟踪
/// 当未检测到目标时为null
/// </remarks>
public double? TargetAngle { get; set; }
public double? TargetAngle { get; set; } = null;
}
/// <summary>
@ -81,7 +86,7 @@ namespace ThreatSource.Sensor
/// 记录目标的毫米波辐射强度
/// 用于目标特征分析和识别判断
/// </remarks>
public double RadiationIntensity { get; set; }
public double RadiationIntensity { get; set; } = 0;
/// <summary>
/// 获取或设置是否检测到目标
@ -91,7 +96,7 @@ namespace ThreatSource.Sensor
/// false表示未探测到目标
/// 用于目标存在性判断
/// </remarks>
public bool IsTargetDetected { get; set; }
public bool IsTargetDetected { get; set; } = false;
/// <summary>
/// 获取或设置目标的方位角,单位:弧度
@ -101,7 +106,7 @@ namespace ThreatSource.Sensor
/// 用于目标定位和跟踪
/// 当未检测到目标时为null
/// </remarks>
public double? TargetAngle { get; set; }
public double? TargetAngle { get; set; } = null;
}
/// <summary>
@ -121,7 +126,7 @@ namespace ThreatSource.Sensor
/// 记录当前对地高度
/// 用于高度保持和地形跟随
/// </remarks>
public double Altitude { get; set; }
public double Altitude { get; set; } = 0;
}
/// <summary>
@ -141,11 +146,6 @@ namespace ThreatSource.Sensor
/// 记录到目标的直线距离
/// 用于目标定位和制导控制
/// </remarks>
public double Distance { get; set; }
/// <summary>
/// 获取或设置数据是否有效
/// </summary>
public bool IsValid { get; set; }
public double Distance { get; set; } = 0;
}
}

View File

@ -32,7 +32,7 @@ namespace ThreatSource.Simulation
/// <remarks>
/// 包含编码类型和编码值等基本信息
/// </remarks>
public LaserCode Code { get; set; }
public LaserCode Code { get; set; } = new LaserCode();
/// <summary>
/// 获取或设置是否启用编码
@ -41,7 +41,7 @@ namespace ThreatSource.Simulation
/// true表示使用编码
/// false表示不使用编码
/// </remarks>
public bool IsCodeEnabled { get; set; }
public bool IsCodeEnabled { get; set; } = true;
/// <summary>
/// 获取或设置是否要求编码匹配
@ -50,7 +50,7 @@ namespace ThreatSource.Simulation
/// true表示必须匹配编码
/// false表示不要求匹配
/// </remarks>
public bool IsCodeMatchRequired { get; set; }
public bool IsCodeMatchRequired { get; set; } = true;
/// <summary>
/// 检查当前激光编码配置是否与目标配置匹配
@ -81,22 +81,6 @@ namespace ThreatSource.Simulation
// 检查编码是否匹配
return Code.Matches(other.Code);
}
/// <summary>
/// 初始化激光编码配置的新实例
/// </summary>
/// <remarks>
/// 设置默认值:
/// - 新的LaserCode实例
/// - 启用编码
/// - 要求编码匹配
/// </remarks>
public LaserCodeConfig()
{
Code = new LaserCode();
IsCodeEnabled = true;
IsCodeMatchRequired = true;
}
}
/// <summary>
@ -119,7 +103,7 @@ namespace ThreatSource.Simulation
/// 单位:瓦特
/// 影响激光照射的有效距离和目标反射强度
/// </remarks>
public double LaserPower { get; set; }
public double LaserPower { get; set; } = 0;
/// <summary>
/// 获取或设置激光发散角
@ -128,7 +112,7 @@ namespace ThreatSource.Simulation
/// 单位:弧度
/// 影响激光束的扩散特性和照射面积
/// </remarks>
public double LaserDivergenceAngle { get; set; }
public double LaserDivergenceAngle { get; set; } = 0;
/// <summary>
/// 获取或设置激光编码配置
@ -137,7 +121,7 @@ namespace ThreatSource.Simulation
/// 定义激光信号的编码参数
/// 用于抗干扰和安全识别
/// </remarks>
public LaserCodeConfig LaserCodeConfig { get; set; }
public LaserCodeConfig LaserCodeConfig { get; set; } = new LaserCodeConfig();
/// <summary>
/// 获取或设置干扰抗性阈值
@ -147,7 +131,7 @@ namespace ThreatSource.Simulation
/// 定义了抵抗干扰所需的最小功率阈值
/// 干扰功率超过此阈值时会影响指示器工作
/// </remarks>
public double JammingResistanceThreshold { get; set; }
public double JammingResistanceThreshold { get; set; } = 1.0;
/// <summary>
/// 获取或设置最小工作波长
@ -157,7 +141,7 @@ namespace ThreatSource.Simulation
/// 激光指示器工作的最小波长
/// 影响激光干扰的匹配判断
/// </remarks>
public double MinWavelength { get; set; }
public double MinWavelength { get; set; } = 1.0;
/// <summary>
/// 获取或设置最大工作波长
@ -167,28 +151,7 @@ namespace ThreatSource.Simulation
/// 激光指示器工作的最大波长
/// 影响激光干扰的匹配判断
/// </remarks>
public double MaxWavelength { get; set; }
/// <summary>
/// 初始化激光指示器配置的新实例
/// </summary>
/// <remarks>
/// 设置默认值:
/// - ID为空字符串
/// - 初始位置为原点(0,0,0)
/// - 激光功率为0瓦特
/// - 发散角为0弧度
/// - 默认激光编码配置
/// </remarks>
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;
}
/// <summary>
@ -212,7 +175,7 @@ namespace ThreatSource.Simulation
/// 单位:瓦特
/// 影响制导波束的有效距离和导引精度
/// </remarks>
public double LaserPower { get; set; }
public double LaserPower { get; set; } = 0;
/// <summary>
/// 获取或设置控制场直径
@ -221,7 +184,7 @@ namespace ThreatSource.Simulation
/// 单位:米
/// 定义了导弹可以接收制导信号的横向范围
/// </remarks>
public double ControlFieldDiameter { get; set; }
public double ControlFieldDiameter { get; set; } = 0;
/// <summary>
/// 获取或设置最大导引距离
@ -230,7 +193,7 @@ namespace ThreatSource.Simulation
/// 单位:米
/// 定义了驾束仪的最大有效工作距离
/// </remarks>
public double MaxGuidanceDistance { get; set; }
public double MaxGuidanceDistance { get; set; } = 0;
/// <summary>
/// 获取或设置激光编码配置
@ -239,7 +202,7 @@ namespace ThreatSource.Simulation
/// 定义激光信号的编码参数
/// 用于抗干扰和安全识别
/// </remarks>
public LaserCodeConfig LaserCodeConfig { get; set; }
public LaserCodeConfig LaserCodeConfig { get; set; } = new LaserCodeConfig();
/// <summary>
/// 获取或设置干扰抗性阈值
@ -249,28 +212,7 @@ namespace ThreatSource.Simulation
/// 定义了抵抗干扰所需的最小功率阈值
/// 干扰功率超过此阈值时会影响制导系统
/// </remarks>
public double JammingResistanceThreshold { get; set; }
/// <summary>
/// 初始化激光驾束仪配置的新实例
/// </summary>
/// <remarks>
/// 设置默认值:
/// - ID为空字符串
/// - 初始位置为原点(0,0,0)
/// - 激光功率为0瓦特
/// - 控制场直径为0米
/// - 最大导引距离为0米
/// - 默认激光编码配置
/// </remarks>
public LaserBeamRiderConfig()
{
LaserPower = 0;
ControlFieldDiameter = 0;
MaxGuidanceDistance = 0;
LaserCodeConfig = new LaserCodeConfig();
JammingResistanceThreshold = 1.0; // 默认抗干扰阈值为1瓦特
}
public double JammingResistanceThreshold { get; set; } = 1.0;
}
/// <summary>
@ -293,7 +235,7 @@ namespace ThreatSource.Simulation
/// 单位:瓦特/平方米
/// 当接收到的激光功率密度超过此阈值时触发告警
/// </remarks>
public double SensitivityThreshold { get; set; }
public double SensitivityThreshold { get; set; } = 0;
/// <summary>
/// 获取或设置警报持续时间
@ -302,7 +244,7 @@ namespace ThreatSource.Simulation
/// 单位:秒
/// 定义了每次告警的持续时间
/// </remarks>
public double AlarmDuration { get; set; }
public double AlarmDuration { get; set; } = 5.0;
/// <summary>
/// 获取或设置最小探测波长
@ -311,7 +253,7 @@ namespace ThreatSource.Simulation
/// 单位:纳米
/// 定义了告警器可以探测的最短波长
/// </remarks>
public double WavelengthMin { get; set; }
public double WavelengthMin { get; set; } = 0;
/// <summary>
/// 获取或设置最大探测波长
@ -320,25 +262,7 @@ namespace ThreatSource.Simulation
/// 单位:纳米
/// 定义了告警器可以探测的最长波长
/// </remarks>
public double WavelengthMax { get; set; }
/// <summary>
/// 初始化激光告警器配置的新实例
/// </summary>
/// <remarks>
/// 设置默认值:
/// - ID为空字符串
/// - 灵敏度阈值为0
/// - 警报持续时间为5秒
/// - 波长范围为0-0纳米
/// </remarks>
public LaserWarnerConfig()
{
SensitivityThreshold = 0;
AlarmDuration = 5.0; // 默认警报持续5秒
WavelengthMin = 0;
WavelengthMax = 0;
}
public double WavelengthMax { get; set; } = 0;
}
/// <summary>
@ -361,7 +285,7 @@ namespace ThreatSource.Simulation
/// 单位:瓦特/平方米
/// 当接收到的紫外辐射强度超过此阈值时触发告警
/// </remarks>
public double SensitivityThreshold { get; set; }
public double SensitivityThreshold { get; set; } = 0;
/// <summary>
/// 获取或设置警报持续时间
@ -370,7 +294,7 @@ namespace ThreatSource.Simulation
/// 单位:秒
/// 定义了每次告警的持续时间
/// </remarks>
public double AlarmDuration { get; set; }
public double AlarmDuration { get; set; } = 5.0;
/// <summary>
/// 获取或设置最小探测波长
@ -379,7 +303,7 @@ namespace ThreatSource.Simulation
/// 单位:纳米
/// 定义了告警器可以探测的最短紫外波长
/// </remarks>
public double WavelengthMin { get; set; }
public double WavelengthMin { get; set; } = 0;
/// <summary>
/// 获取或设置最大探测波长
@ -388,25 +312,7 @@ namespace ThreatSource.Simulation
/// 单位:纳米
/// 定义了告警器可以探测的最长紫外波长
/// </remarks>
public double WavelengthMax { get; set; }
/// <summary>
/// 初始化紫外告警器配置的新实例
/// </summary>
/// <remarks>
/// 设置默认值:
/// - ID为空字符串
/// - 灵敏度阈值为0
/// - 警报持续时间为5秒
/// - 波长范围为0-0纳米
/// </remarks>
public UltravioletWarnerConfig()
{
SensitivityThreshold = 0;
AlarmDuration = 5.0; // 默认警报持续5秒
WavelengthMin = 0;
WavelengthMax = 0;
}
public double WavelengthMax { get; set; } = 0;
}
/// <summary>
@ -429,7 +335,7 @@ namespace ThreatSource.Simulation
/// 单位:瓦特/平方米
/// 当接收到的红外辐射强度超过此阈值时触发告警
/// </remarks>
public double SensitivityThreshold { get; set; }
public double SensitivityThreshold { get; set; } = 0;
/// <summary>
/// 获取或设置警报持续时间
@ -438,7 +344,7 @@ namespace ThreatSource.Simulation
/// 单位:秒
/// 定义了每次告警的持续时间
/// </remarks>
public double AlarmDuration { get; set; }
public double AlarmDuration { get; set; } = 5.0;
/// <summary>
/// 获取或设置最小探测波长
@ -447,7 +353,7 @@ namespace ThreatSource.Simulation
/// 单位:纳米
/// 定义了告警器可以探测的最短红外波长
/// </remarks>
public double WavelengthMin { get; set; }
public double WavelengthMin { get; set; } = 0;
/// <summary>
/// 获取或设置最大探测波长
@ -456,25 +362,7 @@ namespace ThreatSource.Simulation
/// 单位:纳米
/// 定义了告警器可以探测的最长红外波长
/// </remarks>
public double WavelengthMax { get; set; }
/// <summary>
/// 初始化红外告警器配置的新实例
/// </summary>
/// <remarks>
/// 设置默认值:
/// - ID为空字符串
/// - 灵敏度阈值为0
/// - 警报持续时间为5秒
/// - 波长范围为0-0纳米
/// </remarks>
public InfraredWarnerConfig()
{
SensitivityThreshold = 0;
AlarmDuration = 5.0; // 默认警报持续5秒
WavelengthMin = 0;
WavelengthMax = 0;
}
public double WavelengthMax { get; set; } = 0;
}
/// <summary>
@ -497,7 +385,7 @@ namespace ThreatSource.Simulation
/// 单位:瓦特/平方米
/// 当接收到的毫米波辐射强度超过此阈值时触发告警
/// </remarks>
public double SensitivityThreshold { get; set; }
public double SensitivityThreshold { get; set; } = 0;
/// <summary>
/// 获取或设置警报持续时间
@ -506,7 +394,7 @@ namespace ThreatSource.Simulation
/// 单位:秒
/// 定义了每次告警的持续时间
/// </remarks>
public double AlarmDuration { get; set; }
public double AlarmDuration { get; set; } = 5.0;
/// <summary>
/// 获取或设置最小探测波长
@ -515,7 +403,7 @@ namespace ThreatSource.Simulation
/// 单位:纳米
/// 定义了告警器可以探测的最短毫米波波长
/// </remarks>
public double WavelengthMin { get; set; }
public double WavelengthMin { get; set; } = 0;
/// <summary>
/// 获取或设置最大探测波长
@ -524,25 +412,7 @@ namespace ThreatSource.Simulation
/// 单位:纳米
/// 定义了告警器可以探测的最长毫米波波长
/// </remarks>
public double WavelengthMax { get; set; }
/// <summary>
/// 初始化毫米波告警器配置的新实例
/// </summary>
/// <remarks>
/// 设置默认值:
/// - ID为空字符串
/// - 灵敏度阈值为0
/// - 警报持续时间为5秒
/// - 波长范围为0-0纳米
/// </remarks>
public MillimeterWaveWarnerConfig()
{
SensitivityThreshold = 0;
AlarmDuration = 5.0; // 默认警报持续5秒
WavelengthMin = 0;
WavelengthMax = 0;
}
public double WavelengthMax { get; set; } = 0;
}
/// <summary>
@ -553,33 +423,22 @@ namespace ThreatSource.Simulation
/// <summary>
/// 最大干扰冷却时间(秒)
/// </summary>
public double MaxJammingCooldown { get; set; }
public double MaxJammingCooldown { get; set; } = 5.0;
/// <summary>
/// 最大干扰功率(瓦特)
/// </summary>
public double MaxJammingPower { get; set; }
public double MaxJammingPower { get; set; } = 10000.0;
/// <summary>
/// 初始干扰功率(瓦特)
/// </summary>
public double InitialJammingPower { get; set; }
public double InitialJammingPower { get; set; } = 4000.0;
/// <summary>
/// 功率增加速率(瓦特/秒)
/// </summary>
public double PowerIncreaseRate { get; set; }
/// <summary>
/// 构造函数,设置默认值
/// </summary>
public LaserJammerConfig()
{
MaxJammingCooldown = 5.0;
MaxJammingPower = 10000.0;
InitialJammingPower = 4000.0;
PowerIncreaseRate = 2000.0; // 每秒增加的功率
}
public double PowerIncreaseRate { get; set; } = 2000.0;
}
/// <summary>
@ -590,22 +449,22 @@ namespace ThreatSource.Simulation
/// <summary>
/// 最大跟踪距离(米)
/// </summary>
public double MaxTrackingRange { get; set; }
public double MaxTrackingRange { get; set; } = 10000;
/// <summary>
/// 视场角(弧度)
/// </summary>
public double FieldOfView { get; set; }
public double FieldOfView { get; set; } = Math.PI / 3;
/// <summary>
/// 角度测量精度(弧度)
/// </summary>
public double AngleMeasurementAccuracy { get; set; }
public double AngleMeasurementAccuracy { get; set; } = 0.001;
/// <summary>
/// 更新频率(赫兹)
/// </summary>
public double UpdateFrequency { get; set; }
public double UpdateFrequency { get; set; } = 10;
/// <summary>
/// 干扰抗性阈值(瓦特)
@ -614,19 +473,7 @@ namespace ThreatSource.Simulation
/// 定义了红外测角仪抵抗干扰的能力
/// 当实际干扰功率超过此阈值时,测角仪将受到干扰
/// </remarks>
public double JammingResistanceThreshold { get; set; }
/// <summary>
/// 构造函数,设置默认值
/// </summary>
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;
}
/// <summary>
@ -637,33 +484,22 @@ namespace ThreatSource.Simulation
/// <summary>
/// 最大干扰功率(瓦特)
/// </summary>
public double MaxJammingPower { get; set; }
public double MaxJammingPower { get; set; } = 1000;
/// <summary>
/// 初始干扰功率(瓦特)
/// </summary>
public double InitialJammingPower { get; set; }
public double InitialJammingPower { get; set; } = 400;
/// <summary>
/// 功率增长率(瓦特/秒)
/// </summary>
public double PowerIncreaseRate { get; set; }
public double PowerIncreaseRate { get; set; } = 200;
/// <summary>
/// 最大冷却时间(秒)
/// </summary>
public double MaxJammingCooldown { get; set; }
/// <summary>
/// 构造函数
/// </summary>
public MillimeterWaveJammerConfig()
{
MaxJammingPower = 1000;
InitialJammingPower = 400;
PowerIncreaseRate = 200;
MaxJammingCooldown = 5;
}
public double MaxJammingCooldown { get; set; } = 5;
}
/// <summary>
@ -683,14 +519,16 @@ namespace ThreatSource.Simulation
}
/// <summary>
/// 红外成像导引系统配置类
/// 红外成像导引配置类
/// </summary>
/// <remarks>
/// 存储红外成像导引系统的特定参数:
/// - 视场角配置
/// - 图像传感器配置
/// - 目标识别配置
/// - 时间参数配置
/// 该类定义了红外成像导引系统的关键参数:
/// - 搜索视场角12度
/// - 跟踪视场角3度
/// - 图像分辨率640x512
/// - 背景辐射0.01 W/sr
/// - 识别概率阈值0.6/0.8
/// - 时间参数0.2s/0.3s
/// </remarks>
public class InfraredImagingGuidanceConfig
{
@ -773,14 +611,18 @@ namespace ThreatSource.Simulation
}
/// <summary>
/// 激光半主动导引系统配置类
/// 激光半主动导引配置类
/// </summary>
/// <remarks>
/// 该类定义了激光半主动导引系统的关键参数:
/// - 光学系统参数(视场角、镜头直径等)
/// - 目标特性参数(反射系数、有效反射面积)
/// - 系统性能参数(锁定阈值、灵敏度)
/// 这些参数决定了导引系统的探测能力和跟踪性能
/// 该类定义了激光半主动导引的关键参数:
/// - 视场角30度
/// - 镜头直径0.1米
/// - 传感器直径0.03米
/// - 光斑直径0.006米
/// - 反射系数0.2
/// - 反射面积1.0平方米
/// - 锁定阈值1e-12瓦特
/// - 灵敏度0.5
/// </remarks>
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米/秒
/// </remarks>
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
/// </remarks>
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
/// </remarks>
public class MillimeterWaveGuidanceConfig
{
@ -1532,4 +1413,145 @@ namespace ThreatSource.Simulation
/// </summary>
public double InitialEstimateError { get; set; } = 1.0;
}
/// <summary>
/// 红外探测器配置类
/// </summary>
/// <remarks>
/// 默认值:
/// - 探测范围1000米
/// - 视场角30度
/// - 波段:长波
/// - 干扰抗性阈值1e-3瓦特
/// </remarks>
public class InfraredDetectorConfig
{
/// <summary>
/// 最大探测距离,单位:米
/// </summary>
public double MaxDetectionRange { get; set; } = 1000.0;
/// <summary>
/// 视场角,单位:度
/// </summary>
public double FieldOfView { get; set; } = 1.0;
/// <summary>
/// 红外波段
/// </summary>
public InfraredBand Band { get; set; } = InfraredBand.Short;
/// <summary>
/// 干扰抗性阈值,单位:瓦特
/// </summary>
public double JammingResistanceThreshold { get; set; } = 1e-3;
}
/// <summary>
/// 激光测距仪配置类
/// </summary>
/// <remarks>
/// 默认值:
/// - 最大测距1000米
/// - 波长1.0微米
/// - 脉冲率1.0脉冲/秒
/// - 精度0.1米
/// - 干扰抗性阈值1e-3瓦特
/// </remarks>
public class LaserRangefinderConfig
{
/// <summary>
/// 最大测距,单位:米
/// </summary>
public double MaxDetectionRange { get; set; } = 1000.0;
/// <summary>
/// 波长,单位:微米
/// </summary>
public double Wavelength { get; set; } = 1.06;
/// <summary>
/// 脉冲率,单位:脉冲/秒
/// </summary>
public double PulseRate { get; set; } = 100.0;
/// <summary>
/// 精度,单位:米
/// </summary>
public double Accuracy { get; set; } = 0.1;
/// <summary>
/// 干扰抗性阈值,单位:瓦特
/// </summary>
public double JammingResistanceThreshold { get; set; } = 1e-3;
}
/// <summary>
/// 毫米波辐射计配置类
/// </summary>
/// <remarks>
/// 默认值:
/// - 最大探测距离1000米
/// - 波段8毫米
/// - 干扰抗性阈值1e-3瓦特
/// </remarks>
public class MillimeterWaveRadiometerConfig
{
/// <summary>
/// 最大探测距离,单位:米
/// </summary>
public double MaxDetectionRange { get; set; } = 1000.0;
/// <summary>
/// 波段
/// </summary>
public MillimeterWaveBand Band { get; set; } = MillimeterWaveBand.Band3;
/// <summary>
/// 扫描视场角,单位:度
/// </summary>
public double ScanFieldOfView { get; set; } = 1.0;
/// <summary>
/// 干扰抗性阈值,单位:瓦特
/// </summary>
public double JammingResistanceThreshold { get; set; } = 1e-3;
}
/// <summary>
/// 毫米波测高仪配置类
/// </summary>
/// <remarks>
/// 默认值:
/// - 最大探测距离1000米
/// - 波段8毫米
/// - 干扰抗性阈值1e-3瓦特
/// </remarks>
public class MillimeterWaveAltimeterConfig
{
/// <summary>
/// 最大探测距离,单位:米
/// </summary>
public double MaxAltitude { get; set; } = 1000.0;
/// <summary>
/// 波段
/// </summary>
public MillimeterWaveBand Band { get; set; } = MillimeterWaveBand.Band8;
/// <summary>
/// 测量精度,单位:米
/// </summary>
public double MeasurementAccuracy { get; set; } = 0.5;
/// <summary>
/// 扫描视场角,单位:度
/// </summary>
public double ScanFieldOfView { get; set; } = 30.0;
/// <summary>
/// 干扰抗性阈值,单位:瓦特
/// </summary>
public double JammingResistanceThreshold { get; set; } = 1e-3;
}
}

View File

@ -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)