增加了末敏弹使用毫米波辐射计探测目标的逻辑
This commit is contained in:
parent
f60b7697fe
commit
8cb3854cdc
@ -37,6 +37,7 @@ namespace ActiveProtect
|
||||
MaxArmor = 100,
|
||||
InfraredRadiationIntensity = 150,
|
||||
RadarCrossSection = 10,
|
||||
RadiationTemperature = 10,
|
||||
HasLaserWarner = false,
|
||||
HasLaserJammer = true
|
||||
}
|
||||
@ -214,7 +215,7 @@ namespace ActiveProtect
|
||||
{
|
||||
simulationManager.Update();
|
||||
simulationManager.PrintStatus();
|
||||
Thread.Sleep(10); // 暂停100毫秒,使输出更易读
|
||||
Thread.Sleep(20); // 暂停100毫秒,使输出更易读
|
||||
iteration++;
|
||||
}
|
||||
|
||||
|
||||
@ -47,6 +47,11 @@ namespace ActiveProtect.Models
|
||||
/// </summary>
|
||||
public double RadarCrossSection { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 辐射温度(K),默认为 0 K
|
||||
/// </summary>
|
||||
public double RadiationTemperature { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否装备激光告警器
|
||||
/// </summary>
|
||||
@ -90,6 +95,7 @@ namespace ActiveProtect.Models
|
||||
HasLaserJammer = false;
|
||||
HasMillimeterWaveJammer = false;
|
||||
InfraredRadiationIntensity = 0;
|
||||
RadiationTemperature = 0;
|
||||
}
|
||||
|
||||
// 验证方法
|
||||
|
||||
@ -25,7 +25,7 @@ namespace ActiveProtect.Models
|
||||
|
||||
private const double SpiralRotationSpeed = 8 * Math.PI; // 4 rotations per second
|
||||
private const double VerticalDescentSpeed = 10; // 10 m/s
|
||||
private const double ScanAngle = 20 * Math.PI / 180; // 20 degrees in radians
|
||||
private const double ScanAngle = 30 * Math.PI / 180; // 30 degrees in radians
|
||||
|
||||
// 减速高度 400米
|
||||
private const double DecelerationHeight = 400;
|
||||
@ -50,6 +50,11 @@ namespace ActiveProtect.Models
|
||||
/// </summary>
|
||||
private double spiralAngle;
|
||||
|
||||
/// <summary>
|
||||
/// 扫描方向
|
||||
/// </summary>
|
||||
private Vector3D scanDirection;
|
||||
|
||||
// 检测到目标的角度
|
||||
private double detectionAngle;
|
||||
|
||||
@ -69,11 +74,12 @@ namespace ActiveProtect.Models
|
||||
{
|
||||
currentStage = SubmunitionStage.Separation;
|
||||
spiralAngle = 0;
|
||||
scanDirection = new Vector3D(0, 0, 0);
|
||||
detectionAngle = 0;
|
||||
|
||||
// 初始化传感器
|
||||
infraredDetector = new InfraredDetector(Position, Orientation, 100, 30);
|
||||
radiometer = new MillimeterWaveRadiometer(Position, Orientation, 94e9, 1e-6);
|
||||
radiometer = new MillimeterWaveRadiometer(this, 3); // 毫米波辐射计,工作波段3mm
|
||||
altimeter = new MillimeterWaveAltimeter(this, 1000, 0.1); // 毫米波测高仪,测量精度0.1米
|
||||
rangefinder = new LaserRangefinder(Position, Orientation, 1000, 1000);
|
||||
}
|
||||
@ -166,6 +172,12 @@ namespace ActiveProtect.Models
|
||||
/// </summary>
|
||||
private void UpdateSpiralScanStage(double deltaTime)
|
||||
{
|
||||
if(!radiometer.IsActive)
|
||||
{
|
||||
// 激活毫米波辐射计
|
||||
radiometer.Activate();
|
||||
}
|
||||
|
||||
Velocity = new Vector3D(0, -VerticalDescentSpeed, 0);
|
||||
GuidanceAcceleration = Vector3D.Zero;
|
||||
|
||||
@ -184,15 +196,14 @@ namespace ActiveProtect.Models
|
||||
Velocity = new(horizontalVelocity.X, -VerticalDescentSpeed, horizontalVelocity.Z);
|
||||
|
||||
// 计算扫描方向
|
||||
Vector3D scanDirection = new(
|
||||
scanDirection = new(
|
||||
Math.Cos(spiralAngle) * Math.Sin(ScanAngle),
|
||||
-Math.Cos(ScanAngle),
|
||||
Math.Sin(spiralAngle) * Math.Sin(ScanAngle)
|
||||
);
|
||||
|
||||
if (DetectTarget(scanDirection))
|
||||
if (radiometer.GetSensorData() is RadiometerSensorData radiometerData && radiometerData.IsTargetDetected)
|
||||
{
|
||||
Console.WriteLine("检测到目标");
|
||||
double currentTime = SimulationManager.CurrentTime;
|
||||
if (lastDetectionTime == null)
|
||||
{
|
||||
@ -254,9 +265,8 @@ namespace ActiveProtect.Models
|
||||
/// <summary>
|
||||
/// 检测目标
|
||||
/// </summary>
|
||||
/// <param name="scanDirection">扫描方向</param>
|
||||
/// <returns>是否检测到目标</returns>
|
||||
private bool DetectTarget(Vector3D scanDirection)
|
||||
public bool DetectTarget()
|
||||
{
|
||||
Vector3D targetPosition = SimulationManager.GetEntityById(MissileProperties.TargetId).Position;
|
||||
Vector3D toTarget = (targetPosition - Position).Normalize();
|
||||
|
||||
@ -1,35 +0,0 @@
|
||||
namespace ActiveProtect.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// 定义传感器的基本接口
|
||||
/// </summary>
|
||||
public interface ISensor
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置传感器是否处于激活状态
|
||||
/// </summary>
|
||||
bool IsActive { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 激活传感器
|
||||
/// </summary>
|
||||
void Activate();
|
||||
|
||||
/// <summary>
|
||||
/// 停用传感器
|
||||
/// </summary>
|
||||
void Deactivate();
|
||||
|
||||
/// <summary>
|
||||
/// 更新传感器状态
|
||||
/// </summary>
|
||||
/// <param name="deltaTime">自上次更新以来的时间间隔</param>
|
||||
void Update(double deltaTime);
|
||||
|
||||
/// <summary>
|
||||
/// 获取传感器数据
|
||||
/// </summary>
|
||||
/// <returns>传感器采集的数据</returns>
|
||||
SensorData GetSensorData();
|
||||
}
|
||||
}
|
||||
@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using ActiveProtect.Utility;
|
||||
namespace ActiveProtect.Models
|
||||
{
|
||||
@ -12,12 +13,22 @@ namespace ActiveProtect.Models
|
||||
public double Wavelength { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 辐射温度差检测阈值,辐射计高温物体与低温物体的检测温差,单位K,默认 50K
|
||||
/// 辐射温度差检测阈值,辐射计高温物体与低温物体的检测温差,单位K,默认 100K;
|
||||
/// 对于金属目标,与草地的典型温差为170~230K,砂石地 120~150K
|
||||
/// 辐射温度 = 物理温度 * 辐射率,草地辐射率为 1,砂石地为 0.83,金属为 0
|
||||
/// 坦克的辐射温度 = 天空背景辐射的反射温度,根据角度不同,天顶角 30 度时为 90K
|
||||
/// </summary>
|
||||
public double DetectionTemperatureDifferenceThreshold { get; set; } = 50;
|
||||
public double DetectionTemperatureDifferenceThreshold { get; set; } = 100;
|
||||
|
||||
private double lastDetectionTemperature = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 毫米波辐射计传感器数据
|
||||
/// </summary>
|
||||
private readonly RadiometerSensorData sensorData;
|
||||
|
||||
private readonly TerminalSensitiveSubmunition submunition;
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
@ -25,12 +36,13 @@ namespace ActiveProtect.Models
|
||||
/// <param name="orientation">辐射计的朝向</param>
|
||||
/// <param name="wavelength">工作波段</param>
|
||||
/// <param name="detectionTemperatureDifferenceThreshold">辐射温差检测阈值</param>
|
||||
public MillimeterWaveRadiometer(Vector3D position, Orientation orientation, double wavelength, double detectionTemperatureDifferenceThreshold)
|
||||
: base(position, orientation)
|
||||
public MillimeterWaveRadiometer(TerminalSensitiveSubmunition submunition, double wavelength)
|
||||
: base(submunition.Position, submunition.Orientation)
|
||||
{
|
||||
Wavelength = wavelength;
|
||||
DetectionTemperatureDifferenceThreshold = detectionTemperatureDifferenceThreshold;
|
||||
lastDetectionTemperature = 0;
|
||||
sensorData = new RadiometerSensorData();
|
||||
this.submunition = submunition;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -40,6 +52,30 @@ namespace ActiveProtect.Models
|
||||
public override void Update(double deltaTime)
|
||||
{
|
||||
// 实现毫米波辐射计的更新逻辑
|
||||
if (IsActive)
|
||||
{
|
||||
// 获取当前方向上的辐射温度
|
||||
double currentDirectionRadiationTemperature = GetCurrentDirectionRadiationTemperature();
|
||||
// 计算辐射温度差
|
||||
double temperatureDifference = Math.Abs(currentDirectionRadiationTemperature - lastDetectionTemperature);
|
||||
// 如果温度差大于检测阈值,则认为检测到目标
|
||||
if (temperatureDifference >= DetectionTemperatureDifferenceThreshold)
|
||||
{
|
||||
sensorData.IsTargetDetected = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
sensorData.IsTargetDetected = false;
|
||||
}
|
||||
// 更新上次检测温度
|
||||
lastDetectionTemperature = currentDirectionRadiationTemperature;
|
||||
}
|
||||
}
|
||||
|
||||
private double GetCurrentDirectionRadiationTemperature()
|
||||
{
|
||||
// 获取当前方向上的辐射温度,如果检测到目标,则返回天空背景辐射的反射温度,否则返回300K
|
||||
return submunition.DetectTarget() ? 90 : 300;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -49,7 +85,7 @@ namespace ActiveProtect.Models
|
||||
public override SensorData GetSensorData()
|
||||
{
|
||||
// 返回毫米波辐射计的数据
|
||||
return new RadiometerSensorData();
|
||||
return sensorData;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -39,6 +39,11 @@ namespace ActiveProtect.Models
|
||||
/// 探测到的辐射强度
|
||||
/// </summary>
|
||||
public double RadiationIntensity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否检测到目标
|
||||
/// </summary>
|
||||
public bool IsTargetDetected { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -4,6 +4,39 @@ using ActiveProtect.Utility;
|
||||
|
||||
namespace ActiveProtect.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// 定义传感器的基本接口
|
||||
/// </summary>
|
||||
public interface ISensor
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置传感器是否处于激活状态
|
||||
/// </summary>
|
||||
bool IsActive { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 激活传感器
|
||||
/// </summary>
|
||||
void Activate();
|
||||
|
||||
/// <summary>
|
||||
/// 停用传感器
|
||||
/// </summary>
|
||||
void Deactivate();
|
||||
|
||||
/// <summary>
|
||||
/// 更新传感器状态
|
||||
/// </summary>
|
||||
/// <param name="deltaTime">自上次更新以来的时间间隔</param>
|
||||
void Update(double deltaTime);
|
||||
|
||||
/// <summary>
|
||||
/// 获取传感器数据
|
||||
/// </summary>
|
||||
/// <returns>传感器采集的数据</returns>
|
||||
SensorData GetSensorData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 传感器的抽象基类,实现了ISensor接口的基本功能
|
||||
/// </summary>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user