微调末敏弹参数指标,寻找最佳值
This commit is contained in:
parent
a97cb6a909
commit
3eb8194620
@ -1,6 +1,7 @@
|
||||
using ThreatSource.Simulation;
|
||||
using ThreatSource.Utils;
|
||||
using ThreatSource.Sensor;
|
||||
using ThreatSource.Target;
|
||||
|
||||
namespace ThreatSource.Missile
|
||||
{
|
||||
@ -120,7 +121,7 @@ namespace ThreatSource.Missile
|
||||
/// 目标探测的距离阈值
|
||||
/// 影响目标探测阶段的触发时机
|
||||
/// </remarks>
|
||||
private const double TargetDetectionDistance = 120;
|
||||
private const double TargetDetectionDistance = 150;
|
||||
|
||||
/// <summary>
|
||||
/// 自毁高度,单位:米
|
||||
@ -174,7 +175,7 @@ namespace ThreatSource.Missile
|
||||
/// 记录检测到目标时的角度
|
||||
/// 用于目标确认和重获
|
||||
/// </remarks>
|
||||
private double detectionAngle;
|
||||
//private double detectionAngle;
|
||||
|
||||
/// <summary>
|
||||
/// 红外探测器实例
|
||||
@ -242,11 +243,11 @@ namespace ThreatSource.Missile
|
||||
currentStage = SubmunitionStage.Separation;
|
||||
spiralAngle = 0;
|
||||
scanDirection = new Vector3D(0, 0, 0);
|
||||
detectionAngle = 0;
|
||||
//detectionAngle = 0;
|
||||
|
||||
// 初始化传感器
|
||||
infraredDetector = new InfraredDetector(this, 500, InfraredBand.Short, 10); // 红外探测器,探测距离 500 米,近红外,视场角10度
|
||||
radiometer = new MillimeterWaveRadiometer(this, 500, MillimeterWaveBand.Band3, 11); // 毫米波辐射计,探测距离500米,工作波段3mm,扫描视场角11度
|
||||
infraredDetector = new InfraredDetector(this, 500, InfraredBand.Short, 1); // 红外探测器,探测距离 500 米,近红外,视场角0.5度
|
||||
radiometer = new MillimeterWaveRadiometer(this, 500, MillimeterWaveBand.Band3, 1); // 毫米波辐射计,探测距离500米,工作波段3mm,扫描视场角0.5度
|
||||
altimeter = new MillimeterWaveAltimeter(this, 1000, MillimeterWaveBand.Band8, 0.5, 25); // 毫米波测高仪,测量精度0.5米
|
||||
rangefinder = new LaserRangefinder(this, 500, 1.06, 100, 0.5); // 激光测距仪,测量距离500米,波长1.06µm,测量频率100Hz,测量精度0.5米
|
||||
}
|
||||
@ -629,12 +630,39 @@ namespace ThreatSource.Missile
|
||||
/// </remarks>
|
||||
public bool DetectTarget(double fieldOfView)
|
||||
{
|
||||
// 获取目标对象
|
||||
SimulationElement target = SimulationManager.GetEntityById(TargetId) as SimulationElement ?? throw new Exception("目标不存在");
|
||||
Vector3D targetPosition = target.Position;
|
||||
Vector3D toTarget = (targetPosition - Position).Normalize();
|
||||
|
||||
// 检查目标是否在扫描视场内
|
||||
return Vector3D.DotProduct(scanDirection, toTarget) > Math.Cos(fieldOfView * Math.PI / 180);
|
||||
// 获取目标的尺寸属性
|
||||
double targetLength = (target as ITarget)?.Length ?? 0; // 目标长度
|
||||
double targetWidth = (target as ITarget)?.Width ?? 0; // 目标宽度
|
||||
|
||||
// 获取目标的朝向向量
|
||||
Vector3D targetForward = target.Orientation.ToVector();
|
||||
Vector3D targetRight = Vector3D.CrossProduct(Vector3D.UnitY, targetForward).Normalize();
|
||||
|
||||
// 计算矩形四个顶点的位置
|
||||
Vector3D targetPosition = target.Position;
|
||||
Vector3D[] vertices = new Vector3D[4];
|
||||
|
||||
// 前后左右四个顶点
|
||||
vertices[0] = targetPosition + (targetForward * (targetLength/2)) + (targetRight * (targetWidth/2)); // 右前
|
||||
vertices[1] = targetPosition + (targetForward * (targetLength/2)) - (targetRight * (targetWidth/2)); // 左前
|
||||
vertices[2] = targetPosition - (targetForward * (targetLength/2)) + (targetRight * (targetWidth/2)); // 右后
|
||||
vertices[3] = targetPosition - (targetForward * (targetLength/2)) - (targetRight * (targetWidth/2)); // 左后
|
||||
|
||||
// 检查是否至少有一个顶点在视场内
|
||||
double cosFieldOfView = Math.Cos(fieldOfView * Math.PI / 180);
|
||||
foreach(var vertex in vertices)
|
||||
{
|
||||
Vector3D toVertex = (vertex - Position).Normalize();
|
||||
if(Vector3D.DotProduct(scanDirection, toVertex) > cosFieldOfView)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -10,6 +10,7 @@ namespace ThreatSource.Target
|
||||
/// - 目标类型标识
|
||||
/// - 雷达散射截面积
|
||||
/// - 红外辐射特征
|
||||
/// - 目标物理尺寸
|
||||
/// 用于在仿真系统中表示和识别不同类型的目标
|
||||
/// </remarks>
|
||||
public interface ITarget
|
||||
@ -42,5 +43,32 @@ namespace ThreatSource.Target
|
||||
/// 影响红外制导系统的探测和跟踪能力
|
||||
/// </remarks>
|
||||
double InfraredRadiationIntensity { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取目标的长度
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 单位:米
|
||||
/// 表示目标在前后方向上的尺寸
|
||||
/// </remarks>
|
||||
double Length { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取目标的宽度
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 单位:米
|
||||
/// 表示目标在左右方向上的尺寸
|
||||
/// </remarks>
|
||||
double Width { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取目标的高度
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 单位:米
|
||||
/// 表示目标在垂直方向上的尺寸
|
||||
/// </remarks>
|
||||
double Height { get; }
|
||||
}
|
||||
}
|
||||
@ -51,6 +51,33 @@ namespace ThreatSource.Target
|
||||
/// </remarks>
|
||||
public double Health { get; set; } = 100.0;
|
||||
|
||||
/// <summary>
|
||||
/// 获取坦克的长度
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 单位:米
|
||||
/// 固定值6.0,表示坦克的长度
|
||||
/// </remarks>
|
||||
public double Length => 6.0;
|
||||
|
||||
/// <summary>
|
||||
/// 获取坦克的宽度
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 单位:米
|
||||
/// 固定值3.0,表示坦克的宽度
|
||||
/// </remarks>
|
||||
public double Width => 3.0;
|
||||
|
||||
/// <summary>
|
||||
/// 获取坦克的高度
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 单位:米
|
||||
/// 固定值2.5,表示坦克的高度
|
||||
/// </remarks>
|
||||
public double Height => 2.5;
|
||||
|
||||
/// <summary>
|
||||
/// 初始化坦克类的新实例
|
||||
/// </summary>
|
||||
|
||||
50
docs/articles/tunning.md
Normal file
50
docs/articles/tunning.md
Normal file
@ -0,0 +1,50 @@
|
||||
# 导弹弹参数调整
|
||||
|
||||
## 末敏弹参数调整
|
||||
|
||||
调整参数后的运行记录
|
||||
|
||||
| 精度 | 角度误差 | 仿真步长 | 视场角 |
|
||||
| ------ | -------- | -------- | ------ |
|
||||
| 0.73米 | +1.08 度 | 0.0005秒 | 0.2度 |
|
||||
| 0.32米 | +0.36 度 | 0.0005秒 | 0.5度 |
|
||||
| 1.44米 | +0.36 度 | 0.0005秒 | 1度 |
|
||||
| 4.03米 | +0.36 度 | 0.0005秒 | 2度 |
|
||||
| 11.54米 | -0.36 度 | 0.0005秒 | 5度 |
|
||||
| 25.51米 | -14.04 度 | 0.0005秒 | 10度 |
|
||||
| 38.04米 | -28.44 度 | 0.0005秒 | 15度 |
|
||||
|
||||
| 精度 | 角度误差 | 仿真步长 | 视场角 |
|
||||
| ------ | -------- | -------- | ------ |
|
||||
| 0.69米 | +1.08 度 | 0.001秒 | 0.5度 |
|
||||
| 1.62米 | +1.08 度 | 0.001秒 | 1度 |
|
||||
| 3.87米 | +1.08 度 | 0.001秒 | 2度 |
|
||||
| 11.5米 | +1.08 度 | 0.001秒 | 5度 |
|
||||
| 24.4米 | -13.32 度 | 0.001秒 | 10度 |
|
||||
| 36.55米 | -27.72 度 | 0.001秒 | 15度 |
|
||||
|
||||
| 精度 | 角度误差 | 仿真步长 | 视场角 |
|
||||
| ------ | -------- | -------- | ------ |
|
||||
| 1.88米 | -0.65 度 | 0.0001秒 | 1度 |
|
||||
| 1.73米 | -0.36 度 | 0.0002秒 | 1度 |
|
||||
| 1.41米 | +0.36 度 | 0.0005秒 | 1度 |
|
||||
| 1.62米 | +1.08 度 | 0.001秒 | 1度 |
|
||||
| 2.56米 | +2.52 度 | 0.002秒 | 1度 |
|
||||
| 5.61米 | +5.40 度 | 0.005秒 | 2度 |
|
||||
| 22.75米 | +19.8 度 | 0.01秒 | 5度 |
|
||||
| 36.14米 | +34.20 度 | 0.02秒 | 5度 |
|
||||
|
||||
从以上数据可以看出,仿真步长越小,精度越高,角度误差越小,视场角越大,探测距离越远。
|
||||
最好的参数是:
|
||||
|
||||
- 仿真步长:0.0005秒
|
||||
- 视场角:0.5度
|
||||
- 精度:0.32米
|
||||
- 角度误差:+0.36度
|
||||
|
||||
比较合理的参数是:
|
||||
|
||||
- 仿真步长:0.001秒
|
||||
- 视场角:1度
|
||||
- 精度:1.62米
|
||||
- 角度误差:+0.36度
|
||||
@ -3,7 +3,7 @@ using ThreatSource.Simulation;
|
||||
using ThreatSource.Utils;
|
||||
using ThreatSource.Jamming;
|
||||
using ThreatSource.Sensor;
|
||||
|
||||
using ThreatSource.Target;
|
||||
namespace ThreatSource.Tools
|
||||
{
|
||||
/// <summary>
|
||||
@ -15,7 +15,7 @@ namespace ThreatSource.Tools
|
||||
private readonly List<TerminalSensitiveSubmunition> missiles;
|
||||
private readonly List<SimulationElement> targets;
|
||||
private bool isRunning;
|
||||
private readonly double timeStep = 0.005; // 时间步长,单位:秒
|
||||
private readonly double timeStep = 0.001; // 时间步长,单位:秒
|
||||
|
||||
/// <summary>
|
||||
/// 初始化导弹模拟器
|
||||
@ -56,7 +56,7 @@ namespace ThreatSource.Tools
|
||||
var properties = new MissileProperties
|
||||
{
|
||||
Mass = 10,
|
||||
ExplosionRadius = 5,
|
||||
ExplosionRadius = 0.1,
|
||||
MaxSpeed = 2000
|
||||
};
|
||||
|
||||
@ -194,10 +194,21 @@ namespace ThreatSource.Tools
|
||||
/// <summary>
|
||||
/// 模拟目标类
|
||||
/// </summary>
|
||||
public class MockTarget : SimulationElement
|
||||
public class MockTarget : SimulationElement, ITarget
|
||||
{
|
||||
public MockTarget(string id) : base(id, new Vector3D(0, 0, 0), new Orientation(), 1000, null) { }
|
||||
|
||||
public override void Update(double deltaTime) { }
|
||||
|
||||
public string Type => "Tank";
|
||||
|
||||
// 设置目标的物理尺寸
|
||||
public double Length => 6.0; // 长度 6 米
|
||||
public double Width => 3.0; // 宽度 3 米
|
||||
public double Height => 2.5; // 高度 2.5 米
|
||||
|
||||
// 设置目标的特征参数
|
||||
public double RadarCrossSection => 10.0; // 雷达散射截面积(示例值)
|
||||
public double InfraredRadiationIntensity => 500.0; // 红外辐射强度(示例值)
|
||||
}
|
||||
}
|
||||
@ -14,7 +14,7 @@ namespace ThreatSource.Tools
|
||||
var targetId = simulator.AddTarget(new Vector3D(0, 0, 0));
|
||||
|
||||
// 发射导弹
|
||||
simulator.LaunchMissile(targetId, new Vector3D(50, 400, 50));
|
||||
simulator.LaunchMissile(targetId, new Vector3D(40, 400, 40));
|
||||
|
||||
// 启动模拟线程
|
||||
var simulationThread = new Thread(simulator.Start);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user