增加了末敏弹红外探测器检测,与毫米波辐射计检测,是或的关系

This commit is contained in:
Tian jianyong 2024-10-31 14:39:16 +08:00
parent 8cb3854cdc
commit 1802ffb31a
4 changed files with 70 additions and 17 deletions

View File

@ -78,8 +78,8 @@ namespace ActiveProtect.Models
detectionAngle = 0;
// 初始化传感器
infraredDetector = new InfraredDetector(Position, Orientation, 100, 30);
radiometer = new MillimeterWaveRadiometer(this, 3); // 毫米波辐射计工作波段3mm
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);
}
@ -177,6 +177,11 @@ namespace ActiveProtect.Models
// 激活毫米波辐射计
radiometer.Activate();
}
if(!infraredDetector.IsActive)
{
// 激活红外探测器
infraredDetector.Activate();
}
Velocity = new Vector3D(0, -VerticalDescentSpeed, 0);
GuidanceAcceleration = Vector3D.Zero;
@ -202,7 +207,10 @@ namespace ActiveProtect.Models
Math.Sin(spiralAngle) * Math.Sin(ScanAngle)
);
if (radiometer.GetSensorData() is RadiometerSensorData radiometerData && radiometerData.IsTargetDetected)
bool isRadiationDetected = radiometer.GetSensorData() is RadiometerSensorData radiometerData && radiometerData.IsTargetDetected;
bool isInfraredDetected = infraredDetector.GetSensorData() is InfraredSensorData infraredData && infraredData.IsTargetDetected;
if (isRadiationDetected || isInfraredDetected)
{
double currentTime = SimulationManager.CurrentTime;
if (lastDetectionTime == null)
@ -265,14 +273,15 @@ namespace ActiveProtect.Models
/// <summary>
/// 检测目标
/// </summary>
/// <returns>是否检测到目标</returns>
public bool DetectTarget()
/// <param name="fieldOfView">视场角</param>
/// <returns>在扫描方向上是否检测到目标</returns>
public bool DetectTarget(double fieldOfView)
{
Vector3D targetPosition = SimulationManager.GetEntityById(MissileProperties.TargetId).Position;
Vector3D toTarget = (targetPosition - Position).Normalize();
// 检查目标是否在扫描线上
return Vector3D.DotProduct(scanDirection, toTarget) > Math.Cos(5 * Math.PI / 180); // 允许5度的误差
// 检查目标是否在扫描视场内
return Vector3D.DotProduct(scanDirection, toTarget) > Math.Cos(fieldOfView * Math.PI / 180);
}
/// <summary>

View File

@ -7,6 +7,11 @@ namespace ActiveProtect.Models
/// </summary>
public class InfraredDetector : Sensor
{
/// <summary>
/// 探测辐射强度阈值单位W/Sr
/// </summary>
private const double DetectionRadiationIntensityThreshold = 50;
/// <summary>
/// 探测范围
/// </summary>
@ -17,18 +22,29 @@ namespace ActiveProtect.Models
/// </summary>
public double FieldOfView { get; set; }
/// <summary>
/// 末敏弹
/// </summary>
private readonly TerminalSensitiveSubmunition submunition;
/// <summary>
/// 红外探测器数据
/// </summary>
private InfraredSensorData sensorData;
/// <summary>
/// 构造函数
/// </summary>
/// <param name="position">探测器的位置</param>
/// <param name="orientation">探测器的朝向</param>
/// <param name="submunition">末敏弹</param>
/// <param name="detectionRange">探测范围</param>
/// <param name="fieldOfView">视场角</param>
public InfraredDetector(Vector3D position, Orientation orientation, double detectionRange, double fieldOfView)
: base(position, orientation)
public InfraredDetector(TerminalSensitiveSubmunition submunition, double detectionRange, double fieldOfView)
: base(submunition.Position, submunition.Orientation)
{
DetectionRange = detectionRange;
FieldOfView = fieldOfView;
this.submunition = submunition;
sensorData = new InfraredSensorData();
}
/// <summary>
@ -38,6 +54,30 @@ namespace ActiveProtect.Models
public override void Update(double deltaTime)
{
// 实现红外探测器的更新逻辑
if (IsActive)
{
// 获取当前方向上的红外辐射强度
double currentDirectionRadiationIntensity = GetCurrentDirectionRadiationIntensity();
// 如果辐射强度大于探测阈值,则认为检测到目标
if (currentDirectionRadiationIntensity >= DetectionRadiationIntensityThreshold)
{
sensorData.IsTargetDetected = true;
}
else
{
sensorData.IsTargetDetected = false;
}
}
}
/// <summary>
/// 获取当前方向上的红外辐射强度
/// </summary>
/// <returns>当前方向上的红外辐射强度</returns>
private double GetCurrentDirectionRadiationIntensity()
{
// 获取当前方向上的辐射强度如果检测到目标则返回目标的辐射强度否则返回0
return submunition.DetectTarget(FieldOfView) ? 100 : 0;
}
/// <summary>
@ -47,7 +87,7 @@ namespace ActiveProtect.Models
public override SensorData GetSensorData()
{
// 返回红外探测器的数据
return new InfraredSensorData();
return sensorData;
}
}

View File

@ -12,6 +12,9 @@ namespace ActiveProtect.Models
/// </summary>
public double Wavelength { get; set; }
//扫描视场角,默认 5度
private double FieldOfView;
/// <summary>
/// 辐射温度差检测阈值辐射计高温物体与低温物体的检测温差单位K默认 100K
/// 对于金属目标与草地的典型温差为170~230K砂石地 120~150K
@ -20,7 +23,7 @@ namespace ActiveProtect.Models
/// </summary>
public double DetectionTemperatureDifferenceThreshold { get; set; } = 100;
private double lastDetectionTemperature = 0;
private double lastDetectionTemperature;
/// <summary>
/// 毫米波辐射计传感器数据
@ -36,10 +39,11 @@ namespace ActiveProtect.Models
/// <param name="orientation">辐射计的朝向</param>
/// <param name="wavelength">工作波段</param>
/// <param name="detectionTemperatureDifferenceThreshold">辐射温差检测阈值</param>
public MillimeterWaveRadiometer(TerminalSensitiveSubmunition submunition, double wavelength)
public MillimeterWaveRadiometer(TerminalSensitiveSubmunition submunition, double wavelength, double fieldOfView)
: base(submunition.Position, submunition.Orientation)
{
Wavelength = wavelength;
FieldOfView = fieldOfView;
lastDetectionTemperature = 0;
sensorData = new RadiometerSensorData();
this.submunition = submunition;
@ -75,7 +79,7 @@ namespace ActiveProtect.Models
private double GetCurrentDirectionRadiationTemperature()
{
// 获取当前方向上的辐射温度如果检测到目标则返回天空背景辐射的反射温度否则返回300K
return submunition.DetectTarget() ? 90 : 300;
return submunition.DetectTarget(FieldOfView) ? 90 : 300;
}
/// <summary>

View File

@ -25,9 +25,9 @@ namespace ActiveProtect.Models
public double Temperature { get; set; }
/// <summary>
/// 目标方向(如果检测到目标)
/// 是否检测到目标
/// </summary>
public Vector3D? TargetDirection { get; set; }
public bool IsTargetDetected { get; set; }
}
/// <summary>