commit ab0146339f8144ab5df85c26abfe29ba1f73080d
Author: Tian jianyong <11429339@qq.com>
Date: Sun Oct 13 13:22:45 2024 +0800
项目V1.0.0发布
diff --git a/.cursorrules b/.cursorrules
new file mode 100644
index 0000000..3b14016
--- /dev/null
+++ b/.cursorrules
@@ -0,0 +1,69 @@
+
+ # C# 开发规则
+
+ 您是一名C#开发专家。
+
+ ## 代码风格和结构
+ - 编写简洁、符合习惯的 C# 代码,并提供准确的示例。
+ - 根据需要使用面向对象和函数式编程模式。
+ - 优先使用 LINQ 和 lambda 表达式进行集合操作。
+ - 使用描述性变量和方法名称(例如,'IsUserSignedIn', 'CalculateTotal')。
+
+ ## 命名约定
+ - 类名、方法名和公共成员使用 PascalCase。
+ - 局部变量和私有字段使用 camelCase。
+ - 常量使用 UPPERCASE。
+ - 接口名称以 "I" 开头(例如,'IUserService')。
+
+ ## C# 使用
+ - 在适当的情况下使用 C# 10+ 特性(例如,记录类型、模式匹配、空合并赋值)。
+ - 有效使用 Entity Framework Core 进行数据库操作。
+ - 使用依赖注入实现松耦合和可测试性。
+ - 使用主构造函数构建类,成员变量使用属性初始化。
+
+ ## 语法和格式
+ - 遵循 C# 编码约定(https://docs.microsoft.com/en-us/dotnet/csharp/fundamentals/coding-style/coding-conventions)
+ - 使用 C# 的表达式语法(例如,空条件运算符、字符串插值)
+ - 当类型明显时,使用 'var' 进行隐式类型声明。
+
+ ## 错误处理和验证
+ - 对于异常情况使用异常,而不是控制流。
+ - 使用内置的 .NET 日志记录或第三方日志记录器实现适当的错误日志记录。
+ - 使用数据注解或 Fluent Validation 进行模型验证。
+ - 实现全局异常处理的中间件。
+ - 返回适当的 HTTP 状态码和一致的错误响应。
+
+ ## API 设计
+ - 遵循 RESTful API 设计原则。
+ - 在控制器中使用属性路由。
+ - 为您的 API 实现版本控制。
+ - 使用操作过滤器处理跨切关注点。
+
+ ## 性能优化
+ - 对于 I/O 密集型操作,使用 async/await 进行异步编程。
+ - 使用 IMemoryCache 或分布式缓存实现缓存策略。
+ - 使用高效的 LINQ 查询,避免 N+1 查询问题。
+ - 对于大型数据集实现分页。
+
+ ## 关键约定
+ - 使用依赖注入实现松耦合和可测试性。
+ - 根据复杂性实现仓储模式或直接使用 Entity Framework Core。
+ - 如有需要,使用 AutoMapper 进行对象到对象的映射。
+ - 使用 IHostedService 或 BackgroundService 实现后台任务。
+
+ ## 测试
+ - 使用 xUnit、NUnit 或 MSTest 编写单元测试。
+ - 使用 Moq 或 NSubstitute 模拟依赖项。
+ - 为 API 端点实现集成测试。
+
+ ## 安全性
+ - 使用身份验证和授权中间件。
+ - 实现 JWT 身份验证以进行无状态 API 身份验证。
+ - 使用 HTTPS 并强制 SSL。
+ - 实现适当的 CORS 策略。
+
+ ## API 文档
+ - 使用 Swagger/OpenAPI 进行 API 文档(根据安装的 Swashbuckle.AspNetCore 包)。
+ - 为控制器和模型提供 XML 注释,以增强 Swagger 文档。
+
+ 遵循官方 Microsoft 文档,以获取路由、控制器、模型和其他 API 组件的最佳实践。
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..2b97d60
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,51 @@
+# 构建结果
+[Bb]in/
+[Oo]bj/
+[Ll]ib/
+
+# Visual Studio 文件
+.vs/
+*.user
+*.userosscache
+*.suo
+*.userprefs
+
+# 编译文件
+*.dll
+*.exe
+*.pdb
+
+# 日志文件
+*.log
+
+# 临时文件
+[Tt]emp/
+[Tt]mp/
+
+# 缓存文件
+*.cache
+*.bak
+
+# 测试结果
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+# NuGet包
+*.nupkg
+**/packages/*
+!**/packages/build/
+
+# Visual Studio Code 设置
+.vscode/
+
+# Rider 设置
+.idea/
+
+# 操作系统文件
+.DS_Store
+Thumbs.db
+
+# 其他
+*.swp
+*.*~
+project.lock.json
\ No newline at end of file
diff --git a/AirTransmission/AtmosphericTransmittanceCalculator.cs b/AirTransmission/AtmosphericTransmittanceCalculator.cs
new file mode 100644
index 0000000..5b4ad4d
--- /dev/null
+++ b/AirTransmission/AtmosphericTransmittanceCalculator.cs
@@ -0,0 +1,144 @@
+using System;
+
+namespace AirTransmission
+{
+ ///
+ /// 提供各种大气传输模型的计算方法
+ ///
+ public static class AtmosphericTransmittanceCalculator
+ {
+ ///
+ /// 计算激光在给定天气条件和距离下的大气透过率
+ ///
+ /// 天气条件
+ /// 传输距离(米)
+ /// 大气透过率
+ public static double CalcLaser(WeatherCondition weather, double distance)
+ {
+ var model = new LaserTransmittanceModel(weather);
+ return model.CalculateTransmittance(distance);
+ }
+
+ ///
+ /// 计算激光在有烟雾条件下的大气透过率
+ ///
+ /// 天气条件
+ /// 传输距离(米)
+ /// 烟雾浓度
+ /// 烟雾厚度(米)
+ /// 大气透过率
+ public static double CalcLaserWithSmoke(WeatherCondition weather, double distance, double smokeConcentration = 0, double smokeThickness = 0)
+ {
+ var model = new LaserTransmittanceModel(weather);
+ return model.CalculateTransmittanceWithSmoke(distance, smokeConcentration, smokeThickness);
+ }
+
+ ///
+ /// 计算红外线在给定条件下的大气透过率
+ ///
+ /// 天气条件
+ /// 传输距离(米)
+ /// 烟雾浓度
+ /// 烟雾厚度(米)
+ /// 大气透过率
+ public static double CalcIR(WeatherCondition weather, double distance, double smokeConcentration = 0, double smokeThickness = 0)
+ {
+ var model = new IRTransmittanceModel(weather);
+ double transmittance = model.CalculateTransmittance(distance);
+ double smokeTransmittance = TransmittanceModel.CalculateSmokeScreenTransmittance(smokeConcentration, smokeThickness);
+ return transmittance * smokeTransmittance;
+ }
+
+ ///
+ /// 计算毫米波在给定条件下的大气透过率
+ ///
+ /// 天气条件
+ /// 传输距离(米)
+ /// 烟雾浓度
+ /// 烟雾厚度(米)
+ /// 大气透过率
+ public static double CalcMillimeterWave(WeatherCondition weather, double distance, double smokeConcentration = 0, double smokeThickness = 0)
+ {
+ var model = new MillimeterWaveTransmittanceModel(weather);
+ double transmittance = model.CalculateTransmittance(distance);
+ double smokeTransmittance = TransmittanceModel.CalculateSmokeScreenTransmittance(smokeConcentration, smokeThickness);
+ return transmittance * smokeTransmittance;
+ }
+
+ ///
+ /// 计算接收到的辐射功率
+ ///
+ /// 大气透过率
+ /// 激光能量(焦耳)
+ /// 脉冲宽度(纳秒)
+ /// 目标距离(米)
+ /// 接收器距离(米)
+ /// 目标反射率
+ /// 接收到的辐射功率(瓦特)
+ public static double CalculateReceivedRadiation(double transmittance, double laserEnergy, double pulseWidth, double targetDistance, double receiverDistance, double targetReflectivity)
+ {
+ double totalDistance = targetDistance + receiverDistance;
+ // 计算峰值功率(W)
+ double peakPower = laserEnergy / (pulseWidth * 1e-9);
+
+ // 假设坦克为朗伯反射体
+ double reflectedPower = peakPower * targetReflectivity / Math.PI;
+
+ // 计算立体角(假设导弹导引头接收面积为10cm^2)
+ double receiverArea = 0.001; // 10cm^2 转换为m^2
+ double solidAngle = receiverArea / (receiverDistance * receiverDistance);
+
+ // 计算接收到的能量(J)
+ double receivedEnergy = reflectedPower * transmittance * solidAngle * (pulseWidth * 1e-9);
+
+ // 输出计算过程中的关键参数
+ Console.WriteLine($"Laser energy: {laserEnergy:F2} J");
+ Console.WriteLine($"Pulse width: {pulseWidth} ns");
+ Console.WriteLine($"Peak power: {peakPower:E2} W");
+ Console.WriteLine($"Target distance: {targetDistance} km");
+ Console.WriteLine($"Target reflected power: {reflectedPower:E2} W");
+ Console.WriteLine($"Receiver distance: {receiverDistance} km");
+ Console.WriteLine($"Double path transmittance: {transmittance:F4}");
+ Console.WriteLine($"Received energy: {receivedEnergy:E2} J");
+ Console.WriteLine($"Received power: {receivedEnergy / (pulseWidth * 1e-9):E2} W");
+
+ return receivedEnergy / (pulseWidth * 1e-9); // 返回接收功率(W)
+ }
+
+ ///
+ /// 计算单程传输中接收到的辐射功率
+ ///
+ /// 大气透过率
+ /// 目标辐射(W/Sr)
+ /// 接收器距离(米)
+ /// 接收到的辐射功率(W/Sr)
+ public static double CalculateReceivedRadiationSinglePath(double transmittance, double targetRadiation, double receiverDistance)
+ {
+ // 计算立体角(假设导弹导引头接收面积为10cm^2)
+ double receiverArea = 0.001; // 10cm^2 转换为m^2
+ double solidAngle = receiverArea / (receiverDistance * receiverDistance);
+
+ double receivedPower = targetRadiation * transmittance * solidAngle;
+
+ // 输出计算过程中的关键参数
+ Console.WriteLine($"Target radiation: {targetRadiation} W/Sr");
+ Console.WriteLine($"Receiver distance: {receiverDistance} m");
+ Console.WriteLine($"Single path transmittance: {transmittance:F4}");
+ Console.WriteLine($"Received power: {receivedPower:E2} W/Sr");
+
+ return receivedPower;
+ }
+
+ ///
+ /// 计算紫外线在给定天气条件和距离下的大气透过率
+ ///
+ /// 天气条件
+ /// 传输距离(米)
+ /// 大气透过率
+ public static double CalcUV(WeatherCondition weather, double distance)
+ {
+ var model = new UVTransmittanceModel(weather);
+ return model.CalculateTransmittance(distance);
+ }
+ }
+}
diff --git a/AirTransmission/AtmosphericTurbulenceModel.cs b/AirTransmission/AtmosphericTurbulenceModel.cs
new file mode 100644
index 0000000..f9e7c1e
--- /dev/null
+++ b/AirTransmission/AtmosphericTurbulenceModel.cs
@@ -0,0 +1,126 @@
+/*
+ * 版本历史:
+ * 1.0.0 (2024-10-13): 初始版本,实现大气湍流对光传输影响的计算模型。作者:田建勇
+ */
+
+using System;
+
+namespace AirTransmission
+{
+ ///
+ /// 大气湍流模型类,用于计算大气湍流对光传输的影响
+ ///
+ public class AtmosphericTurbulenceModel
+ {
+ // 波数,假设波长为1.06微米(常用的激光波长)
+ private const double k = 2 * Math.PI / 1.06e-6;
+
+ ///
+ /// 计算大气湍流对光传输的综合影响
+ ///
+ /// 传输距离(米)
+ /// 传输高度(米)
+ /// 风速(米/秒)
+ /// 大气折射率结构常数
+ /// 湍流效应(0到1之间的值,1表示无影响,0表示完全衰减)
+ public static double CalculateTurbulenceEffect(double distance, double height, double windSpeed, double C2n)
+ {
+ double r0 = CalculateFriedParameter(C2n, distance);
+ double sigmaI2 = CalculateScintillationIndex(C2n, k, distance);
+ double beamWander = CalculateBeamWander(C2n, distance, height);
+
+ // 修改综合湍流效应计算
+ double turbulenceEffect = Math.Exp(-sigmaI2) * (1 - Math.Exp(-r0 / beamWander));
+
+ // 增加一个缩放因子,使效应更明显
+ double scalingFactor = 0.8;
+ turbulenceEffect = 1 - scalingFactor * (1 - turbulenceEffect);
+
+ return turbulenceEffect;
+ }
+
+ ///
+ /// 使用修改后的 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);
+ }
+
+ ///
+ /// 计算弗里德参数(Fried parameter)
+ ///
+ /// 大气折射率结构常数
+ /// 传输距离(米)
+ /// 弗里德参数(米)
+ private static double CalculateFriedParameter(double C2n, double L)
+ {
+ return Math.Pow(0.423 * k * k * C2n * L, -3.0 / 5.0);
+ }
+
+ ///
+ /// 计算闪烁指数(Scintillation Index)
+ ///
+ /// 大气折射率结构常数
+ /// 波数
+ /// 传输距离(米)
+ /// 闪烁指数(无量纲)
+ private static double CalculateScintillationIndex(double C2n, double k, double L)
+ {
+ return 1.23 * C2n * Math.Pow(k, 7.0 / 6.0) * Math.Pow(L, 11.0 / 6.0);
+ }
+
+ ///
+ /// 计算光束漂移(Beam Wander)
+ ///
+ /// 大气折射率结构常数
+ /// 传输距离(米)
+ /// 传输高度(米)
+ /// 光束漂移(弧度)
+ private static double CalculateBeamWander(double C2n, double L, double h)
+ {
+ return 2.87 * Math.Pow(C2n * L * Math.Pow(h, 5.0/3.0), 1.0/3.0);
+ }
+
+ ///
+ /// 计算相干长度(Coherence Length)
+ ///
+ /// 大气折射率结构常数
+ /// 传输距离(米)
+ /// 相干长度(米)
+ private static double CalculateCoherenceLength(double C2n, double L)
+ {
+ return Math.Pow(1.46 * k * k * C2n * L, -3.0 / 5.0);
+ }
+
+ ///
+ /// 计算到达角(Angle of Arrival)
+ ///
+ /// 大气折射率结构常数
+ /// 传输距离(米)
+ /// 接收器口径(米)
+ /// 到达角(弧度)
+ public static double CalculateAngleOfArrival(double C2n, double L, double D)
+ {
+ return 2.91 * Math.Pow(C2n * L / Math.Pow(D, 1.0/3.0), 0.6);
+ }
+
+ ///
+ /// 计算等晕角(Isoplanatism Angle)
+ ///
+ /// 大气折射率结构常数
+ /// 传输距离(米)
+ /// 等晕角(弧度)
+ public static double CalculateIsoplanatismAngle(double C2n, double L)
+ {
+ return 0.314 * Math.Pow(C2n * k * k * L, -3.0 / 5.0);
+ }
+ }
+}
diff --git a/AirTransmission/IRTransmittanceModel.cs b/AirTransmission/IRTransmittanceModel.cs
new file mode 100644
index 0000000..2ba9a08
--- /dev/null
+++ b/AirTransmission/IRTransmittanceModel.cs
@@ -0,0 +1,189 @@
+/*
+ * 版本历史:
+ * 1.0.0 (2024-10-13): 初始版本,实现红外线在大气中的传输特性计算,包括水蒸气和CO2的影响。作者:田建勇
+ */
+
+using System;
+
+namespace AirTransmission
+{
+ ///
+ /// 红外线传输模型类,用于计算红外线在大气中的传输特性
+ ///
+ public class IRTransmittanceModel(WeatherCondition weather) : TransmittanceModel(weather)
+ {
+ // 红外线波长(微米)
+ private const double IR_WAVELENGTH = 10.0;
+
+ ///
+ /// 计算给定距离的红外线透过率
+ ///
+ /// 传输距离(米)
+ /// 红外线透过率(0到1之间的值)
+ public override double CalculateTransmittance(double distance)
+ {
+ double attenuationFactor = CalculateIRAttenuationFactor();
+ double rainAttenuation = CalculateRainAttenuation(distance, IR_WAVELENGTH);
+ double fogAttenuation = CalculateFogAttenuation(distance);
+ double dustAttenuation = CalculateDustAttenuation(distance);
+ double snowAttenuation = CalculateSnowAttenuation(distance, IR_WAVELENGTH);
+ double waterVaporAttenuation = CalculateWaterVaporAttenuation(distance);
+ double co2Attenuation = CalculateCO2Attenuation(distance);
+
+ double transmittance = Math.Exp(-attenuationFactor * distance - rainAttenuation - fogAttenuation - dustAttenuation - snowAttenuation - waterVaporAttenuation - co2Attenuation);
+
+ return Math.Max(0, Math.Min(1, transmittance));
+ }
+
+ ///
+ /// 计算雨对红外线的衰减系数K
+ ///
+ /// 波长(微米)
+ /// 雨衰减系数K
+ protected override double CalculateRainKCoefficient(double wavelength)
+ {
+ if (wavelength >= 8 && wavelength <= 12)
+ {
+ // 对于远红外波段(8-12μm)
+ return 0.187;
+ }
+ else if (wavelength >= 3 && wavelength <= 5)
+ {
+ // 对于中远红外波段(3-5μm)
+ return 0.2656;
+ }
+
+ return 0;
+ }
+
+ ///
+ /// 计算雨对红外线的衰减系数α
+ ///
+ /// 波长(微米)
+ /// 雨衰减系数α
+ protected override double CalculateRainAlphaCoefficient(double wavelength)
+ {
+ if (wavelength >= 8 && wavelength <= 12)
+ {
+ // 对于远红外波段(8-12μm)
+ return 0.784;
+ }
+ else if (wavelength >= 3 && wavelength <= 5)
+ {
+ // 对于中远红外波段(3-5μm)
+ return 0.7978;
+ }
+
+ return 0;
+ }
+
+ ///
+ /// 计算雪对红外线的衰减系数K
+ ///
+ /// 波长(微米)
+ /// 雪衰减系数K
+ protected override double CalculateSnowKCoefficient(double wavelength)
+ {
+ return 0.365;
+ }
+
+ ///
+ /// 计算雪对红外线的衰减系数α
+ ///
+ /// 波长(微米)
+ /// 雪衰减系数α
+ protected override double CalculateSnowAlphaCoefficient(double wavelength)
+ {
+ return 0.88;
+ }
+
+ ///
+ /// 计算红外线的总衰减因子
+ ///
+ /// 红外线总衰减因子
+ private double CalculateIRAttenuationFactor()
+ {
+ double molecularFactor = CalculateIRMolecularFactor();
+ double aerosolFactor = CalculateIRAerosolFactor();
+ return molecularFactor + aerosolFactor;
+ }
+
+ ///
+ /// 计算红外线的分子散射因子
+ ///
+ /// 红外线分子散射因子
+ private double CalculateIRMolecularFactor()
+ {
+ // 对于10μm波长,分子散射可以忽略不计
+ return 0.0001;
+ }
+
+ ///
+ /// 计算红外线的气溶胶散射因子
+ ///
+ /// 红外线气溶胶散射因子
+ private double CalculateIRAerosolFactor()
+ {
+ // 使用更适合IR的模型
+ double beta = 0.0116 * Math.Pow(Visibility, -0.75);
+ return beta;
+ }
+
+ ///
+ /// 计算雾对红外线的衰减
+ ///
+ /// 传输路径长度(米)
+ /// 雾对红外线的衰减
+ private double CalculateFogAttenuation(double pathLength)
+ {
+ if (!IsFoggy)
+ return 0;
+
+ double q = 0.585 * Math.Pow(Visibility, 1.0/3.0);
+ double beta = 3.91 / Visibility * Math.Pow(IR_WAVELENGTH / 0.55, -q);
+ return beta * pathLength * 0.5;
+ }
+
+ ///
+ /// 计算水蒸气对红外线的衰减
+ ///
+ /// 传输距离(米)
+ /// 水蒸气对红外线的衰减
+ private double CalculateWaterVaporAttenuation(double distance)
+ {
+ double waterVaporDensity = CalculateWaterVaporDensity();
+ double absorptionCoefficient = 0.0005; // 这个值需要根据具体波长调整
+ return absorptionCoefficient * waterVaporDensity * distance;
+ }
+
+ ///
+ /// 计算水蒸气密度
+ ///
+ /// 水蒸气密度(g/m³)
+ private double CalculateWaterVaporDensity()
+ {
+ // 使用Magnus公式计算饱和水汽压
+ double a = 17.27;
+ double b = 237.7;
+ double saturationVaporPressure = 6.112 * Math.Exp((a * Temperature) / (b + Temperature));
+
+ // 计算实际水汽压
+ double actualVaporPressure = (Humidity / 100.0) * saturationVaporPressure;
+
+ // 计算水汽密度 (g/m³)
+ return (actualVaporPressure * 2.16679) / (Temperature + 273.15);
+ }
+
+ ///
+ /// 计算二氧化碳对红外线的衰减
+ ///
+ /// 传输距离(米)
+ /// 二氧化碳对红外线的衰减
+ private double CalculateCO2Attenuation(double distance)
+ {
+ double co2Concentration = CO2Concentration; // ppm
+ double absorptionCoefficient = 0.00001; // 这个值需要根据具体波长调整
+ return absorptionCoefficient * (co2Concentration / 1000000) * distance;
+ }
+ }
+}
diff --git a/AirTransmission/LaserTransmittanceModel.cs b/AirTransmission/LaserTransmittanceModel.cs
new file mode 100644
index 0000000..fe71d18
--- /dev/null
+++ b/AirTransmission/LaserTransmittanceModel.cs
@@ -0,0 +1,205 @@
+/*
+ * 版本历史:
+ * 1.0.0 (2024-10-13): 初始版本,实现激光在大气中的传输特性计算,包括湍流效应。作者:田建勇
+ */
+
+using System;
+
+namespace AirTransmission
+{
+ ///
+ /// 激光传输模型类,用于计算激光在大气中的传输特性
+ ///
+ public class LaserTransmittanceModel(WeatherCondition weather) : TransmittanceModel(weather)
+ {
+ ///
+ /// 激光波长(微米)
+ ///
+ private const double LASER_WAVELENGTH = 1.06;
+
+ ///
+ /// 计算给定距离的激光透过率
+ ///
+ /// 传输距离(米)
+ /// 激光透过率(0到1之间的值)
+ public override double CalculateTransmittance(double distance)
+ {
+ double attenuationFactor = CalculateAttenuationFactor();
+ double rainAttenuation = CalculateRainAttenuation(distance, LASER_WAVELENGTH);
+ double snowAttenuation = CalculateSnowAttenuation(distance, LASER_WAVELENGTH);
+ double fogAttenuation = CalculateFogAttenuation(distance);
+ double dustAttenuation = CalculateDustAttenuation(distance);
+
+ double transmittance = Math.Pow(STANDARD_TRANSMITTANCE, attenuationFactor * distance) *
+ Math.Exp(-rainAttenuation - snowAttenuation - fogAttenuation - dustAttenuation);
+
+ // 确保透过率在有效范围内
+ transmittance = Math.Max(0, Math.Min(1, transmittance));
+
+ return transmittance;
+ }
+
+ ///
+ /// 计算考虑湍流效应的激光透过率
+ ///
+ /// 传输距离(米)
+ /// 考虑湍流效应的激光透过率
+ public double CalculateTransmittanceWithTurbulence(double distance)
+ {
+ double transmittance = CalculateTransmittance(distance);
+ return ApplyTurbulenceEffect(transmittance, distance);
+ }
+
+ ///
+ /// 计算雨对激光的衰减系数K
+ ///
+ /// 波长(微米)
+ /// 雨衰减系数K
+ protected override double CalculateRainKCoefficient(double wavelength)
+ {
+ // 对于1.06μm激光
+ return 0.25;
+ }
+
+ ///
+ /// 计算雨对激光的衰减系数α
+ ///
+ /// 波长(微米)
+ /// 雨衰减系数α
+ protected override double CalculateRainAlphaCoefficient(double wavelength)
+ {
+ // 对于1.06μm激光
+ return 0.659;
+ }
+
+ ///
+ /// 计算雪对激光的衰减系数K
+ ///
+ /// 波长(微米)
+ /// 雪衰减系数K
+ protected override double CalculateSnowKCoefficient(double wavelength)
+ {
+ if (wavelength == LASER_WAVELENGTH)
+ return 0.56;
+ else if (wavelength == 10.6)
+ return 0.8;
+ else
+ return 0;
+ }
+
+ ///
+ /// 计算雪对激光的衰减系数α
+ ///
+ /// 波长(微米)
+ /// 雪衰减系数α
+ protected override double CalculateSnowAlphaCoefficient(double wavelength)
+ {
+ if (wavelength == LASER_WAVELENGTH)
+ return 0.57;
+ else if (wavelength == 10.6)
+ return 0.75;
+ else
+ return 0;
+ }
+
+ ///
+ /// 计算激光的总衰减因子
+ ///
+ /// 激光总衰减因子
+ private double CalculateAttenuationFactor()
+ {
+ double molecularFactor = CalculateMolecularFactor();
+ double aerosolFactor = CalculateAerosolFactor();
+ double visibilityFactor = CalculateVisibilityFactor();
+
+ return molecularFactor * aerosolFactor * visibilityFactor;
+ }
+
+ ///
+ /// 计算分子散射因子
+ ///
+ /// 分子散射因子
+ private double CalculateMolecularFactor()
+ {
+ return (Pressure / 1013.25) * (288.15 / Temperature);
+ }
+
+ ///
+ /// 计算气溶胶散射因子
+ ///
+ /// 气溶胶散射因子
+ private double CalculateAerosolFactor()
+ {
+ double q;
+ if (Visibility > 50)
+ q = 1.6;
+ else if (Visibility > 6)
+ q = 1.3;
+ else if (Visibility > 1)
+ q = 0.585 * Math.Pow(Visibility, 1.0/3.0);
+ else
+ q = 0.585 * Math.Pow(1, 1.0/3.0);
+
+ double aerosolFactor = 3.91 / Visibility * Math.Pow(LASER_WAVELENGTH / 0.55, -q);
+
+ if (Visibility < 5)
+ {
+ aerosolFactor *= (1 + (5 - Visibility) / 5);
+ }
+
+ if (IsDusty)
+ {
+ aerosolFactor *= 1.3;
+ }
+
+ return Math.Max(1, aerosolFactor);
+ }
+
+ ///
+ /// 计算雾对激光的衰减
+ ///
+ /// 传输路径长度(米)
+ /// 雾对激光的衰减
+ private double CalculateFogAttenuation(double pathLength)
+ {
+ if (!IsFoggy)
+ 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);
+ return beta * pathLength * 0.5;
+ }
+
+ ///
+ /// 计算考虑烟雾的激光透过率
+ ///
+ /// 传输距离(米)
+ /// 烟雾浓度
+ /// 烟雾厚度(米)
+ /// 考虑烟雾的激光透过率
+ public double CalculateTransmittanceWithSmoke(double distance, double smokeConcentration, double smokeThickness)
+ {
+ double transmittance = CalculateTransmittance(distance);
+ double smokeTransmittance = CalculateSmokeScreenTransmittance(smokeConcentration, smokeThickness);
+ return transmittance * smokeTransmittance;
+ }
+
+ ///
+ /// 应用湍流效应到透过率
+ ///
+ /// 原始透过率
+ /// 传输距离(米)
+ /// 考虑湍流效应后的透过率
+ protected static double ApplyTurbulenceEffect(double transmittance, double distance)
+ {
+ double height = 10; // 假设光束平均高度为10米
+ double windSpeed = 5; // 假设风速为5 m/s
+ double C2n = AtmosphericTurbulenceModel.CalculateC2n(height, windSpeed);
+
+ double turbulenceEffect = AtmosphericTurbulenceModel.CalculateTurbulenceEffect(distance * 1000, height, windSpeed, C2n);
+
+ // 修改湍流效应的应用方式
+ return transmittance * (0.7 + 0.3 * turbulenceEffect);
+ }
+ }
+}
diff --git a/AirTransmission/MillimeterWaveTransmittanceModel.cs b/AirTransmission/MillimeterWaveTransmittanceModel.cs
new file mode 100644
index 0000000..9942cbe
--- /dev/null
+++ b/AirTransmission/MillimeterWaveTransmittanceModel.cs
@@ -0,0 +1,124 @@
+/*
+ * 版本历史:
+ * 1.0.0 (2024-10-13): 初始版本,实现毫米波在大气中的传输特性计算,包括氧气和水蒸气的影响。作者:田建勇
+ */
+
+using System;
+
+namespace AirTransmission
+{
+ ///
+ /// 毫米波传输模型类,用于计算毫米波在大气中的传输特性
+ ///
+ public class MillimeterWaveTransmittanceModel(WeatherCondition weather) : TransmittanceModel(weather)
+ {
+ ///
+ /// 毫米波波长(毫米)
+ ///
+ private const double MILLIMETER_WAVE_WAVELENGTH = 3.19; // 毫米(对应94 GHz)
+
+ ///
+ /// 计算给定距离的毫米波透过率
+ ///
+ /// 传输距离(米)
+ /// 毫米波透过率(0到1之间的值)
+ public override double CalculateTransmittance(double distance)
+ {
+ double attenuationFactor = CalculateMillimeterWaveAttenuationFactor();
+ double rainAttenuation = CalculateRainAttenuation(distance, MILLIMETER_WAVE_WAVELENGTH);
+ double fogAttenuation = CalculateMillimeterWaveFogAttenuation(distance);
+ double snowAttenuation = CalculateSnowAttenuation(distance, MILLIMETER_WAVE_WAVELENGTH);
+ double transmittance = Math.Exp(-attenuationFactor * distance - rainAttenuation - fogAttenuation - snowAttenuation);
+
+ return transmittance;
+ }
+
+ ///
+ /// 计算雨对毫米波的衰减系数K
+ ///
+ /// 波长(毫米)
+ /// 雨衰减系数K
+ protected override double CalculateRainKCoefficient(double wavelength)
+ {
+ // 对应94 GHz毫米波
+ return 0.926;
+ }
+
+ ///
+ /// 计算雨对毫米波的衰减系数α
+ ///
+ /// 波长(毫米)
+ /// 雨衰减系数α
+ protected override double CalculateRainAlphaCoefficient(double wavelength)
+ {
+ // 对应94 GHz毫米波
+ return 0.9551;
+ }
+
+ ///
+ /// 计算雪对毫米波的衰减系数K
+ ///
+ /// 波长(毫米)
+ /// 雪衰减系数K
+ protected override double CalculateSnowKCoefficient(double wavelength)
+ {
+ return 0.997;
+ }
+
+ ///
+ /// 计算雪对毫米波的衰减系数α
+ ///
+ /// 波长(毫米)
+ /// 雪衰减系数α
+ protected override double CalculateSnowAlphaCoefficient(double wavelength)
+ {
+ return 1.064;
+ }
+
+ ///
+ /// 计算毫米波的总衰减因子
+ ///
+ /// 毫米波总衰减因子
+ private double CalculateMillimeterWaveAttenuationFactor()
+ {
+ double oxygenAttenuation = CalculateOxygenAttenuation();
+ double waterVaporAttenuation = CalculateWaterVaporAttenuation();
+ return oxygenAttenuation + waterVaporAttenuation;
+ }
+
+ ///
+ /// 计算氧气对毫米波的衰减
+ ///
+ /// 氧气衰减因子
+ private double CalculateOxygenAttenuation()
+ {
+ double gamma = 0.01 * (MILLIMETER_WAVE_WAVELENGTH / 60.0) * (Temperature / 293.15);
+ return gamma * (Pressure / 1013.25);
+ }
+
+ ///
+ /// 计算水蒸气对毫米波的衰减
+ ///
+ /// 水蒸气衰减因子
+ private double CalculateWaterVaporAttenuation()
+ {
+ double rho = Humidity * 0.01 * 6.11 * Math.Exp(17.27 * (Temperature - 273.15) / (Temperature - 35.85));
+ return 0.05 * rho * (MILLIMETER_WAVE_WAVELENGTH / 100.0) * (Temperature / 293.15);
+ }
+
+ ///
+ /// 计算雾对毫米波的衰减
+ ///
+ /// 传输路径长度(米)
+ /// 雾对毫米波的衰减
+ private double CalculateMillimeterWaveFogAttenuation(double pathLength)
+ {
+ if (!IsFoggy)
+ return 0;
+
+ double liquidWaterDensity = 0.05; // 假设的液态水密度,单位:g/m³
+ double specificAttenuation = 0.4 * MILLIMETER_WAVE_WAVELENGTH * liquidWaterDensity / 1000.0;
+ return specificAttenuation * pathLength;
+ }
+ }
+}
diff --git a/AirTransmission/TransmittanceModel.cs b/AirTransmission/TransmittanceModel.cs
new file mode 100644
index 0000000..0c56ea2
--- /dev/null
+++ b/AirTransmission/TransmittanceModel.cs
@@ -0,0 +1,287 @@
+/*
+ * 版本历史:
+ * 1.0.0 (2024-10-13): 初始版本,实现大气透过率模型的基类,包括各种天气条件下的衰减计算。作者:田建勇
+ */
+
+using System;
+
+namespace AirTransmission
+{
+ ///
+ /// 大气透过率模型的抽象基类,提供了各种大气条件下的透过率计算方法
+ ///
+ public abstract class TransmittanceModel(WeatherCondition weather)
+ {
+ // 常量
+ ///
+ /// 标准大气透过率
+ ///
+ protected const double STANDARD_TRANSMITTANCE = 0.979; // 标准大气透过率
+ ///
+ /// 标准能见度(公里)
+ ///
+ protected const double STANDARD_VISIBILITY = 23.0; // 标准能见度 (km)
+ ///
+ /// 标准气溶胶密度(粒子/立方厘米)
+ ///
+ protected const double STANDARD_AEROSOL_DENSITY = 100.0; // 标准气溶胶密度 (particles/cm³)
+
+
+ ///
+ /// 当前天气条件
+ ///
+ protected WeatherCondition weatherCondition = weather;
+ // 大气模型参数
+ ///
+ /// 温度(开尔文)
+ ///
+ protected double Temperature { get; set; } = weather.Temperature + 273.15;
+ ///
+ /// 大气压力(百帕)
+ ///
+ protected double Pressure { get; set; } = 1013.25;
+ ///
+ /// 相对湿度(百分比)
+ ///
+ protected double Humidity { get; set; } = weather.RelativeHumidity;
+ ///
+ /// 气溶胶密度(粒子/立方厘米)
+ ///
+ protected double AerosolDensity { get; set; } = CalculateAerosolDensity(weather.Visibility);
+ ///
+ /// 能见度(公里)
+ ///
+ protected double Visibility { get; set; } = weather.Visibility;
+ ///
+ /// 是否下雨
+ ///
+ protected bool IsRaining { get; set; } = weather.Type == WeatherType.雨天;
+ ///
+ /// 降雨量(毫米/小时)
+ ///
+ protected double RainRate { get; set; } = weather.Type == WeatherType.雨天 ? (weather.Precipitation ?? 0) : 0;
+ ///
+ /// 是否有雾
+ ///
+ protected bool IsFoggy { get; set; } = weather.Type == WeatherType.雾天;
+ ///
+ /// 是否有沙尘
+ ///
+ protected bool IsDusty { get; set; } = weather.Type == WeatherType.沙尘;
+ ///
+ /// 是否下雪
+ ///
+ protected bool IsSnowing { get; set; } = weather.Type == WeatherType.雪天;
+ ///
+ /// 降雪量(毫米/小时)
+ ///
+ protected double SnowRate { get; set; } = weather.Type == WeatherType.雪天 ? (weather.Precipitation ?? 0) : 0;
+ ///
+ /// 二氧化碳浓度(ppm)
+ ///
+ protected double CO2Concentration { get; set; } = 415; // ppm, 默认值
+
+ ///
+ /// 计算给定距离的大气透过率
+ ///
+ /// 传输距离(米)
+ /// 大气透过率(0到1之间的值)
+ public abstract double CalculateTransmittance(double distance);
+
+ ///
+ /// 根据能见度计算气溶胶密度
+ ///
+ /// 能见度(公里)
+ /// 气溶胶密度(粒子/立方厘米)
+ protected static double CalculateAerosolDensity(double visibility)
+ {
+ // 使用指数关系来计算气溶胶密度
+ return STANDARD_AEROSOL_DENSITY * Math.Pow(STANDARD_VISIBILITY / Math.Max(visibility, 0.1), 0.75);
+ }
+
+ ///
+ /// 计算雨对电磁波的衰减系数K
+ ///
+ /// 波长(微米或毫米)
+ /// 雨衰减系数K
+ protected abstract double CalculateRainKCoefficient(double wavelength);
+ ///
+ /// 计算雨对电磁波的衰减系数α
+ ///
+ /// 波长(微米或毫米)
+ /// 雨衰减系数α
+ protected abstract double CalculateRainAlphaCoefficient(double wavelength);
+
+ ///
+ /// 计算雪对电磁波的衰减系数K
+ ///
+ /// 波长(微米或毫米)
+ /// 雪衰减系数K
+ protected abstract double CalculateSnowKCoefficient(double wavelength);
+ ///
+ /// 计算雪对电磁波的衰减系数α
+ ///
+ /// 波长(微米或毫米)
+ /// 雪衰减系数α
+ protected abstract double CalculateSnowAlphaCoefficient(double wavelength);
+ ///
+ /// 计算雨对电磁波的衰减
+ ///
+ /// 传输路径长度(米)
+ /// 波长(微米或毫米)
+ /// 雨衰减(dB)
+ protected double CalculateRainAttenuation(double pathLength, double wavelength)
+ {
+ if (!IsRaining || RainRate <= 0)
+ return 0;
+
+ // 计算 k 和 α 系数
+ double k = CalculateRainKCoefficient(wavelength);
+ double alpha = CalculateRainAlphaCoefficient(wavelength);
+
+ // 计算特定衰减(dB/km)
+ double specificAttenuation = k * Math.Pow(RainRate, alpha);
+
+ // 计算总衰减(dB)
+ return specificAttenuation * pathLength;
+ }
+
+ ///
+ /// 计算雪对电磁波的衰减
+ ///
+ /// 传输路径长度(米)
+ /// 波长(微米或毫米)
+ /// 雪衰减(dB)
+ protected double CalculateSnowAttenuation(double pathLength, double wavelength)
+ {
+ if (!IsSnowing || SnowRate <= 0)
+ return 0;
+
+ // 雪的衰减系数(这里使用一个简化模型,实际上可能需要更复杂的计算)
+ double k = CalculateSnowKCoefficient(wavelength);
+ double alpha = CalculateSnowAlphaCoefficient(wavelength);
+
+ // 计算特定衰减(dB/km)
+ double specificAttenuation = k * Math.Pow(SnowRate, alpha);
+
+ // 计算总衰减(dB)
+ return specificAttenuation * pathLength;
+ }
+
+ ///
+ /// 计算沙尘对电磁波的衰减
+ ///
+ /// 传输路径长度(米)
+ /// 沙尘衰减(dB)
+ protected double CalculateDustAttenuation(double pathLength)
+ {
+ if (!IsDusty)
+ return 0;
+
+ // 沙尘天气衰减计算
+ double dustFactor = 1.5; // 沙尘对衰减的额外影响因子
+ double beta = (3.91 / Visibility) * dustFactor;
+ return beta * pathLength;
+ }
+
+ ///
+ /// 计算能见度因子
+ ///
+ /// 能见度因子
+ protected double CalculateVisibilityFactor()
+ {
+ // 调整能见度因子计算,减小低能见度的影响
+ double factor;
+ if (Visibility >= STANDARD_VISIBILITY)
+ factor = 1;
+ else if (Visibility > 5)
+ factor = Math.Pow(STANDARD_VISIBILITY / Visibility, 0.2);
+ else
+ factor = Math.Pow(STANDARD_VISIBILITY / Visibility, 0.3);
+
+ if (IsDusty)
+ {
+ // 沙尘天气下,进一步降低能见度因子
+ factor *= 0.9;
+ }
+
+ return factor;
+ }
+
+ ///
+ /// 计算烟幕对电磁波的透过率
+ ///
+ /// 烟幕浓度(g/m³)
+ /// 烟幕厚度(米)
+ /// 烟幕透过率(0到1之间的值)
+ public static double CalculateSmokeScreenTransmittance(double smokeConcentration, double smokeThickness)
+ {
+ if (smokeConcentration <= 0 || smokeThickness <= 0)
+ return 1; // 如果没有烟幕,返回1(无衰减)
+
+ // 烟幕衰减系数(假设值,需要根据实际烟幕特性调整)
+ double smokeAttenuationCoefficient = 0.5;
+
+ // 使用Beer-Lambert定律计算透过率
+ double transmittance = Math.Exp(-smokeAttenuationCoefficient * smokeConcentration * smokeThickness);
+
+ Console.WriteLine($"烟幕透过率计算:");
+ Console.WriteLine($"烟幕浓度: {smokeConcentration:F2} g/m³");
+ Console.WriteLine($"烟幕厚度: {smokeThickness:F2} m");
+ Console.WriteLine($"烟幕透过率: {transmittance:F4}");
+
+ return transmittance;
+ }
+
+ ///
+ /// 打印天气信息
+ ///
+ /// 天气条件
+ public static void PrintWeatherInfo(WeatherCondition weather){
+ Console.WriteLine($"---天气类型: {weather.Type}, 温度: {weather.Temperature}°C, 相对湿度: {weather.RelativeHumidity}%, 能见度: {weather.Visibility}km, 降水量: {weather.Precipitation ?? 0}mm/h");
+ }
+ }
+
+ ///
+ /// 天气类型枚举
+ ///
+ public enum WeatherType
+ {
+ 晴天,
+ 雨天,
+ 雪天,
+ 雾天,
+ 沙尘
+ }
+
+ ///
+ /// 天气条件类
+ ///
+ public class WeatherCondition(WeatherType type, double temperature, double relativeHumidity, double visibility, double? precipitation = null, double co2Concentration = 415)
+ {
+ ///
+ /// 天气类型
+ ///
+ public WeatherType Type { get; set; } = type; // 天气类型
+ ///
+ /// 温度(摄氏度)
+ ///
+ public double Temperature { get; set; } = temperature; // 温度
+ ///
+ /// 相对湿度(百分比)
+ ///
+ public double RelativeHumidity { get; set; } = relativeHumidity; // 相对湿度
+ ///
+ /// 能见度(公里)
+ ///
+ public double Visibility { get; set; } = visibility; // 能见度
+ ///
+ /// 降水量(毫米/小时)
+ ///
+ public double? Precipitation { get; set; } = precipitation; // 降水量
+ ///
+ /// 二氧化碳浓度(ppm)
+ ///
+ public double CO2Concentration { get; set; } = co2Concentration;
+ }
+}
\ No newline at end of file
diff --git a/AirTransmission/UVTransmittanceModel.cs b/AirTransmission/UVTransmittanceModel.cs
new file mode 100644
index 0000000..88eb7ce
--- /dev/null
+++ b/AirTransmission/UVTransmittanceModel.cs
@@ -0,0 +1,143 @@
+/*
+ * 版本历史:
+ * 1.0.0 (2024-10-13): 初始版本,实现紫外线在大气中的传输特性计算。作者:田建勇
+ */
+
+using System;
+
+namespace AirTransmission
+{
+ ///
+ /// 紫外线传输模型类,用于计算紫外线在大气中的传输特性
+ ///
+ public class UVTransmittanceModel(WeatherCondition weather) : TransmittanceModel(weather)
+ {
+ ///
+ /// 紫外线波长(微米)
+ ///
+ private const double UV_WAVELENGTH = 0.308; // 微米 (308 nm)
+
+ ///
+ /// 计算给定距离的紫外线透过率
+ ///
+ /// 传输距离(米)
+ /// 紫外线透过率(0到1之间的值)
+ public override double CalculateTransmittance(double distance)
+ {
+ double attenuationFactor = CalculateUVAttenuationFactor();
+ double rainAttenuation = CalculateRainAttenuation(distance, UV_WAVELENGTH);
+ double fogAttenuation = CalculateFogAttenuation(distance);
+ double dustAttenuation = CalculateDustAttenuation(distance);
+ double snowAttenuation = CalculateSnowAttenuation(distance, UV_WAVELENGTH);
+
+ double transmittance = Math.Pow(STANDARD_TRANSMITTANCE, attenuationFactor * distance) *
+ Math.Exp(-rainAttenuation - fogAttenuation - dustAttenuation - snowAttenuation);
+
+ return Math.Max(0, Math.Min(1, transmittance));
+ }
+
+ ///
+ /// 计算雨对紫外线的衰减系数K
+ ///
+ /// 波长(微米)
+ /// 雨衰减系数K
+ protected override double CalculateRainKCoefficient(double wavelength)
+ {
+ // 对于UV波段 (308 nm)
+ return 0.4715;
+ }
+
+ ///
+ /// 计算雨对紫外线的衰减系数α
+ ///
+ /// 波长(微米)
+ /// 雨衰减系数α
+ protected override double CalculateRainAlphaCoefficient(double wavelength)
+ {
+ // 对于UV波段 (308 nm)
+ return 0.6296;
+ }
+
+ ///
+ /// 计算雪对紫外线的衰减系数K
+ ///
+ /// 波长(微米)
+ /// 雪衰减系数K
+ protected override double CalculateSnowKCoefficient(double wavelength)
+ {
+ // 对于UV波段 (308 nm)
+ return 0.5225;
+ }
+
+ ///
+ /// 计算雪对紫外线的衰减系数α
+ ///
+ /// 波长(微米)
+ /// 雪衰减系数α
+ protected override double CalculateSnowAlphaCoefficient(double wavelength)
+ {
+ // 对于UV波段 (308 nm)
+ return 0.7937;
+ }
+
+ ///
+ /// 计算紫外线的总衰减因子
+ ///
+ /// 紫外线总衰减因子
+ private double CalculateUVAttenuationFactor()
+ {
+ double molecularFactor = CalculateUVMolecularFactor();
+ double aerosolFactor = CalculateUVAerosolFactor();
+ double visibilityFactor = CalculateVisibilityFactor();
+
+ return molecularFactor * aerosolFactor * visibilityFactor;
+ }
+
+ ///
+ /// 计算紫外线的分子散射因子
+ ///
+ /// 紫外线分子散射因子
+ private double CalculateUVMolecularFactor()
+ {
+ // UV分子散射比可见光更强
+ return (Pressure / 1013.25) * (288.15 / Temperature) * 2.0;
+ }
+
+ ///
+ /// 计算紫外线的气溶胶散射因子
+ ///
+ /// 紫外线气溶胶散射因子
+ private double CalculateUVAerosolFactor()
+ {
+ double q = 0.585 * Math.Pow(Visibility, 1.0/3.0);
+ double aerosolFactor = 3.91 / Visibility * Math.Pow(UV_WAVELENGTH / 0.55, -q);
+
+ if (Visibility < 5)
+ {
+ aerosolFactor *= (1 + (5 - Visibility) / 5);
+ }
+
+ if (IsDusty)
+ {
+ aerosolFactor *= 1.5;
+ }
+
+ return Math.Max(1, aerosolFactor);
+ }
+
+ ///
+ /// 计算雾对紫外线的衰减
+ ///
+ /// 传输路径长度(米)
+ /// 雾对紫外线的衰减
+ private double CalculateFogAttenuation(double pathLength)
+ {
+ if (!IsFoggy)
+ return 0;
+
+ double q = 0.585 * Math.Pow(Visibility, 1.0/3.0);
+ double beta = 3.91 / Visibility * Math.Pow(UV_WAVELENGTH / 0.55, -q);
+ return beta * pathLength * 0.7; // UV在雾中的衰减可能比可见光更强
+ }
+ }
+}
diff --git a/Program.cs b/Program.cs
new file mode 100644
index 0000000..67cb31b
--- /dev/null
+++ b/Program.cs
@@ -0,0 +1,274 @@
+/*
+ * 版本历史:
+ * 1.0.0 (2024-10-13): 初始版本,实现基本的大气透过率计算和测试功能。作者:田建勇
+ */
+
+using System;
+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();
+
+ Console.WriteLine("\n湍流效应对激光透过率的影响");
+ TestTurbulenceEffect();
+ }
+
+ // 测试不同天气条件下的激光透过率
+ 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: 70, visibility: 1);
+ 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 = 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}条件下的激光透过率]");
+ TransmittanceModel.PrintWeatherInfo(weatherCondition);
+ foreach (var d in distances){
+ double laserTransmittance = AtmosphericTransmittanceCalculator.CalcLaser(weatherCondition, d);
+ Console.WriteLine($"距离:{d}公里, 1.06μm激光透过率为: {laserTransmittance: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}条件下的红外线透过率]");
+ TransmittanceModel.PrintWeatherInfo(weatherCondition);
+ foreach (var d in distances)
+ {
+ double irTransmittance = AtmosphericTransmittanceCalculator.CalcIR(weatherCondition, d);
+ Console.WriteLine($"距离:{d}公里, 红外线透过率为: {irTransmittance:P2}");
+ }
+ }
+
+ // 测试烟幕效应
+ static void TestSmokeScreenEffect()
+ {
+ // 创建天气条件
+ var weatherCondition = new WeatherCondition(
+ type: WeatherType.晴天,
+ temperature: 25,
+ relativeHumidity: 60,
+ visibility: 10
+ );
+
+ double smokeConcentration = 0.5; // 假设烟幕浓度为0.5 g/m³
+ double smokeThickness = 15; // 假设烟幕墙厚度为5米
+
+ // 计算烟幕透过率
+ double smokeScreenTransmittance = TransmittanceModel.CalculateSmokeScreenTransmittance(smokeConcentration, smokeThickness);
+ Console.WriteLine($"\n仅考虑烟幕的透过率: {smokeScreenTransmittance:P2}");
+ }
+
+ // 测试不同天气条件下的毫米波透过率
+ 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}条件下的毫米波透过率]");
+ TransmittanceModel.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}条件下的紫外线透过率]");
+ TransmittanceModel.PrintWeatherInfo(weatherCondition);
+ foreach (var d in distances)
+ {
+ double uvTransmittance = AtmosphericTransmittanceCalculator.CalcUV(weatherCondition, d);
+ Console.WriteLine($"距离:{d}公里, 紫外线透过率为: {uvTransmittance:P2}");
+ }
+ }
+
+ // 测试湍流效应对激光透过率的影响
+ static void TestTurbulenceEffect()
+ {
+ // 创建天气条件
+ var weatherCondition = new WeatherCondition(
+ type: WeatherType.晴天,
+ temperature: 25,
+ relativeHumidity: 60,
+ visibility: 10
+ );
+
+ var laserModel = new LaserTransmittanceModel(weatherCondition);
+
+ double[] distances = [0.1, 0.5, 1, 5, 10]; // 测试不同距离(公里)
+
+ // 输出结果
+ Console.WriteLine("\n[湍流效应对激光透过率的影响]");
+ foreach (var d in distances)
+ {
+ double transmittanceWithoutTurbulence = laserModel.CalculateTransmittance(d);
+ double transmittanceWithTurbulence = laserModel.CalculateTransmittanceWithTurbulence(d);
+ Console.WriteLine($"距离:{d}公里, 无湍流透过率: {transmittanceWithoutTurbulence:P2}, 有湍流透过率: {transmittanceWithTurbulence:P2}");
+ }
+ }
+}
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..5b6c891
--- /dev/null
+++ b/README.md
@@ -0,0 +1,69 @@
+# 大气透过率计算器
+
+## 项目简介
+
+大气透过率计算器是一个用于模拟和计算各种电磁波(包括激光、红外线、毫米波和紫外线)在不同大气条件下透过率的工具。本项目考虑了多种天气因素和大气湍流的影响,为光学和通信系统的设计与分析提供了有力支持。
+
+## 功能特性
+
+- 支持多种电磁波类型:激光、红外线、毫米波和紫外线
+- 考虑多种天气条件:晴天、雨天、雪天、雾天、沙尘天气
+- 模拟大气湍流对光传输的影响
+- 计算烟幕对透过率的影响
+- 灵活配置传输距离和天气参数
+- 提供详细的计算过程和结果输出
+
+## 安装说明
+
+1. 确保您的系统已安装 .NET Core 3.1 或更高版本。
+2. 克隆此仓库到本地机器: ```
+ git clone https://github.com/tianjianyong/atmospheric-transmittance-calculator.git ```
+3. 进入项目目录: ```
+ cd atmospheric-transmittance-calculator ```
+4. 编译项目: ```
+ dotnet build ```
+
+## 使用方法
+
+1. 在项目根目录下运行程序: ```
+ dotnet run ```
+2. 程序将自动执行一系列预设的测试场景,包括不同天气条件和传输距离。
+3. 查看控制台输出,了解各种条件下的透过率计算结果。
+
+### 示例代码
+
+如果您想在自己的程序中使用此计算器,可以参考Program.cs中的代码
+
+## 项目结构
+
+- `Program.cs`: 主程序入口,包含各种测试方法
+- `AtmosphericTransmittanceCalculator.cs`: 主要的计算接口
+- `TransmittanceModel.cs`: 透过率模型的基类
+- `LaserTransmittanceModel.cs`: 激光透过率模型
+- `IRTransmittanceModel.cs`: 红外线透过率模型
+- `MillimeterWaveTransmittanceModel.cs`: 毫米波透过率模型
+- `UVTransmittanceModel.cs`: 紫外线透过率模型
+- `AtmosphericTurbulenceModel.cs`: 大气湍流模型
+
+## 版本历史
+
+- 1.0.0 (2024-10-13): 初始版本发布
+
+## 作者
+
+田建勇
+
+## 许可证
+
+本项目采用 MIT 许可证。详情请见 [LICENSE](LICENSE) 文件。
+
+## 联系方式
+
+如有任何问题或建议,请通过以下方式联系我们:
+
+- 电子邮件:
+- 项目 Issues:
+
+## 致谢
+
+感谢所有为本项目做出贡献的开发者和研究人员。
diff --git a/air.csproj b/air.csproj
new file mode 100644
index 0000000..206b89a
--- /dev/null
+++ b/air.csproj
@@ -0,0 +1,10 @@
+
+
+
+ Exe
+ net8.0
+ enable
+ enable
+
+
+
diff --git a/air.sln b/air.sln
new file mode 100644
index 0000000..b859968
--- /dev/null
+++ b/air.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.5.002.0
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "air", "air.csproj", "{2A5A314C-58B2-4853-A6CA-F2B17F69A8E5}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {2A5A314C-58B2-4853-A6CA-F2B17F69A8E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {2A5A314C-58B2-4853-A6CA-F2B17F69A8E5}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {2A5A314C-58B2-4853-A6CA-F2B17F69A8E5}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {2A5A314C-58B2-4853-A6CA-F2B17F69A8E5}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {16FD379F-2B2B-4334-A010-A5740A406481}
+ EndGlobalSection
+EndGlobal