183 lines
6.8 KiB
C#
183 lines
6.8 KiB
C#
using System;
|
|
|
|
namespace ActiveProtect.Models
|
|
{
|
|
/// <summary>
|
|
/// 激光半主动制导系统
|
|
/// </summary>
|
|
public class LaserSemiActiveGuidanceSystem : BasicGuidanceSystem
|
|
{
|
|
private const double FieldOfViewAngle = Math.PI / 6; // 30度视场角
|
|
private const double DetectorDiameter = 0.1; // 探测器直径(米)
|
|
private const double FocusedSpotDiameter = 0.003; // 聚焦后光斑直径(米)
|
|
private const double ReflectionCoefficient = 0.2; // 反射系数
|
|
private const double LockThreshold = 1e-12; // 锁定阈值(瓦特)
|
|
private const double TargetReflectiveArea = 1.0; // 目标有效反射面积(平方米)
|
|
|
|
/// <summary>
|
|
/// 目标位置
|
|
/// </summary>
|
|
private Vector3D TargetPosition { get; set; }
|
|
|
|
/// <summary>
|
|
/// 目标速度
|
|
/// </summary>
|
|
private Vector3D TargetVelocity { get; set; }
|
|
|
|
/// <summary>
|
|
/// 激光照射是否开启
|
|
/// </summary>
|
|
private bool LaserIlluminationOn { get; set; }
|
|
|
|
/// <summary>
|
|
/// 激光指示器位置
|
|
/// </summary>
|
|
private Vector3D LaserDesignatorPosition { get; set; }
|
|
|
|
/// <summary>
|
|
/// 激光功率
|
|
/// </summary>
|
|
private double LaserPower { get; set; }
|
|
|
|
/// <summary>
|
|
/// 激光发散角
|
|
/// </summary>
|
|
private double LaserDivergenceAngle { get; set; }
|
|
|
|
|
|
/// <summary>
|
|
/// 构造函数
|
|
/// </summary>
|
|
public LaserSemiActiveGuidanceSystem(double maxAcceleration, double guidanceCoefficient) : base(maxAcceleration, guidanceCoefficient)
|
|
{
|
|
TargetPosition = Vector3D.Zero;
|
|
TargetVelocity = Vector3D.Zero;
|
|
LaserIlluminationOn = false;
|
|
LaserDesignatorPosition = Vector3D.Zero;
|
|
LaserPower = 0;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 更新激光指示器
|
|
/// </summary>
|
|
/// <param name="sourcePosition">激光源位置</param>
|
|
/// <param name="targetPosition">目标位置</param>
|
|
/// <param name="targetVelocity">目标速度</param>
|
|
/// <param name="laserPower">激光功率</param>
|
|
/// <param name="laserDivergenceAngle">激光发散角</param>
|
|
public void UpdateLaserDesignator(Vector3D sourcePosition, Vector3D targetPosition, Vector3D targetVelocity, double laserPower, double laserDivergenceAngle)
|
|
{
|
|
LaserIlluminationOn = true;
|
|
LaserDesignatorPosition = sourcePosition;
|
|
TargetPosition = targetPosition;
|
|
TargetVelocity = targetVelocity;
|
|
LaserPower = laserPower;
|
|
LaserDivergenceAngle = laserDivergenceAngle;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 关闭激光照射
|
|
/// </summary>
|
|
public void DeactivateLaserDesignator()
|
|
{
|
|
LaserIlluminationOn = false;
|
|
LaserDesignatorPosition = Vector3D.Zero;
|
|
TargetPosition = Vector3D.Zero;
|
|
TargetVelocity = Vector3D.Zero;
|
|
LaserPower = 0;
|
|
LaserDivergenceAngle = 0;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 更新制导系统
|
|
/// </summary>
|
|
/// <param name="deltaTime">时间步长</param>
|
|
/// <param name="missilePosition">导弹位置</param>
|
|
/// <param name="missileVelocity">导弹速度</param>
|
|
public override void Update(double deltaTime, Vector3D missilePosition, Vector3D missileVelocity)
|
|
{
|
|
base.Update(deltaTime, missilePosition, missileVelocity);
|
|
if (LaserIlluminationOn)
|
|
{
|
|
HasGuidance = CalculateReceivedLaserPower() > LockThreshold;
|
|
if (HasGuidance)
|
|
{
|
|
CalculateGuidanceAcceleration(deltaTime);
|
|
}
|
|
else
|
|
{
|
|
GuidanceAcceleration = Vector3D.Zero;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
GuidanceAcceleration = Vector3D.Zero;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 计算接收到的激光功率
|
|
/// </summary>
|
|
/// <returns>接收到的激光功率</returns>
|
|
private double CalculateReceivedLaserPower()
|
|
{
|
|
double distanceDesignatorToTarget = (LaserDesignatorPosition - TargetPosition).Magnitude();
|
|
double distanceMissileToTarget = (Position - TargetPosition).Magnitude();
|
|
|
|
// 计算目标处的光斑面积
|
|
double spotAreaAtTarget = Math.PI * Math.Pow(distanceDesignatorToTarget * Math.Tan(LaserDivergenceAngle), 2);
|
|
|
|
// 计算目标处的激光功率密度
|
|
double powerDensityAtTarget = LaserPower / spotAreaAtTarget;
|
|
|
|
// 计算从目标反射的总功率
|
|
double reflectedPower = powerDensityAtTarget * TargetReflectiveArea * ReflectionCoefficient;
|
|
|
|
// 计算反射光在导弹处的扩散面积(假设漫反射)
|
|
double reflectedSpotArea = 2 * Math.PI * Math.Pow(distanceMissileToTarget, 2);
|
|
|
|
// 计算导弹接收到的功率
|
|
double receivedPower = reflectedPower / reflectedSpotArea;
|
|
|
|
// 计算探测器接收到的功率比例
|
|
double detectorArea = Math.PI * Math.Pow(DetectorDiameter / 2, 2);
|
|
double illuminatedArea = Math.PI * Math.Pow(distanceMissileToTarget * Math.Tan(FieldOfViewAngle / 2), 2);
|
|
double powerRatio = Math.Min(1, detectorArea / illuminatedArea);
|
|
|
|
// 计算聚焦后的功率密度增加
|
|
double focusedArea = Math.PI * Math.Pow(FocusedSpotDiameter / 2, 2);
|
|
double focusingFactor = detectorArea / focusedArea;
|
|
|
|
// 计算最终接收到的功率
|
|
double finalReceivedPower = receivedPower * powerRatio * focusingFactor;
|
|
|
|
return finalReceivedPower;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 计算制导加速度
|
|
/// </summary>
|
|
/// <param name="deltaTime">时间步长</param>
|
|
protected override void CalculateGuidanceAcceleration(double deltaTime)
|
|
{
|
|
// 计算比例导引加速度
|
|
GuidanceAcceleration = CalculateProportionalNavigation(ProportionalNavigationCoefficient, Position, Velocity, TargetPosition, TargetVelocity);
|
|
|
|
// 限制最大加速度
|
|
double maxAcceleration = 100; // 根据实际情况调整
|
|
if (GuidanceAcceleration.Magnitude() > maxAcceleration)
|
|
{
|
|
GuidanceAcceleration = GuidanceAcceleration.Normalize() * maxAcceleration;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取制导系统状态
|
|
/// </summary>
|
|
public override string GetStatus()
|
|
{
|
|
return base.GetStatus() + $" 接收到的激光功率: {CalculateReceivedLaserPower():E} W 锁定阈值: {LockThreshold:E} W";
|
|
}
|
|
}
|
|
}
|