增加了升力加速度的计算,将发射、巡航、制导三个阶段汇聚到导弹基类中
This commit is contained in:
parent
3b38e699e5
commit
2a03ff7c51
@ -15,6 +15,10 @@
|
||||
- 毫米波跟踪和锁定阶段采用脉冲多普勒制导
|
||||
- 命中概率和系统随机噪声
|
||||
|
||||
## [1.1.21] - 2025-05-24
|
||||
- 增加了升力加速度的计算
|
||||
- 将发射、巡航、制导三个阶段汇聚到导弹基类中
|
||||
|
||||
## [1.1.20] - 2025-05-19
|
||||
- 增加了SwerlingRCS回波模型
|
||||
- 在毫米波制导中使用SwerlingRCS回波模型获取目标RCS
|
||||
|
||||
@ -14,7 +14,7 @@ MaxAcceleration = 100.0
|
||||
ProportionalNavigationCoefficient = 4.0
|
||||
LaunchAcceleration = 100.0
|
||||
MaxEngineBurnTime = 2.5
|
||||
CruiseTime = 4.0
|
||||
CruiseTime = 3.5
|
||||
Mass = 25.0
|
||||
ExplosionRadius = 5.0
|
||||
HitProbability = 0.9
|
||||
@ -34,7 +34,7 @@ ActivationTrigger = "OnLaunch" # 激活触发器:OnLaunch, AfterFligh
|
||||
ActivationValue = 0.0 # 触发器关联值 (例如:飞行时间秒数,距离米数)
|
||||
Priority = 0 # 优先级 (例如:0为最高)
|
||||
MaxTimeToAcquireGuidanceSeconds = 5.0 # 获取制导的最大时间
|
||||
MinTimeWithGuidanceBeforeSwitchSeconds = 0.2 # 稳定跟踪0.2秒后切换(因为毫米波跟踪不稳定)
|
||||
MinTimeWithGuidanceBeforeSwitchSeconds = 0.0 # 稳定跟踪0.1秒后切换(因为毫米波跟踪不稳定)
|
||||
ContinueChainOnFailure = true # 失败后继续尝试下一个
|
||||
|
||||
# 第二个制导阶段:红外成像末制导
|
||||
@ -65,7 +65,7 @@ Wavelength = 3.0 # 波长 (微米)
|
||||
|
||||
[MillimeterWaveGuidanceConfig]
|
||||
MaxDetectionRange = 5000.0 # 最大探测距离 (米)
|
||||
FieldOfViewAngle = 45.0 # 视场角 (度)
|
||||
FieldOfViewAngle = 15.0 # 视场角 (度)
|
||||
TargetRecognitionProbability = 0.95 # 目标识别概率
|
||||
WaveFrequency = 9.4e10 # 波频率 (赫兹)
|
||||
PulseDuration = 1.0e-6 # 脉冲持续时间 (秒)
|
||||
|
||||
@ -14,7 +14,7 @@ MaxAcceleration = 100.0
|
||||
ProportionalNavigationCoefficient = 4.0
|
||||
LaunchAcceleration = 100.0
|
||||
MaxEngineBurnTime = 2.5
|
||||
CruiseTime = 4.0
|
||||
CruiseTime = 3.5
|
||||
Mass = 25.0
|
||||
ExplosionRadius = 5.0
|
||||
HitProbability = 0.9
|
||||
@ -34,7 +34,7 @@ ActivationTrigger = "OnLaunch" # 激活触发器:OnLaunch, AfterFligh
|
||||
ActivationValue = 0.0 # 触发器关联值 (例如:飞行时间秒数,距离米数)
|
||||
Priority = 0 # 优先级 (例如:0为最高)
|
||||
MaxTimeToAcquireGuidanceSeconds = 5.0 # 获取制导的最大时间
|
||||
MinTimeWithGuidanceBeforeSwitchSeconds = 0.2 # 稳定跟踪0.2秒后切换(因为毫米波跟踪不稳定)
|
||||
MinTimeWithGuidanceBeforeSwitchSeconds = 0.3 # 稳定跟踪0.3秒后切换
|
||||
ContinueChainOnFailure = true # 失败后继续尝试下一个
|
||||
|
||||
# 第二个制导阶段:红外成像末制导
|
||||
|
||||
@ -12,9 +12,9 @@ MaxFlightTime = 60.0 # 最大飞行时间 (秒)
|
||||
MaxFlightDistance = 5000.0 # 最大飞行距离 (米)
|
||||
MaxAcceleration = 100.0 # 最大加速度 (米/秒^2)
|
||||
ProportionalNavigationCoefficient = 4.0 # 比例导引系数
|
||||
LaunchAcceleration = 100.0 # 发射加速度 (米/秒^2)
|
||||
MaxEngineBurnTime = 3.0 # 最大发动机燃烧时间 (秒)
|
||||
CruiseTime = 5.0 # 巡航时间 (秒)
|
||||
LaunchAcceleration = 150.0 # 发射加速度 (米/秒^2)
|
||||
MaxEngineBurnTime = 2.0 # 最大发动机燃烧时间 (秒)
|
||||
CruiseTime = 2.0 # 巡航时间 (秒)
|
||||
Mass = 23.5 # 质量 (千克)
|
||||
ExplosionRadius = 5.0 # 爆炸半径 (米)
|
||||
HitProbability = 0.9 # 命中概率
|
||||
|
||||
@ -14,7 +14,7 @@ MaxAcceleration = 100.0
|
||||
ProportionalNavigationCoefficient = 4.0
|
||||
LaunchAcceleration = 100.0
|
||||
MaxEngineBurnTime = 2.5
|
||||
CruiseTime = 4.0
|
||||
CruiseTime = 3.0
|
||||
Mass = 25.0
|
||||
ExplosionRadius = 5.0
|
||||
HitProbability = 0.9
|
||||
|
||||
@ -14,7 +14,7 @@ MaxAcceleration = 100.0 # 最大加速度 (米/秒^2)
|
||||
ProportionalNavigationCoefficient = 3.0 # 比例导引系数
|
||||
LaunchAcceleration = 100.0 # 发射加速度 (米/秒^2)
|
||||
MaxEngineBurnTime = 3.0 # 最大发动机燃烧时间 (秒)
|
||||
CruiseTime = 5.0 # 巡航时间 (秒)
|
||||
CruiseTime = 0.0 # 巡航时间 (秒)
|
||||
Mass = 24.5 # 质量 (千克)
|
||||
ExplosionRadius = 5.0 # 爆炸半径 (米)
|
||||
HitProbability = 0.9 # 命中概率
|
||||
|
||||
@ -12,10 +12,10 @@ MaxSpeed = 800.0 # 最大速度 (m/s)
|
||||
MaxFlightTime = 60.0 # 最大飞行时间 (秒)
|
||||
MaxFlightDistance = 20000.0 # 最大飞行距离 (米)
|
||||
MaxAcceleration = 50.0 # 最大横向加速度 (m/s^2)
|
||||
ProportionalNavigationCoefficient = 2.0 # 比例导引系数
|
||||
LaunchAcceleration = 100.0 # 初始发射加速度 (m/s^2)
|
||||
MaxEngineBurnTime = 0.1 # 发动机最大燃烧时间 (秒)
|
||||
CruiseTime = 5.0 #巡航阶段时长 (秒)
|
||||
ProportionalNavigationCoefficient = 3.0 # 比例导引系数
|
||||
LaunchAcceleration = 0.0 # 初始发射加速度 (m/s^2)
|
||||
MaxEngineBurnTime = 0.0 # 发动机最大燃烧时间 (秒)
|
||||
CruiseTime = 10.0 #巡航阶段时长 (秒)
|
||||
Mass = 22.0 # 导弹质量 (kg)
|
||||
ExplosionRadius = 5.0 # 爆炸半径 (米)
|
||||
HitProbability = 0.9 # 固有命中概率 (0.0 到 1.0)
|
||||
|
||||
@ -11,10 +11,10 @@ MaxSpeed = 250.0 # 最大速度 (米/秒)
|
||||
MaxFlightTime = 60.0 # 最大飞行时间 (秒)
|
||||
MaxFlightDistance = 8000.0 # 最大飞行距离 (米)
|
||||
MaxAcceleration = 100.0 # 最大加速度 (米/秒^2)
|
||||
ProportionalNavigationCoefficient = 4.0 # 比例导引系数
|
||||
ProportionalNavigationCoefficient = 4.0 # 比例导引系数
|
||||
LaunchAcceleration = 100.0 # 发射加速度 (米/秒^2)
|
||||
MaxEngineBurnTime = 2.5 # 最大发动机燃烧时间 (秒)
|
||||
CruiseTime = 4.0 # 巡航时间 (秒)
|
||||
CruiseTime = 3.5 # 巡航时间 (秒)
|
||||
Mass = 28.0 # 质量 (千克)
|
||||
ExplosionRadius = 5.0 # 爆炸半径 (米)
|
||||
HitProbability = 0.9 # 命中概率
|
||||
@ -24,7 +24,7 @@ UltravioletRadiationIntensity = 100.0 # 紫外辐射强度 (瓦特/球面度)
|
||||
|
||||
[MillimeterWaveGuidanceConfig]
|
||||
MaxDetectionRange = 5000.0 # 最大探测距离 (米)
|
||||
FieldOfViewAngle = 45.0 # 视场角 (度)
|
||||
FieldOfViewAngle = 15.0 # 视场角 (度)
|
||||
TargetRecognitionProbability = 0.95 # 目标识别概率
|
||||
WaveFrequency = 9.4e10 # 波频率 (赫兹, JSON中为94e9)
|
||||
PulseDuration = 1.0e-6 # 脉冲持续时间 (秒)
|
||||
|
||||
@ -13,8 +13,8 @@ MaxFlightTime = 100.0 # 最大飞行时间 (秒)
|
||||
MaxFlightDistance = 20000.0 # 最大飞行距离 (米)
|
||||
MaxAcceleration = 200.0 # 最大加速度 (米/秒^2)
|
||||
ProportionalNavigationCoefficient = 3.0 # 比例导引系数
|
||||
LaunchAcceleration = 100.0 # 发射加速度 (米/秒^2)
|
||||
MaxEngineBurnTime = 0.1 # 最大发动机燃烧时间 (秒)
|
||||
LaunchAcceleration = 0.0 # 发射加速度 (米/秒^2)
|
||||
MaxEngineBurnTime = 0.0 # 最大发动机燃烧时间 (秒)
|
||||
CruiseTime = 5.0 # 巡航时间 (秒)
|
||||
Mass = 50.0 # 质量 (千克)
|
||||
ExplosionRadius = 5.0 # 爆炸半径 (米)
|
||||
@ -26,8 +26,8 @@ MaxFlightTime = 60.0 # 最大飞行时间 (秒)
|
||||
MaxFlightDistance = 2000.0 # 最大飞行距离 (米)
|
||||
MaxAcceleration = 500.0 # 最大加速度 (米/秒^2)
|
||||
ProportionalNavigationCoefficient = 4.0 # 比例导引系数
|
||||
LaunchAcceleration = 10.0 # 发射加速度 (米/秒^2)
|
||||
MaxEngineBurnTime = 0.1 # 最大发动机燃烧时间 (秒)
|
||||
LaunchAcceleration = 0.0 # 发射加速度 (米/秒^2)
|
||||
MaxEngineBurnTime = 0.0 # 最大发动机燃烧时间 (秒)
|
||||
Mass = 10.0 # 质量 (千克)
|
||||
ExplosionRadius = 8.0 # 爆炸半径 (米)
|
||||
HitProbability = 0.9 # 命中概率
|
||||
@ -38,11 +38,11 @@ SeparationSpeed = 600.0 # 分离速度 (米/秒)
|
||||
SeparationHeight = 1000.0 # 分离高度 (米)
|
||||
SeparationDistance = 1000.0 # 分离距离 (米)
|
||||
SubmunitionSeparationAngle = 35.0 # 子弹药分离角度 (度)
|
||||
SeparationRange = 25.0 # 分离散布范围 (米)
|
||||
DecelerationAcceleration = 155.0 # 减速加速度 (米/秒^2)
|
||||
SeparationRange = 10.0 # 分离散布范围 (米)
|
||||
DecelerationAcceleration = 150.0 # 减速加速度 (米/秒^2)
|
||||
DecelerationEndSpeed = 200.0 # 减速结束速度 (米/秒)
|
||||
ParachuteDeploymentHeight = 400.0 # 开伞高度 (米)
|
||||
ParachuteDeceleration = 100.0 # 降落伞减速度 (米/秒^2)
|
||||
ParachuteDeceleration = 95.0 # 降落伞减速度 (米/秒^2)
|
||||
StableScanHeight = 200.0 # 稳定扫描高度 (米)
|
||||
VerticalDeclineSpeed = 10.0 # 垂直下降速度 (米/秒)
|
||||
SpiralRotationSpeed = 25.13 # 螺旋旋转速度 (弧度/秒)
|
||||
|
||||
@ -115,7 +115,7 @@ namespace ThreatSource.Guidance
|
||||
/// <summary>
|
||||
/// 识别成功率阈值 (搜索切换和跟踪稳定性判断共用, 例如80%)
|
||||
/// </summary>
|
||||
private const double COMMON_RECOGNITION_SUCCESS_RATE_THRESHOLD = 0.8;
|
||||
private const double COMMON_RECOGNITION_SUCCESS_RATE_THRESHOLD = 0.7;
|
||||
|
||||
/// <summary>
|
||||
/// 锁定模式下目标丢失计时器
|
||||
|
||||
@ -100,10 +100,20 @@ namespace ThreatSource.Missile
|
||||
/// </remarks>
|
||||
protected Vector3D ThrustAcceleration { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置导弹的升力加速度
|
||||
/// </summary>
|
||||
/// <value>三维加速度向量,单位:米/秒²</value>
|
||||
/// <remarks>
|
||||
/// 由升力产生的加速度
|
||||
/// 影响导弹的垂直运动
|
||||
/// </remarks>
|
||||
protected Vector3D LiftAcceleration { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 重力加速度(北京标准值)
|
||||
/// </summary>
|
||||
private static readonly Vector3D GravityAcceleration = new(0, -MotionAlgorithm.Gravity, 0);
|
||||
private static readonly Vector3D GravityAcceleration = new(0, -PhysicalConstants.BeijingGravity, 0);
|
||||
|
||||
/// <summary>
|
||||
/// 获取导弹的固定配置参数
|
||||
@ -115,6 +125,30 @@ namespace ThreatSource.Missile
|
||||
/// </remarks>
|
||||
public readonly MissileProperties Properties;
|
||||
|
||||
/// <summary>
|
||||
/// 标准导弹三段式飞行阶段
|
||||
/// </summary>
|
||||
public enum MissileFlightStage
|
||||
{
|
||||
/// <summary>
|
||||
/// 发射阶段
|
||||
/// </summary>
|
||||
Launch,
|
||||
/// <summary>
|
||||
/// 巡航阶段
|
||||
/// </summary>
|
||||
Cruise,
|
||||
/// <summary>
|
||||
/// 制导阶段
|
||||
/// </summary>
|
||||
Guidance
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当前飞行阶段
|
||||
/// </summary>
|
||||
protected MissileFlightStage currentStage = MissileFlightStage.Launch;
|
||||
|
||||
/// <summary>
|
||||
/// 初始化导弹基类的新实例
|
||||
/// </summary>
|
||||
@ -146,12 +180,26 @@ namespace ThreatSource.Missile
|
||||
IsActive = false;
|
||||
IsGuidance = false;
|
||||
GuidanceAcceleration = Vector3D.Zero;
|
||||
LiftAcceleration = Vector3D.Zero;
|
||||
|
||||
// 计算初始推力加速度
|
||||
Vector3D launchDirection = kinematicState.Orientation.ToVector().Normalize();
|
||||
ThrustAcceleration = launchDirection * properties.LaunchAcceleration;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断是否为末敏弹类型
|
||||
/// </summary>
|
||||
protected bool IsTerminalSensitiveType()
|
||||
{
|
||||
return Properties.Type == MissileType.TerminalSensitiveSubmunition;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 供末敏弹等特殊导弹重写的自定义阶段更新方法
|
||||
/// </summary>
|
||||
protected virtual void UpdateCustomStages(double deltaTime) { }
|
||||
|
||||
/// <summary>
|
||||
/// 更新导弹的状态
|
||||
/// </summary>
|
||||
@ -164,17 +212,82 @@ namespace ThreatSource.Missile
|
||||
/// </remarks>
|
||||
public override void Update(double deltaTime)
|
||||
{
|
||||
if (IsActive)
|
||||
{
|
||||
// 更新导弹运动状态
|
||||
UpdateMotionState(deltaTime);
|
||||
if (!IsActive) return;
|
||||
|
||||
// 检查是否应该自毁
|
||||
if (ShouldSelfDestruct())
|
||||
// 末敏弹等特殊类型走自定义流程
|
||||
if (!IsTerminalSensitiveType())
|
||||
{
|
||||
// 标准三段式流程
|
||||
switch (currentStage)
|
||||
{
|
||||
SelfDestruct();
|
||||
case MissileFlightStage.Launch:
|
||||
OnLaunchStage(deltaTime);
|
||||
break;
|
||||
case MissileFlightStage.Cruise:
|
||||
OnCruiseStage(deltaTime);
|
||||
break;
|
||||
case MissileFlightStage.Guidance:
|
||||
OnGuidanceStage(deltaTime);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 公共运动学与生命周期管理
|
||||
UpdateMotionState(deltaTime);
|
||||
if (ShouldSelfDestruct())
|
||||
{
|
||||
SelfDestruct();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发射阶段默认实现
|
||||
/// </summary>
|
||||
protected virtual void OnLaunchStage(double deltaTime)
|
||||
{
|
||||
// 发射阶段不使用制导
|
||||
GuidanceAcceleration = Vector3D.Zero;
|
||||
|
||||
// 计算升力加速度。在发射阶段,升力加速度和攻角相关
|
||||
LiftAcceleration = LiftModel.CalculateLiftAcceleration(KState.Orientation.Pitch * 180 / Math.PI);
|
||||
|
||||
// 发射阶段结束,进入巡航阶段
|
||||
if (FlightTime >= Properties.MaxEngineBurnTime)
|
||||
{
|
||||
currentStage = MissileFlightStage.Cruise;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 巡航阶段默认实现
|
||||
/// </summary>
|
||||
protected virtual void OnCruiseStage(double deltaTime)
|
||||
{
|
||||
// 巡航阶段不使用制导
|
||||
GuidanceAcceleration = Vector3D.Zero;
|
||||
|
||||
if(KState.Orientation.Pitch > 0)
|
||||
{
|
||||
KState.Orientation = new Orientation(KState.Orientation.Yaw, -0.01, KState.Orientation.Roll);
|
||||
}
|
||||
|
||||
// 计算升力加速度。在巡航阶段,升力加速度与重力加速度抵消
|
||||
LiftAcceleration = new Vector3D(0, PhysicalConstants.BeijingGravity, 0);
|
||||
|
||||
// 巡航阶段结束,进入制导阶段
|
||||
if (FlightTime >= Properties.MaxEngineBurnTime + Properties.CruiseTime)
|
||||
{
|
||||
currentStage = MissileFlightStage.Guidance;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 制导阶段默认实现
|
||||
/// </summary>
|
||||
protected virtual void OnGuidanceStage(double deltaTime)
|
||||
{
|
||||
// 计算升力加速度。在制导阶段,升力加速度和攻角相关;
|
||||
LiftAcceleration = LiftModel.CalculateLiftAcceleration(KState.Orientation.Pitch * 180 / Math.PI);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -218,6 +331,8 @@ namespace ThreatSource.Missile
|
||||
(KState.Position, KState.Velocity) = MotionAlgorithm.CalculateBallisticMotion(KState.Position, KState.Velocity, acceleration, deltaTime);
|
||||
}
|
||||
|
||||
KState.Orientation = Orientation.FromVector(KState.Velocity);
|
||||
|
||||
// 限制速度不超过最大速度
|
||||
if (KState.Speed > Properties.MaxSpeed)
|
||||
{
|
||||
@ -250,13 +365,13 @@ namespace ThreatSource.Missile
|
||||
Vector3D windVector = GetWindVectorFromWeather();
|
||||
|
||||
// 计算空气阻力加速度(考虑风的影响)
|
||||
Vector3D dragAcceleration = MotionAlgorithm.CalculateDragAcceleration(velocity, windVector, Properties.Mass);;
|
||||
Vector3D dragAcceleration = MotionAlgorithm.CalculateDragAcceleration(velocity, windVector, Properties.Mass);
|
||||
|
||||
// 合成总加速度(制导加速度 + 推力加速度 + 空气阻力加速度 + 重力加速度)
|
||||
Vector3D totalAcceleration = GuidanceAcceleration + ThrustAcceleration + dragAcceleration + GravityAcceleration;
|
||||
// 合成总加速度(制导加速度 + 推力加速度 + 空气阻力加速度 + 升力加速度 + 重力加速度)
|
||||
Vector3D totalAcceleration = GuidanceAcceleration + ThrustAcceleration + dragAcceleration + LiftAcceleration + GravityAcceleration;
|
||||
|
||||
Debug.WriteLine($"导弹 {Id} 的加速度: {totalAcceleration}, 制导: {GuidanceAcceleration}, " +
|
||||
$"推力: {ThrustAcceleration}, 空阻(含风): {dragAcceleration}, 重力: {GravityAcceleration}");
|
||||
$"推力: {ThrustAcceleration}, 空阻(含风): {dragAcceleration}, 升力: {LiftAcceleration}, 重力: {GravityAcceleration}");
|
||||
|
||||
if (totalAcceleration.Magnitude() > Properties.MaxAcceleration)
|
||||
{
|
||||
@ -480,6 +595,7 @@ namespace ThreatSource.Missile
|
||||
statusInfo.ExtendedProperties["FlightTime"] = FlightTime;
|
||||
statusInfo.ExtendedProperties["FlightDistance"] = FlightDistance;
|
||||
statusInfo.ExtendedProperties["EngineBurnTime"] = EngineBurnTime;
|
||||
statusInfo.ExtendedProperties["CurrentStage"] = currentStage.ToString();
|
||||
statusInfo.ExtendedProperties["IsGuidance"] = IsGuidance;
|
||||
statusInfo.ExtendedProperties["LostGuidanceTime"] = LostGuidanceTime;
|
||||
statusInfo.ExtendedProperties["GuidanceAcceleration"] = GuidanceAcceleration;
|
||||
|
||||
@ -7,13 +7,6 @@ using ThreatSource.Jammable;
|
||||
|
||||
namespace ThreatSource.Missile
|
||||
{
|
||||
internal enum CompositeFlightStage
|
||||
{
|
||||
Launch, // 发射阶段
|
||||
Cruise, // 巡航阶段
|
||||
Terminal // 末制导阶段
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 复合制导导弹类,继承自 BaseMissile
|
||||
/// </summary>
|
||||
@ -42,10 +35,6 @@ namespace ThreatSource.Missile
|
||||
/// 目标类型
|
||||
/// </summary>
|
||||
private readonly EquipmentType targetType;
|
||||
/// <summary>
|
||||
/// 当前飞行阶段
|
||||
/// </summary>
|
||||
private CompositeFlightStage currentFlightStage;
|
||||
|
||||
/// <summary>
|
||||
/// 经过优先级排序的制导组件配置列表。
|
||||
@ -357,37 +346,22 @@ namespace ThreatSource.Missile
|
||||
/// </summary>
|
||||
public override void Update(double deltaTime)
|
||||
{
|
||||
if (!IsActive) return;
|
||||
|
||||
switch (currentFlightStage)
|
||||
{
|
||||
case CompositeFlightStage.Launch:
|
||||
UpdateLaunchStage(deltaTime);
|
||||
break;
|
||||
case CompositeFlightStage.Cruise:
|
||||
UpdateCruiseStage(deltaTime);
|
||||
break;
|
||||
case CompositeFlightStage.Terminal:
|
||||
UpdateTerminalStage(deltaTime); // UpdateTerminalStage 内部可以决定是否调用 UpdateGuidanceLogic
|
||||
break;
|
||||
}
|
||||
|
||||
// 具体的制导模式切换和活动制导系统更新由 UpdateGuidanceLogic 处理
|
||||
// 只在特定条件下(例如,串行模式且处于末制导)调用 UpdateGuidanceLogic
|
||||
if (Properties.CompositeWorkMode == CompositeWorkType.Serial && currentFlightStage == CompositeFlightStage.Terminal)
|
||||
if (Properties.CompositeWorkMode == CompositeWorkType.Serial && currentStage == MissileFlightStage.Guidance)
|
||||
{
|
||||
UpdateGuidanceLogic(deltaTime);
|
||||
}
|
||||
|
||||
if (currentActiveGuidance != null && currentActiveGuidance.HasGuidance)
|
||||
{
|
||||
this.IsGuidance = true;
|
||||
this.GuidanceAcceleration = currentActiveGuidance.GetGuidanceAcceleration();
|
||||
IsGuidance = true;
|
||||
GuidanceAcceleration = currentActiveGuidance.GetGuidanceAcceleration();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.IsGuidance = false;
|
||||
this.GuidanceAcceleration = Vector3D.Zero;
|
||||
IsGuidance = false;
|
||||
GuidanceAcceleration = Vector3D.Zero;
|
||||
}
|
||||
|
||||
base.Update(deltaTime); // 调用基类更新,处理运动学等
|
||||
@ -399,44 +373,27 @@ namespace ThreatSource.Missile
|
||||
public override void Fire()
|
||||
{
|
||||
base.Fire();
|
||||
currentFlightStage = CompositeFlightStage.Launch;
|
||||
|
||||
// 重置制导链状态
|
||||
InitializeGuidanceSuite();
|
||||
currentPhaseActivationTime = -1.0;
|
||||
currentPhaseStableGuidanceTime = -1.0;
|
||||
|
||||
Debug.WriteLine($"[CompositeGuidedMissile.Fire] 导弹 {Id} 发射. 初始阶段: {currentFlightStage}. 制导链已重置.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新发射阶段,基于MaxEngineBurnTime转换到巡航阶段。
|
||||
/// 更新制导阶段状态
|
||||
/// </summary>
|
||||
protected virtual void UpdateLaunchStage(double deltaTime)
|
||||
protected override void OnGuidanceStage(double deltaTime)
|
||||
{
|
||||
if (FlightTime >= Properties.MaxEngineBurnTime)
|
||||
if(currentActiveGuidance == null)
|
||||
{
|
||||
currentFlightStage = CompositeFlightStage.Cruise;
|
||||
KState.Orientation = new Orientation(KState.Orientation.Yaw, -0.02, KState.Orientation.Roll);
|
||||
KState.Velocity = KState.Orientation.ToVector() * KState.Speed;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新巡航阶段,基于CruiseTime转换到末制导阶段。
|
||||
/// </summary>
|
||||
protected virtual void UpdateCruiseStage(double deltaTime)
|
||||
{
|
||||
if (FlightTime >= Properties.CruiseTime + Properties.MaxEngineBurnTime)
|
||||
{
|
||||
currentFlightStage = CompositeFlightStage.Terminal;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新末制导阶段,调用UpdateGuidanceMode处理制导逻辑。
|
||||
/// </summary>
|
||||
protected virtual void UpdateTerminalStage(double deltaTime)
|
||||
{
|
||||
UpdateGuidanceLogic(deltaTime);
|
||||
|
||||
base.OnGuidanceStage(deltaTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -465,9 +422,8 @@ namespace ThreatSource.Missile
|
||||
public override ElementStatusInfo GetStatusInfo()
|
||||
{
|
||||
var statusInfo = base.GetStatusInfo();
|
||||
statusInfo.ExtendedProperties["CurrentFlightStage"] = currentFlightStage; // 已有
|
||||
statusInfo.ExtendedProperties["CompositeWorkMode"] = Properties.CompositeWorkMode?.ToString() ?? "None"; // 已有
|
||||
statusInfo.ExtendedProperties["ActiveGuidanceSystem"] = currentActiveGuidance?.GetType().Name ?? "None"; // 已有
|
||||
statusInfo.ExtendedProperties["CompositeWorkMode"] = Properties.CompositeWorkMode?.ToString() ?? "None";
|
||||
statusInfo.ExtendedProperties["ActiveGuidanceSystem"] = currentActiveGuidance?.GetType().Name ?? "None";
|
||||
statusInfo.ExtendedProperties["ActiveGuidanceConfig"] = currentActiveConfig?.ComponentName ?? "None";
|
||||
statusInfo.ExtendedProperties["CurrentGuidancePhaseIndex"] = currentGuidancePhaseIndex;
|
||||
statusInfo.ExtendedProperties["GuidanceChainHaltedOrCompleted"] = guidanceChainHaltedOrCompleted.ToString();
|
||||
|
||||
@ -18,31 +18,6 @@ namespace ThreatSource.Missile
|
||||
/// </remarks>
|
||||
public class InfraredCommandGuidedMissile : BaseMissile
|
||||
{
|
||||
/// <summary>
|
||||
/// 红外指令制导导弹阶段枚举
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 定义了导弹飞行的四个主要阶段:
|
||||
/// - Launch:发射阶段,初始加速
|
||||
/// - Cruise:巡航阶段,执行制导
|
||||
/// - Explode:爆炸阶段,命中目标
|
||||
/// - SelfDestruct:自毁阶段,触发自毁
|
||||
/// </remarks>
|
||||
private enum ICGM_Stage
|
||||
{
|
||||
Launch, // 发射阶段
|
||||
Cruise // 巡航阶段
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置当前飞行阶段
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 用于控制导弹在不同阶段的行为
|
||||
/// 影响导弹的运动和制导方式
|
||||
/// </remarks>
|
||||
private ICGM_Stage currentStage;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置红外热源辐射功率
|
||||
/// </summary>
|
||||
@ -108,65 +83,20 @@ namespace ThreatSource.Missile
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新导弹运动状态
|
||||
/// 更新制导阶段状态
|
||||
/// </summary>
|
||||
/// <param name="deltaTime">时间步长,单位:秒</param>
|
||||
/// <remarks>
|
||||
/// 更新过程:
|
||||
/// - 点亮红外热源
|
||||
/// - 根据当前阶段更新状态
|
||||
/// - 调用基类的运动更新
|
||||
/// </remarks>
|
||||
public override void Update(double deltaTime)
|
||||
{
|
||||
// 点亮红外热源
|
||||
LightInfraredSource();
|
||||
|
||||
switch (currentStage)
|
||||
{
|
||||
case ICGM_Stage.Launch:
|
||||
UpdateLaunchStage(deltaTime);
|
||||
break;
|
||||
case ICGM_Stage.Cruise:
|
||||
UpdateCruiseStage(deltaTime);
|
||||
break;
|
||||
}
|
||||
|
||||
base.Update(deltaTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新发射阶段状态
|
||||
/// </summary>
|
||||
/// <param name="deltaTime">时间步长,单位:秒</param>
|
||||
/// <remarks>
|
||||
/// 发射阶段处理:
|
||||
/// - 清除制导加速度
|
||||
/// - 检查发射时间
|
||||
/// - 转换到巡航阶段
|
||||
/// </remarks>
|
||||
private void UpdateLaunchStage(double deltaTime)
|
||||
{
|
||||
// 发射阶段
|
||||
GuidanceAcceleration = Vector3D.Zero;
|
||||
if (FlightTime >= Properties.MaxEngineBurnTime)
|
||||
{
|
||||
currentStage = ICGM_Stage.Cruise;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新巡航阶段状态
|
||||
/// </summary>
|
||||
/// <param name="deltaTime">时间步长,单位:秒</param>
|
||||
/// <remarks>
|
||||
/// 巡航阶段处理:
|
||||
/// 制导阶段处理:
|
||||
/// - 启用制导控制
|
||||
/// - 更新制导系统
|
||||
/// - 计算制导加速度
|
||||
/// </remarks>
|
||||
private void UpdateCruiseStage(double deltaTime)
|
||||
protected override void OnGuidanceStage(double deltaTime)
|
||||
{
|
||||
// 点亮红外热源
|
||||
LightInfraredSource();
|
||||
// 更新制导系统
|
||||
guidanceSystem.Update(deltaTime);
|
||||
GuidanceAcceleration = guidanceSystem.GetGuidanceAcceleration();
|
||||
IsGuidance = guidanceSystem.HasGuidance;
|
||||
@ -209,20 +139,6 @@ namespace ThreatSource.Missile
|
||||
SimulationManager.PublishEvent(new InfraredGuidanceMissileLightEvent { RadiationPower = RadiationPower, SenderId = Id });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发射导弹
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 发射过程:
|
||||
/// - 调用基类发射方法
|
||||
/// - 设置当前阶段为发射阶段
|
||||
/// </remarks>
|
||||
public override void Fire()
|
||||
{
|
||||
base.Fire();
|
||||
currentStage = ICGM_Stage.Launch;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 熄灭红外热源
|
||||
/// </summary>
|
||||
@ -284,7 +200,6 @@ namespace ThreatSource.Missile
|
||||
public override ElementStatusInfo GetStatusInfo()
|
||||
{
|
||||
var statusInfo = base.GetStatusInfo();
|
||||
statusInfo.ExtendedProperties["CurrentStage"] = currentStage.ToString();
|
||||
statusInfo.ExtendedProperties["GuidanceSystem"] = guidanceSystem.GetStatusInfo();
|
||||
return statusInfo;
|
||||
}
|
||||
|
||||
@ -24,33 +24,6 @@ namespace ThreatSource.Missile
|
||||
/// </remarks>
|
||||
public class InfraredImagingTerminalGuidedMissile : BaseMissile
|
||||
{
|
||||
/// <summary>
|
||||
/// 红外成像末制导导弹的飞行阶段枚举
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 定义了导弹的工作阶段:
|
||||
/// - Launch: 发射阶段,初始加速
|
||||
/// - Cruise: 巡航阶段,中程飞行
|
||||
/// - TerminalSearch: 末制导搜索阶段,大视场角搜索目标
|
||||
/// - TerminalTrack: 末制导跟踪阶段,小视场角精确跟踪
|
||||
/// - TerminalLock: 末制导锁定阶段,目标确认后的精确跟踪
|
||||
/// </remarks>
|
||||
private enum IRTG_Stage
|
||||
{
|
||||
Launch, // 发射阶段
|
||||
Cruise, // 巡航阶段
|
||||
Terminal // 末制导
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 导弹当前的飞行阶段
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 用于控制导弹的行为状态
|
||||
/// 在不同阶段执行不同的更新逻辑
|
||||
/// </remarks>
|
||||
private IRTG_Stage currentStage;
|
||||
|
||||
/// <summary>
|
||||
/// 红外成像制导系统实例
|
||||
/// </summary>
|
||||
@ -108,102 +81,31 @@ namespace ThreatSource.Missile
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新导弹的状态
|
||||
/// 更新制导阶段的状态
|
||||
/// </summary>
|
||||
/// <param name="deltaTime">时间步长,单位:秒</param>
|
||||
/// <remarks>
|
||||
/// 更新过程:
|
||||
/// 1. 调用基类的更新方法
|
||||
/// 2. 根据当前阶段选择更新方法
|
||||
/// 3. 执行相应阶段的更新逻辑
|
||||
/// 4. 检查是否需要自毁
|
||||
/// </remarks>
|
||||
public override void Update(double deltaTime)
|
||||
{
|
||||
switch (currentStage)
|
||||
{
|
||||
case IRTG_Stage.Launch:
|
||||
UpdateLaunchStage(deltaTime);
|
||||
break;
|
||||
case IRTG_Stage.Cruise:
|
||||
UpdateCruiseStage(deltaTime);
|
||||
break;
|
||||
case IRTG_Stage.Terminal:
|
||||
UpdateTerminalStage(deltaTime);
|
||||
break;
|
||||
}
|
||||
base.Update(deltaTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新发射阶段的状态
|
||||
/// </summary>
|
||||
/// <param name="deltaTime">时间步长,单位:秒</param>
|
||||
/// <remarks>
|
||||
/// 发射阶段特点:
|
||||
/// - 不使用制导加速度
|
||||
/// - 仅依靠发动机推力
|
||||
/// - 持续时间为1秒
|
||||
/// - 结束后进入巡航阶段
|
||||
/// </remarks>
|
||||
private void UpdateLaunchStage(double deltaTime)
|
||||
{
|
||||
GuidanceAcceleration = Vector3D.Zero;
|
||||
if (FlightTime > Properties.MaxEngineBurnTime)
|
||||
{
|
||||
currentStage = IRTG_Stage.Cruise;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新巡航阶段的状态
|
||||
/// </summary>
|
||||
/// <param name="deltaTime">时间步长,单位:秒</param>
|
||||
/// <remarks>
|
||||
/// 巡航阶段特点:
|
||||
/// - 保持稳定飞行
|
||||
/// - 不使用制导系统
|
||||
/// - 达到巡航时间后进入末制导搜索阶段
|
||||
/// </remarks>
|
||||
private void UpdateCruiseStage(double deltaTime)
|
||||
{
|
||||
// 如果巡航时间达到,切换到末制导搜索阶段
|
||||
if (FlightTime > Properties.CruiseTime + Properties.MaxEngineBurnTime)
|
||||
{
|
||||
currentStage = IRTG_Stage.Terminal;
|
||||
guidanceSystem.Activate();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新末制导搜索阶段的状态
|
||||
/// </summary>
|
||||
/// <param name="deltaTime">时间步长,单位:秒</param>
|
||||
/// <remarks>
|
||||
/// 末制导阶段特点:
|
||||
/// 制导阶段特点:
|
||||
/// - 完全依赖导航系统的工作模式
|
||||
/// - 根据导航系统状态更新制导
|
||||
/// - 持续到命中目标
|
||||
/// </remarks>
|
||||
private void UpdateTerminalStage(double deltaTime)
|
||||
protected override void OnGuidanceStage(double deltaTime)
|
||||
{
|
||||
// 激活制导系统
|
||||
if(!guidanceSystem.IsActive)
|
||||
{
|
||||
guidanceSystem.Activate();
|
||||
KState.Orientation = new Orientation(KState.Orientation.Yaw, -0.1, KState.Orientation.Roll);
|
||||
KState.Velocity = KState.Orientation.ToVector() * KState.Speed;
|
||||
}
|
||||
|
||||
// 更新制导系统
|
||||
guidanceSystem.Update(deltaTime);
|
||||
GuidanceAcceleration = guidanceSystem.GetGuidanceAcceleration();
|
||||
IsGuidance = guidanceSystem.HasGuidance;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发射导弹
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 发射过程:
|
||||
/// - 调用基类发射方法
|
||||
/// - 设置当前阶段为发射阶段
|
||||
/// </remarks>
|
||||
public override void Fire()
|
||||
{
|
||||
base.Fire();
|
||||
currentStage = IRTG_Stage.Launch;
|
||||
base.OnGuidanceStage(deltaTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -217,7 +119,6 @@ namespace ThreatSource.Missile
|
||||
public override void Activate()
|
||||
{
|
||||
base.Activate();
|
||||
guidanceSystem.Activate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -246,7 +147,6 @@ namespace ThreatSource.Missile
|
||||
public override ElementStatusInfo GetStatusInfo()
|
||||
{
|
||||
var statusInfo = base.GetStatusInfo();
|
||||
statusInfo.ExtendedProperties["CurrentStage"] = currentStage.ToString();
|
||||
statusInfo.ExtendedProperties["GuidanceSystem"] = guidanceSystem.GetStatusInfo();
|
||||
return statusInfo;
|
||||
}
|
||||
|
||||
@ -18,31 +18,6 @@ namespace ThreatSource.Missile
|
||||
/// </remarks>
|
||||
public class LaserBeamRiderMissile : BaseMissile
|
||||
{
|
||||
/// <summary>
|
||||
/// 激光驾束制导导弹阶段枚举
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 定义了导弹飞行的四个主要阶段:
|
||||
/// - Launch:发射阶段,初始加速
|
||||
/// - Cruise:巡航阶段,跟踪波束
|
||||
/// - Explode:爆炸阶段,命中目标
|
||||
/// - SelfDestruct:自毁阶段,触发自毁
|
||||
/// </remarks>
|
||||
private enum LBRM_Stage
|
||||
{
|
||||
Launch, // 发射阶段
|
||||
Cruise // 巡航阶段
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置当前飞行阶段
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 用于控制导弹在不同阶段的行为
|
||||
/// 影响导弹的运动和制导方式
|
||||
/// </remarks>
|
||||
private LBRM_Stage currentStage;
|
||||
|
||||
/// <summary>
|
||||
/// 激光波束制导系统实例
|
||||
/// </summary>
|
||||
@ -65,7 +40,6 @@ namespace ThreatSource.Missile
|
||||
/// - 初始化基本属性
|
||||
/// - 创建制导系统
|
||||
/// - 配置制导参数
|
||||
/// - 设置初始飞行阶段
|
||||
/// </remarks>
|
||||
public LaserBeamRiderMissile(
|
||||
string missileId,
|
||||
@ -85,81 +59,23 @@ namespace ThreatSource.Missile
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新导弹状态
|
||||
/// </summary>
|
||||
/// 制导阶段默认实现
|
||||
/// <param name="deltaTime">时间步长,单位:秒</param>
|
||||
/// <remarks>
|
||||
/// 更新过程:
|
||||
/// - 根据当前阶段更新状态
|
||||
/// - 处理阶段转换
|
||||
/// - 调用基类更新
|
||||
/// </remarks>
|
||||
public override void Update(double deltaTime)
|
||||
{
|
||||
switch (currentStage)
|
||||
{
|
||||
case LBRM_Stage.Launch:
|
||||
UpdateLaunchStage(deltaTime);
|
||||
break;
|
||||
case LBRM_Stage.Cruise:
|
||||
UpdateCruiseStage(deltaTime);
|
||||
break;
|
||||
}
|
||||
|
||||
base.Update(deltaTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新发射阶段状态
|
||||
/// </summary>
|
||||
/// <param name="deltaTime">时间步长,单位:秒</param>
|
||||
/// <remarks>
|
||||
/// 发射阶段处理:
|
||||
/// - 清除制导加速度
|
||||
/// - 检查发射时间
|
||||
/// - 转换到巡航阶段
|
||||
/// </remarks>
|
||||
private void UpdateLaunchStage(double deltaTime)
|
||||
{
|
||||
// 发射阶段
|
||||
GuidanceAcceleration = Vector3D.Zero;
|
||||
if (FlightTime >= Properties.MaxEngineBurnTime)
|
||||
{
|
||||
currentStage = LBRM_Stage.Cruise;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新巡航阶段状态
|
||||
/// </summary>
|
||||
/// <param name="deltaTime">时间步长,单位:秒</param>
|
||||
/// <remarks>
|
||||
/// 巡航阶段处理:
|
||||
/// - 启用波束跟踪
|
||||
/// 制导阶段处理:
|
||||
/// - 更新制导系统
|
||||
/// - 计算制导加速度
|
||||
/// - 检查自毁条件
|
||||
/// - 获取制导加速度
|
||||
/// - 设置制导状态
|
||||
/// </remarks>
|
||||
private void UpdateCruiseStage(double deltaTime)
|
||||
{
|
||||
// 巡航阶段
|
||||
guidanceSystem.Update(deltaTime);
|
||||
GuidanceAcceleration = guidanceSystem.GetGuidanceAcceleration();
|
||||
IsGuidance = guidanceSystem.HasGuidance;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发射导弹
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 发射过程:
|
||||
/// - 调用基类发射方法
|
||||
/// - 设置当前阶段为发射阶段
|
||||
/// </remarks>
|
||||
public override void Fire()
|
||||
protected override void OnGuidanceStage(double deltaTime)
|
||||
{
|
||||
base.Fire();
|
||||
currentStage = LBRM_Stage.Launch;
|
||||
// 更新制导系统
|
||||
guidanceSystem.Update(deltaTime);
|
||||
// 获取制导加速度
|
||||
GuidanceAcceleration = guidanceSystem.GetGuidanceAcceleration();
|
||||
// 设置制导状态
|
||||
IsGuidance = guidanceSystem.HasGuidance;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -201,12 +117,10 @@ namespace ThreatSource.Missile
|
||||
/// <remarks>
|
||||
/// 返回信息包括:
|
||||
/// - 基本状态信息
|
||||
/// - 当前飞行阶段
|
||||
/// </remarks>
|
||||
public override ElementStatusInfo GetStatusInfo()
|
||||
{
|
||||
var statusInfo = base.GetStatusInfo();
|
||||
statusInfo.ExtendedProperties["CurrentStage"] = currentStage.ToString();
|
||||
statusInfo.ExtendedProperties["GuidanceSystem"] = guidanceSystem.GetStatusInfo();
|
||||
return statusInfo;
|
||||
}
|
||||
|
||||
@ -17,31 +17,6 @@ namespace ThreatSource.Missile
|
||||
/// </remarks>
|
||||
public class LaserSemiActiveGuidedMissile : BaseMissile
|
||||
{
|
||||
/// <summary>
|
||||
/// 激光半主动制导导弹阶段枚举
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 定义了导弹飞行的四个主要阶段:
|
||||
/// - Launch:发射阶段,初始加速
|
||||
/// - Cruise:巡航阶段,执行制导
|
||||
/// - Explode:爆炸阶段,命中目标
|
||||
/// - SelfDestruct:自毁阶段,触发自毁
|
||||
/// </remarks>
|
||||
private enum LSAGM_Stage
|
||||
{
|
||||
Launch, // 发射阶段
|
||||
Cruise // 巡航阶段
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置当前飞行阶段
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 用于控制导弹在不同阶段的行为
|
||||
/// 影响导弹的运动和制导方式
|
||||
/// </remarks>
|
||||
private LSAGM_Stage currentStage;
|
||||
|
||||
/// <summary>
|
||||
/// 激光半主动制导系统实例
|
||||
/// </summary>
|
||||
@ -93,20 +68,6 @@ namespace ThreatSource.Missile
|
||||
manager);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发射导弹
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 发射过程:
|
||||
/// - 调用基类发射方法
|
||||
/// - 设置当前阶段为发射阶段
|
||||
/// </remarks>
|
||||
public override void Fire()
|
||||
{
|
||||
base.Fire();
|
||||
currentStage = LSAGM_Stage.Launch;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 激活导弹
|
||||
/// </summary>
|
||||
@ -117,8 +78,7 @@ namespace ThreatSource.Missile
|
||||
public override void Activate()
|
||||
{
|
||||
base.Activate();
|
||||
// 激活制导系统
|
||||
guidanceSystem.Activate();
|
||||
|
||||
// 将制导系统注册到仿真管理器
|
||||
SimulationManager.RegisterEntity(guidanceSystem.Id, guidanceSystem);
|
||||
}
|
||||
@ -139,50 +99,6 @@ namespace ThreatSource.Missile
|
||||
SimulationManager.UnregisterEntity(guidanceSystem.Id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新导弹状态
|
||||
/// </summary>
|
||||
/// <param name="deltaTime">时间步长,单位:秒</param>
|
||||
/// <remarks>
|
||||
/// 更新过程:
|
||||
/// - 根据当前阶段更新状态
|
||||
/// - 处理阶段转换
|
||||
/// - 调用基类更新
|
||||
/// </remarks>
|
||||
public override void Update(double deltaTime)
|
||||
{
|
||||
switch (currentStage)
|
||||
{
|
||||
case LSAGM_Stage.Launch:
|
||||
UpdateLaunchStage(deltaTime);
|
||||
break;
|
||||
case LSAGM_Stage.Cruise:
|
||||
UpdateCruiseStage(deltaTime);
|
||||
break;
|
||||
}
|
||||
base.Update(deltaTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新发射阶段状态
|
||||
/// </summary>
|
||||
/// <param name="deltaTime">时间步长,单位:秒</param>
|
||||
/// <remarks>
|
||||
/// 发射阶段处理:
|
||||
/// - 清除制导加速度
|
||||
/// - 检查发射时间
|
||||
/// - 转换到巡航阶段
|
||||
/// </remarks>
|
||||
private void UpdateLaunchStage(double deltaTime)
|
||||
{
|
||||
// 发射阶段
|
||||
GuidanceAcceleration = Vector3D.Zero;
|
||||
if (FlightTime >= Properties.MaxEngineBurnTime)
|
||||
{
|
||||
currentStage = LSAGM_Stage.Cruise;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新巡航阶段状态
|
||||
/// </summary>
|
||||
@ -194,13 +110,35 @@ namespace ThreatSource.Missile
|
||||
/// - 计算制导加速度
|
||||
/// - 检查自毁条件
|
||||
/// </remarks>
|
||||
private void UpdateCruiseStage(double deltaTime)
|
||||
protected override void OnCruiseStage(double deltaTime)
|
||||
{
|
||||
base.OnCruiseStage(deltaTime);
|
||||
|
||||
LiftAcceleration = Vector3D.Zero;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新制导阶段状态
|
||||
/// </summary>
|
||||
/// <param name="deltaTime">时间步长,单位:秒</param>
|
||||
/// <remarks>
|
||||
/// 制导阶段处理:
|
||||
/// - 启用制导控制
|
||||
/// - 更新制导系统
|
||||
/// - 计算制导加速度
|
||||
/// - 检查自毁条件
|
||||
/// </remarks>
|
||||
protected override void OnGuidanceStage(double deltaTime)
|
||||
{
|
||||
// 激活制导系统
|
||||
if(!guidanceSystem.IsActive)
|
||||
{
|
||||
guidanceSystem.Activate();
|
||||
}
|
||||
|
||||
// 更新制导系统
|
||||
guidanceSystem.Update(deltaTime);
|
||||
// 获取制导加速度
|
||||
GuidanceAcceleration = guidanceSystem.GetGuidanceAcceleration();
|
||||
// 设置制导状态
|
||||
IsGuidance = guidanceSystem.HasGuidance;
|
||||
}
|
||||
|
||||
|
||||
@ -23,31 +23,6 @@ namespace ThreatSource.Missile
|
||||
/// </remarks>
|
||||
public class MillimeterWaveTerminalGuidedMissile : BaseMissile
|
||||
{
|
||||
/// <summary>
|
||||
/// 毫米波末制导导弹的飞行阶段枚举
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 定义了导弹的三个工作阶段:
|
||||
/// - Launch: 发射阶段,初始加速
|
||||
/// - Cruise: 巡航阶段,中程飞行
|
||||
/// - Terminal: 末制导阶段,毫米波制导
|
||||
/// </remarks>
|
||||
private enum MWTG_Stage
|
||||
{
|
||||
Launch, // 发射阶段
|
||||
Cruise, // 巡航阶段
|
||||
Terminal // 末制导阶段
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 导弹当前的飞行阶段
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 用于控制导弹的行为状态
|
||||
/// 在不同阶段执行不同的更新逻辑
|
||||
/// </remarks>
|
||||
private MWTG_Stage currentStage;
|
||||
|
||||
/// <summary>
|
||||
/// 毫米波制导系统实例
|
||||
/// </summary>
|
||||
@ -101,102 +76,31 @@ namespace ThreatSource.Missile
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新导弹的状态
|
||||
/// 更新制导阶段的状态
|
||||
/// </summary>
|
||||
/// <param name="deltaTime">时间步长,单位:秒</param>
|
||||
/// <remarks>
|
||||
/// 更新过程:
|
||||
/// 1. 调用基类的更新方法
|
||||
/// 2. 根据当前阶段选择更新方法
|
||||
/// 3. 执行相应阶段的更新逻辑
|
||||
/// 4. 检查是否需要自毁
|
||||
/// </remarks>
|
||||
public override void Update(double deltaTime)
|
||||
{
|
||||
switch (currentStage)
|
||||
{
|
||||
case MWTG_Stage.Launch:
|
||||
UpdateLaunchStage(deltaTime);
|
||||
break;
|
||||
case MWTG_Stage.Cruise:
|
||||
UpdateCruiseStage(deltaTime);
|
||||
break;
|
||||
case MWTG_Stage.Terminal:
|
||||
UpdateTerminalStage(deltaTime);
|
||||
break;
|
||||
}
|
||||
base.Update(deltaTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新发射阶段的状态
|
||||
/// </summary>
|
||||
/// <param name="deltaTime">时间步长,单位:秒</param>
|
||||
/// <remarks>
|
||||
/// 发射阶段特点:
|
||||
/// - 不使用制导加速度
|
||||
/// - 仅依靠发动机推力
|
||||
/// - 持续时间为0.1秒
|
||||
/// - 结束后进入巡航阶段
|
||||
/// </remarks>
|
||||
private void UpdateLaunchStage(double deltaTime)
|
||||
{
|
||||
GuidanceAcceleration = Vector3D.Zero;
|
||||
if (FlightTime > Properties.MaxEngineBurnTime)
|
||||
{
|
||||
currentStage = MWTG_Stage.Cruise;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新巡航阶段的状态
|
||||
/// </summary>
|
||||
/// <param name="deltaTime">时间步长,单位:秒</param>
|
||||
/// <remarks>
|
||||
/// 巡航阶段特点:
|
||||
/// - 保持稳定飞行
|
||||
/// - 不使用制导系统
|
||||
/// - 持续时间为3秒
|
||||
/// - 结束后进入末制导阶段
|
||||
/// </remarks>
|
||||
private void UpdateCruiseStage(double deltaTime)
|
||||
{
|
||||
if (FlightTime > Properties.CruiseTime + Properties.MaxEngineBurnTime)
|
||||
{
|
||||
currentStage = MWTG_Stage.Terminal;
|
||||
guidanceSystem.Activate(); // 激活制导系统
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新末制导阶段的状态
|
||||
/// </summary>
|
||||
/// <param name="deltaTime">时间步长,单位:秒</param>
|
||||
/// <remarks>
|
||||
/// 末制导阶段特点:
|
||||
/// 制导阶段特点:
|
||||
/// - 完全依赖导航系统的工作模式
|
||||
/// - 根据导航系统状态更新制导
|
||||
/// - 持续到命中目标
|
||||
/// </remarks>
|
||||
private void UpdateTerminalStage(double deltaTime)
|
||||
protected override void OnGuidanceStage(double deltaTime)
|
||||
{
|
||||
// 激活制导系统
|
||||
if(!guidanceSystem.IsActive)
|
||||
{
|
||||
guidanceSystem.Activate();
|
||||
KState.Orientation = new Orientation(KState.Orientation.Yaw, -0.02, KState.Orientation.Roll);
|
||||
KState.Velocity = KState.Orientation.ToVector() * KState.Speed;
|
||||
}
|
||||
|
||||
// 更新制导系统
|
||||
guidanceSystem.Update(deltaTime);
|
||||
GuidanceAcceleration = guidanceSystem.GetGuidanceAcceleration();
|
||||
IsGuidance = guidanceSystem.HasGuidance;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发射导弹
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 发射过程:
|
||||
/// - 调用基类发射方法
|
||||
/// - 设置当前阶段为发射阶段
|
||||
/// </remarks>
|
||||
public override void Fire()
|
||||
{
|
||||
base.Fire();
|
||||
currentStage = MWTG_Stage.Launch;
|
||||
base.OnGuidanceStage(deltaTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -210,7 +114,6 @@ namespace ThreatSource.Missile
|
||||
public override void Activate()
|
||||
{
|
||||
base.Activate();
|
||||
guidanceSystem.Activate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -31,29 +31,6 @@ namespace ThreatSource.Missile
|
||||
/// </remarks>
|
||||
private readonly TerminalSensitiveSubmunitionConfig submunitionConfig;
|
||||
|
||||
/// <summary>
|
||||
/// 末敏弹的飞行阶段
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 枚举定义了末敏弹的飞行阶段
|
||||
/// 包括发射阶段、巡航阶段和分离阶段
|
||||
/// </remarks>
|
||||
private enum TSGM_Stage
|
||||
{
|
||||
Launch, // 发射阶段
|
||||
Cruise, // 巡航阶段
|
||||
Separation // 分离阶段
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 导弹当前的飞行阶段
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 用于控制导弹的行为状态
|
||||
/// 在不同阶段执行不同的更新逻辑
|
||||
/// </remarks>
|
||||
private TSGM_Stage currentStage;
|
||||
|
||||
/// <summary>
|
||||
/// 子弹的属性
|
||||
/// </summary>
|
||||
@ -175,75 +152,6 @@ namespace ThreatSource.Missile
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发射导弹
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 发射过程:
|
||||
/// - 调用基类发射方法
|
||||
/// - 设置当前阶段为发射阶段
|
||||
/// </remarks>
|
||||
public override void Fire()
|
||||
{
|
||||
base.Fire();
|
||||
currentStage = TSGM_Stage.Launch;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新导弹的状态
|
||||
/// </summary>
|
||||
/// <param name="deltaTime">时间步长,单位:秒</param>
|
||||
/// <remarks>
|
||||
/// 更新过程:
|
||||
/// 1. 检查导弹是否处于活动状态
|
||||
/// 2. 验证自毁条件(时间、距离、高度)
|
||||
/// 3. 更新基本运动状态
|
||||
/// 4. 计算与分离点的距离
|
||||
/// 5. 记录状态信息
|
||||
/// 6. 必要时触发分离动作
|
||||
///
|
||||
/// 自毁条件:
|
||||
/// - 超出最大飞行时间
|
||||
/// - 超出最大飞行距离
|
||||
/// - 高度低于地面
|
||||
/// </remarks>
|
||||
public override void Update(double deltaTime)
|
||||
{
|
||||
switch (currentStage)
|
||||
{
|
||||
case TSGM_Stage.Launch:
|
||||
UpdateLaunchStage(deltaTime);
|
||||
break;
|
||||
case TSGM_Stage.Cruise:
|
||||
UpdateCruiseStage(deltaTime);
|
||||
break;
|
||||
case TSGM_Stage.Separation:
|
||||
UpdateSeparationStage(deltaTime);
|
||||
break;
|
||||
}
|
||||
base.Update(deltaTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新发射阶段的状态
|
||||
/// </summary>
|
||||
/// <param name="deltaTime">时间步长,单位:秒</param>
|
||||
/// <remarks>
|
||||
/// 发射阶段特点:
|
||||
/// - 不使用制导加速度
|
||||
/// - 仅依靠发动机推力
|
||||
/// - 持续时间为0.1秒
|
||||
/// - 结束后进入巡航阶段
|
||||
/// </remarks>
|
||||
private void UpdateLaunchStage(double deltaTime)
|
||||
{
|
||||
GuidanceAcceleration = Vector3D.Zero;
|
||||
if (FlightTime > Properties.MaxEngineBurnTime)
|
||||
{
|
||||
currentStage = TSGM_Stage.Cruise;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新巡航阶段的状态
|
||||
/// </summary>
|
||||
@ -254,13 +162,15 @@ namespace ThreatSource.Missile
|
||||
/// - 不使用制导系统
|
||||
/// - 结束后进入分离阶段
|
||||
/// </remarks>
|
||||
private void UpdateCruiseStage(double deltaTime)
|
||||
protected override void OnCruiseStage(double deltaTime)
|
||||
{
|
||||
LiftAcceleration = Vector3D.Zero;
|
||||
|
||||
double distanceToSeparationPoint = (separationPoint - KState.Position).Magnitude();
|
||||
//距离分离点距离小于配置的分离范围,则分离
|
||||
if (distanceToSeparationPoint <= submunitionConfig.SeparationRange)
|
||||
{
|
||||
currentStage = TSGM_Stage.Separation;
|
||||
currentStage = MissileFlightStage.Guidance;
|
||||
}
|
||||
}
|
||||
|
||||
@ -272,7 +182,7 @@ namespace ThreatSource.Missile
|
||||
/// 分离阶段特点:
|
||||
/// - 分离子弹药
|
||||
/// </remarks>
|
||||
private void UpdateSeparationStage(double deltaTime)
|
||||
protected override void OnGuidanceStage(double deltaTime)
|
||||
{
|
||||
PerformSeparation();
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ namespace ThreatSource.Missile
|
||||
/// 用于控制子弹在不同阶段的行为
|
||||
/// 影响传感器工作模式和制导方式
|
||||
/// </remarks>
|
||||
private SubmunitionStage currentStage;
|
||||
private SubmunitionStage currentSubmunitionStage;
|
||||
|
||||
/// <summary>
|
||||
/// 子弹配置参数
|
||||
@ -214,7 +214,7 @@ namespace ThreatSource.Missile
|
||||
public override void Fire()
|
||||
{
|
||||
base.Fire();
|
||||
currentStage = SubmunitionStage.Separation;
|
||||
currentSubmunitionStage = SubmunitionStage.Separation;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -236,7 +236,7 @@ namespace ThreatSource.Missile
|
||||
altimeter.Update(deltaTime);
|
||||
rangefinder.Update(deltaTime);
|
||||
|
||||
switch (currentStage)
|
||||
switch (currentSubmunitionStage)
|
||||
{
|
||||
case SubmunitionStage.Separation:
|
||||
UpdateSeparationStage(deltaTime);
|
||||
@ -274,7 +274,7 @@ namespace ThreatSource.Missile
|
||||
// 分离阶段只表示分离行为,不进行任何物理计算
|
||||
|
||||
// 分离阶段结束,进入减速阶段
|
||||
currentStage = SubmunitionStage.Deceleration;
|
||||
currentSubmunitionStage = SubmunitionStage.Deceleration;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -310,7 +310,7 @@ namespace ThreatSource.Missile
|
||||
if(altimeterData.IsValid && altimeterData.Altitude <= config.ParachuteDeploymentHeight)
|
||||
{
|
||||
// 如果是,则进入降落伞打开阶段
|
||||
currentStage = SubmunitionStage.ParachuteDeployment;
|
||||
currentSubmunitionStage = SubmunitionStage.ParachuteDeployment;
|
||||
}
|
||||
}
|
||||
|
||||
@ -341,11 +341,11 @@ namespace ThreatSource.Missile
|
||||
if(altimeterData.IsValid && altimeterData.Altitude <= config.StableScanHeight)
|
||||
{
|
||||
// 如果是,则进入稳定扫描阶段
|
||||
currentStage = SubmunitionStage.StableScan;
|
||||
currentSubmunitionStage = SubmunitionStage.StableScan;
|
||||
// 维持稳定的垂直下降速度
|
||||
KState.Velocity = new Vector3D(0, -config.VerticalDeclineSpeed, 0);
|
||||
// 制导加速度抵消重力加速度,匀速下降
|
||||
GuidanceAcceleration = new Vector3D(0, MotionAlgorithm.Gravity, 0);
|
||||
GuidanceAcceleration = new Vector3D(0, PhysicalConstants.BeijingGravity, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -387,7 +387,7 @@ namespace ThreatSource.Missile
|
||||
RangefinderSensorData rangefinderData = (RangefinderSensorData)rangefinder.GetSensorData();
|
||||
if (rangefinderData.IsValid && rangefinderData.Distance <= config.TargetDetectionDistance)
|
||||
{
|
||||
currentStage = SubmunitionStage.Detection;
|
||||
currentSubmunitionStage = SubmunitionStage.Detection;
|
||||
}
|
||||
}
|
||||
|
||||
@ -488,7 +488,7 @@ namespace ThreatSource.Missile
|
||||
// 二次确认成功,进入攻击阶段
|
||||
Debug.WriteLine($"二次确认成功,进入攻击阶段,当前角度: {spiralAngle * 180 / Math.PI:F2}°");
|
||||
IsGuidance = true;
|
||||
currentStage = SubmunitionStage.Attack;
|
||||
currentSubmunitionStage = SubmunitionStage.Attack;
|
||||
return;
|
||||
}
|
||||
else
|
||||
@ -642,7 +642,7 @@ namespace ThreatSource.Missile
|
||||
SimulationElement target = SimulationManager.GetEntityById(TargetId) as SimulationElement ?? throw new Exception("目标不存在");
|
||||
double distanceToTarget = (target.KState.Position - KState.Position).Magnitude();
|
||||
|
||||
statusInfo.ExtendedProperties["CurrentStage"] = currentStage.ToString();
|
||||
statusInfo.ExtendedProperties["CurrentStage"] = currentSubmunitionStage.ToString();
|
||||
statusInfo.ExtendedProperties["SpiralAngle"] = spiralAngle * 180 / Math.PI;
|
||||
statusInfo.ExtendedProperties["LastDetectionTime"] = lastDetectionTime?.ToString() ?? "null";
|
||||
statusInfo.ExtendedProperties["FirstDetectionAngle"] = firstDetectionAngle?.ToString() ?? "null";
|
||||
@ -690,7 +690,7 @@ namespace ThreatSource.Missile
|
||||
private bool IsSensorsJammed()
|
||||
{
|
||||
// 根据当前阶段检查相应传感器的干扰状态
|
||||
switch (currentStage)
|
||||
switch (currentSubmunitionStage)
|
||||
{
|
||||
case SubmunitionStage.Deceleration:
|
||||
// 减速阶段需要测高仪
|
||||
|
||||
@ -34,4 +34,22 @@ namespace ThreatSource.Utils
|
||||
/// </summary>
|
||||
Band8
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 存储通用的物理常量。
|
||||
/// </summary>
|
||||
public static class PhysicalConstants
|
||||
{
|
||||
/// <summary>
|
||||
/// 重力加速度值(北京标准值)。
|
||||
/// 单位:m/s²
|
||||
/// </summary>
|
||||
public static readonly double BeijingGravity = 9.8015;
|
||||
|
||||
/// <summary>
|
||||
/// 重力加速度(标准值)。
|
||||
/// 单位:m/s²
|
||||
/// </summary>
|
||||
public static readonly double StandardGravity = 9.80665;
|
||||
}
|
||||
}
|
||||
35
ThreatSource/src/Utils/LiftModel.cs
Normal file
35
ThreatSource/src/Utils/LiftModel.cs
Normal file
@ -0,0 +1,35 @@
|
||||
namespace ThreatSource.Utils
|
||||
{
|
||||
/// <summary>
|
||||
/// 提供计算导弹升力相关参数的静态方法。
|
||||
/// </summary>
|
||||
public static class LiftModel
|
||||
{
|
||||
private const double MinEffectivePitchDegrees = -5.0; // 模型有效的最小俯仰角 (度)
|
||||
private const double MaxEffectivePitchDegrees = 15.0; // 模型有效的最大俯仰角 (度)
|
||||
private const double PitchOffsetDegrees = 5.0; // 升力和重力平衡点的俯仰角(攻角) (度)
|
||||
private const double LiftCoefficientPerDegree = 1.0; // 每度俯仰角的升力系数 (m/s^2 / 度)
|
||||
|
||||
/// <summary>
|
||||
/// 根据给定的俯仰角(攻角)计算升力产生的垂直加速度。
|
||||
/// 此计算基于一个模型,该模型首先定义了一个"已合并重力效应"的加速度 (combined_vertical_acceleration),
|
||||
/// 然后通过 lift_acceleration = combined_vertical_acceleration + g 来得到纯升力加速度。
|
||||
/// 当俯仰角(攻角)超出预定有效范围时,此模型贡献的升力加速度为0。
|
||||
/// </summary>
|
||||
/// <param name="pitchDegrees">当前俯仰角(单位:度)。在此模型中作为攻角的代理。</param>
|
||||
/// <returns>升力产生的加速度矢量(单位:m/s²)。如果在有效俯仰角范围之外,则返回0。</returns>
|
||||
public static Vector3D CalculateLiftAcceleration(double pitchDegrees)
|
||||
{
|
||||
if (pitchDegrees < MinEffectivePitchDegrees || pitchDegrees > MaxEffectivePitchDegrees)
|
||||
{
|
||||
return Vector3D.Zero;
|
||||
}
|
||||
|
||||
double combinedVerticalAcceleration = (pitchDegrees - PitchOffsetDegrees) * LiftCoefficientPerDegree;
|
||||
|
||||
double liftAcceleration = combinedVerticalAcceleration + PhysicalConstants.BeijingGravity;
|
||||
|
||||
return new Vector3D(0, liftAcceleration, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -15,11 +15,6 @@ namespace ThreatSource.Utils
|
||||
/// </remarks>
|
||||
public static class MotionAlgorithm
|
||||
{
|
||||
/// <summary>
|
||||
/// 重力值(北京标准值)
|
||||
/// </summary>
|
||||
public static readonly double Gravity = 9.8015;
|
||||
|
||||
/// <summary>
|
||||
/// 计算抛物线弹道最佳发射方向(选择较小的仰角)
|
||||
/// </summary>
|
||||
@ -78,7 +73,7 @@ namespace ThreatSource.Utils
|
||||
double v0_2 = v0 * v0;
|
||||
double v0_4 = v0_2 * v0_2;
|
||||
|
||||
double discriminant = v0_4 - Gravity * (Gravity * x * x + 2 * y * v0_2);
|
||||
double discriminant = v0_4 - PhysicalConstants.BeijingGravity * (PhysicalConstants.BeijingGravity * x * x + 2 * y * v0_2);
|
||||
|
||||
if (discriminant < 0)
|
||||
{
|
||||
@ -86,8 +81,8 @@ namespace ThreatSource.Utils
|
||||
return null;
|
||||
}
|
||||
|
||||
double angle1 = Math.Atan((v0_2 + Math.Sqrt(discriminant)) / (Gravity * x));
|
||||
double angle2 = Math.Atan((v0_2 - Math.Sqrt(discriminant)) / (Gravity * x));
|
||||
double angle1 = Math.Atan((v0_2 + Math.Sqrt(discriminant)) / (PhysicalConstants.BeijingGravity * x));
|
||||
double angle2 = Math.Atan((v0_2 - Math.Sqrt(discriminant)) / (PhysicalConstants.BeijingGravity * x));
|
||||
|
||||
Debug.WriteLine($"计算得到的两个角度: {angle1 * 180 / Math.PI:F2}° 和 {angle2 * 180 / Math.PI:F2}°");
|
||||
|
||||
@ -405,7 +400,7 @@ namespace ThreatSource.Utils
|
||||
// 使用阻力调整后的初始速度计算发射角度
|
||||
// (这是一个简化模型,实际情况更复杂,可能需要迭代求解)
|
||||
Vector3D deltaPos = targetPos - startPos;
|
||||
Vector3D gravityVector = new(0, -Gravity, 0);
|
||||
Vector3D gravityVector = new(0, -PhysicalConstants.BeijingGravity, 0);
|
||||
Vector3D effectiveTotalAcceleration = gravityVector + dragAcceleration;
|
||||
|
||||
double coeff_a = 0.25 * effectiveTotalAcceleration.MagnitudeSquared();
|
||||
|
||||
@ -13,9 +13,9 @@ namespace ThreatSource.Utils
|
||||
{
|
||||
public double MinU, MinV, MaxU, MaxV;
|
||||
public double AverageDepth; // 新增:投影物体顶点的平均深度
|
||||
public double Width => MaxU - MinU;
|
||||
public double Height => MaxV - MinV;
|
||||
public bool IsValid => Width >= 0 && Height >= 0;
|
||||
public readonly double Width => MaxU - MinU;
|
||||
public readonly double Height => MaxV - MinV;
|
||||
public readonly bool IsValid => Width >= 0 && Height >= 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -7,6 +7,11 @@
|
||||
- 事件描述
|
||||
- 分析处理
|
||||
|
||||
## 2025-05-24 增加了升力的影响
|
||||
- 增加了升力加速度的计算
|
||||
- 将发射、巡航、制导三个阶段汇聚到导弹基类中
|
||||
- 毫米波搜索稳定性很差,原来是 FOV 太大,使搜索速度变慢。从 45 度改为 15 度,稳定了。
|
||||
|
||||
## 2025-05-19 增加了SwerlingRCS回波模型
|
||||
- 增加了SwerlingRCS回波模型
|
||||
- 在毫米波制导中,用RCS特征矩阵取值
|
||||
|
||||
@ -488,3 +488,56 @@
|
||||
- 使用SwerlingRCS回波模型获取到的目标RCS,起伏比较大,有一定概率出现几倍的误差。实际观察,从 60%到 200% 都有。
|
||||
- 因为扫描周期较长(360度每秒),所以偏离较大的RCS,对跟踪和锁定有一定影响。
|
||||
|
||||
|
||||
## 增加了升力加速度计算之后的实验记录
|
||||
|
||||
时间:2025-05-24 10:00:00
|
||||
版本:v1.1.21
|
||||
|
||||
### 实验结果
|
||||
1. 末敏弹
|
||||
- 爆炸半径:5 米
|
||||
- 分离散布范围:10米
|
||||
- 减速加速度:150 m/s²
|
||||
- 降落伞减速度:95 m/s²
|
||||
|
||||
- 发射加速度:0 m/s²
|
||||
- 发动机最大燃烧时间:0 秒
|
||||
2. 激光驾束
|
||||
- 发射加速度:100 m/s²
|
||||
- 发动机最大燃烧时间:3.0 秒
|
||||
- 巡航时间:0 秒
|
||||
3. 红外指令
|
||||
- 发射加速度:150 m/s²
|
||||
- 发动机最大燃烧时间:2.0 秒
|
||||
- 巡航时间:2 秒
|
||||
4. 红外热成像
|
||||
- 发射加速度:100 m/s²
|
||||
- 发动机最大燃烧时间:2.5 秒
|
||||
- 巡航时间:3.0 秒
|
||||
|
||||
- 发射角度:0.12 弧度(此时巡航高度 150 米,制导阶段起始角度-0.01弧度)
|
||||
5. 毫米波末制导
|
||||
- 发射加速度:100 m/s²
|
||||
- 发动机最大燃烧时间:2.5 秒
|
||||
- 巡航时间:3.0 秒
|
||||
|
||||
- 发射角度:0.05 弧度(此时巡航高度 15 米,制导阶段起始角度-0.02弧度,搜索视场角 15 度)
|
||||
|
||||
6. 激光半主动
|
||||
- 比例引导系数:3
|
||||
- 发射加速度:0.0 m/s²
|
||||
- 发动机最大燃烧时间:0.0 秒
|
||||
- 巡航时间:10.0 秒
|
||||
|
||||
- 发射距离:10000 m
|
||||
- 发射速度:700 m/s
|
||||
- 发射角度:Math.PI/20(大约 3 度)
|
||||
7. 复合制导
|
||||
- 发射加速度:100 m/s²
|
||||
- 发动机最大燃烧时间:2.5 秒
|
||||
- 巡航时间:3.0 秒
|
||||
|
||||
- 发射角度:0.05 弧度(此时巡航高度 15 米,制导阶段起始角度-0.02弧度,毫米波搜索视场角 15 度)
|
||||
|
||||
|
||||
|
||||
76
missile_lift_model.md
Normal file
76
missile_lift_model.md
Normal file
@ -0,0 +1,76 @@
|
||||
# 上下文
|
||||
文件名:[missile_lift_model.md]
|
||||
创建于:[2024-05-23T10:00:00Z]
|
||||
创建者:[AI]
|
||||
|
||||
# 任务描述
|
||||
用户请求设计并实现导弹的升力加速度模型。
|
||||
升力加速度az =(功角a - 5 度)* 1 米每秒的平方。
|
||||
功角 a 的范围是大于等于负 5 度且小于等于 15 度。在其他情况下,az=0。
|
||||
功角 a 定义为导弹速度矢量与XY平面(水平面)的夹角。
|
||||
升力加速度作用在导弹的垂直方向(垂直于速度矢量,并在由速度矢量和世界Y轴定义的平面内)。
|
||||
|
||||
# 项目概述
|
||||
项目为一个导弹仿真系统,需要修改导弹基类及其运动算法来集成新的升力模型。
|
||||
|
||||
---
|
||||
*以下部分由 AI 在协议执行过程中维护*
|
||||
---
|
||||
|
||||
# 分析 (由 RESEARCH 模式填充)
|
||||
- 升力计算的核心位置在 `BaseMissile.cs` 的 `CalculateAcceleration` 方法。
|
||||
- 攻角 (alpha) 用户定义为速度矢量与水平面 (XZ平面,假设Y为垂直轴) 的夹角。
|
||||
- 升力方向垂直于速度矢量,并位于由速度矢量和世界Y轴(`Vector3D.UnitY`)定义的平面内。
|
||||
- `MotionAlgorithm.cs` 是存放运动相关计算的工具类。
|
||||
|
||||
# 提议的解决方案 (由 INNOVATE 模式填充)
|
||||
方案:在 `MotionAlgorithm.cs` 中增加计算攻角和升力矢量的方法。在 `BaseMissile.cs` 中调用这些方法并将升力加入总加速度。
|
||||
|
||||
# 实施计划 (由 PLAN 模式生成)
|
||||
见下方实施检查清单。
|
||||
|
||||
实施检查清单:
|
||||
1. **在 `ThreatSource/src/Utils/MotionAlgorithm.cs` 中**:
|
||||
1. 创建 `public static double CalculateAngleOfAttackFromHorizontal(Vector3D velocity)` 方法。
|
||||
* 输入: `Vector3D velocity`。
|
||||
* 计算水平速度大小 `horizontalMagnitude = Math.Sqrt(velocity.X * velocity.X + velocity.Z * velocity.Z)`。
|
||||
* 处理 `horizontalMagnitude < 1e-6` 的情况:
|
||||
* If `velocity.Y > 0`, return `Math.PI / 2`.
|
||||
* If `velocity.Y < 0`, return `-Math.PI / 2`.
|
||||
* Else, return `0.0`.
|
||||
* 否则,计算 `alpha_rad = Math.Atan2(velocity.Y, horizontalMagnitude)`。
|
||||
* Return `alpha_rad`.
|
||||
2. **在 `ThreatSource/src/Utils/MotionAlgorithm.cs` 中**:
|
||||
1. 创建 `public static Vector3D CalculateLiftAccelerationVector(Vector3D velocity, double angleOfAttackDegrees)` 方法。
|
||||
* 输入: `Vector3D velocity`, `double angleOfAttackDegrees`.
|
||||
* 定义常量: `MIN_AOA_DEG = -5.0`, `MAX_AOA_DEG = 15.0`, `AOA_OFFSET_DEG = 5.0`.
|
||||
* 计算 `az_magnitude`:
|
||||
* If `angleOfAttackDegrees >= MIN_AOA_DEG && angleOfAttackDegrees <= MAX_AOA_DEG`:
|
||||
* `az_magnitude = (angleOfAttackDegrees - AOA_OFFSET_DEG) * 1.0`.
|
||||
* Else:
|
||||
* `az_magnitude = 0.0`.
|
||||
* If `Math.Abs(az_magnitude) < 1e-6 || velocity.MagnitudeSquared() < 1e-9`, return `Vector3D.Zero`.
|
||||
* 定义 `WorldUp = Vector3D.UnitY`.
|
||||
* `velocityNormalized = velocity.Normalize()`.
|
||||
* `RightVec = Vector3D.CrossProduct(velocityNormalized, WorldUp)`.
|
||||
* If `RightVec.MagnitudeSquared() < 1e-9`, return `Vector3D.Zero` (处理垂直飞行情况).
|
||||
* `LiftDir = Vector3D.CrossProduct(RightVec, velocityNormalized).Normalize()`.
|
||||
* `liftAcceleration = LiftDir * az_magnitude`.
|
||||
* Return `liftAcceleration`.
|
||||
3. **在 `ThreatSource/src/Missile/BaseMissile.cs` 的 `CalculateAcceleration(Vector3D velocity)` 方法中**:
|
||||
1. 在计算 `totalAcceleration` 之前,获取当前速度 `currentMissileVelocity = velocity` (或直接用 `velocity` 参数)。
|
||||
2. 计算攻角(度): `double currentAoARad = MotionAlgorithm.CalculateAngleOfAttackFromHorizontal(currentMissileVelocity);`
|
||||
3. `double currentAoADegrees = currentAoARad * 180.0 / Math.PI;`
|
||||
4. 计算升力加速度矢量: `Vector3D liftAcceleration = MotionAlgorithm.CalculateLiftAccelerationVector(currentMissileVelocity, currentAoADegrees);`
|
||||
5. 修改 `totalAcceleration` 的计算公式,加入 `liftAcceleration`:
|
||||
`Vector3D totalAcceleration = GuidanceAcceleration + ThrustAcceleration + dragAcceleration + GravityAcceleration + liftAcceleration;`
|
||||
6. 更新 `Debug.WriteLine` 语句,包含 `liftAcceleration` 的值。例如,在原有的基础上追加 `$", 升力: {liftAcceleration}"`。
|
||||
|
||||
# 当前执行步骤 (由 EXECUTE 模式在开始执行某步骤时更新)
|
||||
> 正在执行: "1. 在 `ThreatSource/src/Utils/MotionAlgorithm.cs` 中:1. 创建 `public static double CalculateAngleOfAttackFromHorizontal(Vector3D velocity)` 方法。"
|
||||
|
||||
# 任务进度 (由 EXECUTE 模式在每步完成后追加)
|
||||
* [待填写]
|
||||
|
||||
# 最终审查 (由 REVIEW 模式填充)
|
||||
[待填写]
|
||||
@ -119,62 +119,63 @@ namespace ThreatSource.Tools.MissileSimulation
|
||||
/// </summary>
|
||||
private void InitializeMissileJammingMap()
|
||||
{
|
||||
missileJammingMap = new Dictionary<string, List<(JammingType, string, string, string, string)>>();
|
||||
|
||||
// 激光驾束导弹
|
||||
missileJammingMap["LBRM_1"] =
|
||||
missileJammingMap = new Dictionary<string, List<(JammingType, string, string, string, string)>>
|
||||
{
|
||||
// 激光驾束导弹
|
||||
["LBRM_1"] =
|
||||
[
|
||||
(JammingType.Laser, "激光干扰", "LaserJammer_Designator", "阻塞", "驾束仪"),
|
||||
(JammingType.SmokeGrenade, "烟幕弹", "SG_1", "遮蔽", "驾束仪")
|
||||
];
|
||||
|
||||
// 激光半主动制导导弹
|
||||
missileJammingMap["LSGM_1"] =
|
||||
],
|
||||
|
||||
// 激光半主动制导导弹
|
||||
["LSGM_1"] =
|
||||
[
|
||||
(JammingType.Laser, "激光干扰(指示器)", "LaserJammer_Designator", "阻塞", "指示器"),
|
||||
(JammingType.Laser, "激光干扰(导弹)", "LaserJammer_Missile", "阻塞", "导弹"),
|
||||
(JammingType.LaserDecoy, "激光诱偏目标", "LDY_1", "欺骗", "导弹"),
|
||||
(JammingType.SmokeGrenade, "烟幕弹", "SG_1", "遮蔽", "两者")
|
||||
];
|
||||
|
||||
// 红外指令制导导弹
|
||||
missileJammingMap["ICGM_1"] =
|
||||
],
|
||||
|
||||
// 红外指令制导导弹
|
||||
["ICGM_1"] =
|
||||
[
|
||||
(JammingType.Infrared, "红外干扰", "InfraredJammer_Designator", "阻塞", "指示器"),
|
||||
(JammingType.SmokeGrenade, "烟幕弹", "SG_2", "遮蔽", "指示器")
|
||||
];
|
||||
|
||||
// 红外成像末制导导弹
|
||||
missileJammingMap["ITGM_1"] =
|
||||
],
|
||||
|
||||
// 红外成像末制导导弹
|
||||
["ITGM_1"] =
|
||||
[
|
||||
(JammingType.Infrared, "红外干扰", "InfraredJammer_Missile", "阻塞", "导弹"),
|
||||
(JammingType.SmokeGrenade, "红外烟幕弹", "SG_2", "遮蔽", "导弹")
|
||||
];
|
||||
|
||||
// 毫米波末制导导弹
|
||||
missileJammingMap["MMWG_1"] =
|
||||
],
|
||||
|
||||
// 毫米波末制导导弹
|
||||
["MMWG_1"] =
|
||||
[
|
||||
(JammingType.MillimeterWave, "毫米波干扰", "MillimeterWaveJammer_Missile", "阻塞", "导弹"),
|
||||
(JammingType.SmokeGrenade, "烟幕弹", "SG_3", "遮蔽", "导弹")
|
||||
];
|
||||
|
||||
// 末敏子弹药
|
||||
missileJammingMap["TSM_1"] =
|
||||
],
|
||||
|
||||
// 末敏子弹药
|
||||
["TSM_1"] =
|
||||
[
|
||||
(JammingType.Laser, "激光干扰", "LaserJammer_Submunition", "阻塞", "子弹药"),
|
||||
(JammingType.Infrared, "红外干扰", "InfraredJammer_Submunition", "阻塞", "子弹药"),
|
||||
(JammingType.MillimeterWave, "毫米波干扰", "MillimeterWaveJammer_Submunition", "阻塞", "子弹药"),
|
||||
(JammingType.MillimeterWave, "毫米波假信号", "MillimeterWaveCompensationJammer_Submunition", "欺骗", "子弹药"),
|
||||
(JammingType.SmokeGrenade, "烟幕弹", "SG_4", "遮蔽", "子弹药")
|
||||
];
|
||||
],
|
||||
|
||||
// 复合制导导弹
|
||||
missileJammingMap["CGGM_1"] =
|
||||
// 复合制导导弹
|
||||
["CGGM_1"] =
|
||||
[
|
||||
(JammingType.MillimeterWave, "毫米波干扰", "MillimeterWaveJammer_Missile", "阻塞", "导弹"),
|
||||
(JammingType.Infrared, "红外干扰", "InfraredJammer_Missile", "阻塞", "导弹"),
|
||||
(JammingType.SmokeGrenade, "烟幕弹", "SG_1", "遮蔽", "导弹")
|
||||
];
|
||||
]
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -233,7 +234,7 @@ namespace ThreatSource.Tools.MissileSimulation
|
||||
{
|
||||
Position = new Vector3D(0, 1.2, 0),
|
||||
Orientation = new Orientation(0.0, 0.0, 0.0),
|
||||
Speed = 1.0
|
||||
Speed = 2.0
|
||||
};
|
||||
string targetId = "Tank_1";
|
||||
var target = _threatSourceFactory.CreateEquipment(targetId, "mbt_001", motionParameters);
|
||||
@ -323,8 +324,8 @@ namespace ThreatSource.Tools.MissileSimulation
|
||||
{
|
||||
var motionParameters = new KinematicState
|
||||
{
|
||||
Position = new Vector3D(10000, 10, 10),
|
||||
Orientation = new Orientation(Math.PI/2, Math.PI/18, 0),
|
||||
Position = new Vector3D(10000, 1, 10),
|
||||
Orientation = new Orientation(Math.PI/2, Math.PI/20, 0),
|
||||
Speed = 700
|
||||
};
|
||||
string missileId = "LSGM_1";
|
||||
@ -342,7 +343,7 @@ namespace ThreatSource.Tools.MissileSimulation
|
||||
var motionParameters = new KinematicState
|
||||
{
|
||||
Position = new Vector3D(2000, 1, 10),
|
||||
Orientation = new Orientation(Math.PI/2, 0.1, 0.0),
|
||||
Orientation = new Orientation(Math.PI/2, 0.04, 0.0),
|
||||
Speed = 10
|
||||
};
|
||||
string missileId = "LBRM_1";
|
||||
@ -359,7 +360,7 @@ namespace ThreatSource.Tools.MissileSimulation
|
||||
{
|
||||
var motionParameters = new KinematicState
|
||||
{
|
||||
Position = new Vector3D(3000, 0, 20),
|
||||
Position = new Vector3D(3000, 1, 20),
|
||||
Orientation = new Orientation(Math.PI/2, 0.0, 0.0),
|
||||
Speed = 700
|
||||
};
|
||||
@ -380,7 +381,7 @@ namespace ThreatSource.Tools.MissileSimulation
|
||||
var motionParameters = new KinematicState
|
||||
{
|
||||
Position = new Vector3D(2000, 1, 20),
|
||||
Orientation = new Orientation(Math.PI/2, 0.15, 0),
|
||||
Orientation = new Orientation(Math.PI/2, 0.05, 0),
|
||||
Speed = 10
|
||||
};
|
||||
|
||||
@ -399,7 +400,7 @@ namespace ThreatSource.Tools.MissileSimulation
|
||||
var motionParameters = new KinematicState
|
||||
{
|
||||
Position = new Vector3D(2000, 1, 0),
|
||||
Orientation = new Orientation(Math.PI/2, 0.2, 0),
|
||||
Orientation = new Orientation(Math.PI/2, 0.12, 0),
|
||||
Speed = 10
|
||||
};
|
||||
string missileId = "ITGM_1";
|
||||
@ -417,7 +418,7 @@ namespace ThreatSource.Tools.MissileSimulation
|
||||
var motionParameters = new KinematicState
|
||||
{
|
||||
Position = new Vector3D(2000, 1, 20),
|
||||
Orientation = new Orientation(Math.PI/2, 0.2, 0),
|
||||
Orientation = new Orientation(Math.PI/2, 0.05, 0),
|
||||
Speed = 10
|
||||
};
|
||||
string missileId = "MMWG_1";
|
||||
@ -435,7 +436,7 @@ namespace ThreatSource.Tools.MissileSimulation
|
||||
var motionParameters = new KinematicState
|
||||
{
|
||||
Position = new Vector3D(2000, 1, 20),
|
||||
Orientation = new Orientation(Math.PI/2, 0.2, 0),
|
||||
Orientation = new Orientation(Math.PI/2, 0.05, 0),
|
||||
Speed = 10
|
||||
};
|
||||
string missileId = "CGGM_1";
|
||||
@ -484,7 +485,7 @@ namespace ThreatSource.Tools.MissileSimulation
|
||||
Orientation = new Orientation(Math.PI/2, 0, 0),
|
||||
Speed = 0
|
||||
};
|
||||
var infraredTracker = _threatSourceFactory.CreateIndicator(infraredTrackerId, "ir_001", "Tank_1", "ITGM_1", infraredTrackerLaunchParams);
|
||||
var infraredTracker = _threatSourceFactory.CreateIndicator(infraredTrackerId, "ir_001", "Tank_1", "ICGM_1", infraredTrackerLaunchParams);
|
||||
indicators[infraredTrackerId] = (SimulationElement)infraredTracker;
|
||||
simulationManager.RegisterEntity(infraredTrackerId, infraredTracker);
|
||||
Console.WriteLine($"注册红外测角仪 {infraredTrackerId}");
|
||||
@ -1313,7 +1314,7 @@ namespace ThreatSource.Tools.MissileSimulation
|
||||
Console.WriteLine($"未知组件 ({entity.GetType().Name})");
|
||||
}
|
||||
}
|
||||
Console.WriteLine($"总计: {allEntities.Count()} 个组件");
|
||||
Console.WriteLine($"总计: {allEntities.Count} 个组件");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user