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