140 lines
6.0 KiB
C#
140 lines
6.0 KiB
C#
using System;
|
|
|
|
namespace ActiveProtect.Models
|
|
{
|
|
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; // 目标有效反射面积(平方米)
|
|
private Vector3D TargetPosition { get; set; }
|
|
private Vector3D TargetVelocity { get; set; }
|
|
private bool LaserIlluminationOn { get; set; }
|
|
private Vector3D LaserDesignatorPosition { get; set; }
|
|
private double LaserPower { get; set; }
|
|
private double LaserDivergenceAngle { get; set; }
|
|
|
|
private double ProportionalNavigationCoefficient { get; set; }
|
|
|
|
|
|
public LaserSemiActiveGuidanceSystem()
|
|
{
|
|
TargetPosition = Vector3D.Zero;
|
|
TargetVelocity = Vector3D.Zero;
|
|
LaserIlluminationOn = false;
|
|
LaserDesignatorPosition = Vector3D.Zero;
|
|
LaserPower = 0;
|
|
ProportionalNavigationCoefficient = 4;
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
public void DeactivateLaserDesignator()
|
|
{
|
|
LaserIlluminationOn = false;
|
|
LaserDesignatorPosition = Vector3D.Zero;
|
|
TargetPosition = Vector3D.Zero;
|
|
TargetVelocity = Vector3D.Zero;
|
|
LaserPower = 0;
|
|
LaserDivergenceAngle = 0;
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
PrintGuidanceInfo();
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
protected override void CalculateGuidanceAcceleration(double deltaTime)
|
|
{
|
|
Console.WriteLine($"激光半主动导弹引导加速度计算: 位置: {Position}, 速度: {Velocity}, 目标位置: {TargetPosition}, 目标速度: {TargetVelocity}");
|
|
// 计算比例导引加速度
|
|
GuidanceAcceleration = CalculateProportionalNavigation(ProportionalNavigationCoefficient, Position, Velocity, TargetPosition, TargetVelocity);
|
|
|
|
// 限制最大加速度
|
|
double maxAcceleration = 100; // 根据实际情况调整
|
|
if (GuidanceAcceleration.Magnitude() > maxAcceleration)
|
|
{
|
|
GuidanceAcceleration = GuidanceAcceleration.Normalize() * maxAcceleration;
|
|
}
|
|
}
|
|
|
|
private void PrintGuidanceInfo()
|
|
{
|
|
Console.WriteLine($"激光半主动导弹引导信息:");
|
|
Console.WriteLine($" 位置: {Position}");
|
|
Console.WriteLine($" 速度: {Velocity}");
|
|
Console.WriteLine($" 速度大小: {Velocity.Magnitude():F2} m/s");
|
|
Console.WriteLine($" 是否有引导: {HasGuidance}");
|
|
Console.WriteLine($" 目标位置: {TargetPosition}");
|
|
Console.WriteLine($" 制导加速度: {GuidanceAcceleration}");
|
|
Console.WriteLine($" 接收到的激光功率: {CalculateReceivedLaserPower():E} W");
|
|
Console.WriteLine($" 锁定阈值: {LockThreshold:E} W");
|
|
Console.WriteLine();
|
|
}
|
|
}
|
|
}
|