481 lines
14 KiB
C#
481 lines
14 KiB
C#
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using ActiveProtect.Models;
|
|
using Model;
|
|
|
|
namespace ActiveProtect.SimulationEnvironment
|
|
{
|
|
/// <summary>
|
|
/// 仿真配置类,包含整个仿真所需的所有配置信息
|
|
/// </summary>
|
|
public class SimulationConfig
|
|
{
|
|
/// <summary>
|
|
/// 坦克配置列表
|
|
/// </summary>
|
|
public List<TankConfig> TankConfigs { get; set; }
|
|
|
|
/// <summary>
|
|
/// 导弹配置列表
|
|
/// </summary>
|
|
public List<MissileConfig> MissileConfigs { get; set; }
|
|
|
|
/// <summary>
|
|
/// 激光指示器配置列表
|
|
/// </summary>
|
|
public LaserDesignatorConfig LaserDesignatorConfig { get; set; }
|
|
|
|
/// <summary>
|
|
/// 激光驾束仪配置列表
|
|
/// </summary>
|
|
public LaserBeamRiderConfig LaserBeamRiderConfig { get; set; }
|
|
|
|
/// <summary>
|
|
/// 激光告警器配置
|
|
/// </summary>
|
|
public LaserWarnerConfig LaserWarnerConfig { get; set; }
|
|
|
|
/// <summary>
|
|
/// 激光干扰器配置
|
|
/// </summary>
|
|
public LaserJammerConfig LaserJammerConfig { get; set; }
|
|
|
|
/// <summary>
|
|
/// 仿真时间步长(秒)
|
|
/// </summary>
|
|
public double SimulationTimeStep { get; set; }
|
|
|
|
/// <summary>
|
|
/// 构造函数,初始化默认配置
|
|
/// </summary>
|
|
public SimulationConfig()
|
|
{
|
|
TankConfigs = new List<TankConfig>();
|
|
MissileConfigs = new List<MissileConfig>();
|
|
LaserDesignatorConfig = new LaserDesignatorConfig();
|
|
LaserBeamRiderConfig = new LaserBeamRiderConfig();
|
|
LaserWarnerConfig = new LaserWarnerConfig();
|
|
LaserJammerConfig = new LaserJammerConfig();
|
|
SimulationTimeStep = 0.1; // 默认时间步长为0.1秒
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 坦克配置类
|
|
/// </summary>
|
|
public class TankConfig
|
|
{
|
|
/// <summary>
|
|
/// 初始位置
|
|
/// </summary>
|
|
public Vector3D InitialPosition { get; set; }
|
|
|
|
/// <summary>
|
|
/// 初始朝向
|
|
/// </summary>
|
|
public Orientation InitialOrientation { get; set; }
|
|
|
|
/// <summary>
|
|
/// 初始速度(米/秒)
|
|
/// </summary>
|
|
public double InitialSpeed { get; set; }
|
|
|
|
/// <summary>
|
|
/// 最大速度(米/秒)
|
|
/// </summary>
|
|
public double MaxSpeed { get; set; }
|
|
|
|
/// <summary>
|
|
/// 最大装甲值
|
|
/// </summary>
|
|
public double MaxArmor { get; set; }
|
|
|
|
/// <summary>
|
|
/// 是否装备激光告警器
|
|
/// </summary>
|
|
public bool HasLaserWarner { get; set; }
|
|
|
|
/// <summary>
|
|
/// 是否装备激光干扰器
|
|
/// </summary>
|
|
public bool HasLaserJammer { get; set; }
|
|
|
|
/// <summary>
|
|
/// 构造函数,设置默认值
|
|
/// </summary>
|
|
public TankConfig()
|
|
{
|
|
SetDefaultValues();
|
|
|
|
InitialPosition = new Vector3D(0, 0, 0);
|
|
InitialOrientation = new Orientation(0, 0, 0);
|
|
}
|
|
|
|
public TankConfig(TankInfo tankInfo){
|
|
SetDefaultValues();
|
|
|
|
InitialPosition = new Vector3D(tankInfo.xp, tankInfo.yp, tankInfo.zp);
|
|
InitialOrientation = new Orientation(0, 0, 0);
|
|
}
|
|
|
|
public void SetDefaultValues(){
|
|
InitialSpeed = 0;
|
|
MaxSpeed = 0;
|
|
MaxArmor = 0;
|
|
HasLaserWarner = false;
|
|
HasLaserJammer = false;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 导弹配置类
|
|
/// </summary>
|
|
public class MissileConfig
|
|
{
|
|
/// <summary>
|
|
/// 初始位置
|
|
/// </summary>
|
|
public Vector3D InitialPosition { get; set; }
|
|
|
|
/// <summary>
|
|
/// 初始朝向
|
|
/// </summary>
|
|
public Orientation InitialOrientation { get; set; }
|
|
|
|
/// <summary>
|
|
/// 初始速度(米/秒)
|
|
/// </summary>
|
|
public double InitialSpeed { get; set; }
|
|
|
|
/// <summary>
|
|
/// 最大速度(米/秒)
|
|
/// </summary>
|
|
public double MaxSpeed { get; set; }
|
|
|
|
/// <summary>
|
|
/// 目标索引
|
|
/// </summary>
|
|
public int TargetIndex { get; set; }
|
|
|
|
/// <summary>
|
|
/// 最大飞行时间(秒)
|
|
/// </summary>
|
|
public double MaxFlightTime { get; set; }
|
|
|
|
/// <summary>
|
|
/// 最大飞行距离(米)
|
|
/// </summary>
|
|
public double MaxFlightDistance { get; set; }
|
|
|
|
/// <summary>
|
|
/// 最大加速度(米/秒²)
|
|
/// </summary>
|
|
public double MaxAcceleration { get; set; }
|
|
|
|
/// <summary>
|
|
/// 比例导引系数
|
|
/// </summary>
|
|
public double ProportionalNavigationCoefficient { get; set; }
|
|
|
|
/// <summary>
|
|
/// 飞行阶段配置
|
|
/// </summary>
|
|
public FlightStageConfig StageConfig { get; set; }
|
|
|
|
/// <summary>
|
|
/// 距离参数
|
|
/// </summary>
|
|
public MissileDistanceParams DistanceParams { get; set; }
|
|
|
|
/// <summary>
|
|
/// 发射推力加速度(米/秒²)
|
|
/// </summary>
|
|
public double LaunchAcceleration { get; set; }
|
|
|
|
/// <summary>
|
|
/// 最大发动机燃烧时间(秒)
|
|
/// </summary>
|
|
public double MaxEngineBurnTime { get; set; }
|
|
|
|
/// <summary>
|
|
/// 导弹质量(千克)
|
|
/// </summary>
|
|
public double Mass { get; set; }
|
|
|
|
/// <summary>
|
|
/// 导弹类型
|
|
/// </summary>
|
|
public MissileType Type { get; set; }
|
|
|
|
/// <summary>
|
|
/// 构造函数,设置默认值
|
|
/// </summary>
|
|
public MissileConfig()
|
|
{
|
|
SetDefaultValues();
|
|
|
|
InitialPosition = new Vector3D(0, 0, 0);
|
|
InitialOrientation = new Orientation(0, 0, 0);
|
|
}
|
|
|
|
public MissileConfig(MIniInfo mIniInfo){
|
|
SetDefaultValues();
|
|
|
|
InitialPosition = new Vector3D(mIniInfo.xm, mIniInfo.ym, mIniInfo.zm);
|
|
InitialOrientation = new Orientation(mIniInfo.psi_m, mIniInfo.theta_m, 0);
|
|
InitialSpeed = mIniInfo.vm;
|
|
}
|
|
|
|
public void SetDefaultValues(){
|
|
InitialSpeed = 0;
|
|
MaxSpeed = 0;
|
|
TargetIndex = 0;
|
|
MaxFlightTime = 0;
|
|
MaxFlightDistance = 0;
|
|
StageConfig = FlightStageConfig.StandardMissile;
|
|
LaunchAcceleration = 0;
|
|
MaxEngineBurnTime = 0;
|
|
MaxAcceleration = 0;
|
|
DistanceParams = new MissileDistanceParams(0, 0, 0);
|
|
ProportionalNavigationCoefficient = 0;
|
|
Type = MissileType.StandardMissile;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 激光指示器配置类
|
|
/// </summary>
|
|
public class LaserDesignatorConfig
|
|
{
|
|
/// <summary>
|
|
/// 初始位置
|
|
/// </summary>
|
|
public Vector3D InitialPosition { get; set; }
|
|
|
|
/// <summary>
|
|
/// 激光功率(瓦特)
|
|
/// </summary>
|
|
public double LaserPower { get; set; }
|
|
|
|
/// <summary>
|
|
/// 激光发散角
|
|
/// </summary>
|
|
public double LaserDivergenceAngle { get; set; }
|
|
|
|
/// <summary>
|
|
/// 构造函数,设置默认值
|
|
/// </summary>
|
|
public LaserDesignatorConfig()
|
|
{
|
|
InitialPosition = new Vector3D(0, 0, 0);
|
|
LaserPower = 0;
|
|
LaserDivergenceAngle = 0;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 激光驾束仪配置类
|
|
/// </summary>
|
|
public class LaserBeamRiderConfig
|
|
{
|
|
/// <summary>
|
|
/// 初始位置
|
|
/// </summary>
|
|
public Vector3D InitialPosition { get; set; }
|
|
|
|
/// <summary>
|
|
/// 激光功率(瓦特)
|
|
/// </summary>
|
|
public double LaserPower { get; set; }
|
|
|
|
/// <summary>
|
|
/// 控制场直径(米)
|
|
/// </summary>
|
|
public double ControlFieldDiameter { get; set; }
|
|
|
|
/// <summary>
|
|
/// 最大导引距离(米)
|
|
/// </summary>
|
|
public double MaxGuidanceDistance { get; set; }
|
|
|
|
|
|
/// <summary>
|
|
/// 构造函数,设置默认值
|
|
/// </summary>
|
|
public LaserBeamRiderConfig()
|
|
{
|
|
InitialPosition = new Vector3D(0, 0, 0);
|
|
LaserPower = 0;
|
|
ControlFieldDiameter = 0;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 导弹类型枚举
|
|
/// </summary>
|
|
public enum MissileType
|
|
{
|
|
StandardMissile, // 标准导弹
|
|
LaserSemiActiveGuidance, // 激光半主动制导
|
|
LaserBeamRiderGuidance, // 激光驾束制导
|
|
InfraredCommandGuidance, // 红外指令制导
|
|
InfraredImagingTerminalGuidance, // 红外成像末制导
|
|
MillimeterWaveTerminalGuidance, // 毫米波末制导
|
|
TerminalSensitiveMissile // 末敏弹
|
|
}
|
|
|
|
/// <summary>
|
|
/// 导弹距离参数结构
|
|
/// </summary>
|
|
public struct MissileDistanceParams
|
|
{
|
|
/// <summary>
|
|
/// 终端制导距离(米)
|
|
/// </summary>
|
|
public double TerminalGuidanceDistance;
|
|
/// <summary>
|
|
/// 攻击距离(米)
|
|
/// </summary>
|
|
public double AttackDistance;
|
|
/// <summary>
|
|
/// 爆炸距离(米)
|
|
/// </summary>
|
|
public double ExplosionDistance;
|
|
|
|
public MissileDistanceParams(double terminalGuidanceDistance, double attackDistance, double explosionDistance)
|
|
{
|
|
TerminalGuidanceDistance = terminalGuidanceDistance;
|
|
AttackDistance = attackDistance;
|
|
ExplosionDistance = explosionDistance;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
/// 导弹飞行阶段配置结构
|
|
/// </summary>
|
|
public struct FlightStageConfig
|
|
{
|
|
/// <summary>
|
|
/// 启用发射阶段
|
|
/// </summary>
|
|
public bool EnableLaunch;
|
|
/// <summary>
|
|
/// 启用加速阶段
|
|
/// </summary>
|
|
public bool EnableAcceleration;
|
|
/// <summary>
|
|
/// 启用巡航阶段
|
|
/// </summary>
|
|
public bool EnableCruise;
|
|
/// <summary>
|
|
/// 启用终端制导阶段
|
|
/// </summary>
|
|
public bool EnableTerminalGuidance;
|
|
/// <summary>
|
|
/// 启用攻击阶段
|
|
/// </summary>
|
|
public bool EnableAttack;
|
|
|
|
/// <summary>
|
|
/// 标准导弹的预设配置, 所有阶段都启用
|
|
/// </summary>
|
|
public static FlightStageConfig StandardMissile => new(false, true, false, false, false);
|
|
|
|
/// <summary>
|
|
/// 激光半主动制导导弹的预设配置, 没有加速阶段
|
|
/// </summary>
|
|
public static FlightStageConfig LaserSemiActiveGuidedMissile => new(true, false, true, true, true);
|
|
|
|
/// <summary>
|
|
/// 激光驾束制导导弹的预设配置,没有巡航阶段
|
|
/// </summary>
|
|
public static FlightStageConfig LaserBeamRiderGuidance => new(true, true, false, true, true);
|
|
|
|
/// <summary>
|
|
/// 红外指令制导导弹的预设配置,没有巡航阶段
|
|
/// </summary>
|
|
public static FlightStageConfig InfraredCommandGuidance => new(true, true, false, true, true);
|
|
|
|
/// <summary>
|
|
/// 红外成像末制导导弹的预设配置
|
|
/// </summary>
|
|
public static FlightStageConfig InfraredImagingTerminalGuidance => new(true, true, true, true, true);
|
|
|
|
/// <summary>
|
|
/// 毫米波末制导导弹的预设配置
|
|
/// </summary>
|
|
public static FlightStageConfig MillimeterWaveTerminalGuidance => new(true, true, true, true, true);
|
|
|
|
/// <summary>
|
|
/// 末敏弹的预设配置
|
|
/// </summary>
|
|
public static FlightStageConfig TerminalSensitiveMissile => new(true, true, false, false, true);
|
|
|
|
public FlightStageConfig(bool enableLaunch, bool enableAcceleration, bool enableCruise, bool enableTerminalGuidance, bool enableAttack)
|
|
{
|
|
EnableLaunch = enableLaunch;
|
|
EnableAcceleration = enableAcceleration;
|
|
EnableCruise = enableCruise;
|
|
EnableTerminalGuidance = enableTerminalGuidance;
|
|
EnableAttack = enableAttack;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 激光告警器配置类
|
|
/// </summary>
|
|
public class LaserWarnerConfig
|
|
{
|
|
/// <summary>
|
|
/// 警报持续时间(秒)
|
|
/// </summary>
|
|
public double AlarmDuration { get; set; }
|
|
|
|
/// <summary>
|
|
/// 构造函数,设置默认值
|
|
/// </summary>
|
|
public LaserWarnerConfig()
|
|
{
|
|
AlarmDuration = 5.0; // 默认警报持续5秒
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 激光干扰器配置类
|
|
/// </summary>
|
|
public class LaserJammerConfig
|
|
{
|
|
/// <summary>
|
|
/// 最大干扰冷却时间(秒)
|
|
/// </summary>
|
|
public double MaxJammingCooldown { get; set; }
|
|
|
|
/// <summary>
|
|
/// 最大干扰功率(瓦特)
|
|
/// </summary>
|
|
public double MaxJammingPower { get; set; }
|
|
|
|
/// <summary>
|
|
/// 初始干扰功率(瓦特)
|
|
/// </summary>
|
|
public double InitialJammingPower { get; set; }
|
|
|
|
/// <summary>
|
|
/// 功率增加速率(瓦特/秒)
|
|
/// </summary>
|
|
public double PowerIncreaseRate { get; set; }
|
|
|
|
/// <summary>
|
|
/// 构造函数,设置默认值
|
|
/// </summary>
|
|
public LaserJammerConfig()
|
|
{
|
|
MaxJammingCooldown = 5.0;
|
|
MaxJammingPower = 10000.0;
|
|
InitialJammingPower = 4000.0;
|
|
PowerIncreaseRate = 2000.0; // 每秒增加的功率
|
|
}
|
|
}
|
|
}
|