增加了干扰机制;修改了末敏弹的阶段和参数
This commit is contained in:
parent
bde8c7e47e
commit
ee2128b36e
@ -11,6 +11,8 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="coverlet.collector" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
|
||||
<PackageReference Include="MSTest.TestAdapter" Version="3.1.1" />
|
||||
<PackageReference Include="MSTest.TestFramework" Version="3.1.1" />
|
||||
<PackageReference Include="xunit" Version="2.5.3" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3" />
|
||||
</ItemGroup>
|
||||
|
||||
264
ThreatSource.Tests/src/Jamming/JammingTests.cs
Normal file
264
ThreatSource.Tests/src/Jamming/JammingTests.cs
Normal file
@ -0,0 +1,264 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using ThreatSource.Jamming;
|
||||
using ThreatSource.Sensor;
|
||||
using ThreatSource.Missile;
|
||||
using ThreatSource.Simulation;
|
||||
using ThreatSource.Utils;
|
||||
|
||||
namespace ThreatSource.Tests.Jamming
|
||||
{
|
||||
[TestClass]
|
||||
public class JammingTests
|
||||
{
|
||||
private InfraredDetector infraredDetector = null!;
|
||||
private MillimeterWaveRadiometer radiometer = null!;
|
||||
private LaserRangefinder rangefinder = null!;
|
||||
private MillimeterWaveAltimeter altimeter = null!;
|
||||
private TerminalSensitiveSubmunition submunition = null!;
|
||||
private MockSimulationManager simulationManager = null!;
|
||||
|
||||
[TestInitialize]
|
||||
public void Setup()
|
||||
{
|
||||
simulationManager = new MockSimulationManager();
|
||||
var properties = new MissileProperties
|
||||
{
|
||||
Mass = 10,
|
||||
ExplosionRadius = 5,
|
||||
MaxSpeed = 2000
|
||||
};
|
||||
|
||||
submunition = new TerminalSensitiveSubmunition("target1", properties, simulationManager);
|
||||
|
||||
// 初始化传感器
|
||||
infraredDetector = new InfraredDetector(submunition, 500, InfraredBand.Short, 10);
|
||||
radiometer = new MillimeterWaveRadiometer(submunition, 500, MillimeterWaveBand.Band3, 11);
|
||||
altimeter = new MillimeterWaveAltimeter(submunition, 1000, MillimeterWaveBand.Band8, 0.5, 25);
|
||||
rangefinder = new LaserRangefinder(submunition, 500, 1.06, 100, 0.5);
|
||||
|
||||
// 设置子弹到Detection阶段
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
submunition.Update(0.1);
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestInfraredJamming()
|
||||
{
|
||||
// 激活红外探测器
|
||||
infraredDetector.Activate();
|
||||
Assert.IsTrue(infraredDetector.IsActive);
|
||||
|
||||
// 应用红外干扰
|
||||
var jammingParams = new JammingParameters
|
||||
{
|
||||
Type = JammingType.Infrared,
|
||||
Power = 100,
|
||||
AngleRange = 30,
|
||||
Duration = 5,
|
||||
Direction = new Vector3D(1, 0, 0)
|
||||
};
|
||||
|
||||
infraredDetector.ApplyJamming(jammingParams);
|
||||
Assert.IsFalse(infraredDetector.IsActive, "红外探测器应该在干扰下失效");
|
||||
|
||||
// 清除干扰
|
||||
infraredDetector.ClearJamming(JammingType.Infrared);
|
||||
Assert.IsTrue(infraredDetector.IsActive, "红外探测器应该在干扰清除后恢复工作");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestMillimeterWaveJamming()
|
||||
{
|
||||
// 激活毫米波辐射计
|
||||
radiometer.Activate();
|
||||
Assert.IsTrue(radiometer.IsActive);
|
||||
|
||||
// 应用毫米波干扰
|
||||
var jammingParams = new JammingParameters
|
||||
{
|
||||
Type = JammingType.MillimeterWave,
|
||||
Power = 200,
|
||||
AngleRange = 45,
|
||||
Duration = 3,
|
||||
Direction = new Vector3D(1, 0, 0)
|
||||
};
|
||||
|
||||
radiometer.ApplyJamming(jammingParams);
|
||||
Assert.IsFalse(radiometer.IsActive, "毫米波辐射计应该在干扰下失效");
|
||||
|
||||
// 清除干扰
|
||||
radiometer.ClearJamming(JammingType.MillimeterWave);
|
||||
Assert.IsTrue(radiometer.IsActive, "毫米波辐射计应该在干扰清除后恢复工作");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestLaserJamming()
|
||||
{
|
||||
// 激活激光测距仪
|
||||
rangefinder.Activate();
|
||||
Assert.IsTrue(rangefinder.IsActive);
|
||||
|
||||
// 应用激光干扰
|
||||
var jammingParams = new JammingParameters
|
||||
{
|
||||
Type = JammingType.Laser,
|
||||
Power = 150,
|
||||
AngleRange = 15,
|
||||
Duration = 4,
|
||||
Direction = new Vector3D(1, 0, 0)
|
||||
};
|
||||
|
||||
rangefinder.ApplyJamming(jammingParams);
|
||||
Assert.IsFalse(rangefinder.IsActive, "激光测距仪应该在干扰下失效");
|
||||
|
||||
// 清除干扰
|
||||
rangefinder.ClearJamming(JammingType.Laser);
|
||||
Assert.IsTrue(rangefinder.IsActive, "激光测距仪应该在干扰清除后恢复工作");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestSubmunitionJammingResponse()
|
||||
{
|
||||
// 初始化仿真管理器
|
||||
var mockManager = new MockSimulationManager();
|
||||
var mockTarget = new MockTarget("target1") { Position = new Vector3D(100, 0, 100) };
|
||||
mockManager.RegisterEntity("target1", mockTarget);
|
||||
|
||||
// 初始化子弹,设置初始位置在目标正上方120米处(刚好进入探测距离)
|
||||
var properties = new MissileProperties
|
||||
{
|
||||
Mass = 10,
|
||||
ExplosionRadius = 5,
|
||||
MaxSpeed = 2000
|
||||
};
|
||||
var submunition = new TerminalSensitiveSubmunition("target1", properties, mockManager)
|
||||
{
|
||||
Position = new Vector3D(100, 120, 100), // 设置在目标正上方120米处
|
||||
Velocity = new Vector3D(0, -10, 0) // 设置垂直下降速度为10米/秒
|
||||
};
|
||||
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;
|
||||
var rangefinder = submunition.GetType().GetField("rangefinder", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance)?.GetValue(submunition) as LaserRangefinder;
|
||||
|
||||
// 激活传感器
|
||||
infraredDetector?.Activate();
|
||||
radiometer?.Activate();
|
||||
rangefinder?.Activate();
|
||||
|
||||
// 更新子弹状态,让它进入Detection阶段
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
submunition.Update(0.1);
|
||||
var currentStatus = submunition.GetStatus();
|
||||
Console.WriteLine($"更新 {i + 1} 后的状态:{currentStatus}"); // 添加状态输出,帮助调试
|
||||
}
|
||||
|
||||
// 手动设置子弹阶段为Detection
|
||||
var stageField = submunition.GetType().GetField("currentStage", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
|
||||
var stageEnum = submunition.GetType().GetNestedType("SubmunitionStage", System.Reflection.BindingFlags.NonPublic);
|
||||
var detectionStage = Enum.Parse(stageEnum!, "Detection");
|
||||
stageField?.SetValue(submunition, detectionStage);
|
||||
|
||||
// 创建干扰参数
|
||||
var infraredJamming = new JammingParameters
|
||||
{
|
||||
Type = JammingType.Infrared,
|
||||
Power = 100,
|
||||
Duration = 5,
|
||||
Direction = new Vector3D(1, 0, 0)
|
||||
};
|
||||
|
||||
var millimeterWaveJamming = new JammingParameters
|
||||
{
|
||||
Type = JammingType.MillimeterWave,
|
||||
Power = 200,
|
||||
Duration = 5,
|
||||
Direction = new Vector3D(1, 0, 0)
|
||||
};
|
||||
|
||||
// 应用干扰
|
||||
infraredDetector?.ApplyJamming(infraredJamming);
|
||||
radiometer?.ApplyJamming(millimeterWaveJamming);
|
||||
|
||||
// 更新子弹状态
|
||||
submunition.Update(0.1);
|
||||
|
||||
// 验证子弹响应
|
||||
var status = submunition.GetStatus();
|
||||
Console.WriteLine($"应用干扰后的状态:{status}"); // 添加状态输出,帮助调试
|
||||
Assert.IsTrue(status.Contains("传感器受到干扰"), "子弹状态应该反映传感器受到干扰");
|
||||
|
||||
// 清除干扰
|
||||
infraredDetector?.ClearJamming(JammingType.Infrared);
|
||||
radiometer?.ClearJamming(JammingType.MillimeterWave);
|
||||
|
||||
// 再次更新子弹状态
|
||||
submunition.Update(0.1);
|
||||
status = submunition.GetStatus();
|
||||
Console.WriteLine($"清除干扰后的状态:{status}"); // 添加状态输出,帮助调试
|
||||
Assert.IsFalse(infraredDetector?.IsActive == false || radiometer?.IsActive == false, "传感器应该恢复正常工作状态");
|
||||
Assert.IsFalse(status.Contains("传感器受到干扰"), "子弹状态应该反映传感器恢复正常");
|
||||
}
|
||||
}
|
||||
|
||||
// 模拟仿真管理器
|
||||
public class MockSimulationManager : ISimulationManager
|
||||
{
|
||||
private readonly Dictionary<string, object> entities = new();
|
||||
private ISimulationAdapter? adapter;
|
||||
|
||||
void ISimulationManager.PublishEvent<T>(T evt) { }
|
||||
|
||||
void ISimulationManager.SubscribeToEvent<T>(Action<T> handler) { }
|
||||
|
||||
void ISimulationManager.UnsubscribeFromEvent<T>(Action<T> handler) { }
|
||||
|
||||
public bool RegisterEntity(string id, object entity)
|
||||
{
|
||||
entities[id] = entity;
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool UnregisterEntity(string id)
|
||||
{
|
||||
return entities.Remove(id);
|
||||
}
|
||||
|
||||
public object GetEntityById(string id)
|
||||
{
|
||||
return entities.TryGetValue(id, out var entity) ? entity : new MockTarget("mock_target") { Position = new Vector3D(100, 50, 100) };
|
||||
}
|
||||
|
||||
public IReadOnlyList<T> GetEntitiesByType<T>() where T : class
|
||||
{
|
||||
return entities.Values.OfType<T>().ToList();
|
||||
}
|
||||
|
||||
public IReadOnlyList<object> GetAllEntities()
|
||||
{
|
||||
return entities.Values.ToList();
|
||||
}
|
||||
|
||||
public void SetSimulationAdapter(ISimulationAdapter adapter)
|
||||
{
|
||||
this.adapter = adapter;
|
||||
}
|
||||
|
||||
public ISimulationAdapter? GetSimulationAdapter()
|
||||
{
|
||||
return adapter;
|
||||
}
|
||||
}
|
||||
|
||||
// 模拟目标
|
||||
public class MockTarget : SimulationElement
|
||||
{
|
||||
public MockTarget(string id) : base(id, new Vector3D(100, 50, 100), new Orientation(), 1000, null) { }
|
||||
public override void Update(double deltaTime) { }
|
||||
}
|
||||
}
|
||||
@ -144,9 +144,18 @@ namespace ThreatSource.Indicator
|
||||
/// </remarks>
|
||||
public enum IndicatorType
|
||||
{
|
||||
LaserDisintegrator, // 激光指示器
|
||||
LaserBeamRider, // 激光波束制导器
|
||||
InfraredTracker // 红外跟踪器
|
||||
/// <summary>
|
||||
/// 激光指示器
|
||||
/// </summary>
|
||||
LaserDisintegrator,
|
||||
/// <summary>
|
||||
/// 激光波束制导器
|
||||
/// </summary>
|
||||
LaserBeamRider,
|
||||
/// <summary>
|
||||
/// 红外跟踪器
|
||||
/// </summary>
|
||||
InfraredTracker
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -160,7 +169,13 @@ namespace ThreatSource.Indicator
|
||||
/// </remarks>
|
||||
public enum IndicatorState
|
||||
{
|
||||
Indicating, // 指示状态
|
||||
Idle // 空闲状态
|
||||
/// <summary>
|
||||
/// 指示状态
|
||||
/// </summary>
|
||||
Indicating,
|
||||
/// <summary>
|
||||
/// 空闲状态
|
||||
/// </summary>
|
||||
Idle
|
||||
}
|
||||
}
|
||||
|
||||
32
ThreatSource/src/Jamming/IJammable.cs
Normal file
32
ThreatSource/src/Jamming/IJammable.cs
Normal file
@ -0,0 +1,32 @@
|
||||
using ThreatSource.Utils;
|
||||
|
||||
namespace ThreatSource.Jamming
|
||||
{
|
||||
/// <summary>
|
||||
/// 可干扰设备接口
|
||||
/// </summary>
|
||||
public interface IJammable
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取设备支持的干扰类型
|
||||
/// </summary>
|
||||
IEnumerable<JammingType> SupportedJammingTypes { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取设备当前是否处于被干扰状态
|
||||
/// </summary>
|
||||
bool IsJammed { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 应用干扰
|
||||
/// </summary>
|
||||
/// <param name="parameters">干扰参数</param>
|
||||
void ApplyJamming(JammingParameters parameters);
|
||||
|
||||
/// <summary>
|
||||
/// 清除干扰
|
||||
/// </summary>
|
||||
/// <param name="type">要清除的干扰类型</param>
|
||||
void ClearJamming(JammingType type);
|
||||
}
|
||||
}
|
||||
37
ThreatSource/src/Jamming/InfraredJammingHandler.cs
Normal file
37
ThreatSource/src/Jamming/InfraredJammingHandler.cs
Normal file
@ -0,0 +1,37 @@
|
||||
using ThreatSource.Sensor;
|
||||
|
||||
namespace ThreatSource.Jamming
|
||||
{
|
||||
/// <summary>
|
||||
/// 红外干扰处理器
|
||||
///
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 红外干扰处理器
|
||||
/// </remarks>
|
||||
/// <param name="detector">红外探测器</param>
|
||||
public class InfraredJammingHandler(InfraredDetector detector) : JammingHandler
|
||||
{
|
||||
private readonly InfraredDetector detector = detector;
|
||||
|
||||
/// <summary>
|
||||
/// 当干扰被应用时调用
|
||||
/// </summary>
|
||||
/// <param name="parameters">干扰参数</param>
|
||||
protected override void OnJammingApplied(JammingParameters parameters)
|
||||
{
|
||||
detector.IsActive = false;
|
||||
Console.WriteLine($"红外探测器受到干扰,功率:{parameters.Power}瓦特");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当干扰被清除时调用
|
||||
/// </summary>
|
||||
/// <param name="parameters">被清除的干扰参数</param>
|
||||
protected override void OnJammingCleared(JammingParameters? parameters)
|
||||
{
|
||||
detector.IsActive = true;
|
||||
Console.WriteLine("红外探测器干扰解除");
|
||||
}
|
||||
}
|
||||
}
|
||||
73
ThreatSource/src/Jamming/JammingHandler.cs
Normal file
73
ThreatSource/src/Jamming/JammingHandler.cs
Normal file
@ -0,0 +1,73 @@
|
||||
namespace ThreatSource.Jamming
|
||||
{
|
||||
/// <summary>
|
||||
/// 干扰处理基类
|
||||
/// </summary>
|
||||
public abstract class JammingHandler
|
||||
{
|
||||
/// <summary>
|
||||
/// 是否处于被干扰状态
|
||||
/// </summary>
|
||||
public bool IsJammed { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 当前干扰参数
|
||||
/// </summary>
|
||||
protected JammingParameters? CurrentJamming { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新干扰状态
|
||||
/// </summary>
|
||||
/// <param name="deltaTime">时间步长,单位:秒</param>
|
||||
public virtual void Update(double deltaTime)
|
||||
{
|
||||
if (IsJammed && CurrentJamming?.Duration != null)
|
||||
{
|
||||
// 检查是否超时
|
||||
var elapsed = (DateTime.Now - CurrentJamming.StartTime).TotalSeconds;
|
||||
if (elapsed >= CurrentJamming.Duration)
|
||||
{
|
||||
ClearJamming();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 处理干扰
|
||||
/// </summary>
|
||||
/// <param name="parameters">干扰参数</param>
|
||||
public virtual void HandleJamming(JammingParameters parameters)
|
||||
{
|
||||
parameters.StartTime = DateTime.Now;
|
||||
IsJammed = true;
|
||||
CurrentJamming = parameters;
|
||||
OnJammingApplied(parameters);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 清除干扰
|
||||
/// </summary>
|
||||
public virtual void ClearJamming()
|
||||
{
|
||||
if (IsJammed)
|
||||
{
|
||||
IsJammed = false;
|
||||
var oldJamming = CurrentJamming;
|
||||
CurrentJamming = null;
|
||||
OnJammingCleared(oldJamming);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当干扰被应用时调用
|
||||
/// </summary>
|
||||
/// <param name="parameters">干扰参数</param>
|
||||
protected abstract void OnJammingApplied(JammingParameters parameters);
|
||||
|
||||
/// <summary>
|
||||
/// 当干扰被清除时调用
|
||||
/// </summary>
|
||||
/// <param name="parameters">被清除的干扰参数</param>
|
||||
protected abstract void OnJammingCleared(JammingParameters? parameters);
|
||||
}
|
||||
}
|
||||
28
ThreatSource/src/Jamming/JammingMode.cs
Normal file
28
ThreatSource/src/Jamming/JammingMode.cs
Normal file
@ -0,0 +1,28 @@
|
||||
namespace ThreatSource.Jamming
|
||||
{
|
||||
/// <summary>
|
||||
/// 干扰模式枚举
|
||||
/// </summary>
|
||||
public enum JammingMode
|
||||
{
|
||||
/// <summary>
|
||||
/// 噪声干扰
|
||||
/// </summary>
|
||||
Noise,
|
||||
|
||||
/// <summary>
|
||||
/// 欺骗干扰
|
||||
/// </summary>
|
||||
Deception,
|
||||
|
||||
/// <summary>
|
||||
/// 阻塞干扰
|
||||
/// </summary>
|
||||
Blocking,
|
||||
|
||||
/// <summary>
|
||||
/// 扫频干扰
|
||||
/// </summary>
|
||||
Sweep
|
||||
}
|
||||
}
|
||||
54
ThreatSource/src/Jamming/JammingParameters.cs
Normal file
54
ThreatSource/src/Jamming/JammingParameters.cs
Normal file
@ -0,0 +1,54 @@
|
||||
using ThreatSource.Utils;
|
||||
|
||||
namespace ThreatSource.Jamming
|
||||
{
|
||||
/// <summary>
|
||||
/// 干扰参数类
|
||||
/// </summary>
|
||||
public class JammingParameters
|
||||
{
|
||||
/// <summary>
|
||||
/// 干扰类型
|
||||
/// </summary>
|
||||
public JammingType Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 干扰功率,单位:瓦特
|
||||
/// </summary>
|
||||
public double Power { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 干扰方向
|
||||
/// </summary>
|
||||
public required Vector3D Direction { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 干扰角度范围,单位:弧度
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 定义了干扰波束的发散角度
|
||||
/// 影响干扰的覆盖范围
|
||||
/// </remarks>
|
||||
public double AngleRange { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 干扰频率,单位:赫兹
|
||||
/// </summary>
|
||||
public double Frequency { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 持续时间,单位:秒,null表示持续干扰
|
||||
/// </summary>
|
||||
public double? Duration { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 干扰模式
|
||||
/// </summary>
|
||||
public JammingMode Mode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 干扰开始时间
|
||||
/// </summary>
|
||||
public DateTime StartTime { get; set; }
|
||||
}
|
||||
}
|
||||
33
ThreatSource/src/Jamming/JammingType.cs
Normal file
33
ThreatSource/src/Jamming/JammingType.cs
Normal file
@ -0,0 +1,33 @@
|
||||
namespace ThreatSource.Jamming
|
||||
{
|
||||
/// <summary>
|
||||
/// 干扰类型枚举
|
||||
/// </summary>
|
||||
public enum JammingType
|
||||
{
|
||||
/// <summary>
|
||||
/// 红外干扰
|
||||
/// </summary>
|
||||
Infrared,
|
||||
|
||||
/// <summary>
|
||||
/// 毫米波干扰
|
||||
/// </summary>
|
||||
MillimeterWave,
|
||||
|
||||
/// <summary>
|
||||
/// 激光干扰
|
||||
/// </summary>
|
||||
Laser,
|
||||
|
||||
/// <summary>
|
||||
/// 射频干扰
|
||||
/// </summary>
|
||||
RadioFrequency,
|
||||
|
||||
/// <summary>
|
||||
/// GPS干扰
|
||||
/// </summary>
|
||||
GPS
|
||||
}
|
||||
}
|
||||
36
ThreatSource/src/Jamming/LaserJammingHandler.cs
Normal file
36
ThreatSource/src/Jamming/LaserJammingHandler.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using ThreatSource.Sensor;
|
||||
|
||||
namespace ThreatSource.Jamming
|
||||
{
|
||||
/// <summary>
|
||||
/// 激光干扰处理器
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 激光干扰处理器
|
||||
/// </remarks>
|
||||
/// <param name="rangefinder">激光测距仪</param>
|
||||
public class LaserJammingHandler(LaserRangefinder rangefinder) : JammingHandler
|
||||
{
|
||||
private readonly LaserRangefinder rangefinder = rangefinder;
|
||||
|
||||
/// <summary>
|
||||
/// 当干扰被应用时调用
|
||||
/// </summary>
|
||||
/// <param name="parameters">干扰参数</param>
|
||||
protected override void OnJammingApplied(JammingParameters parameters)
|
||||
{
|
||||
rangefinder.IsActive = false;
|
||||
Console.WriteLine($"激光测距仪受到干扰,功率:{parameters.Power}瓦特");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当干扰被清除时调用
|
||||
/// </summary>
|
||||
/// <param name="parameters">被清除的干扰参数</param>
|
||||
protected override void OnJammingCleared(JammingParameters? parameters)
|
||||
{
|
||||
rangefinder.IsActive = true;
|
||||
Console.WriteLine("激光测距仪干扰解除");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
using ThreatSource.Sensor;
|
||||
|
||||
namespace ThreatSource.Jamming
|
||||
{
|
||||
/// <summary>
|
||||
/// 毫米波测高雷达干扰处理器
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 初始化毫米波测高雷达干扰处理器
|
||||
/// </remarks>
|
||||
/// <param name="altimeter">毫米波测高雷达</param>
|
||||
public class MillimeterWaveAltimeterJammingHandler(MillimeterWaveAltimeter altimeter) : JammingHandler
|
||||
{
|
||||
private readonly MillimeterWaveAltimeter altimeter = altimeter;
|
||||
|
||||
/// <summary>
|
||||
/// 当干扰被应用时调用
|
||||
/// </summary>
|
||||
/// <param name="parameters">干扰参数</param>
|
||||
protected override void OnJammingApplied(JammingParameters parameters)
|
||||
{
|
||||
altimeter.IsActive = false;
|
||||
Console.WriteLine($"毫米波测高雷达受到干扰,功率:{parameters.Power}瓦特");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当干扰被清除时调用
|
||||
/// </summary>
|
||||
/// <param name="parameters">被清除的干扰参数</param>
|
||||
protected override void OnJammingCleared(JammingParameters? parameters)
|
||||
{
|
||||
altimeter.IsActive = true;
|
||||
Console.WriteLine("毫米波测高雷达干扰解除");
|
||||
}
|
||||
}
|
||||
}
|
||||
36
ThreatSource/src/Jamming/MillimeterWaveJammingHandler.cs
Normal file
36
ThreatSource/src/Jamming/MillimeterWaveJammingHandler.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using ThreatSource.Sensor;
|
||||
|
||||
namespace ThreatSource.Jamming
|
||||
{
|
||||
/// <summary>
|
||||
/// 毫米波干扰处理器
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 毫米波干扰处理器
|
||||
/// </remarks>
|
||||
/// <param name="radiometer">毫米波辐射计</param>
|
||||
public class MillimeterWaveJammingHandler(MillimeterWaveRadiometer radiometer) : JammingHandler
|
||||
{
|
||||
private readonly MillimeterWaveRadiometer radiometer = radiometer;
|
||||
|
||||
/// <summary>
|
||||
/// 当干扰被应用时调用
|
||||
/// </summary>
|
||||
/// <param name="parameters">干扰参数</param>
|
||||
protected override void OnJammingApplied(JammingParameters parameters)
|
||||
{
|
||||
radiometer.IsActive = false;
|
||||
Console.WriteLine($"毫米波辐射计受到干扰,功率:{parameters.Power}瓦特");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当干扰被清除时调用
|
||||
/// </summary>
|
||||
/// <param name="parameters">被清除的干扰参数</param>
|
||||
protected override void OnJammingCleared(JammingParameters? parameters)
|
||||
{
|
||||
radiometer.IsActive = true;
|
||||
Console.WriteLine("毫米波辐射计干扰解除");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -154,6 +154,16 @@ namespace ThreatSource.Missile
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新导弹的运动状态
|
||||
/// </summary>
|
||||
/// <param name="deltaTime">时间步长,单位:秒</param>
|
||||
/// <remarks>
|
||||
/// 更新过程:
|
||||
/// - 计算合加速度
|
||||
/// - 根据制导状态选择运动更新方法
|
||||
/// - 更新导弹的位置和速度
|
||||
/// </remarks>
|
||||
protected virtual void UpdateMotionState(double deltaTime)
|
||||
{
|
||||
//Vector3D acceleration = CalculateAcceleration(Velocity);
|
||||
@ -299,12 +309,28 @@ namespace ThreatSource.Missile
|
||||
Deactivate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 激活导弹
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 激活过程:
|
||||
/// - 调用基类激活方法
|
||||
/// - 订阅目标命中事件
|
||||
/// </remarks>
|
||||
public override void Activate()
|
||||
{
|
||||
base.Activate();
|
||||
SimulationManager.SubscribeToEvent<TargetHitEvent>(OnTargetHitEvent);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 停用导弹
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 停用过程:
|
||||
/// - 调用基类停用方法
|
||||
/// - 取消订阅目标命中事件
|
||||
/// </remarks>
|
||||
public override void Deactivate()
|
||||
{
|
||||
base.Deactivate();
|
||||
|
||||
@ -17,13 +17,34 @@ namespace ThreatSource.Missile
|
||||
/// </remarks>
|
||||
public enum MissileType
|
||||
{
|
||||
StandardMissile, // 标准导弹
|
||||
LaserSemiActiveGuidance, // 激光半主动制导
|
||||
LaserBeamRiderGuidance, // 激光驾束制导
|
||||
InfraredCommandGuidance, // 红外指令制导
|
||||
InfraredImagingTerminalGuidance, // 红外成像末制导
|
||||
MillimeterWaveTerminalGuidance, // 毫米波末制导
|
||||
TerminalSensitiveMissile // 末敏弹
|
||||
/// <summary>
|
||||
/// 标准导弹
|
||||
/// </summary>
|
||||
StandardMissile,
|
||||
/// <summary>
|
||||
/// 激光半主动制导
|
||||
/// </summary>
|
||||
LaserSemiActiveGuidance,
|
||||
/// <summary>
|
||||
/// 激光驾束制导
|
||||
/// </summary>
|
||||
LaserBeamRiderGuidance,
|
||||
/// <summary>
|
||||
/// 红外指令制导
|
||||
/// </summary>
|
||||
InfraredCommandGuidance,
|
||||
/// <summary>
|
||||
/// 红外成像末制导
|
||||
/// </summary>
|
||||
InfraredImagingTerminalGuidance,
|
||||
/// <summary>
|
||||
/// 毫米波末制导
|
||||
/// </summary>
|
||||
MillimeterWaveTerminalGuidance,
|
||||
/// <summary>
|
||||
/// 末敏弹
|
||||
/// </summary>
|
||||
TerminalSensitiveMissile
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -21,10 +21,12 @@ namespace ThreatSource.Missile
|
||||
/// 子弹飞行阶段枚举
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 定义了子弹飞行的六个主要阶段:
|
||||
/// 定义了子弹飞行的八个主要阶段:
|
||||
/// - Separation:分离阶段,从母弹分离
|
||||
/// - Deceleration:减速阶段,调整速度
|
||||
/// - SpiralScan:螺旋扫描阶段,搜索目标
|
||||
/// - ParachuteDeployment:降落伞打开阶段,稳定下降
|
||||
/// - StableScan:稳定扫描阶段,稳定下降
|
||||
/// - Detection:目标探测阶段,搜索确定目标
|
||||
/// - Attack:攻击阶段,末端制导
|
||||
/// - Explode:爆炸阶段,命中目标
|
||||
/// - SelfDestruct:自毁阶段,触发自毁
|
||||
@ -33,7 +35,9 @@ namespace ThreatSource.Missile
|
||||
{
|
||||
Separation, // 分离阶段
|
||||
Deceleration, // 减速阶段
|
||||
SpiralScan, // 螺旋扫描阶段
|
||||
ParachuteDeployment, // 降落伞打开阶段
|
||||
StableScan, // 稳定扫描阶段
|
||||
Detection, // 目标探测阶段
|
||||
Attack, // 攻击阶段
|
||||
Explode, // 爆炸阶段
|
||||
SelfDestruct // 自毁阶段
|
||||
@ -57,13 +61,21 @@ namespace ThreatSource.Missile
|
||||
/// </remarks>
|
||||
private const double SpiralRotationSpeed = 8 * Math.PI;
|
||||
|
||||
/// <summary>
|
||||
/// 减速阶段末速,单位:米/秒
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 定义了减速阶段的垂直下降速度
|
||||
/// </remarks>
|
||||
private const double DecelerationEndSpeed = 40;
|
||||
|
||||
/// <summary>
|
||||
/// 垂直下降速度,单位:米/秒
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 定义了扫描和攻击阶段的垂直下降速度
|
||||
/// </remarks>
|
||||
private const double VerticalDescentSpeed = 10;
|
||||
private const double VerticalDeclineSpeed = 10;
|
||||
|
||||
/// <summary>
|
||||
/// 扫描角度,单位:弧度
|
||||
@ -72,16 +84,16 @@ namespace ThreatSource.Missile
|
||||
/// 定义了螺旋扫描的锥角
|
||||
/// 30度 = π/6弧度
|
||||
/// </remarks>
|
||||
private const double ScanAngle = 30 * Math.PI / 180;
|
||||
public const double ScanAngle = 30 * Math.PI / 180;
|
||||
|
||||
/// <summary>
|
||||
/// 减速高度,单位:米
|
||||
/// 开伞高度,单位:米
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 开始减速的高度阈值
|
||||
/// 影响减速阶段的触发时机
|
||||
/// 打开降落伞的高度阈值
|
||||
/// 影响降落伞打开阶段的触发时机
|
||||
/// </remarks>
|
||||
private const double DecelerationHeight = 400;
|
||||
private const double ParachuteDeploymentHeight = 400;
|
||||
|
||||
/// <summary>
|
||||
/// 减速加速度,单位:米/秒²
|
||||
@ -93,13 +105,22 @@ namespace ThreatSource.Missile
|
||||
private const double DecelerationAcceleration = 50;
|
||||
|
||||
/// <summary>
|
||||
/// 扫描高度,单位:米
|
||||
/// 稳定扫描高度,单位:米
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 开始螺旋扫描的高度阈值
|
||||
/// 影响扫描阶段的触发时机
|
||||
/// </remarks>
|
||||
private const double ScanningHeight = 200;
|
||||
private const double StableScanHeight = 200;
|
||||
|
||||
/// <summary>
|
||||
/// 目标探测距离,单位:米
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 目标探测的距离阈值
|
||||
/// 影响目标探测阶段的触发时机
|
||||
/// </remarks>
|
||||
private const double TargetDetectionDistance = 120;
|
||||
|
||||
/// <summary>
|
||||
/// 自毁高度,单位:米
|
||||
@ -224,10 +245,10 @@ namespace ThreatSource.Missile
|
||||
detectionAngle = 0;
|
||||
|
||||
// 初始化传感器
|
||||
infraredDetector = new InfraredDetector(this, 500, 5); // 红外探测器,探测距离 500 米,视场角5度
|
||||
radiometer = new MillimeterWaveRadiometer(this, 3, 5); // 毫米波辐射计,工作波段3mm,扫描视场角5度
|
||||
altimeter = new MillimeterWaveAltimeter(this, 1000, 0.1); // 毫米波测高仪,测量精度0.1米
|
||||
rangefinder = new LaserRangefinder(Position, Orientation, 1000, 1000);
|
||||
infraredDetector = new InfraredDetector(this, 500, InfraredBand.Short, 10); // 红外探测器,探测距离 500 米,近红外,视场角10度
|
||||
radiometer = new MillimeterWaveRadiometer(this, 500, MillimeterWaveBand.Band3, 11); // 毫米波辐射计,探测距离500米,工作波段3mm,扫描视场角11度
|
||||
altimeter = new MillimeterWaveAltimeter(this, 1000, MillimeterWaveBand.Band8, 0.5, 25); // 毫米波测高仪,测量精度0.5米
|
||||
rangefinder = new LaserRangefinder(this, 500, 1.06, 100, 0.5); // 激光测距仪,测量距离500米,波长1.06µm,测量频率100Hz,测量精度0.5米
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -259,8 +280,14 @@ namespace ThreatSource.Missile
|
||||
case SubmunitionStage.Deceleration:
|
||||
UpdateDecelerationStage(deltaTime);
|
||||
break;
|
||||
case SubmunitionStage.SpiralScan:
|
||||
UpdateSpiralScanStage(deltaTime);
|
||||
case SubmunitionStage.ParachuteDeployment:
|
||||
UpdateParachuteDeploymentStage(deltaTime);
|
||||
break;
|
||||
case SubmunitionStage.StableScan:
|
||||
UpdateStableScanStage(deltaTime);
|
||||
break;
|
||||
case SubmunitionStage.Detection:
|
||||
UpdateDetectionStage(deltaTime);
|
||||
break;
|
||||
case SubmunitionStage.Attack:
|
||||
UpdateAttackStage(deltaTime);
|
||||
@ -282,8 +309,7 @@ namespace ThreatSource.Missile
|
||||
/// 分离阶段处理:
|
||||
/// - 施加重力加速度
|
||||
/// - 更新位置和速度
|
||||
/// - 激活测高仪
|
||||
/// - 检查高度条件
|
||||
/// - 分离阶段结束,进入减速阶段
|
||||
/// </remarks>
|
||||
private void UpdateSeparationStage(double deltaTime)
|
||||
{
|
||||
@ -292,18 +318,8 @@ namespace ThreatSource.Missile
|
||||
Velocity += deceleration * deltaTime;
|
||||
Position += Velocity * deltaTime;
|
||||
|
||||
if(!altimeter.IsActive)
|
||||
{
|
||||
// 激活毫米波测高雷达
|
||||
altimeter.Activate();
|
||||
}
|
||||
|
||||
// 检查高度是否小于等于减速高度
|
||||
if(((AltimeterSensorData)altimeter.GetSensorData()).Altitude <= DecelerationHeight)
|
||||
{
|
||||
// 如果是,则进入减速阶段
|
||||
currentStage = SubmunitionStage.Deceleration;
|
||||
}
|
||||
// 分离阶段结束,进入减速阶段
|
||||
currentStage = SubmunitionStage.Deceleration;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -316,28 +332,79 @@ namespace ThreatSource.Missile
|
||||
/// - 计算减速加速度
|
||||
/// - 更新速度和位置
|
||||
/// - 检查高度条件
|
||||
/// - 如果高度小于等于开伞高度,则进入降落伞打开阶段
|
||||
/// </remarks>
|
||||
private void UpdateDecelerationStage(double deltaTime)
|
||||
{
|
||||
IsGuidance = true;
|
||||
|
||||
if(!altimeter.IsActive)
|
||||
{
|
||||
// 激活毫米波测高雷达
|
||||
altimeter.Activate();
|
||||
}
|
||||
|
||||
// 减速减旋,垂直速度减小
|
||||
Vector3D deceleration = - Velocity.Normalize() * DecelerationAcceleration;
|
||||
Velocity += deceleration * deltaTime;
|
||||
|
||||
if (Velocity.Magnitude() <= VerticalDescentSpeed)
|
||||
if (Velocity.Magnitude() <= DecelerationEndSpeed)
|
||||
{
|
||||
Velocity = new Vector3D(0, -VerticalDescentSpeed, 0);
|
||||
Velocity = new Vector3D(0, -DecelerationEndSpeed, 0);
|
||||
GuidanceAcceleration = Vector3D.Zero;
|
||||
}
|
||||
|
||||
if (((AltimeterSensorData)altimeter.GetSensorData()).Altitude <= ScanningHeight)
|
||||
|
||||
if(IsSensorsJammed())
|
||||
{
|
||||
currentStage = SubmunitionStage.SpiralScan;
|
||||
// 如果传感器受到干扰,则高度计无法工作
|
||||
Console.WriteLine("减速阶段:传感器受到干扰,无法进行高度测量");
|
||||
return;
|
||||
}
|
||||
|
||||
// 检查高度是否小于等于开伞高度
|
||||
if(((AltimeterSensorData)altimeter.GetSensorData()).Altitude <= ParachuteDeploymentHeight)
|
||||
{
|
||||
// 如果是,则进入降落伞打开阶段
|
||||
currentStage = SubmunitionStage.ParachuteDeployment;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新降落伞打开阶段状态
|
||||
/// </summary>
|
||||
/// <param name="deltaTime">时间步长,单位:秒</param>
|
||||
/// <remarks>
|
||||
/// 降落伞打开阶段处理:
|
||||
/// - 打开降落伞
|
||||
/// - 降落伞减速和稳定
|
||||
/// - 调整姿态准备扫描
|
||||
/// - 激活测高雷达开始工作(第二次测高)
|
||||
/// - 在200米高度进入扫描阶段
|
||||
/// - 此时子弹速度 10 米/秒
|
||||
/// </remarks>
|
||||
private void UpdateParachuteDeploymentStage(double deltaTime)
|
||||
{
|
||||
if (Velocity.Magnitude() <= VerticalDeclineSpeed)
|
||||
{
|
||||
Velocity = new Vector3D(0, -VerticalDeclineSpeed, 0);
|
||||
GuidanceAcceleration = Vector3D.Zero;
|
||||
}
|
||||
|
||||
if(IsSensorsJammed())
|
||||
{
|
||||
// 如果传感器受到干扰,则高度计无法工作
|
||||
Console.WriteLine("开伞阶段:传感器受到干扰,无法进行高度测量");
|
||||
return;
|
||||
}
|
||||
|
||||
if (((AltimeterSensorData)altimeter.GetSensorData()).Altitude <= StableScanHeight)
|
||||
{
|
||||
currentStage = SubmunitionStage.StableScan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新螺旋扫描阶段状态
|
||||
/// 更新稳定扫描阶段状态
|
||||
/// </summary>
|
||||
/// <param name="deltaTime">时间步长,单位:秒</param>
|
||||
/// <remarks>
|
||||
@ -347,7 +414,7 @@ namespace ThreatSource.Missile
|
||||
/// - 处理目标探测
|
||||
/// - 检查目标确认条件
|
||||
/// </remarks>
|
||||
private void UpdateSpiralScanStage(double deltaTime)
|
||||
private void UpdateStableScanStage(double deltaTime)
|
||||
{
|
||||
if(!radiometer.IsActive)
|
||||
{
|
||||
@ -359,15 +426,51 @@ namespace ThreatSource.Missile
|
||||
// 激活红外探测器
|
||||
infraredDetector.Activate();
|
||||
}
|
||||
|
||||
Velocity = new Vector3D(0, -VerticalDescentSpeed, 0);
|
||||
GuidanceAcceleration = Vector3D.Zero;
|
||||
if(!rangefinder.IsActive)
|
||||
{
|
||||
// 激活激光测距仪
|
||||
rangefinder.Activate();
|
||||
}
|
||||
|
||||
// 检查传感器干扰状态
|
||||
if (IsSensorsJammed())
|
||||
{
|
||||
Console.WriteLine("稳定扫描阶段:传感器受到干扰,无法进行距离测量");
|
||||
return;
|
||||
}
|
||||
|
||||
// 如果距离小于等于目标探测距离,则进入目标探测阶段
|
||||
if (((RangefinderSensorData)rangefinder.GetSensorData()).Distance <= TargetDetectionDistance)
|
||||
{
|
||||
currentStage = SubmunitionStage.Detection;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新目标探测阶段状态
|
||||
/// </summary>
|
||||
/// <param name="deltaTime">时间步长,单位:秒</param>
|
||||
/// <remarks>
|
||||
/// 目标探测阶段处理:
|
||||
/// - 多传感器协同工作
|
||||
/// - 进行目标特征识别
|
||||
/// - 执行二次扫描确认
|
||||
/// - 为攻击阶段做准备
|
||||
/// </remarks>
|
||||
private void UpdateDetectionStage(double deltaTime)
|
||||
{
|
||||
// 检查传感器干扰状态
|
||||
if (IsSensorsJammed())
|
||||
{
|
||||
Console.WriteLine("探测阶段:传感器受到干扰,无法进行目标探测");
|
||||
return;
|
||||
}
|
||||
|
||||
// 更新螺旋角度
|
||||
spiralAngle = (spiralAngle + SpiralRotationSpeed * deltaTime) % (2 * Math.PI);
|
||||
|
||||
// 计算水平速度分量
|
||||
double horizontalSpeed = VerticalDescentSpeed * Math.Tan(ScanAngle);
|
||||
double horizontalSpeed = VerticalDeclineSpeed * Math.Tan(ScanAngle);
|
||||
Vector3D horizontalVelocity = new(
|
||||
Math.Cos(spiralAngle) * horizontalSpeed,
|
||||
0,
|
||||
@ -375,7 +478,7 @@ namespace ThreatSource.Missile
|
||||
);
|
||||
|
||||
// 更新速度
|
||||
Velocity = new(horizontalVelocity.X, -VerticalDescentSpeed, horizontalVelocity.Z);
|
||||
Velocity = new(horizontalVelocity.X, -VerticalDeclineSpeed, horizontalVelocity.Z);
|
||||
|
||||
// 计算扫描方向
|
||||
scanDirection = new(
|
||||
@ -408,12 +511,12 @@ namespace ThreatSource.Missile
|
||||
}
|
||||
|
||||
// 使用模式匹配简化类型转换
|
||||
if (altimeter.GetSensorData() is AltimeterSensorData altimeterData &&
|
||||
altimeterData.Altitude <= SelfDestructHeight)
|
||||
if (rangefinder.GetSensorData() is RangefinderSensorData rangefinderData &&
|
||||
rangefinderData.Distance <= SelfDestructHeight)
|
||||
{
|
||||
currentStage = SubmunitionStage.SelfDestruct;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新攻击阶段状态
|
||||
@ -422,18 +525,21 @@ namespace ThreatSource.Missile
|
||||
/// <remarks>
|
||||
/// 攻击阶段处理:
|
||||
/// - 获取目标位置
|
||||
/// - 计算制导指令
|
||||
/// - 更新速度和方向
|
||||
/// - 计算攻击速度
|
||||
/// - 更新速度和位置
|
||||
/// - 检查命中条件
|
||||
/// </remarks>
|
||||
private void UpdateAttackStage(double deltaTime)
|
||||
{
|
||||
Console.WriteLine("攻击阶段");
|
||||
// 攻击逻辑
|
||||
SimulationElement target = SimulationManager.GetEntityById(TargetId) as SimulationElement ?? throw new Exception("目标不存在");
|
||||
Vector3D targetPosition = target.Position;
|
||||
Vector3D direction = (targetPosition - Position).Normalize();
|
||||
Velocity = direction * AttackSpeed;
|
||||
|
||||
// 计算攻击速度,攻击角度为最后的扫描方向
|
||||
Velocity = scanDirection * AttackSpeed;
|
||||
Position += Velocity * deltaTime;
|
||||
|
||||
// 检查命中条件
|
||||
if ((targetPosition - Position).Magnitude() <= MissileProperties.ExplosionRadius)
|
||||
{
|
||||
currentStage = SubmunitionStage.Explode;
|
||||
@ -553,7 +659,52 @@ namespace ThreatSource.Missile
|
||||
/// </remarks>
|
||||
public override string GetStatus()
|
||||
{
|
||||
return $"{base.GetStatus()}\n运行状态: {currentStage}\n检测角度: {detectionAngle * 180 / Math.PI:F2}°\n螺旋角度: {spiralAngle * 180 / Math.PI:F2}°\n目标检测: {lastDetectionTime != null}";
|
||||
var status = $"{base.GetStatus()}\n运行状态: {currentStage}\n检测角度: {detectionAngle * 180 / Math.PI:F2}°\n螺旋角度: {spiralAngle * 180 / Math.PI:F2}°\n目标检测: {lastDetectionTime != null}";
|
||||
|
||||
// 使用IsSensorsJammed方法检查当前阶段所需传感器的状态
|
||||
if (IsSensorsJammed())
|
||||
{
|
||||
status += "\n传感器受到干扰";
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检查传感器是否受到干扰
|
||||
/// </summary>
|
||||
/// <returns>如果当前阶段的关键传感器都被干扰返回true,否则返回false</returns>
|
||||
/// <remarks>
|
||||
/// 不同阶段的检查逻辑:
|
||||
/// - Deceleration阶段:测高仪被干扰才返回true
|
||||
/// - ParachuteDeployment阶段:测高仪被干扰才返回true
|
||||
/// - StableScan阶段:激光测距仪被干扰才返回true
|
||||
/// - Detection阶段:红外探测器和毫米波辐射计都被干扰才返回true
|
||||
/// - Attack阶段:红外探测器和毫米波辐射计都被干扰才返回true
|
||||
/// </remarks>
|
||||
private bool IsSensorsJammed()
|
||||
{
|
||||
// 根据当前阶段检查相应传感器的干扰状态
|
||||
switch (currentStage)
|
||||
{
|
||||
case SubmunitionStage.Deceleration:
|
||||
// 减速阶段需要测高仪
|
||||
return altimeter.IsJammed;
|
||||
case SubmunitionStage.ParachuteDeployment:
|
||||
// 开伞阶段需要测高仪
|
||||
return altimeter.IsJammed;
|
||||
case SubmunitionStage.StableScan:
|
||||
// 稳定扫描阶段需要激光测距仪
|
||||
return rangefinder.IsJammed;
|
||||
case SubmunitionStage.Detection:
|
||||
// 目标探测阶段需要红外探测器和毫米波辐射计
|
||||
return infraredDetector.IsJammed && radiometer.IsJammed;
|
||||
case SubmunitionStage.Attack:
|
||||
// 攻击阶段需要红外探测器和毫米波辐射计
|
||||
return infraredDetector.IsJammed && radiometer.IsJammed;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
using ThreatSource.Missile;
|
||||
using ThreatSource.Utils;
|
||||
using ThreatSource.Jamming;
|
||||
|
||||
namespace ThreatSource.Sensor
|
||||
{
|
||||
@ -34,6 +36,11 @@ namespace ThreatSource.Sensor
|
||||
/// </remarks>
|
||||
public double DetectionRange { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置红外波段
|
||||
/// </summary>
|
||||
public InfraredBand Band { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置视场角,单位:度
|
||||
/// </summary>
|
||||
@ -41,7 +48,7 @@ namespace ThreatSource.Sensor
|
||||
/// 定义了探测器的视场范围
|
||||
/// 影响目标探测的空间覆盖
|
||||
/// </remarks>
|
||||
public double FieldOfView { get; set; }
|
||||
public double FieldOfView { get; set; } = 10;
|
||||
|
||||
/// <summary>
|
||||
/// 末敏子弹实例
|
||||
@ -66,6 +73,7 @@ namespace ThreatSource.Sensor
|
||||
/// </summary>
|
||||
/// <param name="submunition">末敏子弹实例</param>
|
||||
/// <param name="detectionRange">探测范围,单位:米</param>
|
||||
/// <param name="band"></param>
|
||||
/// <param name="fieldOfView">视场角,单位:度</param>
|
||||
/// <remarks>
|
||||
/// 构造过程:
|
||||
@ -74,11 +82,12 @@ namespace ThreatSource.Sensor
|
||||
/// - 初始化传感器数据
|
||||
/// - 继承基类位置和姿态
|
||||
/// </remarks>
|
||||
public InfraredDetector(TerminalSensitiveSubmunition submunition, double detectionRange, double fieldOfView)
|
||||
public InfraredDetector(TerminalSensitiveSubmunition submunition, double detectionRange, InfraredBand band, double fieldOfView)
|
||||
: base(submunition.Position, submunition.Orientation)
|
||||
{
|
||||
DetectionRange = detectionRange;
|
||||
FieldOfView = fieldOfView;
|
||||
Band = band;
|
||||
this.submunition = submunition;
|
||||
sensorData = new InfraredSensorData();
|
||||
}
|
||||
@ -130,6 +139,39 @@ namespace ThreatSource.Sensor
|
||||
return submunition.DetectTarget(FieldOfView) ? 100 : 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 处理红外干扰事件
|
||||
/// </summary>
|
||||
/// <param name="sender">事件源对象</param>
|
||||
/// <param name="e">事件参数</param>
|
||||
/// <remarks>
|
||||
/// 当检测到红外干扰时:
|
||||
/// - 输出警告信息
|
||||
/// - 可能影响探测精度
|
||||
/// - 需要采取抗干扰措施
|
||||
/// </remarks>
|
||||
public void OnInfraredJamming(object sender, EventArgs e)
|
||||
{
|
||||
IsActive = false;
|
||||
Console.WriteLine("红外探测器受到干扰,失效");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 处理红外干扰停止事件
|
||||
/// </summary>
|
||||
/// <param name="sender">事件源对象</param>
|
||||
/// <param name="e">事件参数</param>
|
||||
/// <remarks>
|
||||
/// 当红外干扰停止时:
|
||||
/// - 输出恢复信息
|
||||
/// - 恢复探测状态
|
||||
/// </remarks>
|
||||
public void OnInfraredJammingStop(object sender, EventArgs e)
|
||||
{
|
||||
IsActive = true;
|
||||
Console.WriteLine("红外探测器干扰停止,恢复工作");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取红外探测器的最新数据
|
||||
/// </summary>
|
||||
@ -145,5 +187,19 @@ namespace ThreatSource.Sensor
|
||||
// 返回红外探测器的数据
|
||||
return sensorData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取支持的干扰类型集合
|
||||
/// </summary>
|
||||
public override IEnumerable<JammingType> SupportedJammingTypes =>
|
||||
[JammingType.Infrared];
|
||||
|
||||
/// <summary>
|
||||
/// 初始化干扰处理器
|
||||
/// </summary>
|
||||
protected override void InitializeJammingHandler()
|
||||
{
|
||||
JammingHandler = new InfraredJammingHandler(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,6 @@
|
||||
using ThreatSource.Utils;
|
||||
using ThreatSource.Missile;
|
||||
using ThreatSource.Jamming;
|
||||
|
||||
namespace ThreatSource.Sensor
|
||||
{
|
||||
@ -15,6 +17,23 @@ namespace ThreatSource.Sensor
|
||||
/// </remarks>
|
||||
public class LaserRangefinder : Sensor
|
||||
{
|
||||
/// <summary>
|
||||
/// 当前测量距离,单位:米
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 包含测量精度引入的随机误差
|
||||
/// </remarks>
|
||||
private double currentDistance;
|
||||
|
||||
/// <summary>
|
||||
/// 末敏子弹实例
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 关联的末敏子弹对象
|
||||
/// 用于获取位置和姿态信息
|
||||
/// </remarks>
|
||||
private readonly TerminalSensitiveSubmunition submunition;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置最大测量距离,单位:米
|
||||
/// </summary>
|
||||
@ -25,6 +44,15 @@ namespace ThreatSource.Sensor
|
||||
/// </remarks>
|
||||
public double MaxRange { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置工作波长,单位:微米
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 定义了激光测距仪的工作波段
|
||||
/// 影响测量的准确性和可靠性
|
||||
/// </remarks>
|
||||
public double WaveLength { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置脉冲频率,单位:赫兹
|
||||
/// </summary>
|
||||
@ -35,24 +63,38 @@ namespace ThreatSource.Sensor
|
||||
/// </remarks>
|
||||
public double PulseRate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置测量精度,单位:米
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 定义了测距仪的测量误差范围
|
||||
/// 影响测量的可靠性和稳定性
|
||||
/// 需要根据应用场景选择合适的精度
|
||||
/// </remarks>
|
||||
public double Accuracy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 初始化激光测距仪的新实例
|
||||
/// </summary>
|
||||
/// <param name="position">测距仪的位置坐标</param>
|
||||
/// <param name="orientation">测距仪的朝向</param>
|
||||
/// <param name="submunition">末敏子弹实例</param>
|
||||
/// <param name="maxRange">最大测量距离,单位:米</param>
|
||||
/// <param name="waveLength">工作波段,单位:毫米</param>
|
||||
/// <param name="pulseRate">脉冲频率,单位:赫兹</param>
|
||||
/// <param name="accuracy">测量精度,单位:米</param>
|
||||
/// <remarks>
|
||||
/// 构造过程:
|
||||
/// - 设置位置和姿态
|
||||
/// - 配置测量参数
|
||||
/// - 初始化工作状态
|
||||
/// </remarks>
|
||||
public LaserRangefinder(Vector3D position, Orientation orientation, double maxRange, double pulseRate)
|
||||
: base(position, orientation)
|
||||
public LaserRangefinder(TerminalSensitiveSubmunition submunition, double maxRange, double waveLength, double pulseRate, double accuracy)
|
||||
: base(submunition.Position, submunition.Orientation)
|
||||
{
|
||||
this.submunition = submunition;
|
||||
MaxRange = maxRange;
|
||||
WaveLength = waveLength;
|
||||
PulseRate = pulseRate;
|
||||
Accuracy = accuracy;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -68,7 +110,13 @@ namespace ThreatSource.Sensor
|
||||
/// </remarks>
|
||||
public override void Update(double deltaTime)
|
||||
{
|
||||
// 实现激光测距仪的更新逻辑
|
||||
// 激光测距仪的更新逻辑,考虑测量精度
|
||||
if (IsActive)
|
||||
{
|
||||
// 计算斜向距离:高度/cos(扫描角度)
|
||||
double slantRange = submunition.Position.Y / Math.Cos(TerminalSensitiveSubmunition.ScanAngle);
|
||||
currentDistance = slantRange + (2 * new Random().NextDouble() - 1) * Accuracy;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -78,14 +126,29 @@ namespace ThreatSource.Sensor
|
||||
/// <remarks>
|
||||
/// 返回数据:
|
||||
/// - 目标距离值
|
||||
/// - 信号强度
|
||||
/// - 测量时间戳
|
||||
/// - 数据可靠性
|
||||
/// </remarks>
|
||||
public override SensorData GetSensorData()
|
||||
{
|
||||
// 返回激光测距仪的数据
|
||||
return new RangefinderSensorData();
|
||||
RangefinderSensorData rangefinderSensorData = new()
|
||||
{
|
||||
Distance = currentDistance
|
||||
};
|
||||
return rangefinderSensorData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取支持的干扰类型集合
|
||||
/// </summary>
|
||||
public override IEnumerable<JammingType> SupportedJammingTypes =>
|
||||
[JammingType.Laser];
|
||||
|
||||
/// <summary>
|
||||
/// 初始化干扰处理器
|
||||
/// </summary>
|
||||
protected override void InitializeJammingHandler()
|
||||
{
|
||||
JammingHandler = new LaserJammingHandler(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,6 @@
|
||||
using ThreatSource.Missile;
|
||||
using ThreatSource.Utils;
|
||||
using ThreatSource.Jamming;
|
||||
|
||||
namespace ThreatSource.Sensor
|
||||
{
|
||||
@ -42,6 +44,20 @@ namespace ThreatSource.Sensor
|
||||
/// </remarks>
|
||||
public double MaxAltitude { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置工作波段,枚举
|
||||
/// </summary>
|
||||
public MillimeterWaveBand Band { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置视场角,单位:度
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 定义了探测器的视场范围
|
||||
/// 影响目标探测的空间覆盖
|
||||
/// </remarks>
|
||||
public double FieldOfView { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置测量精度,单位:米
|
||||
/// </summary>
|
||||
@ -56,18 +72,22 @@ namespace ThreatSource.Sensor
|
||||
/// </summary>
|
||||
/// <param name="submunition">末敏子弹实例</param>
|
||||
/// <param name="maxAltitude">最大测量高度,单位:米</param>
|
||||
/// <param name="band">工作波段,枚举</param>
|
||||
/// <param name="accuracy">测量精度,单位:米</param>
|
||||
/// <param name="fieldOfView">视场角,单位:度</param>
|
||||
/// <remarks>
|
||||
/// 构造过程:
|
||||
/// - 设置量程参数
|
||||
/// - 初始化高度记录
|
||||
/// - 继承基类位置和姿态
|
||||
/// </remarks>
|
||||
public MillimeterWaveAltimeter(TerminalSensitiveSubmunition submunition, double maxAltitude, double accuracy)
|
||||
public MillimeterWaveAltimeter(TerminalSensitiveSubmunition submunition, double maxAltitude, MillimeterWaveBand band, double accuracy, double fieldOfView)
|
||||
: base(submunition.Position, submunition.Orientation)
|
||||
{
|
||||
MaxAltitude = maxAltitude;
|
||||
Accuracy = accuracy;
|
||||
Band = band;
|
||||
FieldOfView = fieldOfView;
|
||||
currentAltitude = 0;
|
||||
this.submunition = submunition;
|
||||
}
|
||||
@ -85,7 +105,10 @@ namespace ThreatSource.Sensor
|
||||
public override void Update(double deltaTime)
|
||||
{
|
||||
// 更新当前高度,考虑测量精度
|
||||
currentAltitude = submunition.Position.Y + Accuracy * new Random().NextDouble();
|
||||
if (IsActive)
|
||||
{
|
||||
currentAltitude = submunition.Position.Y + (2 * new Random().NextDouble() - 1) * Accuracy;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -101,7 +124,24 @@ namespace ThreatSource.Sensor
|
||||
/// </remarks>
|
||||
public void OnMillimeterWaveJamming(object sender, EventArgs e)
|
||||
{
|
||||
Console.WriteLine("毫米波测高雷达受到干扰");
|
||||
IsActive = false;
|
||||
Console.WriteLine("毫米波测高雷达受到干扰,失效");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 处理毫米波干扰停止事件
|
||||
/// </summary>
|
||||
/// <param name="sender">事件源对象</param>
|
||||
/// <param name="e">事件参数</param>
|
||||
/// <remarks>
|
||||
/// 当毫米波干扰停止时:
|
||||
/// - 输出恢复信息
|
||||
/// - 恢复探测状态
|
||||
/// </remarks>
|
||||
public void OnMillimeterWaveJammingStop(object sender, EventArgs e)
|
||||
{
|
||||
IsActive = true;
|
||||
Console.WriteLine("毫米波测高雷达干扰停止,恢复工作");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -111,17 +151,29 @@ namespace ThreatSource.Sensor
|
||||
/// <remarks>
|
||||
/// 返回数据:
|
||||
/// - 当前高度值
|
||||
/// - 测量时间戳
|
||||
/// - 数据可靠性
|
||||
/// </remarks>
|
||||
public override SensorData GetSensorData()
|
||||
{
|
||||
// 返回毫米波测高雷达的数据
|
||||
AltimeterSensorData altimeterSensorData = new AltimeterSensorData
|
||||
AltimeterSensorData altimeterSensorData = new()
|
||||
{
|
||||
Altitude = currentAltitude
|
||||
};
|
||||
return altimeterSensorData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取支持的干扰类型集合
|
||||
/// </summary>
|
||||
public override IEnumerable<JammingType> SupportedJammingTypes =>
|
||||
[JammingType.MillimeterWave];
|
||||
|
||||
/// <summary>
|
||||
/// 初始化干扰处理器
|
||||
/// </summary>
|
||||
protected override void InitializeJammingHandler()
|
||||
{
|
||||
JammingHandler = new MillimeterWaveAltimeterJammingHandler(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,6 @@
|
||||
using ThreatSource.Missile;
|
||||
using ThreatSource.Utils;
|
||||
using ThreatSource.Jamming;
|
||||
|
||||
namespace ThreatSource.Sensor
|
||||
{
|
||||
@ -16,13 +18,22 @@ namespace ThreatSource.Sensor
|
||||
public class MillimeterWaveRadiometer : Sensor
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置工作波段,单位:毫米
|
||||
/// 获取或设置探测距离,单位:米
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 定义了辐射计的探测范围
|
||||
/// 影响目标探测的可靠性和稳定性
|
||||
/// </remarks>
|
||||
public double DetectionDistance { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置工作波段,枚举
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 可选波段:3mm 或 8mm
|
||||
/// 影响辐射计的探测性能和大气衰减
|
||||
/// </remarks>
|
||||
public double Wavelength { get; set; }
|
||||
public MillimeterWaveBand Band { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 扫描视场角,单位:度
|
||||
@ -82,7 +93,8 @@ namespace ThreatSource.Sensor
|
||||
/// 初始化毫米波辐射计的新实例
|
||||
/// </summary>
|
||||
/// <param name="submunition">末敏子弹实例</param>
|
||||
/// <param name="wavelength">工作波段,单位:毫米</param>
|
||||
/// <param name="detectionDistance">探测距离,单位:米</param>
|
||||
/// <param name="band">工作波段,枚举</param>
|
||||
/// <param name="fieldOfView">视场角,单位:度</param>
|
||||
/// <remarks>
|
||||
/// 构造过程:
|
||||
@ -91,10 +103,11 @@ namespace ThreatSource.Sensor
|
||||
/// - 创建传感器数据
|
||||
/// - 继承基类位置和姿态
|
||||
/// </remarks>
|
||||
public MillimeterWaveRadiometer(TerminalSensitiveSubmunition submunition, double wavelength, double fieldOfView)
|
||||
public MillimeterWaveRadiometer(TerminalSensitiveSubmunition submunition, double detectionDistance, MillimeterWaveBand band, double fieldOfView)
|
||||
: base(submunition.Position, submunition.Orientation)
|
||||
{
|
||||
Wavelength = wavelength;
|
||||
DetectionDistance = detectionDistance;
|
||||
Band = band;
|
||||
FieldOfView = fieldOfView;
|
||||
lastDetectionTemperature = 0;
|
||||
sensorData = new RadiometerSensorData();
|
||||
@ -153,6 +166,39 @@ namespace ThreatSource.Sensor
|
||||
return submunition.DetectTarget(FieldOfView) ? 90 : 300;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 处理毫米波干扰事件
|
||||
/// </summary>
|
||||
/// <param name="sender">事件源对象</param>
|
||||
/// <param name="e">事件参数</param>
|
||||
/// <remarks>
|
||||
/// 当检测到毫米波干扰时:
|
||||
/// - 输出警告信息
|
||||
/// - 可能影响测量精度
|
||||
/// - 需要采取抗干扰措施
|
||||
/// </remarks>
|
||||
public void OnMillimeterWaveJamming(object sender, EventArgs e)
|
||||
{
|
||||
IsActive = false;
|
||||
Console.WriteLine("毫米波辐射计受到干扰,失效");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 处理毫米波干扰停止事件
|
||||
/// </summary>
|
||||
/// <param name="sender">事件源对象</param>
|
||||
/// <param name="e">事件参数</param>
|
||||
/// <remarks>
|
||||
/// 当毫米波干扰停止时:
|
||||
/// - 输出恢复信息
|
||||
/// - 恢复探测状态
|
||||
/// </remarks>
|
||||
public void OnMillimeterWaveJammingStop(object sender, EventArgs e)
|
||||
{
|
||||
IsActive = true;
|
||||
Console.WriteLine("毫米波辐射计干扰停止,恢复工作");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取毫米波辐射计的最新数据
|
||||
/// </summary>
|
||||
@ -168,5 +214,19 @@ namespace ThreatSource.Sensor
|
||||
// 返回毫米波辐射计的数据
|
||||
return sensorData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取支持的干扰类型集合
|
||||
/// </summary>
|
||||
public override IEnumerable<JammingType> SupportedJammingTypes =>
|
||||
[JammingType.MillimeterWave];
|
||||
|
||||
/// <summary>
|
||||
/// 初始化干扰处理器
|
||||
/// </summary>
|
||||
protected override void InitializeJammingHandler()
|
||||
{
|
||||
JammingHandler = new MillimeterWaveJammingHandler(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,5 @@
|
||||
using ThreatSource.Utils;
|
||||
using ThreatSource.Jamming;
|
||||
|
||||
namespace ThreatSource.Sensor
|
||||
{
|
||||
@ -79,10 +80,26 @@ namespace ThreatSource.Sensor
|
||||
/// - 位置和姿态管理
|
||||
/// - 激活状态控制
|
||||
/// - 数据采集框架
|
||||
/// - 干扰处理机制
|
||||
/// 是具体传感器类的实现基础
|
||||
/// </remarks>
|
||||
public abstract class Sensor : ISensor
|
||||
public abstract class Sensor : ISensor, IJammable
|
||||
{
|
||||
/// <summary>
|
||||
/// 干扰处理器
|
||||
/// </summary>
|
||||
private protected JammingHandler? JammingHandler { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取设备支持的干扰类型
|
||||
/// </summary>
|
||||
public abstract IEnumerable<JammingType> SupportedJammingTypes { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取设备当前是否处于被干扰状态
|
||||
/// </summary>
|
||||
public bool IsJammed => JammingHandler?.IsJammed ?? false;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置传感器是否处于激活状态
|
||||
/// </summary>
|
||||
@ -121,14 +138,21 @@ namespace ThreatSource.Sensor
|
||||
/// - 设置初始位置
|
||||
/// - 设置初始朝向
|
||||
/// - 初始化工作状态
|
||||
/// - 创建干扰处理器
|
||||
/// </remarks>
|
||||
protected Sensor(Vector3D position, Orientation orientation)
|
||||
{
|
||||
Position = position;
|
||||
Orientation = orientation;
|
||||
IsActive = false;
|
||||
InitializeJammingHandler();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 初始化干扰处理器
|
||||
/// </summary>
|
||||
protected abstract void InitializeJammingHandler();
|
||||
|
||||
/// <summary>
|
||||
/// 激活传感器,使其开始工作
|
||||
/// </summary>
|
||||
@ -158,17 +182,40 @@ namespace ThreatSource.Sensor
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新传感器状态(需要在子类中实现)
|
||||
/// 更新传感器状态
|
||||
/// </summary>
|
||||
/// <param name="deltaTime">自上次更新以来的时间间隔,单位:秒</param>
|
||||
/// <remarks>
|
||||
/// 更新要求:
|
||||
/// - 检查工作状态
|
||||
/// - 采集最新数据
|
||||
/// - 更新内部状态
|
||||
/// - 处理异常情况
|
||||
/// </remarks>
|
||||
public abstract void Update(double deltaTime);
|
||||
/// <param name="deltaTime">时间步长,单位:秒</param>
|
||||
public virtual void Update(double deltaTime)
|
||||
{
|
||||
if (IsActive)
|
||||
{
|
||||
JammingHandler?.Update(deltaTime);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用干扰
|
||||
/// </summary>
|
||||
/// <param name="parameters">干扰参数</param>
|
||||
public virtual void ApplyJamming(JammingParameters parameters)
|
||||
{
|
||||
if (SupportedJammingTypes.Contains(parameters.Type))
|
||||
{
|
||||
JammingHandler?.HandleJamming(parameters);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 清除干扰
|
||||
/// </summary>
|
||||
/// <param name="type">要清除的干扰类型</param>
|
||||
public virtual void ClearJamming(JammingType type)
|
||||
{
|
||||
if (SupportedJammingTypes.Contains(type))
|
||||
{
|
||||
JammingHandler?.ClearJamming();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取传感器数据(需要在子类中实现)
|
||||
|
||||
@ -445,6 +445,9 @@ namespace ThreatSource.Simulation
|
||||
/// </summary>
|
||||
public class TargetDestroyedEvent : SimulationEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// 目标ID
|
||||
/// </summary>
|
||||
public string? TargetId { get; set; }
|
||||
}
|
||||
|
||||
|
||||
@ -14,22 +14,41 @@ namespace ThreatSource.Simulation.Testing
|
||||
private readonly List<object> _publishedEvents = new();
|
||||
private ISimulationManager? _simulationManager;
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数,初始化测试适配器
|
||||
/// </summary>
|
||||
/// <param name="simulationManager">仿真管理器</param>
|
||||
public TestSimulationAdapter(ISimulationManager simulationManager)
|
||||
{
|
||||
_simulationManager = simulationManager;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取实体
|
||||
/// </summary>
|
||||
/// <param name="id">实体ID</param>
|
||||
/// <returns>实体对象或null</returns>
|
||||
public object? GetEntity(string id)
|
||||
{
|
||||
return _testEntities.TryGetValue(id, out var entity) ? entity : null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发布事件到外部仿真
|
||||
/// </summary>
|
||||
/// <typeparam name="T">事件类型</typeparam>
|
||||
/// <param name="evt">事件对象</param>
|
||||
public void PublishToExternalSimulation<T>(T evt)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(evt);
|
||||
_publishedEvents.Add(evt);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 接收来自外部仿真的事件
|
||||
/// </summary>
|
||||
/// <typeparam name="T">事件类型</typeparam>
|
||||
/// <param name="evt">事件对象</param>
|
||||
public void ReceiveFromExternalSimulation<T>(T evt)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(evt);
|
||||
@ -37,27 +56,45 @@ namespace ThreatSource.Simulation.Testing
|
||||
_simulationManager?.PublishEvent(evt);
|
||||
}
|
||||
|
||||
// 测试辅助方法
|
||||
/// <summary>
|
||||
/// 添加测试实体
|
||||
/// </summary>
|
||||
/// <param name="id">实体ID</param>
|
||||
/// <param name="entity">实体对象</param>
|
||||
public void AddTestEntity(string id, object entity)
|
||||
{
|
||||
_testEntities[id] = entity;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 清除测试实体
|
||||
/// </summary>
|
||||
public void ClearTestEntities()
|
||||
{
|
||||
_testEntities.Clear();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取已发布的事件
|
||||
/// </summary>
|
||||
/// <returns>已发布的事件列表</returns>
|
||||
public IReadOnlyList<object> GetPublishedEvents()
|
||||
{
|
||||
return _publishedEvents;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取已接收的事件
|
||||
/// </summary>
|
||||
/// <returns>已接收的事件列表</returns>
|
||||
public IReadOnlyList<object> GetReceivedEvents()
|
||||
{
|
||||
return _receivedEvents;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 清除事件
|
||||
/// </summary>
|
||||
public void ClearEvents()
|
||||
{
|
||||
_publishedEvents.Clear();
|
||||
|
||||
@ -438,5 +438,37 @@ namespace ThreatSource.Utils
|
||||
public static Vector2D Zero => new Vector2D(0, 0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 红外波段,枚举
|
||||
/// </summary>
|
||||
public enum InfraredBand
|
||||
{
|
||||
/// <summary>
|
||||
/// 远红外波段,6-15um
|
||||
/// </summary>
|
||||
Long,
|
||||
/// <summary>
|
||||
/// 中红外波段,3-6um
|
||||
/// </summary>
|
||||
Medium,
|
||||
/// <summary>
|
||||
/// 近红外波段,0.75-3um
|
||||
/// </summary>
|
||||
Short
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 毫米波波段,枚举
|
||||
/// </summary>
|
||||
public enum MillimeterWaveBand
|
||||
{
|
||||
/// <summary>
|
||||
/// 3mm波段
|
||||
/// </summary>
|
||||
Band3,
|
||||
/// <summary>
|
||||
/// 8mm波段
|
||||
/// </summary>
|
||||
Band8
|
||||
}
|
||||
}
|
||||
57
docs/articles/reference.md
Normal file
57
docs/articles/reference.md
Normal file
@ -0,0 +1,57 @@
|
||||
# 导弹工作原理
|
||||
|
||||
## 末敏弹工作过程
|
||||
|
||||
### 工作阶段
|
||||
|
||||
1. 母弹抛撒阶段
|
||||
- 母弹飞抵目标上空后,时间引信作用
|
||||
- 启动抛射装置,将末敏子弹按一定距离抛撒出来
|
||||
|
||||
2. 子弹减速阶段
|
||||
- 减速减旋装置动作,对子弹起减速、减旋、定向、稳向作用
|
||||
- 启动热电池,达到规定值时开始对内部电子系统供电
|
||||
|
||||
3. 第一期测距阶段
|
||||
- 子弹以大着角下落
|
||||
- 在中央控制器控制下,测距雷达开始第1期测距
|
||||
- 测定子弹到地面的距离
|
||||
- 达到预定高度时,抛去减速减旋装置
|
||||
- 稳定扫描装置动作,带动子弹旋转
|
||||
|
||||
4. 第二期测距阶段
|
||||
- 稳定扫描装置带动末敏子弹稳态降落
|
||||
- 在中央控制器控制下,测距雷达进行第2期测距
|
||||
- 中央控制器完成对目标探测数据采集的准备工作
|
||||
- 末敏子弹进入稳态扫描
|
||||
|
||||
5. 目标探测阶段
|
||||
- 末敏子弹进入威力有效高度
|
||||
- 敏感探测器在中央控制器指令下进行工作扫描
|
||||
- 在中央控制器控制下安保装置解除最后一道保险
|
||||
- 采用相邻2次扫描判定目标:
|
||||
- 第1次扫过目标后,向中央控制器报告目标信息
|
||||
- 第2次扫过目标后,将目标敏感数据与特征值比较
|
||||
|
||||
6. 攻击/自毁阶段
|
||||
- 如果第2次扫描确认是目标,且目标在威力窗口内:
|
||||
- 中央控制器下达指令起爆战斗部
|
||||
- 抛射出爆炸成形弹丸(EFP)
|
||||
- EFP以大于2000m/s的高速射向目标
|
||||
- 在目标来不及运动的瞬间命中并摧毁目标
|
||||
- 如果第2次扫描判定为非目标:
|
||||
- 可以改换对象,继续探测其他潜在目标
|
||||
- 如果一直没有发现目标:
|
||||
- 末敏子弹将在距离地面一定高度时自毁
|
||||
|
||||
### 关键特性
|
||||
|
||||
1. 扫描特性
|
||||
- 抛出的末敏子弹在实施扫描时相距一定距离
|
||||
- 各自的扫描区相互衔接
|
||||
- 避免击中同一目标或漏掉目标
|
||||
|
||||
2. 安全特性
|
||||
- 多重保险装置
|
||||
- 高度自毁保护
|
||||
- 稳定扫描控制
|
||||
@ -928,21 +928,50 @@ graph TB
|
||||
1. 母弹飞行阶段
|
||||
- 母弹发射并飞向预定分离点
|
||||
- 分离点位于目标上方1000米高度,水平距离1000米
|
||||
- 到达分离点50米范围内时释放子弹
|
||||
- 到达分离点50米范围内时触发分离
|
||||
- 释放完成后母弹自动销毁
|
||||
|
||||
2. 子弹分离阶段
|
||||
- 子弹从母弹分离
|
||||
- 初始速度200米/秒
|
||||
- 初始朝向指向目标
|
||||
- 激活传感器系统
|
||||
2. 子弹分离阶段 (Separation)
|
||||
- 子弹从母弹分离并获得初始速度,与母弹分离速度一致
|
||||
- 初始朝向与母弹分离方向一致
|
||||
- 准备进入减速阶段
|
||||
|
||||
3. 子弹制导阶段
|
||||
- 减速调整(400米高度开始)
|
||||
- 螺旋扫描搜索(200米高度开始)
|
||||
- 目标确认和跟踪
|
||||
- 末端精确制导
|
||||
3. 减速阶段 (Deceleration)
|
||||
- 开始减速减旋
|
||||
- 激活测高雷达开始工作(第一次测高)
|
||||
- 降落到高度 400 米进入降落伞打开阶段
|
||||
- 此时子弹速度 40 米/秒
|
||||
|
||||
4. 降落伞打开阶段 (ParachuteDeployment)
|
||||
- 打开降落伞
|
||||
- 降落伞减速和稳定
|
||||
- 调整姿态准备扫描
|
||||
- 激活测高雷达开始工作(第二次测高)
|
||||
- 在200米高度进入扫描阶段
|
||||
- 此时子弹速度 10 米/秒
|
||||
|
||||
5. 稳定扫描阶段 (StableScanning)
|
||||
- 开始稳定扫描
|
||||
- 保持稳定的下降速度(10米/秒)
|
||||
- 执行扫描搜索(扫描锥角30度)
|
||||
- 在 120 米高度进入目标探测阶段
|
||||
- 此时子弹速度 10 米/秒
|
||||
|
||||
6. 目标探测阶段 (Detection)
|
||||
- 多传感器协同工作
|
||||
- 进行目标特征识别
|
||||
- 执行二次扫描确认
|
||||
- 为攻击阶段做准备
|
||||
|
||||
7. 攻击阶段 (Attack)
|
||||
- 目标确认后进入攻击
|
||||
- 保持2000米/秒攻击速度
|
||||
- 执行末端精确制导
|
||||
|
||||
8. 爆炸/自毁阶段 (Explode/SelfDestruct)
|
||||
- 接近目标后引爆
|
||||
- 低于20米高度时自毁
|
||||
- 未发现目标时自毁
|
||||
|
||||
#### 3.6.2 系统组成
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user