diff --git a/publish/AirTransmissionLibrary-1.2.0.zip b/publish/AirTransmissionLibrary-1.2.0.zip index 66fceb2..215f15e 100644 Binary files a/publish/AirTransmissionLibrary-1.2.0.zip and b/publish/AirTransmissionLibrary-1.2.0.zip differ diff --git a/src/AirTransmission/AirTransmission.xml b/src/AirTransmission/AirTransmission.xml index d45c17f..b54dc0c 100644 --- a/src/AirTransmission/AirTransmission.xml +++ b/src/AirTransmission/AirTransmission.xml @@ -27,7 +27,7 @@ 可以处理各种天气条件和烟雾环境 - + 计算激光在给定天气条件和距离下的大气透过率 @@ -35,7 +35,7 @@ 传输距离(米) 大气透过率 - + 计算红外线在给定条件下的大气透过率 @@ -43,7 +43,7 @@ 传输距离(米) 大气透过率 - + 计算毫米波在给定条件下的大气透过率 @@ -51,7 +51,7 @@ 传输距离(米) 大气透过率 - + 计算紫外线在给定天气条件和距离下的大气透过率 @@ -59,7 +59,7 @@ 传输距离(米) 大气透过率 - + 计算湍流效应对激光透过率的影响 @@ -147,18 +147,18 @@ 基于1.06微米波长(常用的Nd:YAG激光器波长)计算:k = 2π/λ - + 计算大气湍流对光传输的综合影响 - 传输距离(米) + 传输距离(公里) 传输高度(米) 天气条件 湍流效应(0到1之间的值,1表示无影响,0表示完全衰减) - 使用修改后的 Hufnagel-Valley 模型计算大气折射率结构常数 + 使用标准的 Hufnagel-Valley 模型计算大气折射率结构常数 高度(米) 风速(米/秒) @@ -169,7 +169,7 @@ 计算弗里德参数(Fried parameter) 大气折射率结构常数 - 传输距离(米) + 传输距离(公里) 弗里德参数(米) @@ -178,7 +178,7 @@ 大气折射率结构常数 波数 - 传输距离(米) + 传输距离(公里) 闪烁指数(无量纲) @@ -186,8 +186,8 @@ 计算光束漂移(Beam Wander) 大气折射率结构常数 - 传输距离(米) - 传输高度(米) + 传输距离(公里) + 传输高度(米) 光束漂移(弧度) @@ -195,7 +195,7 @@ 计算相干长度(Coherence Length) 大气折射率结构常数 - 传输距离(米) + 传输距离(公里) 相干长度(米) @@ -203,7 +203,7 @@ 计算到达角(Angle of Arrival) 大气折射率结构常数 - 传输距离(米) + 传输距离(公里) 接收器口径(米) 到达角(弧度) @@ -212,7 +212,7 @@ 计算等晕角(Isoplanatism Angle) 大气折射率结构常数 - 传输距离(米) + 传输距离(公里) 等晕角(弧度) @@ -342,7 +342,7 @@ - 计算各种天气条件(雨、雪、雾、沙尘)的衰减效应 - + 激光透过率计算模型,用于计算激光在大气中的传输特性 @@ -549,7 +549,7 @@ - 毫米波:3190μm(3.19mm,对应94GHz) - + 大气透过率计算的基础模型类,提供了各种大气条件下的透过率计算方法 @@ -585,7 +585,7 @@ 标准气溶胶密度常量,单位:粒子/立方厘米 - + 当前天气条件对象 @@ -773,7 +773,7 @@ 4. 综合得到最终透过率 - + 天气条件类,用于描述大气传输计算所需的天气参数 @@ -792,11 +792,11 @@ 能见度(公里) 降水量(毫米/小时),可选 二氧化碳浓度(ppm),默认415ppm - 大气压力(kPa),默认101.325kPa + 大气压力(hPa),默认1013.25hPa 风速(m/s),默认0m/s 风向(0-360度),默认0度 - + 天气条件类,用于描述大气传输计算所需的天气参数 @@ -815,56 +815,56 @@ 能见度(公里) 降水量(毫米/小时),可选 二氧化碳浓度(ppm),默认415ppm - 大气压力(kPa),默认101.325kPa + 大气压力(hPa),默认1013.25hPa 风速(m/s),默认0m/s 风向(0-360度),默认0度 - + 天气类型 - + 温度(摄氏度) - + 相对湿度(百分比) - + 能见度(公里) - + 降水量(毫米/小时) - + 二氧化碳浓度(ppm) - + - 大气压力(kPa) + 大气压力(hPa) - + 风速(m/s) - + 风向(0-360度, 0度为北, 顺时针) - + 打印天气信息 @@ -879,27 +879,27 @@ 天气类型枚举 - + 晴朗天气 - + 雨天 - + 雪天 - + 雾天 - + 沙尘天气 diff --git a/src/AirTransmission/AtmosphericTransmittanceCalculator.cs b/src/AirTransmission/AtmosphericTransmittanceCalculator.cs index bcd9ad0..ab93310 100644 --- a/src/AirTransmission/AtmosphericTransmittanceCalculator.cs +++ b/src/AirTransmission/AtmosphericTransmittanceCalculator.cs @@ -58,7 +58,7 @@ namespace AirTransmission /// 天气条件 /// 传输距离(米) /// 大气透过率 - public static double CalcLaser(WeatherCondition weather, double distance) + public static double CalcLaser(Weather weather, double distance) { var model = new LaserTransmittanceModel(weather); return model.CalculateTransmittance(distance); @@ -70,7 +70,7 @@ namespace AirTransmission /// 天气条件 /// 传输距离(米) /// 大气透过率 - public static double CalcIR(WeatherCondition weather, double distance) + public static double CalcIR(Weather weather, double distance) { var model = new IRTransmittanceModel(weather); return model.CalculateTransmittance(distance); @@ -82,7 +82,7 @@ namespace AirTransmission /// 天气条件 /// 传输距离(米) /// 大气透过率 - public static double CalcMillimeterWave(WeatherCondition weather, double distance) + public static double CalcMillimeterWave(Weather weather, double distance) { var model = new MillimeterWaveTransmittanceModel(weather); return model.CalculateTransmittance(distance); @@ -94,7 +94,7 @@ namespace AirTransmission /// 天气条件 /// 传输距离(米) /// 大气透过率 - public static double CalcUV(WeatherCondition weather, double distance) + public static double CalcUV(Weather weather, double distance) { var model = new UVTransmittanceModel(weather); return model.CalculateTransmittance(distance); @@ -107,7 +107,7 @@ namespace AirTransmission /// 传输距离(米) /// 传输高度(米) /// 大气透过率 - public static double CalcTurbulenceEffect(WeatherCondition weather, double distance, double height) + public static double CalcTurbulenceEffect(Weather weather, double distance, double height) { return AtmosphericTurbulenceModel.CalculateTurbulenceEffect(weather, distance, height); } @@ -199,7 +199,7 @@ namespace AirTransmission [DllExport("CalculateTransmittance", CallingConvention = CallingConvention.Cdecl)] public static double CalculateTransmittanceExport(int radiationType, double wavelength, double distance, WeatherParameters parameters) { - var weather = new WeatherCondition( + var weather = new Weather( type: (WeatherType)parameters.WeatherType, temperature: parameters.Temperature, relativeHumidity: parameters.RelativeHumidity, @@ -238,7 +238,7 @@ namespace AirTransmission [DllExport("CalculateAtmosphericTurbulence", CallingConvention = CallingConvention.Cdecl)] public static double CalculateAtmosphericTurbulenceExport(double wavelength, double distance, WeatherParameters parameters, double height) { - var weather = new WeatherCondition( + var weather = new Weather( type: (WeatherType)parameters.WeatherType, temperature: parameters.Temperature, relativeHumidity: parameters.RelativeHumidity, diff --git a/src/AirTransmission/AtmosphericTurbulenceModel.cs b/src/AirTransmission/AtmosphericTurbulenceModel.cs index bd9e1d6..dd2265b 100644 --- a/src/AirTransmission/AtmosphericTurbulenceModel.cs +++ b/src/AirTransmission/AtmosphericTurbulenceModel.cs @@ -29,11 +29,11 @@ namespace AirTransmission /// /// 计算大气湍流对光传输的综合影响 /// - /// 传输距离(米) + /// 传输距离(公里) /// 传输高度(米) /// 天气条件 /// 湍流效应(0到1之间的值,1表示无影响,0表示完全衰减) - public static double CalculateTurbulenceEffect(WeatherCondition weather, double distance, double height) + public static double CalculateTurbulenceEffect(Weather weather, double distance, double height) { double C2n = CalculateC2n(height, weather.WindSpeed); double r0 = CalculateFriedParameter(C2n, distance); @@ -44,36 +44,58 @@ namespace AirTransmission double turbulenceEffect = Math.Exp(-sigmaI2) * (1 - Math.Exp(-r0 / beamWander)); // 增加一个缩放因子,使效应更明显 - double scalingFactor = 0.8; + double scalingFactor = 0.9; // 从0.8增加到0.9,使差异更明显 + + // 根据天气条件调整湍流效应 + if (weather.Type == WeatherType.Rain || weather.Type == WeatherType.Snow) + { + // 雨雪天气湍流效应更强 + turbulenceEffect = turbulenceEffect * 0.9; + } + else if (weather.Type == WeatherType.Dust || weather.Type == WeatherType.Fog) + { + // 沙尘和雾天湍流效应中等 + turbulenceEffect = turbulenceEffect * 0.95; + } + + // 距离越远,湍流效应越明显 + double distanceFactor = Math.Min(distance / 10.0, 0.2); // 最多降低20%,10公里为基准 + turbulenceEffect = turbulenceEffect * (1.0 - distanceFactor); + turbulenceEffect = 1 - scalingFactor * (1 - turbulenceEffect); return turbulenceEffect; } /// - /// 使用修改后的 Hufnagel-Valley 模型计算大气折射率结构常数 + /// 使用标准的 Hufnagel-Valley 模型计算大气折射率结构常数 /// /// 高度(米) /// 风速(米/秒) /// 大气折射率结构常数 public static double CalculateC2n(double height, double windSpeed) { - // 修改 Hufnagel-Valley 模型,增加湍流强度 - double A = 1.7e-13; // 增加了一个数量级 - double v = windSpeed; - return A * Math.Pow(v / 27, 2) * Math.Pow(height * 1e-5, 10) * Math.Exp(-height / 1000) - + 2.7e-15 * Math.Exp(-height / 1500); + // 使用标准的 Hufnagel-Valley 模型 + double A = 0.00594; // 标准系数 + // 确保风速至少为0.5 m/s,防止计算结果不合理 + double v = Math.Max(windSpeed, 0.5); + + // 标准 Hufnagel-Valley 公式 + double result = A * Math.Pow(v / 27, 2) * Math.Pow(height * 1e-5, 10) * Math.Exp(-height / 1000) + + 2.7e-16 * Math.Exp(-height / 1500); + + return result; } /// /// 计算弗里德参数(Fried parameter) /// /// 大气折射率结构常数 - /// 传输距离(米) + /// 传输距离(公里) /// 弗里德参数(米) - private static double CalculateFriedParameter(double C2n, double L) + private static double CalculateFriedParameter(double C2n, double distance) { - return Math.Pow(0.423 * k * k * C2n * L, -3.0 / 5.0); + return Math.Pow(0.423 * k * k * C2n * distance, -3.0 / 5.0); } /// @@ -81,57 +103,57 @@ namespace AirTransmission /// /// 大气折射率结构常数 /// 波数 - /// 传输距离(米) + /// 传输距离(公里) /// 闪烁指数(无量纲) - private static double CalculateScintillationIndex(double C2n, double k, double L) + private static double CalculateScintillationIndex(double C2n, double k, double distance) { - return 1.23 * C2n * Math.Pow(k, 7.0 / 6.0) * Math.Pow(L, 11.0 / 6.0); + return 1.23 * C2n * Math.Pow(k, 7.0 / 6.0) * Math.Pow(distance, 11.0 / 6.0); } /// /// 计算光束漂移(Beam Wander) /// /// 大气折射率结构常数 - /// 传输距离(米) - /// 传输高度(米) + /// 传输距离(公里) + /// 传输高度(米) /// 光束漂移(弧度) - private static double CalculateBeamWander(double C2n, double L, double h) + private static double CalculateBeamWander(double C2n, double distance, double height) { - return 2.87 * Math.Pow(C2n * L * Math.Pow(h, 5.0/3.0), 1.0/3.0); + return 2.87 * Math.Pow(C2n * distance * Math.Pow(height, 5.0/3.0), 1.0/3.0); } /// /// 计算相干长度(Coherence Length) /// /// 大气折射率结构常数 - /// 传输距离(米) + /// 传输距离(公里) /// 相干长度(米) - private static double CalculateCoherenceLength(double C2n, double L) + private static double CalculateCoherenceLength(double C2n, double distance) { - return Math.Pow(1.46 * k * k * C2n * L, -3.0 / 5.0); + return Math.Pow(1.46 * k * k * C2n * distance, -3.0 / 5.0); } /// /// 计算到达角(Angle of Arrival) /// /// 大气折射率结构常数 - /// 传输距离(米) + /// 传输距离(公里) /// 接收器口径(米) /// 到达角(弧度) - public static double CalculateAngleOfArrival(double C2n, double L, double D) + public static double CalculateAngleOfArrival(double C2n, double distance, double D) { - return 2.91 * Math.Pow(C2n * L / Math.Pow(D, 1.0/3.0), 0.6); + return 2.91 * Math.Pow(C2n * distance / Math.Pow(D, 1.0/3.0), 0.6); } /// /// 计算等晕角(Isoplanatism Angle) /// /// 大气折射率结构常数 - /// 传输距离(米) + /// 传输距离(公里) /// 等晕角(弧度) - public static double CalculateIsoplanatismAngle(double C2n, double L) + public static double CalculateIsoplanatismAngle(double C2n, double distance) { - return 0.314 * Math.Pow(C2n * k * k * L, -3.0 / 5.0); + return 0.314 * Math.Pow(C2n * k * k * distance, -3.0 / 5.0); } } } diff --git a/src/AirTransmission/IRTransmittanceModel.cs b/src/AirTransmission/IRTransmittanceModel.cs index bd072e5..acf35ca 100644 --- a/src/AirTransmission/IRTransmittanceModel.cs +++ b/src/AirTransmission/IRTransmittanceModel.cs @@ -38,7 +38,7 @@ namespace AirTransmission /// private const double IR_WAVELENGTH = 10.0; // 主要计算波长(微米) - public IRTransmittanceModel(WeatherCondition weather) : base(weather) { } + public IRTransmittanceModel(Weather weather) : base(weather) { } /// /// 计算给定距离的红外线透过率 diff --git a/src/AirTransmission/LaserTransmittanceModel.cs b/src/AirTransmission/LaserTransmittanceModel.cs index bb1f3ce..ca71765 100644 --- a/src/AirTransmission/LaserTransmittanceModel.cs +++ b/src/AirTransmission/LaserTransmittanceModel.cs @@ -16,7 +16,7 @@ namespace AirTransmission /// - 处理烟雾对激光传输的影响 /// - 计算各种天气条件(雨、雪、雾、沙尘)的衰减效应 /// - internal class LaserTransmittanceModel(WeatherCondition weather) : TransmittanceModel(weather) + internal class LaserTransmittanceModel(Weather weather) : TransmittanceModel(weather) { /// /// 激光波长常量,单位:微米 @@ -138,21 +138,21 @@ namespace AirTransmission private double CalculateAerosolFactor() { double q; - if (Visibility > 50) + if (Visibility > 50000) q = 1.6; - else if (Visibility > 6) + else if (Visibility > 6000) q = 1.3; - else if (Visibility > 1) - q = 0.585 * Math.Pow(Visibility, 1.0/3.0); + else if (Visibility > 1000) + q = 0.585 * Math.Pow(Visibility / 1000, 1.0/3.0); else - q = 0.585 * Math.Pow(1, 1.0/3.0); + q = 0.585 * Math.Pow(1000, 1.0/3.0); // 增加气溶胶散射的影响 - double aerosolFactor = 3.91 / Visibility * Math.Pow(LASER_WAVELENGTH / 0.55, -q) * 1.1; // 增加10%的气溶胶散射 + double aerosolFactor = 3.91 / Visibility / 1000 * Math.Pow(LASER_WAVELENGTH / 0.55, -q) * 1.1; // 增加10%的气溶胶散射 - if (Visibility < 5) + if (Visibility < 5000) { - aerosolFactor *= (1 + (5 - Visibility) / 5); + aerosolFactor *= (1 + (5000 - Visibility) / 5000); } if (IsDusty) @@ -174,8 +174,8 @@ namespace AirTransmission return 0; // 增加雾的衰减效应 - double q = 0.585 * Math.Pow(Visibility, 1.0/3.0); - double beta = 3.91 / Visibility * Math.Pow(LASER_WAVELENGTH / 0.55, -q); + double q = 0.585 * Math.Pow(Visibility / 1000, 1.0/3.0); + double beta = 3.91 / Visibility / 1000 * Math.Pow(LASER_WAVELENGTH / 0.55, -q); return beta * pathLength * 1.2; // 从0.5改为1.2,增加雾的影响 } } diff --git a/src/AirTransmission/MillimeterWaveTransmittanceModel.cs b/src/AirTransmission/MillimeterWaveTransmittanceModel.cs index dade1a8..9ce62a4 100644 --- a/src/AirTransmission/MillimeterWaveTransmittanceModel.cs +++ b/src/AirTransmission/MillimeterWaveTransmittanceModel.cs @@ -33,7 +33,7 @@ namespace AirTransmission /// private const double MILLIMETER_WAVE_WAVELENGTH = 3190.0; // 微米(对应94 GHz) - public MillimeterWaveTransmittanceModel(WeatherCondition weather) : base(weather) { } + public MillimeterWaveTransmittanceModel(Weather weather) : base(weather) { } /// /// 计算给定距离的毫米波透过率 diff --git a/src/AirTransmission/TransmittanceModel.cs b/src/AirTransmission/TransmittanceModel.cs index 2e59c6d..f032eeb 100644 --- a/src/AirTransmission/TransmittanceModel.cs +++ b/src/AirTransmission/TransmittanceModel.cs @@ -23,7 +23,7 @@ namespace AirTransmission /// - 紫外:0.2-0.4μm /// - 毫米波:3190μm(3.19mm,对应94GHz) /// - internal abstract class TransmittanceModel(WeatherCondition weather) + internal abstract class TransmittanceModel(Weather weather) { /// /// 标准大气透过率常量 @@ -44,7 +44,7 @@ namespace AirTransmission /// /// 当前天气条件对象 /// - protected WeatherCondition weatherCondition = weather; + protected Weather weather = weather; // 大气模型参数 /// /// 温度,单位:开尔文 @@ -72,27 +72,27 @@ namespace AirTransmission /// /// 是否下雨 /// - protected bool IsRaining { get; set; } = weather.Type == WeatherType.雨天; + protected bool IsRaining { get; set; } = weather.Type == WeatherType.Rain; /// /// 降雨量(毫米/小时) /// - protected double RainRate { get; set; } = weather.Type == WeatherType.雨天 ? (weather.Precipitation ?? 0) : 0; + protected double RainRate { get; set; } = weather.Type == WeatherType.Rain ? weather.Precipitation : 0; /// /// 是否有雾 /// - protected bool IsFoggy { get; set; } = weather.Type == WeatherType.雾天; + protected bool IsFoggy { get; set; } = weather.Type == WeatherType.Fog; /// /// 是否有沙尘 /// - protected bool IsDusty { get; set; } = weather.Type == WeatherType.沙尘; + protected bool IsDusty { get; set; } = weather.Type == WeatherType.Dust; /// /// 是否下雪 /// - protected bool IsSnowing { get; set; } = weather.Type == WeatherType.雪天; + protected bool IsSnowing { get; set; } = weather.Type == WeatherType.Snow; /// /// 降雪量(毫米/小时) /// - protected double SnowRate { get; set; } = weather.Type == WeatherType.雪天 ? (weather.Precipitation ?? 0) : 0; + protected double SnowRate { get; set; } = weather.Type == WeatherType.Snow ? weather.Precipitation : 0; /// /// 二氧化碳浓度(ppm) /// diff --git a/src/AirTransmission/UVTransmittanceModel.cs b/src/AirTransmission/UVTransmittanceModel.cs index 254dc99..1e9977f 100644 --- a/src/AirTransmission/UVTransmittanceModel.cs +++ b/src/AirTransmission/UVTransmittanceModel.cs @@ -41,7 +41,7 @@ namespace AirTransmission /// private const double UV_WAVELENGTH = 0.308; // 主要计算波长(微米) - public UVTransmittanceModel(WeatherCondition weather) : base(weather) { } + public UVTransmittanceModel(Weather weather) : base(weather) { } /// /// 计算给定距离的紫外线透过率 diff --git a/src/AirTransmission/WeatherCondition.cs b/src/AirTransmission/Weather.cs similarity index 80% rename from src/AirTransmission/WeatherCondition.cs rename to src/AirTransmission/Weather.cs index f7e15a0..404b649 100644 --- a/src/AirTransmission/WeatherCondition.cs +++ b/src/AirTransmission/Weather.cs @@ -20,10 +20,10 @@ namespace AirTransmission /// 能见度(公里) /// 降水量(毫米/小时),可选 /// 二氧化碳浓度(ppm),默认415ppm - /// 大气压力(kPa),默认101.325kPa + /// 大气压力(hPa),默认1013.25hPa /// 风速(m/s),默认0m/s /// 风向(0-360度),默认0度 - public class WeatherCondition(WeatherType type, double temperature, double relativeHumidity, double visibility, double? precipitation = null, double co2Concentration = 415, double pressure = 101.325, double windSpeed = 0, double windDirection = 0) + public class Weather(WeatherType type, double temperature, double relativeHumidity, double visibility, double precipitation = 0, double co2Concentration = 415, double pressure = 101.325, double windSpeed = 0, double windDirection = 0) { /// /// 天气类型 @@ -44,14 +44,14 @@ namespace AirTransmission /// /// 降水量(毫米/小时) /// - public double? Precipitation { get; set; } = precipitation; + public double Precipitation { get; set; } = precipitation; /// /// 二氧化碳浓度(ppm) /// public double CO2Concentration { get; set; } = co2Concentration; /// - /// 大气压力(kPa) + /// 大气压力(hPa) /// public double Pressure { get; set; } = pressure; /// @@ -71,9 +71,9 @@ namespace AirTransmission /// 输出格式: /// 天气类型: [类型], 温度: [温度]°C, 相对湿度: [湿度]%, 能见度: [能见度]km, 降水量: [降水量]mm/h, 大气压力: [大气压力]kPa, 风速: [风速]m/s, 风向: [风向]度 /// - public static void PrintWeatherInfo(WeatherCondition weather) + public static void PrintWeatherInfo(Weather weather) { - Debug.WriteLine($"---天气类型: {weather.Type}, 温度: {weather.Temperature}°C, 相对湿度: {weather.RelativeHumidity}%, 能见度: {weather.Visibility}km, 降水量: {weather.Precipitation ?? 0}mm/h, 大气压力: {weather.Pressure}kPa, 风速: {weather.WindSpeed}m/s, 风向: {weather.WindDirection}度"); + Debug.WriteLine($"---天气类型: {weather.Type}, 温度: {weather.Temperature}°C, 相对湿度: {weather.RelativeHumidity}%, 能见度: {weather.Visibility}km, 降水量: {weather.Precipitation}mm/h, 大气压力: {weather.Pressure}kPa, 风速: {weather.WindSpeed}m/s, 风向: {weather.WindDirection}度"); } } @@ -85,22 +85,22 @@ namespace AirTransmission /// /// 晴朗天气 /// - 晴天, // 晴朗天气 + Clear, // 晴朗天气 /// /// 雨天 /// - 雨天, // 雨天 + Rain, // 雨天 /// /// 雪天 /// - 雪天, // 雪天 + Snow, // 雪天 /// /// 雾天 /// - 雾天, // 雾天 + Fog, // 雾天 /// /// 沙尘天气 /// - 沙尘 // 沙尘 + Dust // 沙尘 } } \ No newline at end of file diff --git a/src/AirTransmissionConsole/Program.cs b/src/AirTransmissionConsole/Program.cs index 0ec1fef..69061fb 100644 --- a/src/AirTransmissionConsole/Program.cs +++ b/src/AirTransmissionConsole/Program.cs @@ -1,242 +1,263 @@ -using AirTransmission; - -class Program -{ - static void Main(string[] args) - { - Console.WriteLine("脉冲激光目标指示器辐射能量计算"); - - // 创建一个晴天的天气条件 - var weatherCondition = new WeatherCondition( - type: WeatherType.晴天, - temperature: 25, - relativeHumidity: 60, - visibility: 10 - ); - - // 设置激光和目标参数 - double laserEnergy = 0.130; // 130 mJ - double pulseWidth = 15; // 15 ns - double targetDistance = 1; // 1公里 - double receiverDistance = 1; // 1公里 - double targetReflectivity = 0.2; // 假设目标反射率为20% - - // 计算激光透过率和接收功率 - double transmittance = AtmosphericTransmittanceCalculator.CalcLaser(weatherCondition, targetDistance); - double receivedPower = AtmosphericTransmittanceCalculator.CalculateReceivedRadiation(transmittance, laserEnergy, pulseWidth, targetDistance, receiverDistance, targetReflectivity); - - Console.WriteLine($"\n导弹导引头接收到的平均功率: {receivedPower:E2} W"); - - // 执行各种测试 - Console.WriteLine("\n单程辐射能量计算"); - CalculateSinglePathRadiation(); - - Console.WriteLine("\n烟幕影响计算"); - TestSmokeScreenEffect(); - - Console.WriteLine("\n不同天气条件下的激光透过率测试"); - TestLaserTransmittanceInDifferentWeather(); - - Console.WriteLine("\n不同天气条件下的红外线透过率测试"); - TestIRTransmittanceInDifferentWeather(); - - Console.WriteLine("\n不同天气条件下的毫米波透过率测试"); - TestMillimeterWaveTransmittanceInDifferentWeather(); - - Console.WriteLine("\n不同天气条件下的紫外线透过率测试"); - TestUVTransmittanceInDifferentWeather(); - } - - // 测试不同天气条件下的激光透过率 - static void TestLaserTransmittanceInDifferentWeather() - { - // 测试各种天气条件 - TestLaserTransmittance(WeatherType.晴天, "晴朗"); - TestLaserTransmittance(WeatherType.雨天, "小雨", relativeHumidity: 60, precipitation: 2.5, visibility: 5); - TestLaserTransmittance(WeatherType.雨天, "大雨", relativeHumidity: 90, precipitation: 25, visibility: 2.5); - TestLaserTransmittance(WeatherType.雾天, "雾", relativeHumidity: 80, visibility: 5); - TestLaserTransmittance(WeatherType.沙尘, "沙尘", visibility: 0.5); - TestLaserTransmittance(WeatherType.雪天, "雪天", temperature: -5, relativeHumidity: 80, visibility: 1, precipitation: 2.5); - } - - // 测试特定天气条件下的激光透过率 - static void TestLaserTransmittance(WeatherType type, string description, - double temperature = 25, double relativeHumidity = 50, - double visibility = 23, double? precipitation = null, double latitude = 30) - { - double[] distances = [0.1, 0.5, 1, 5, 10]; // 测试不同距离(公里) - - // 创建天气条件 - var weatherCondition = new WeatherCondition( - type: type, - temperature: temperature, - relativeHumidity: relativeHumidity, - visibility: visibility, - precipitation: precipitation - ); - - // 输出结果 - Console.WriteLine($"\n[{description}条件下的激光透过率]"); - WeatherCondition.PrintWeatherInfo(weatherCondition); - foreach (var d in distances){ - double laserTransmittance = AtmosphericTransmittanceCalculator.CalcLaser(weatherCondition, d); - double turbulenceEffect = AtmosphericTransmittanceCalculator.CalcTurbulenceEffect(weatherCondition, d, 100); // 添加高度参数,假设高度为100米 - Console.WriteLine($"距离:{d}公里, 1.06μm激光透过率为: {laserTransmittance:P2}, 湍流效应: {turbulenceEffect:P2}"); - } - } - - // 计算单程辐射能量 - static void CalculateSinglePathRadiation() - { - // 创建天气条件 - var weatherCondition = new WeatherCondition( - type: WeatherType.晴天, - temperature: 25, - relativeHumidity: 60, - visibility: 10 - ); - - double targetRadiation = 2E+006; // 100 W/Sr - double receiverDistance = 3; // 3公里 - - // 计算透过率和接收功率 - double transmittance = AtmosphericTransmittanceCalculator.CalcLaser(weatherCondition, receiverDistance); - double receivedPower = AtmosphericTransmittanceCalculator.CalculateReceivedRadiationSinglePath(transmittance, targetRadiation, receiverDistance); - - Console.WriteLine($"\n导弹导引头接收到的辐射能量: {receivedPower:E2} W/Sr"); - } - - // 测试特定天气条件下的红外线透过率 - static void TestIRTransmittance(WeatherType type, string description, - double temperature = 25, double relativeHumidity = 50, - double visibility = 10, double? precipitation = null, double latitude = 30) - { - double[] distances = [0.1, 0.5, 1, 5, 10]; // 测试不同距离(公里) - - // 创建天气条件 - var weatherCondition = new WeatherCondition( - type: type, - temperature: temperature, - relativeHumidity: relativeHumidity, - visibility: visibility, - precipitation: precipitation - ); - - // 输出结果 - Console.WriteLine($"\n[{description}条件下的红外线透过率]"); - WeatherCondition.PrintWeatherInfo(weatherCondition); - foreach (var d in distances) - { - double irTransmittance = AtmosphericTransmittanceCalculator.CalcIR(weatherCondition, d); - Console.WriteLine($"距离:{d}公里, 红外线透过率为: {irTransmittance:P2}"); - } - } - - // 测试烟幕效应 - static void TestSmokeScreenEffect() - { - Console.WriteLine("\n测试烟幕对激光的影响:"); - Console.WriteLine("------------------------"); - - // 测试不同烟幕浓度下的透过率 - double[] smokeConcentrations = [0.05, 0.1, 0.2, 0.5, 1.0, 2.0]; // g/m³ - double smokeThickness = 10; // 米 - double wavelength = 1.06; // 微米 (1060nm) - - foreach (double concentration in smokeConcentrations) - { - double transmittance = AtmosphericTransmittanceCalculator.CalculateSmokeScreenTransmittance( - wavelength, concentration, smokeThickness); - Console.WriteLine($"烟幕浓度: {concentration:F2} g/m³, 烟幕厚度: {smokeThickness}米, 透过率: {transmittance:F4}"); - } - } - - // 测试不同天气条件下的毫米波透过率 - static void TestMillimeterWaveTransmittanceInDifferentWeather() - { - // 测试各种天气条件 - TestMillimeterWaveTransmittance(WeatherType.晴天, "晴朗"); - TestMillimeterWaveTransmittance(WeatherType.雨天, "小雨", relativeHumidity: 60, precipitation: 2.5, visibility: 5); - TestMillimeterWaveTransmittance(WeatherType.雨天, "大雨", relativeHumidity: 90, precipitation: 25, visibility: 2.5); - TestMillimeterWaveTransmittance(WeatherType.雾天, "雾", relativeHumidity: 70, visibility: 1); - TestMillimeterWaveTransmittance(WeatherType.沙尘, "沙尘", visibility: 0.5); - TestMillimeterWaveTransmittance(WeatherType.雪天, "雪天", temperature: -5, relativeHumidity: 80, visibility: 1, precipitation: 5); - } - - // 测试特定天气条件下的毫米波透过率 - static void TestMillimeterWaveTransmittance(WeatherType type, string description, - double temperature = 25, double relativeHumidity = 50, - double visibility = 10, double? precipitation = null) - { - double[] distances = [0.1, 0.5, 1, 5, 10]; // 测试不同距离(公里) - - // 创建天气条件 - var weatherCondition = new WeatherCondition( - type: type, - temperature: temperature, - relativeHumidity: relativeHumidity, - visibility: visibility, - precipitation: precipitation - ); - - // 输出结果 - Console.WriteLine($"\n[{description}条件下的毫米波透过率]"); - WeatherCondition.PrintWeatherInfo(weatherCondition); - foreach (var d in distances) - { - double mmWaveTransmittance = AtmosphericTransmittanceCalculator.CalcMillimeterWave(weatherCondition, d); - Console.WriteLine($"距离:{d}公里, 毫米波透过率为: {mmWaveTransmittance:P2}"); - } - } - - // 测试不同天气条件下的红外线透过率 - static void TestIRTransmittanceInDifferentWeather() - { - // 测试各种天气条件 - TestIRTransmittance(WeatherType.晴天, "晴朗"); - TestIRTransmittance(WeatherType.雨天, "小雨", relativeHumidity: 60, precipitation: 2.5, visibility: 5); - TestIRTransmittance(WeatherType.雨天, "大雨", relativeHumidity: 90, precipitation: 25, visibility: 2.5); - TestIRTransmittance(WeatherType.雾天, "雾", relativeHumidity: 70, visibility: 1); - TestIRTransmittance(WeatherType.沙尘, "沙尘", visibility: 0.5); - TestIRTransmittance(WeatherType.雪天, "雪天", temperature: -5, relativeHumidity: 80, visibility: 1, precipitation: 5); - } - - // 测试不同天气条件下的紫外线透过率 - static void TestUVTransmittanceInDifferentWeather() - { - // 测试各种天气条件 - TestUVTransmittance(WeatherType.晴天, "晴朗"); - TestUVTransmittance(WeatherType.雨天, "小雨", relativeHumidity: 60, precipitation: 2.5, visibility: 5); - TestUVTransmittance(WeatherType.雨天, "大雨", relativeHumidity: 90, precipitation: 25, visibility: 2.5); - TestUVTransmittance(WeatherType.雾天, "雾", relativeHumidity: 70, visibility: 1); - TestUVTransmittance(WeatherType.沙尘, "沙尘", visibility: 0.5); - TestUVTransmittance(WeatherType.雪天, "雪天", temperature: -5, relativeHumidity: 80, visibility: 1, precipitation: 5); - } - - // 测试特定天气条件下的紫外线透过率 - static void TestUVTransmittance(WeatherType type, string description, - double temperature = 25, double relativeHumidity = 50, - double visibility = 10, double? precipitation = null) - { - double[] distances = [0.1, 0.5, 1, 5, 10]; // 测试不同距离(公里) - - // 创建天气条件 - var weatherCondition = new WeatherCondition( - type: type, - temperature: temperature, - relativeHumidity: relativeHumidity, - visibility: visibility, - precipitation: precipitation - ); - - // 输出结果 - Console.WriteLine($"\n[{description}条件下的紫外线透过率]"); - WeatherCondition.PrintWeatherInfo(weatherCondition); - foreach (var d in distances) - { - double uvTransmittance = AtmosphericTransmittanceCalculator.CalcUV(weatherCondition, d); - Console.WriteLine($"距离:{d}公里, 紫外线透过率为: {uvTransmittance:P2}"); - } - } - -} +using AirTransmission; + +class Program +{ + static void Main(string[] args) + { + Console.WriteLine("脉冲激光目标指示器辐射能量计算"); + + // 创建一个晴天的天气条件 + var weather = new Weather( + type: WeatherType.Clear, + temperature: 25, + relativeHumidity: 60, + visibility: 10 + ); + + // 设置激光和目标参数 + double laserEnergy = 0.130; // 130 mJ + double pulseWidth = 15; // 15 ns + double targetDistance = 1; // 1公里 + double receiverDistance = 1; // 1公里 + double targetReflectivity = 0.2; // 假设目标反射率为20% + + // 计算激光透过率和接收功率 + double transmittance = AtmosphericTransmittanceCalculator.CalcLaser(weather, targetDistance); + double receivedPower = AtmosphericTransmittanceCalculator.CalculateReceivedRadiation(transmittance, laserEnergy, pulseWidth, targetDistance, receiverDistance, targetReflectivity); + + Console.WriteLine($"\n导弹导引头接收到的平均功率: {receivedPower:E2} W"); + + // 执行各种测试 + Console.WriteLine("\n单程辐射能量计算"); + CalculateSinglePathRadiation(); + + Console.WriteLine("\n烟幕影响计算"); + TestSmokeScreenEffect(); + + Console.WriteLine("\n不同天气条件下的激光透过率测试"); + TestLaserTransmittanceInDifferentWeather(); + + Console.WriteLine("\n不同风速条件下的湍流效应测试"); + TestTurbulenceWithDifferentWindSpeeds(); + + Console.WriteLine("\n不同天气条件下的红外线透过率测试"); + TestIRTransmittanceInDifferentWeather(); + + Console.WriteLine("\n不同天气条件下的毫米波透过率测试"); + TestMillimeterWaveTransmittanceInDifferentWeather(); + + Console.WriteLine("\n不同天气条件下的紫外线透过率测试"); + TestUVTransmittanceInDifferentWeather(); + } + + // 测试不同天气条件下的激光透过率 + static void TestLaserTransmittanceInDifferentWeather() + { + // 测试各种天气条件 + TestLaserTransmittance(WeatherType.Clear, "晴朗"); + TestLaserTransmittance(WeatherType.Rain, "小雨", relativeHumidity: 60, precipitation: 2.5, visibility: 5); + TestLaserTransmittance(WeatherType.Rain, "大雨", relativeHumidity: 90, precipitation: 25, visibility: 2.5); + TestLaserTransmittance(WeatherType.Fog, "雾", relativeHumidity: 80, visibility: 5); + TestLaserTransmittance(WeatherType.Dust, "沙尘", visibility: 0.5); + TestLaserTransmittance(WeatherType.Snow, "雪天", temperature: -5, relativeHumidity: 80, visibility: 1, precipitation: 2.5); + } + + // 测试特定天气条件下的激光透过率 + static void TestLaserTransmittance(WeatherType type, string description, + double temperature = 25, double relativeHumidity = 50, + double visibility = 23, double precipitation = 0, + double latitude = 30, double windSpeed = 0) + { + double[] distances = [0.1, 0.5, 1, 5, 10]; // 测试不同距离(公里) + + // 创建天气条件 + var weather = new Weather( + type: type, + temperature: temperature, + relativeHumidity: relativeHumidity, + visibility: visibility, + precipitation: precipitation, + windSpeed: windSpeed + ); + + // 输出结果 + Console.WriteLine($"\n[{description}条件下的激光透过率]"); + Weather.PrintWeatherInfo(weather); + foreach (var d in distances){ + double laserTransmittance = AtmosphericTransmittanceCalculator.CalcLaser(weather, d); + + // 增加合理的光束传输高度,与传输距离和风速相关 + double height = 100 + windSpeed * 10; // 风速越大,光束平均高度越高 + double turbulenceEffect = AtmosphericTransmittanceCalculator.CalcTurbulenceEffect(weather, d, height); + + Console.WriteLine($"距离:{d}公里, 1.06μm激光透过率为: {laserTransmittance:P2}, 湍流效应: {turbulenceEffect:P2}"); + } + } + + // 计算单程辐射能量 + static void CalculateSinglePathRadiation() + { + // 创建天气条件 + var weather = new Weather( + type: WeatherType.Clear, + temperature: 25, + relativeHumidity: 60, + visibility: 10 + ); + + double targetRadiation = 2E+006; // 100 W/Sr + double receiverDistance = 3; // 3公里 + + // 计算透过率和接收功率 + double transmittance = AtmosphericTransmittanceCalculator.CalcLaser(weather, receiverDistance); + double receivedPower = AtmosphericTransmittanceCalculator.CalculateReceivedRadiationSinglePath(transmittance, targetRadiation, receiverDistance); + + Console.WriteLine($"\n导弹导引头接收到的辐射能量: {receivedPower:E2} W/Sr"); + } + + // 测试特定天气条件下的红外线透过率 + static void TestIRTransmittance(WeatherType type, string description, + double temperature = 25, double relativeHumidity = 50, + double visibility = 10, double precipitation = 0) + { + double[] distances = [0.1, 0.5, 1, 5, 10]; // 测试不同距离(公里) + + // 创建天气条件 + var weather = new Weather( + type: type, + temperature: temperature, + relativeHumidity: relativeHumidity, + visibility: visibility, + precipitation: precipitation + ); + + // 输出结果 + Console.WriteLine($"\n[{description}条件下的红外线透过率]"); + Weather.PrintWeatherInfo(weather); + foreach (var d in distances) + { + double irTransmittance = AtmosphericTransmittanceCalculator.CalcIR(weather, d); + Console.WriteLine($"距离:{d}公里, 红外线透过率为: {irTransmittance:P2}"); + } + } + + // 测试烟幕效应 + static void TestSmokeScreenEffect() + { + Console.WriteLine("\n测试烟幕对激光的影响:"); + Console.WriteLine("------------------------"); + + // 测试不同烟幕浓度下的透过率 + double[] smokeConcentrations = [0.05, 0.1, 0.2, 0.5, 1.0, 2.0]; // g/m³ + double smokeThickness = 10; // 米 + double wavelength = 1.06; // 微米 (1060nm) + + foreach (double concentration in smokeConcentrations) + { + double transmittance = AtmosphericTransmittanceCalculator.CalculateSmokeScreenTransmittance( + wavelength, concentration, smokeThickness); + Console.WriteLine($"烟幕浓度: {concentration:F2} g/m³, 烟幕厚度: {smokeThickness}米, 透过率: {transmittance:F4}"); + } + } + + // 测试不同天气条件下的毫米波透过率 + static void TestMillimeterWaveTransmittanceInDifferentWeather() + { + // 测试各种天气条件 + TestMillimeterWaveTransmittance(WeatherType.Clear, "晴朗"); + TestMillimeterWaveTransmittance(WeatherType.Rain, "小雨", relativeHumidity: 60, precipitation: 2.5, visibility: 5); + TestMillimeterWaveTransmittance(WeatherType.Rain, "大雨", relativeHumidity: 90, precipitation: 25, visibility: 2.5); + TestMillimeterWaveTransmittance(WeatherType.Fog, "雾", relativeHumidity: 70, visibility: 1); + TestMillimeterWaveTransmittance(WeatherType.Dust, "沙尘", visibility: 0.5); + TestMillimeterWaveTransmittance(WeatherType.Snow, "雪天", temperature: -5, relativeHumidity: 80, visibility: 1, precipitation: 5); + } + + // 测试特定天气条件下的毫米波透过率 + static void TestMillimeterWaveTransmittance(WeatherType type, string description, + double temperature = 25, double relativeHumidity = 50, + double visibility = 10, double precipitation = 0) + { + double[] distances = [0.1, 0.5, 1, 5, 10]; // 测试不同距离(公里) + + // 创建天气条件 + var weather = new Weather( + type: type, + temperature: temperature, + relativeHumidity: relativeHumidity, + visibility: visibility, + precipitation: precipitation + ); + + // 输出结果 + Console.WriteLine($"\n[{description}条件下的毫米波透过率]"); + Weather.PrintWeatherInfo(weather); + foreach (var d in distances) + { + double mmWaveTransmittance = AtmosphericTransmittanceCalculator.CalcMillimeterWave(weather, d); + Console.WriteLine($"距离:{d}公里, 毫米波透过率为: {mmWaveTransmittance:P2}"); + } + } + + // 测试不同天气条件下的红外线透过率 + static void TestIRTransmittanceInDifferentWeather() + { + // 测试各种天气条件 + TestIRTransmittance(WeatherType.Clear, "晴朗"); + TestIRTransmittance(WeatherType.Rain, "小雨", relativeHumidity: 60, precipitation: 2.5, visibility: 5); + TestIRTransmittance(WeatherType.Rain, "大雨", relativeHumidity: 90, precipitation: 25, visibility: 2.5); + TestIRTransmittance(WeatherType.Fog, "雾", relativeHumidity: 70, visibility: 1); + TestIRTransmittance(WeatherType.Dust, "沙尘", visibility: 0.5); + TestIRTransmittance(WeatherType.Snow, "雪天", temperature: -5, relativeHumidity: 80, visibility: 1, precipitation: 5); + } + + // 测试不同天气条件下的紫外线透过率 + static void TestUVTransmittanceInDifferentWeather() + { + // 测试各种天气条件 + TestUVTransmittance(WeatherType.Clear, "晴朗"); + TestUVTransmittance(WeatherType.Rain, "小雨", relativeHumidity: 60, precipitation: 2.5, visibility: 5); + TestUVTransmittance(WeatherType.Rain, "大雨", relativeHumidity: 90, precipitation: 25, visibility: 2.5); + TestUVTransmittance(WeatherType.Fog, "雾", relativeHumidity: 70, visibility: 1); + TestUVTransmittance(WeatherType.Dust, "沙尘", visibility: 0.5); + TestUVTransmittance(WeatherType.Snow, "雪天", temperature: -5, relativeHumidity: 80, visibility: 1, precipitation: 5); + } + + // 测试特定天气条件下的紫外线透过率 + static void TestUVTransmittance(WeatherType type, string description, + double temperature = 25, double relativeHumidity = 50, + double visibility = 10, double precipitation = 0) + { + double[] distances = [0.1, 0.5, 1, 5, 10]; // 测试不同距离(公里) + + // 创建天气条件 + var weather = new Weather( + type: type, + temperature: temperature, + relativeHumidity: relativeHumidity, + visibility: visibility, + precipitation: precipitation + ); + + // 输出结果 + Console.WriteLine($"\n[{description}条件下的紫外线透过率]"); + Weather.PrintWeatherInfo(weather); + foreach (var d in distances) + { + double uvTransmittance = AtmosphericTransmittanceCalculator.CalcUV(weather, d); + Console.WriteLine($"距离:{d}公里, 紫外线透过率为: {uvTransmittance:P2}"); + } + } + + // 测试不同风速条件下的湍流效应 + static void TestTurbulenceWithDifferentWindSpeeds() + { + // 测试不同风速对湍流的影响 + TestLaserTransmittance(WeatherType.Clear, "晴朗无风", windSpeed: 0); + TestLaserTransmittance(WeatherType.Clear, "晴朗轻微微风", windSpeed: 0.5); + TestLaserTransmittance(WeatherType.Clear, "晴朗微风", windSpeed: 1); + TestLaserTransmittance(WeatherType.Clear, "晴朗轻风", windSpeed: 2.5); + TestLaserTransmittance(WeatherType.Clear, "晴朗中风", windSpeed: 5); + TestLaserTransmittance(WeatherType.Clear, "晴朗强风", windSpeed: 10); + TestLaserTransmittance(WeatherType.Clear, "晴朗大风", windSpeed: 15); + } +}